Mercurial > mm7
annotate mm7_6.cpp @ 872:2db21a810d48
Merge
author | Nomad |
---|---|
date | Mon, 01 Apr 2013 13:39:39 +0200 |
parents | 710cf848ad24 ceef50611567 |
children | 4de9c65baa39 |
rev | line source |
---|---|
0 | 1 #include "MM7.h" |
2 | |
3 #include "MapInfo.h" | |
4 #include "Game.h" | |
5 #include "GUIWindow.h" | |
6 #include "GUIFont.h" | |
7 #include "GUIProgressBar.h" | |
8 #include "Party.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Outdoor.h" | |
11 #include "IndoorCamera.h" | |
12 #include "Overlays.h" | |
13 #include "Monsters.h" | |
14 #include "Arcomage.h" | |
15 #include "LOD.h" | |
16 #include "Actor.h" | |
17 #include "Allocator.h" | |
18 #include "Events.h" | |
19 #include "Viewport.h" | |
20 #include "FrameTableInc.h" | |
21 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
22 #include "SpriteObject.h" |
0 | 23 #include "ObjectList.h" |
24 #include "Chest.h" | |
25 #include "PaletteManager.h" | |
26 #include "DecorationList.h" | |
27 #include "SaveLoad.h" | |
28 #include "stru123.h" | |
29 #include "Time.h" | |
30 #include "IconFrameTable.h" | |
31 #include "Awards.h" | |
32 #include "Autonotes.h" | |
33 #include "stru160.h" | |
34 #include "stru279.h" | |
35 #include "TurnEngine.h" | |
36 #include "stru277.h" | |
37 #include "Weather.h" | |
38 #include "stru272.h" | |
39 #include "stru298.h" | |
189 | 40 #include "texts.h" |
0 | 41 #include "StorylineTextTable.h" |
42 #include "Events2D.h" | |
370 | 43 #include "Log.h" |
0 | 44 |
45 #include "mm7_data.h" | |
46 | |
47 | |
48 | |
49 //----- (00424EE0) -------------------------------------------------------- | |
50 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
51 { | |
52 unsigned int v1; // edx@1 | |
53 double v2; // st7@1 | |
54 signed int v3; // edi@1 | |
55 char *v4; // esi@4 | |
56 char *v5; // ecx@4 | |
57 unsigned int v6; // eax@4 | |
58 char *v7; // edx@4 | |
59 double v8; // st6@10 | |
60 double v9; // st5@10 | |
61 double v10; // st6@11 | |
62 unsigned __int8 v11; // c2@15 | |
63 unsigned __int8 v12; // c3@15 | |
64 void *v13; // edi@22 | |
65 char *v14; // eax@22 | |
66 double v15; // st6@22 | |
67 char *v16; // ecx@22 | |
68 signed int result; // eax@24 | |
69 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
70 bool v19; // [sp+Ch] [bp-28h]@6 | |
71 char *v20; // [sp+10h] [bp-24h]@4 | |
72 char *v21; // [sp+14h] [bp-20h]@4 | |
73 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
74 char *v23; // [sp+1Ch] [bp-18h]@4 | |
75 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
76 char *v25; // [sp+24h] [bp-10h]@4 | |
77 char *v26; // [sp+28h] [bp-Ch]@4 | |
78 char *v27; // [sp+2Ch] [bp-8h]@4 | |
79 char *v28; // [sp+30h] [bp-4h]@4 | |
80 | |
81 v1 = uVertexID; | |
82 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
83 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
84 v3 = 0; | |
85 v22 = 0; | |
86 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
87 v3 = 1; | |
88 if ( (signed int)(uVertexID + 1) <= 1 ) | |
89 return 0; | |
90 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
91 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
92 v6 = v1; | |
93 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 94 v26 = (char *)&array_507D30[0]._rhw; |
0 | 95 v24 = array_507D30; |
96 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
97 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
98 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
99 v27 = (char *)&array_507D30[0].v; | |
100 v28 = (char *)&array_507D30[0].u; | |
101 v7 = (char *)&array_50AC10[0].v; | |
102 v18 = v6; | |
103 do | |
104 { | |
105 v19 = v2 >= *((float *)v7 + 5); | |
106 if ( v3 != v19 ) | |
107 { | |
108 if ( v19 ) | |
109 { | |
110 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
111 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
112 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
113 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
114 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
115 } | |
116 else | |
117 { | |
118 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
119 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
120 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
121 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
122 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
123 } | |
124 *(float *)v27 = v9; | |
125 *(float *)v25 = v2; | |
126 *(float *)v26 = 1.0 / v2; | |
127 if ( v3 ) | |
128 { | |
129 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
130 { | |
131 v11 = 0; | |
132 v12 = *(float *)v4 == *((float *)v7 - 5); | |
133 goto LABEL_19; | |
134 } | |
135 } | |
136 else | |
137 { | |
138 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
139 { | |
140 v11 = 0; | |
141 v12 = *(float *)v4 == *((float *)v7 + 7); | |
142 LABEL_19: | |
143 if ( v12 | v11 ) | |
144 goto LABEL_21; | |
145 goto LABEL_20; | |
146 } | |
147 } | |
148 LABEL_20: | |
149 v26 += 48; | |
150 ++v24; | |
151 v25 += 48; | |
152 v27 += 48; | |
153 v28 += 48; | |
154 v5 += 48; | |
155 v4 += 48; | |
156 ++v22; | |
157 v23 += 48; | |
158 v21 = v5; | |
159 v20 = v4; | |
160 } | |
161 LABEL_21: | |
162 if ( v19 ) | |
163 { | |
164 v13 = v24; | |
165 v14 = v26; | |
166 v21 += 48; | |
167 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
168 v20 += 48; | |
169 ++v22; | |
170 v28 += 48; | |
171 v27 += 48; | |
172 v25 += 48; | |
173 ++v24; | |
174 v26 += 48; | |
175 memcpy(v13, v7 + 8, 0x30u); | |
176 v16 = v23; | |
177 v23 += 48; | |
178 v4 = v20; | |
179 *(float *)v14 = v15; | |
180 *(int *)v16 = *((int *)v7 + 13); | |
181 v5 = v21; | |
182 } | |
183 v3 = v19; | |
184 v7 += 48; | |
185 --v18; | |
186 } | |
187 while ( v18 ); | |
188 result = v22; | |
189 if ( v22 < 3 ) | |
190 return 0; | |
191 return result; | |
192 } | |
193 | |
194 //----- (004250FE) -------------------------------------------------------- | |
195 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
196 { | |
197 unsigned int v1; // edx@1 | |
198 char *v2; // edi@5 | |
199 char *v3; // esi@5 | |
200 char *v4; // ecx@5 | |
201 int v5; // ebx@6 | |
202 double v6; // st6@11 | |
203 double v7; // st5@11 | |
204 double v8; // st6@12 | |
205 unsigned __int8 v9; // c2@16 | |
206 unsigned __int8 v10; // c3@16 | |
207 void *v11; // edi@23 | |
208 double v12; // st6@23 | |
209 char *v13; // ecx@23 | |
210 char v14; // zf@24 | |
211 signed int result; // eax@25 | |
212 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
213 bool v17; // [sp+Ch] [bp-24h]@2 | |
214 bool v18; // [sp+10h] [bp-20h]@7 | |
215 char *v19; // [sp+14h] [bp-1Ch]@5 | |
216 char *v20; // [sp+18h] [bp-18h]@5 | |
217 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
218 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
219 char *v23; // [sp+24h] [bp-Ch]@5 | |
220 char *v24; // [sp+28h] [bp-8h]@5 | |
221 char *v25; // [sp+2Ch] [bp-4h]@5 | |
222 | |
223 v1 = uVertexID; | |
224 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
225 v21 = 0; | |
226 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
227 if ( (signed int)(uVertexID + 1) <= 1 ) | |
228 return 0; | |
229 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
230 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 231 v24 = (char *)&array_507D30[0]._rhw; |
0 | 232 v22 = array_507D30; |
233 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
234 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
235 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
236 v25 = (char *)&array_507D30[0].flt_2C; | |
237 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
238 v16 = v1; | |
239 do | |
240 { | |
241 v5 = (int)(v4 + 48); | |
242 v18 = *((float *)v4 + 12) >= 8.0; | |
243 if ( v17 != v18 ) | |
244 { | |
245 if ( v18 ) | |
246 { | |
247 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
248 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
249 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
250 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
251 } | |
252 else | |
253 { | |
254 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
255 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
256 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
257 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
258 } | |
259 *(float *)v25 = v7; | |
260 *(float *)v23 = 8.0; | |
261 *(int *)v24 = 0x3E000000u; | |
262 if ( v17 ) | |
263 { | |
264 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
265 { | |
266 v9 = 0; | |
267 v10 = *(float *)v2 == *((float *)v4 + 2); | |
268 goto LABEL_20; | |
269 } | |
270 } | |
271 else | |
272 { | |
273 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
274 { | |
275 v9 = 0; | |
276 v10 = *(float *)v2 == *((float *)v4 + 14); | |
277 LABEL_20: | |
278 if ( v10 | v9 ) | |
279 goto LABEL_22; | |
280 goto LABEL_21; | |
281 } | |
282 } | |
283 LABEL_21: | |
284 ++v22; | |
285 v23 += 48; | |
286 v25 += 48; | |
287 v3 += 48; | |
288 v2 += 48; | |
289 ++v21; | |
290 v24 += 48; | |
291 v20 = v3; | |
292 v19 = v2; | |
293 } | |
294 LABEL_22: | |
295 if ( v18 ) | |
296 { | |
297 v11 = v22; | |
298 v20 += 48; | |
299 v19 += 48; | |
300 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
301 ++v21; | |
302 v25 += 48; | |
303 v23 += 48; | |
304 ++v22; | |
305 memcpy(v11, v4 + 36, 0x30u); | |
306 v13 = v24; | |
307 v24 += 48; | |
308 v3 = v20; | |
309 v2 = v19; | |
310 *(float *)v13 = v12; | |
311 } | |
312 v14 = v16-- == 1; | |
313 v17 = v18; | |
314 v4 = (char *)v5; | |
315 } | |
316 while ( !v14 ); | |
317 result = v21; | |
318 if ( v21 < 3 ) | |
319 return 0; | |
320 return result; | |
321 } | |
322 | |
323 //----- (004252E8) -------------------------------------------------------- | |
324 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
325 { | |
326 unsigned int v1; // edx@1 | |
327 double v2; // st7@1 | |
328 char *v3; // edi@5 | |
329 char *v4; // esi@5 | |
330 char *v5; // ecx@5 | |
331 int v6; // ebx@6 | |
332 double v7; // st6@11 | |
333 double v8; // st5@11 | |
334 double v9; // st6@12 | |
335 unsigned __int8 v10; // c2@16 | |
336 unsigned __int8 v11; // c3@16 | |
337 void *v12; // edi@23 | |
338 double v13; // st6@23 | |
339 char *v14; // ecx@23 | |
340 char v15; // zf@24 | |
341 signed int result; // eax@25 | |
342 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
343 bool v18; // [sp+Ch] [bp-24h]@2 | |
344 bool v19; // [sp+10h] [bp-20h]@7 | |
345 char *v20; // [sp+14h] [bp-1Ch]@5 | |
346 char *v21; // [sp+18h] [bp-18h]@5 | |
347 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
348 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
349 char *v24; // [sp+24h] [bp-Ch]@5 | |
350 char *v25; // [sp+28h] [bp-8h]@5 | |
351 char *v26; // [sp+2Ch] [bp-4h]@5 | |
352 | |
353 v1 = uVertexID; | |
354 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
355 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
356 v22 = 0; | |
357 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
358 if ( (signed int)(uVertexID + 1) <= 1 ) | |
359 return 0; | |
360 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
361 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 362 v25 = (char *)&array_507D30[0]._rhw; |
0 | 363 v23 = array_507D30; |
364 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
365 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
366 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
367 v26 = (char *)&array_507D30[0].flt_2C; | |
368 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
369 v17 = v1; | |
370 do | |
371 { | |
372 v6 = (int)(v5 + 48); | |
373 v19 = v2 >= *((float *)v5 + 12); | |
374 if ( v18 != v19 ) | |
375 { | |
376 if ( v19 ) | |
377 { | |
378 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
379 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
380 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
381 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
382 } | |
383 else | |
384 { | |
385 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
386 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
387 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
388 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
389 } | |
390 *(float *)v26 = v8; | |
391 *(float *)v24 = v2; | |
392 *(float *)v25 = 1.0 / v2; | |
393 if ( v18 ) | |
394 { | |
395 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
396 { | |
397 v10 = 0; | |
398 v11 = *(float *)v3 == *((float *)v5 + 2); | |
399 goto LABEL_20; | |
400 } | |
401 } | |
402 else | |
403 { | |
404 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
405 { | |
406 v10 = 0; | |
407 v11 = *(float *)v3 == *((float *)v5 + 14); | |
408 LABEL_20: | |
409 if ( v11 | v10 ) | |
410 goto LABEL_22; | |
411 goto LABEL_21; | |
412 } | |
413 } | |
414 LABEL_21: | |
415 ++v23; | |
416 v24 += 48; | |
417 v26 += 48; | |
418 v4 += 48; | |
419 v3 += 48; | |
420 ++v22; | |
421 v25 += 48; | |
422 v21 = v4; | |
423 v20 = v3; | |
424 } | |
425 LABEL_22: | |
426 if ( v19 ) | |
427 { | |
428 v12 = v23; | |
429 v21 += 48; | |
430 v20 += 48; | |
431 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
432 ++v22; | |
433 v26 += 48; | |
434 v24 += 48; | |
435 ++v23; | |
436 memcpy(v12, v5 + 36, 0x30u); | |
437 v14 = v25; | |
438 v25 += 48; | |
439 v4 = v21; | |
440 v3 = v20; | |
441 *(float *)v14 = v13; | |
442 } | |
443 v15 = v17-- == 1; | |
444 v18 = v19; | |
445 v5 = (char *)v6; | |
446 } | |
447 while ( !v15 ); | |
448 result = v22; | |
449 if ( v22 < 3 ) | |
450 return 0; | |
451 return result; | |
452 } | |
453 | |
454 //----- (004254D2) -------------------------------------------------------- | |
455 int __fastcall sr_4254D2(signed int a1) | |
456 { | |
457 signed int v1; // ebx@2 | |
458 int v2; // ecx@2 | |
459 int result; // eax@11 | |
460 double v4; // ST74_8@12 | |
461 bool v5; // edi@12 | |
462 char *v6; // esi@13 | |
463 char *v7; // ebx@13 | |
464 double v8; // st7@15 | |
465 double v9; // st7@16 | |
466 double v10; // st6@16 | |
467 double v11; // st7@17 | |
468 float v12; // eax@18 | |
469 double v13; // ST4C_8@19 | |
470 double v14; // ST10_8@19 | |
471 double v15; // ST28_8@20 | |
472 double v16; // ST34_8@20 | |
473 char v17; // zf@20 | |
474 double v18; // ST18_8@21 | |
475 double v19; // ST3C_8@21 | |
476 double v20; // ST44_8@22 | |
477 double v21; // ST54_8@22 | |
478 void *v22; // edi@26 | |
479 double v23; // ST54_8@29 | |
480 bool v24; // esi@29 | |
481 char *v25; // edi@30 | |
482 char *v26; // ebx@30 | |
483 bool v27; // ecx@32 | |
484 double v28; // st7@33 | |
485 double v29; // st7@34 | |
486 double v30; // st6@34 | |
487 double v31; // st7@35 | |
488 double v32; // ST44_8@37 | |
489 double v33; // ST3C_8@37 | |
490 double v34; // ST18_8@38 | |
491 double v35; // ST34_8@38 | |
492 char v36; // zf@38 | |
493 double v37; // ST28_8@39 | |
494 double v38; // ST10_8@39 | |
495 double v39; // ST20_8@40 | |
496 double v40; // ST5C_8@40 | |
497 void *v41; // edi@44 | |
498 double v42; // ST5C_8@47 | |
499 bool v43; // edi@47 | |
500 char *v44; // esi@48 | |
501 char *v45; // ebx@48 | |
502 bool v46; // ecx@49 | |
503 double v47; // st6@50 | |
504 double v48; // st6@51 | |
505 double v49; // st5@51 | |
506 double v50; // st6@52 | |
507 double v51; // ST20_8@54 | |
508 double v52; // ST54_8@54 | |
509 double v53; // ST44_8@55 | |
510 double v54; // ST3C_8@55 | |
511 char v55; // zf@55 | |
512 double v56; // ST18_8@56 | |
513 double v57; // ST34_8@56 | |
514 double v58; // ST28_8@57 | |
515 double v59; // ST10_8@57 | |
516 void *v60; // edi@61 | |
517 double v61; // ST5C_8@64 | |
518 bool v62; // edi@64 | |
519 char *v63; // esi@65 | |
520 char *v64; // ebx@65 | |
521 bool v65; // ecx@66 | |
522 double v66; // st6@67 | |
523 double v67; // st6@68 | |
524 double v68; // st5@68 | |
525 double v69; // st6@69 | |
526 double v70; // ST20_8@71 | |
527 double v71; // ST54_8@71 | |
528 double v72; // ST44_8@72 | |
529 double v73; // ST3C_8@72 | |
530 char v74; // zf@72 | |
531 double v75; // ST18_8@73 | |
532 double v76; // ST34_8@73 | |
533 double v77; // ST28_8@74 | |
534 double v78; // ST10_8@74 | |
535 void *v79; // edi@78 | |
536 int v80; // ebx@81 | |
537 char *v81; // ecx@82 | |
538 signed int v82; // esi@82 | |
539 float v83; // ST78_4@83 | |
540 double v84; // ST5C_8@83 | |
541 float v85; // eax@84 | |
542 double v86; // ST20_8@85 | |
543 double v87; // ST54_8@88 | |
544 float v88; // eax@89 | |
545 double v89; // ST44_8@90 | |
546 unsigned __int8 v90; // sf@94 | |
547 unsigned __int8 v91; // of@94 | |
548 int v92; // edx@97 | |
549 int v93; // esi@97 | |
550 int v94; // edi@97 | |
551 int v95; // eax@97 | |
552 int v96; // eax@104 | |
553 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
554 double v98; // [sp+54h] [bp-84h]@49 | |
555 double v99; // [sp+54h] [bp-84h]@66 | |
556 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
557 float v101; // [sp+60h] [bp-78h]@1 | |
558 float v102; // [sp+64h] [bp-74h]@1 | |
559 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
560 float v104; // [sp+A8h] [bp-30h]@1 | |
561 signed int v105; // [sp+A8h] [bp-30h]@96 | |
562 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
563 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
564 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
565 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
566 signed int v110; // [sp+B0h] [bp-28h]@12 | |
567 char *v111; // [sp+B8h] [bp-20h]@30 | |
568 signed int v112; // [sp+B8h] [bp-20h]@48 | |
569 signed int v113; // [sp+B8h] [bp-20h]@65 | |
570 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
571 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
572 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
573 signed int v117; // [sp+C0h] [bp-18h]@1 | |
574 char *v118; // [sp+C0h] [bp-18h]@30 | |
575 char *v119; // [sp+C0h] [bp-18h]@48 | |
576 char *v120; // [sp+C0h] [bp-18h]@65 | |
577 char *v121; // [sp+C4h] [bp-14h]@13 | |
578 char *v122; // [sp+C4h] [bp-14h]@30 | |
579 signed int v123; // [sp+C4h] [bp-14h]@47 | |
580 char *v124; // [sp+C8h] [bp-10h]@30 | |
581 char *v125; // [sp+C8h] [bp-10h]@48 | |
582 char *v126; // [sp+C8h] [bp-10h]@65 | |
583 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
584 char *v128; // [sp+CCh] [bp-Ch]@13 | |
585 char *v129; // [sp+CCh] [bp-Ch]@30 | |
586 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
587 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
588 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
589 char *v133; // [sp+D0h] [bp-8h]@30 | |
590 char *v134; // [sp+D0h] [bp-8h]@48 | |
591 char *v135; // [sp+D0h] [bp-8h]@65 | |
592 signed int v136; // [sp+D4h] [bp-4h]@1 | |
593 char *v137; // [sp+D4h] [bp-4h]@13 | |
594 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
595 char *v139; // [sp+D4h] [bp-4h]@48 | |
596 char *v140; // [sp+D4h] [bp-4h]@65 | |
597 | |
693 | 598 v101 = (double)(signed int)pViewport->uViewportTL_X; |
599 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 600 v117 = a1; |
601 v136 = 1; | |
693 | 602 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
603 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 604 if ( a1 <= 0 ) |
605 return v117; | |
606 v127 = a1; | |
607 v1 = a1; | |
608 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
609 v2 = 0; | |
610 do | |
611 { | |
612 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
613 v136 = 0; | |
614 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
615 v136 = 0; | |
616 ++v2; | |
617 --v127; | |
618 } | |
619 while ( v127 ); | |
620 if ( v136 ) | |
621 return v117; | |
622 v110 = 0; | |
623 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
624 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
693 | 625 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 626 if ( v117 < 1 ) |
627 goto LABEL_112; | |
628 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
629 v132 = array_50A2B0; | |
630 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
631 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
632 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 633 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 634 v7 = (char *)&array_50AC10[0].flt_2C; |
635 do | |
636 { | |
637 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 638 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 639 if ( !(v5 ^ v106) ) |
640 goto LABEL_25; | |
641 v8 = v101; | |
693 | 642 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 643 { |
644 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
645 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
646 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
647 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
648 } | |
649 else | |
650 { | |
651 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
652 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
653 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
654 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
655 } | |
656 *(float *)v121 = v10; | |
657 *(int *)v137 = LODWORD(v101); | |
658 LODWORD(v12) = *(int *)v6; | |
659 if ( v5 ) | |
660 { | |
661 v13 = v12 + 6.7553994e15; | |
662 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
663 if ( LODWORD(v13) == LODWORD(v14) ) | |
664 { | |
665 v15 = *(float *)v137 + 6.7553994e15; | |
666 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
667 v17 = LODWORD(v15) == LODWORD(v16); | |
668 goto LABEL_23; | |
669 } | |
670 } | |
671 else | |
672 { | |
673 v18 = v12 + 6.7553994e15; | |
674 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
675 if ( LODWORD(v18) == LODWORD(v19) ) | |
676 { | |
677 v20 = *(float *)v137 + 6.7553994e15; | |
678 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
679 v17 = LODWORD(v20) == LODWORD(v21); | |
680 LABEL_23: | |
681 if ( v17 ) | |
682 goto LABEL_25; | |
683 goto LABEL_24; | |
684 } | |
685 } | |
686 LABEL_24: | |
687 v121 += 48; | |
688 v114 += 48; | |
689 v6 += 48; | |
690 ++v110; | |
691 ++v132; | |
692 v128 = v6; | |
693 v137 += 48; | |
694 LABEL_25: | |
695 if ( v106 ) | |
696 { | |
697 v22 = v132; | |
698 v128 += 48; | |
699 ++v110; | |
700 v114 += 48; | |
701 v121 += 48; | |
702 v137 += 48; | |
703 ++v132; | |
704 memcpy(v22, v7 + 4, 0x30u); | |
705 v6 = v128; | |
706 } | |
707 v5 = v106; | |
708 v7 += 48; | |
709 --v117; | |
710 } | |
711 while ( v117 ); | |
712 if ( v110 < 3 | |
713 || (v115 = 0, | |
714 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
715 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
693 | 716 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 717 v110 < 1) ) |
718 goto LABEL_112; | |
168 | 719 v25 = (char *)&array_509950[0]._rhw; |
0 | 720 v138 = array_509950; |
721 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
722 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
723 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
724 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
725 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 726 v111 = (char *)&array_509950[0]._rhw; |
0 | 727 v26 = (char *)&array_50A2B0[0].flt_2C; |
728 while ( 2 ) | |
729 { | |
730 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 731 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
732 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 733 if ( v24 != v27 ) |
734 { | |
735 v28 = v100; | |
693 | 736 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 737 { |
738 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
739 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
740 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
741 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
742 } | |
743 else | |
744 { | |
745 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
746 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
747 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
748 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
749 } | |
750 *(float *)v124 = v30; | |
751 *(int *)v133 = LODWORD(v100); | |
752 if ( v24 ) | |
753 { | |
754 v32 = *(float *)v122 + 6.7553994e15; | |
755 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
756 if ( LODWORD(v32) == LODWORD(v33) ) | |
757 { | |
758 v34 = *(float *)v133 + 6.7553994e15; | |
759 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
760 v36 = LODWORD(v34) == LODWORD(v35); | |
761 goto LABEL_41; | |
762 } | |
763 goto LABEL_42; | |
764 } | |
765 v37 = *(float *)v118 + 6.7553994e15; | |
766 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
767 if ( LODWORD(v37) != LODWORD(v38) ) | |
768 goto LABEL_42; | |
769 v39 = *(float *)v129 + 6.7553994e15; | |
770 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
771 v36 = LODWORD(v39) == LODWORD(v40); | |
772 LABEL_41: | |
773 if ( !v36 ) | |
774 { | |
775 LABEL_42: | |
776 v129 += 48; | |
777 v118 += 48; | |
778 v133 += 48; | |
779 v122 += 48; | |
780 v124 += 48; | |
781 v111 += 48; | |
782 ++v115; | |
783 ++v138; | |
784 } | |
785 } | |
786 if ( v27 ) | |
787 { | |
788 v41 = v138; | |
789 ++v115; | |
790 v111 += 48; | |
791 v124 += 48; | |
792 v122 += 48; | |
793 v133 += 48; | |
794 v118 += 48; | |
795 v129 += 48; | |
796 ++v138; | |
797 memcpy(v41, v26 + 4, 0x30u); | |
798 } | |
799 v24 = v107; | |
800 v26 += 48; | |
801 --v110; | |
802 if ( v110 ) | |
803 { | |
804 v25 = v111; | |
805 continue; | |
806 } | |
807 break; | |
808 } | |
809 if ( v115 < 3 | |
810 || (v123 = 0, | |
811 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
812 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
693 | 813 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 814 v115 < 1) ) |
815 goto LABEL_112; | |
816 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
817 v130 = array_508FF0; | |
818 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
819 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
820 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 821 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 822 v45 = (char *)&array_509950[0].flt_2C; |
823 v112 = v115; | |
824 while ( 2 ) | |
825 { | |
826 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 827 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
828 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 829 if ( v43 != v46 ) |
830 { | |
831 v47 = v104; | |
693 | 832 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 833 { |
834 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
835 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
836 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
837 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
838 } | |
839 else | |
840 { | |
841 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
842 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
843 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
844 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
845 } | |
846 *(float *)v125 = v49; | |
847 *(float *)v139 = v104; | |
848 if ( v43 ) | |
849 { | |
850 v51 = v104 + 6.7553994e15; | |
851 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
852 if ( LODWORD(v51) == LODWORD(v52) ) | |
853 { | |
854 v53 = *(float *)v44 + 6.7553994e15; | |
855 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
856 v55 = LODWORD(v53) == LODWORD(v54); | |
857 goto LABEL_58; | |
858 } | |
859 goto LABEL_59; | |
860 } | |
861 v56 = v104 + 6.7553994e15; | |
862 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
863 if ( LODWORD(v56) != LODWORD(v57) ) | |
864 goto LABEL_59; | |
865 v58 = *(float *)v44 + 6.7553994e15; | |
866 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
867 v55 = LODWORD(v58) == LODWORD(v59); | |
868 LABEL_58: | |
869 if ( !v55 ) | |
870 { | |
871 LABEL_59: | |
872 v139 += 48; | |
873 v125 += 48; | |
874 v134 += 48; | |
875 v44 += 48; | |
876 ++v123; | |
877 ++v130; | |
878 v119 = v44; | |
879 } | |
880 } | |
881 if ( v46 ) | |
882 { | |
883 v60 = v130; | |
884 v119 += 48; | |
885 ++v123; | |
886 v134 += 48; | |
887 v125 += 48; | |
888 v139 += 48; | |
889 ++v130; | |
890 memcpy(v60, v45 + 4, 0x30u); | |
891 v44 = v119; | |
892 } | |
893 v43 = v108; | |
894 v45 += 48; | |
895 --v112; | |
896 if ( v112 ) | |
897 continue; | |
898 break; | |
899 } | |
900 if ( v123 < 3 | |
901 || (v116 = 0, | |
902 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
903 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
693 | 904 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 905 v123 < 1) ) |
906 goto LABEL_112; | |
907 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
908 v131 = array_508690; | |
909 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
910 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
911 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 912 v135 = (char *)&array_508690[0]._rhw; |
0 | 913 v64 = (char *)&array_508FF0[0].flt_2C; |
914 v113 = v123; | |
915 while ( 2 ) | |
916 { | |
917 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 918 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
919 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 920 if ( v62 != v65 ) |
921 { | |
922 v66 = v102; | |
693 | 923 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 924 { |
925 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
926 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
927 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
928 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
929 } | |
930 else | |
931 { | |
932 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
933 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
934 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
935 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
936 } | |
937 *(float *)v126 = v68; | |
938 *(float *)v140 = v102; | |
939 if ( v62 ) | |
940 { | |
941 v70 = v102 + 6.7553994e15; | |
942 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
943 if ( LODWORD(v70) == LODWORD(v71) ) | |
944 { | |
945 v72 = *(float *)v63 + 6.7553994e15; | |
946 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
947 v74 = LODWORD(v72) == LODWORD(v73); | |
948 goto LABEL_75; | |
949 } | |
950 goto LABEL_76; | |
951 } | |
952 v75 = v102 + 6.7553994e15; | |
953 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
954 if ( LODWORD(v75) != LODWORD(v76) ) | |
955 goto LABEL_76; | |
956 v77 = *(float *)v63 + 6.7553994e15; | |
957 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
958 v74 = LODWORD(v77) == LODWORD(v78); | |
959 LABEL_75: | |
960 if ( !v74 ) | |
961 { | |
962 LABEL_76: | |
963 v140 += 48; | |
964 v126 += 48; | |
965 v135 += 48; | |
966 v63 += 48; | |
967 ++v116; | |
968 ++v131; | |
969 v120 = v63; | |
970 } | |
971 } | |
972 if ( v65 ) | |
973 { | |
974 v79 = v131; | |
975 v120 += 48; | |
976 ++v116; | |
977 v135 += 48; | |
978 v126 += 48; | |
979 v140 += 48; | |
980 ++v131; | |
981 memcpy(v79, v64 + 4, 0x30u); | |
982 v63 = v120; | |
983 } | |
984 v62 = v109; | |
985 v64 += 48; | |
986 --v113; | |
987 if ( v113 ) | |
988 continue; | |
989 break; | |
990 } | |
991 if ( v116 < 3 ) | |
992 goto LABEL_112; | |
993 v80 = v116; | |
994 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
995 if ( v116 > 0 ) | |
996 { | |
997 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
998 v82 = v116; | |
999 do | |
1000 { | |
1001 LODWORD(v83) = *(int *)v81; | |
1002 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
1003 v84 = v83 + 6.7553994e15; | |
693 | 1004 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1005 { |
1006 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1007 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1008 goto LABEL_88; |
1009 v85 = v101; | |
1010 } | |
1011 else | |
1012 { | |
1013 v85 = v100; | |
1014 } | |
1015 *(int *)v81 = LODWORD(v85); | |
1016 LABEL_88: | |
1017 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1018 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1019 { |
1020 v88 = v102; | |
1021 LABEL_92: | |
1022 *((int *)v81 + 1) = LODWORD(v88); | |
1023 goto LABEL_93; | |
1024 } | |
1025 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1026 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1027 { |
1028 v88 = v104; | |
1029 goto LABEL_92; | |
1030 } | |
1031 LABEL_93: | |
1032 v81 += 48; | |
1033 --v82; | |
1034 } | |
1035 while ( v82 ); | |
1036 } | |
1037 v91 = __OFSUB__(v116, 3); | |
1038 v90 = v116 - 3 < 0; | |
1039 if ( v116 > 3 ) | |
1040 { | |
1041 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1042 if ( v116 > 0 ) | |
1043 { | |
1044 v105 = 1; | |
1045 do | |
1046 { | |
1047 v92 = v105; | |
1048 v93 = v105 - 1; | |
1049 v94 = v105 + 1; | |
1050 v95 = v105 + 1; | |
1051 if ( v105 - 1 >= v80 ) | |
1052 v93 -= v80; | |
1053 if ( v105 >= v80 ) | |
1054 v92 = v105 - v80; | |
1055 if ( v94 >= v80 ) | |
1056 v95 = v94 - v80; | |
1057 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1058 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1059 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1060 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1061 { | |
1062 ++v105; | |
1063 } | |
1064 else | |
1065 { | |
1066 v96 = v105; | |
1067 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1068 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1069 --v80; | |
1070 } | |
1071 } | |
1072 while ( v105 - 1 < v80 ); | |
1073 } | |
1074 v91 = __OFSUB__(v80, 3); | |
1075 v90 = v80 - 3 < 0; | |
1076 } | |
1077 if ( v90 ^ v91 ) | |
1078 LABEL_112: | |
1079 result = 0; | |
1080 else | |
1081 result = v80; | |
1082 return result; | |
1083 } | |
1084 | |
1085 //----- (0042620A) -------------------------------------------------------- | |
1086 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1087 { | |
1088 __int16 v1; // fps@1 | |
1089 unsigned __int8 v2; // c0@2 | |
1090 char v3; // c2@2 | |
1091 unsigned __int8 v4; // c3@2 | |
1092 bool result; // eax@2 | |
1093 unsigned __int8 v6; // c0@4 | |
1094 char v7; // c2@4 | |
1095 unsigned __int8 v8; // c3@4 | |
1096 unsigned __int8 v9; // c0@6 | |
1097 char v10; // c2@6 | |
1098 unsigned __int8 v11; // c3@6 | |
1099 double v12; // st6@7 | |
1100 float v13; // ST04_4@7 | |
1101 float v14; // ST00_4@7 | |
1102 double v15; // st7@7 | |
1103 double v16; // st6@8 | |
1104 float v17; // ST04_4@8 | |
1105 float v18; // ST00_4@8 | |
1106 double v19; // st7@8 | |
1107 | |
1108 //UNDEF(v1); | |
1109 if ( p->vWorldViewPosition.x < 300.0 | |
1110 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1111 v3 = 0, | |
1112 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
1113 BYTE1(result) = HIBYTE(v1), | |
1114 !(v2 | v4)) ) | |
1115 { | |
1116 if ( p->vWorldViewPosition.x < 300.0 ) | |
1117 { | |
1118 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1119 v7 = 0; | |
1120 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
1121 BYTE1(result) = HIBYTE(v1); | |
1122 if ( !(v6 | v8) ) | |
1123 { | |
1124 LOBYTE(result) = 0; | |
1125 return result; | |
1126 } | |
1127 } | |
1128 v9 = 300.0 < p->vWorldViewPosition.x; | |
1129 v10 = 0; | |
1130 v11 = 300.0 == p->vWorldViewPosition.x; | |
1131 BYTE1(result) = HIBYTE(v1); | |
1132 if ( v9 | v11 ) | |
1133 { | |
1134 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1135 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1136 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1137 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1138 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1139 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1140 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1141 } | |
1142 else | |
1143 { | |
1144 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1145 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1146 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1147 v15 = 300.0 - p->vWorldViewPosition.x; | |
1148 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1149 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1150 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1151 } | |
1152 } | |
1153 LOBYTE(result) = 1; | |
1154 return result; | |
1155 } | |
1156 | |
1157 //----- (004268E3) -------------------------------------------------------- | |
1158 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1159 { | |
1160 unsigned int v1; // eax@1 | |
1161 unsigned int v2; // edx@1 | |
1162 int v3; // eax@1 | |
1163 int v4; // edx@1 | |
1164 unsigned int v5; // ecx@1 | |
1165 | |
1166 v1 = uColor >> 9; | |
1167 v2 = uColor >> 6; | |
1168 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1169 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1170 v3 = v2 | v1; | |
1171 v4 = (unsigned __int8)uColor >> 3; | |
1172 v5 = uColor >> 16; | |
1173 LOWORD(v5) = v5 & 0x8000; | |
1174 return v5 | v4 | v3; | |
1175 } | |
1176 | |
1177 //----- (0042690D) -------------------------------------------------------- | |
1178 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1179 { | |
1180 unsigned int v1; // eax@1 | |
1181 unsigned int v2; // edx@1 | |
1182 | |
1183 v1 = a1 >> 8; | |
1184 v2 = a1 >> 5; | |
1185 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1186 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1187 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1188 } | |
1189 | |
1190 //----- (00426947) -------------------------------------------------------- | |
1191 void __cdecl sub_426947() | |
1192 { | |
1193 dword_50C968 = 0; | |
1194 dword_50C994 = 0; | |
1195 dword_50C998_turnbased_icon_1A = 0; | |
1196 } | |
1197 // 50C968: using guessed type int dword_50C968; | |
1198 // 50C994: using guessed type int dword_50C994; | |
1199 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1200 | |
1201 //----- (004269A2) -------------------------------------------------------- | |
792 | 1202 int __fastcall GivePartyExp(unsigned int a1) |
0 | 1203 { |
89 | 1204 //unsigned __int64 v1; // qax@1 |
1205 Player *v1; | |
1206 int v1b; | |
0 | 1207 signed int v2; // ecx@1 |
82 | 1208 int *v3; // esi@1 |
0 | 1209 bool v4; // edi@6 |
82 | 1210 int *v5; // edi@10 |
1211 Player *v6; // esi@10 | |
0 | 1212 int v7; // eax@13 |
1213 unsigned __int8 v8; // cf@13 | |
89 | 1214 int v10[4]; // [sp+Ch] [bp-14h]@1 |
0 | 1215 int v11; // [sp+1Ch] [bp-4h]@10 |
1216 | |
89 | 1217 //v1 = __PAIR__((int)((char *)&pParty + 2620), a1); |
1218 v1 = pParty->pPlayers; | |
1219 v1b = a1; | |
0 | 1220 v2 = 0; |
89 | 1221 v3 = v10; |
0 | 1222 do |
1223 { | |
89 | 1224 /*v4 = !(*(int *)(HIDWORD(v1) - 4) | *(int *)(HIDWORD(v1) - 8)) |
0 | 1225 && !*(int *)HIDWORD(v1) |
1226 && !*(_QWORD *)(HIDWORD(v1) + 8) | |
89 | 1227 && !*(_QWORD *)(HIDWORD(v1) + 16);*/ |
1228 v4 = !(HIDWORD(v1->pConditions[13]) | LODWORD(v1->pConditions[13])) | |
1229 && !v1->pConditions[14] | |
1230 && !v1->pConditions[15] | |
1231 && !v1->pConditions[16]; | |
82 | 1232 *v3 = v4; |
89 | 1233 //HIDWORD(v1) += 6972; |
1234 ++v1; | |
0 | 1235 v2 += v4; |
82 | 1236 ++v3; |
0 | 1237 } |
89 | 1238 while ( v1 <= &pParty->pPlayers[3] ); |
0 | 1239 if ( v2 ) |
1240 { | |
89 | 1241 v1b = v1b / v2; |
1242 v5 = v10; | |
82 | 1243 v6 = pParty->pPlayers;//[0].uExperience; |
89 | 1244 v11 = v1b; |
0 | 1245 do |
1246 { | |
82 | 1247 if ( *v5 ) |
0 | 1248 { |
1249 if ( v11 ) | |
1250 { | |
82 | 1251 LOBYTE(v7) = v6->GetLearningPercent(); |
89 | 1252 v1b = v11 + v11 * v7 / 100; |
1253 //v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); | |
1254 //need review | |
1255 LODWORD(v6->uExperience) += v1b; | |
1256 //HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; | |
82 | 1257 if ( v6->uExperience > 4000000000i64 ) |
0 | 1258 { |
82 | 1259 HIDWORD(v6->uExperience) = 0; |
1260 LODWORD(v6->uExperience) = -294967296; | |
0 | 1261 } |
1262 } | |
1263 } | |
82 | 1264 ++v6; |
1265 ++v5; | |
0 | 1266 } |
82 | 1267 while ( v6 <= &pParty->pPlayers[3] ); |
0 | 1268 } |
89 | 1269 return v1b; |
0 | 1270 } |
1271 | |
1272 //----- (00426A5A) -------------------------------------------------------- | |
1273 void stru319::LootActor(Actor *pActor) | |
1274 { | |
1275 signed int v2; // edi@1 | |
1276 char v3; // zf@1 | |
1277 unsigned int v4; // eax@13 | |
1278 unsigned int v5; // esi@13 | |
1279 int v6; // eax@14 | |
1280 unsigned __int8 v7; // al@30 | |
1281 Party *v8; // esi@34 | |
1282 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1283 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1284 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1285 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1286 int v13; // [sp+30h] [bp-8h]@1 | |
1287 int v14; // [sp+34h] [bp-4h]@1 | |
1288 | |
1289 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1290 Dst.Reset(); | |
1291 v2 = 0; | |
1292 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1293 v13 = 0; | |
1294 v14 = 0; | |
1295 if ( v3 ) | |
1296 { | |
1297 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1298 goto LABEL_9; | |
1299 do | |
1300 { | |
1301 ++v2; | |
1302 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1303 } | |
1304 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1305 } | |
1306 else | |
1307 { | |
1308 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1309 goto LABEL_9; | |
377 | 1310 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1311 pActor->array_000234[3].Reset(); |
1312 } | |
1313 if ( v14 ) | |
1314 { | |
1315 party_finds_gold(v14, 0); | |
1316 viewparams->bRedrawGameUI = 1; | |
1317 } | |
1318 LABEL_9: | |
1319 if ( pActor->uCarriedItemID ) | |
1320 { | |
1321 Dst.Reset(); | |
1322 Dst.uItemID = pActor->uCarriedItemID; | |
1323 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1324 if ( v14 ) | |
721 | 1325 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1326 else |
721 | 1327 sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9); |
0 | 1328 ShowStatusBarString(pTmpBuf2, 2u); |
1329 v4 = Dst.uItemID; | |
1330 v5 = Dst.uItemID; | |
1331 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1332 { | |
1333 v5 = Dst.uItemID; | |
1334 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1335 Dst.uNumCharges = v6; | |
1336 Dst.uMaxCharges = v6; | |
1337 v4 = Dst.uItemID; | |
1338 } | |
1339 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1340 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1341 pItemsTable->SetSpecialBonus(&Dst); |
1342 if ( !pParty->AddItem(&Dst) ) | |
1343 pParty->SetHoldingItem(&Dst); | |
1344 pActor->uCarriedItemID = 0; | |
1345 if ( pActor->array_000234[0].uItemID ) | |
1346 { | |
1347 if ( !pParty->AddItem(pActor->array_000234) ) | |
1348 { | |
1349 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1350 pParty->SetHoldingItem(pActor->array_000234); | |
1351 } | |
1352 pActor->array_000234[0].Reset(); | |
1353 } | |
1354 if ( pActor->array_000234[1].uItemID ) | |
1355 { | |
1356 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1357 { | |
1358 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1359 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1360 } | |
1361 pActor->array_000234[1].Reset(); | |
1362 } | |
1363 LABEL_55: | |
1364 pActor->Remove(); | |
1365 return; | |
1366 } | |
1367 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1368 { | |
1369 if ( pActor->array_000234[3].uItemID ) | |
1370 { | |
1371 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1372 pActor->array_000234[3].Reset(); | |
1373 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1374 if ( v14 ) | |
721 | 1375 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1376 else |
721 | 1377 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11); |
0 | 1378 ShowStatusBarString(pTmpBuf2, 2u); |
1379 if ( !pParty->AddItem(&Dst) ) | |
1380 pParty->SetHoldingItem(&Dst); | |
1381 v13 = 1; | |
1382 } | |
1383 goto LABEL_44; | |
1384 } | |
1385 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1386 { | |
1387 LABEL_44: | |
1388 v8 = pParty; | |
1389 goto LABEL_45; | |
1390 } | |
1391 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1392 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1393 if ( v14 ) | |
721 | 1394 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1395 else |
721 | 1396 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10); |
0 | 1397 ShowStatusBarString(pTmpBuf2, 2u); |
1398 v8 = pParty; | |
1399 if ( !pParty->AddItem(&Dst) ) | |
1400 pParty->SetHoldingItem(&Dst); | |
1401 v13 = 1; | |
1402 LABEL_45: | |
1403 if ( pActor->array_000234[0].uItemID ) | |
1404 { | |
1405 if ( !v8->AddItem(pActor->array_000234) ) | |
1406 { | |
1407 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1408 v8->SetHoldingItem(pActor->array_000234); | |
1409 v13 = 1; | |
1410 } | |
1411 pActor->array_000234[0].Reset(); | |
1412 } | |
1413 if ( pActor->array_000234[1].uItemID ) | |
1414 { | |
1415 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1416 { | |
1417 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1418 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1419 v13 = 1; | |
1420 } | |
1421 pActor->array_000234[1].Reset(); | |
1422 } | |
1423 if ( !v13 || rand() % 100 < 90 ) | |
1424 goto LABEL_55; | |
1425 } | |
1426 | |
1427 //----- (00426E10) -------------------------------------------------------- | |
1428 int stru319::which_player_would_attack(Actor *pActor) | |
1429 { | |
1430 signed int v2; // ebx@1 | |
1431 int v3; // ecx@2 | |
1432 signed int v4; // edx@3 | |
1433 char v5; // zf@3 | |
1434 unsigned int v6; // eax@3 | |
1435 int v7; // eax@6 | |
1436 int v8; // eax@7 | |
1437 int v9; // eax@8 | |
1438 int v10; // eax@9 | |
1439 int v11; // eax@10 | |
1440 int v12; // eax@11 | |
1441 int v13; // esi@35 | |
1442 signed int v14; // edi@37 | |
1443 enum CHARACTER_RACE v15; // eax@44 | |
1444 Player *v16; // ecx@47 | |
1445 unsigned __int8 v17; // sf@50 | |
1446 unsigned __int8 v18; // of@50 | |
1447 int v19; // esi@52 | |
1448 Player *v20; // ecx@53 | |
1449 int result; // eax@57 | |
1450 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1451 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1452 int v24; // [sp+138h] [bp-10h]@2 | |
1453 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1454 int v26; // [sp+140h] [bp-8h]@1 | |
1455 int v27; // [sp+144h] [bp-4h]@1 | |
1456 | |
1457 v27 = -1; | |
1458 v26 = -1; | |
1459 v25 = -1; | |
1460 v2 = 0; | |
1461 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1462 { | |
1463 v3 = 0; | |
1464 v24 = 0; | |
1465 do | |
1466 { | |
1467 v4 = 1; | |
1468 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1469 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1470 v22[v3] = v6; | |
1471 if ( !v5 ) | |
1472 { | |
1473 if ( (signed int)v6 > 128 ) | |
1474 { | |
1475 switch ( v6 ) | |
1476 { | |
1477 case 0x100u: | |
1478 v27 = 8; | |
1479 break; | |
1480 case 0x200u: | |
1481 v25 = 0; | |
1482 break; | |
1483 case 0x400u: | |
1484 v25 = 1; | |
1485 break; | |
1486 case 0x800u: | |
1487 v26 = 0; | |
1488 break; | |
1489 case 0x1000u: | |
1490 v26 = 1; | |
1491 break; | |
1492 case 0x2000u: | |
1493 v26 = 3; | |
1494 break; | |
1495 case 0x4000u: | |
1496 v26 = 2; | |
1497 break; | |
1498 } | |
1499 } | |
1500 else | |
1501 { | |
1502 if ( v6 == 128 ) | |
1503 { | |
1504 v27 = 4; | |
1505 } | |
1506 else | |
1507 { | |
1508 v7 = v6 - 1; | |
1509 if ( v7 ) | |
1510 { | |
1511 v8 = v7 - 1; | |
1512 if ( v8 ) | |
1513 { | |
1514 v9 = v8 - 2; | |
1515 if ( v9 ) | |
1516 { | |
1517 v10 = v9 - 4; | |
1518 if ( v10 ) | |
1519 { | |
1520 v11 = v10 - 8; | |
1521 if ( v11 ) | |
1522 { | |
1523 v12 = v11 - 16; | |
1524 if ( v12 ) | |
1525 { | |
1526 if ( v12 == 32 ) | |
1527 v27 = 20; | |
1528 } | |
1529 else | |
1530 { | |
1531 v27 = 32; | |
1532 } | |
1533 } | |
1534 else | |
1535 { | |
1536 v27 = 24; | |
1537 } | |
1538 } | |
1539 else | |
1540 { | |
1541 v27 = 28; | |
1542 } | |
1543 } | |
1544 else | |
1545 { | |
1546 v27 = 16; | |
1547 } | |
1548 } | |
1549 else | |
1550 { | |
1551 v27 = 12; | |
1552 } | |
1553 } | |
1554 else | |
1555 { | |
1556 v27 = 0; | |
1557 } | |
1558 } | |
1559 } | |
1560 v2 = 0; | |
1561 v13 = 0; | |
1562 while ( 1 ) | |
1563 { | |
1564 v14 = 0; | |
135 | 1565 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1566 v14 = v4; |
1567 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1568 v14 = v4; | |
1569 if ( v26 != -1 ) | |
1570 { | |
1571 v15 = pPlayers[v13 + 1]->GetRace(); | |
1572 if ( v26 == v15 ) | |
1573 v14 = 1; | |
1574 } | |
1575 if ( v14 == 1 ) | |
1576 { | |
1577 v16 = pPlayers[v13 + 1]; | |
1578 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1579 v23[v2++] = v13; | |
1580 } | |
1581 ++v13; | |
1582 if ( v13 >= 4 ) | |
1583 break; | |
1584 v4 = 1; | |
1585 } | |
1586 } | |
1587 v3 = v24 + 1; | |
1588 v18 = __OFSUB__(v24 + 1, 15); | |
1589 v17 = v24++ - 14 < 0; | |
1590 } | |
1591 while ( v17 ^ v18 ); | |
1592 if ( v2 ) | |
1593 goto LABEL_61; | |
1594 } | |
1595 v19 = 0; | |
1596 do | |
1597 { | |
1598 v20 = pPlayers[v19 + 1]; | |
1599 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1600 v23[v2++] = v19; | |
1601 ++v19; | |
1602 } | |
1603 while ( v19 < 4 ); | |
1604 if ( v2 ) | |
1605 LABEL_61: | |
1606 result = v23[rand() % v2]; | |
1607 else | |
1608 result = 0; | |
1609 return result; | |
1610 } | |
1611 | |
1612 //----- (0042704B) -------------------------------------------------------- | |
1613 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1614 { | |
1615 stru319 *v3; // edi@1 | |
1616 signed int v4; // ebx@5 | |
1617 signed int v5; // edi@5 | |
1618 | |
1619 v3 = this; | |
1620 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1621 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1622 && rand() % 100 < 5 ) | |
1623 pActor->_44FD29(a2); | |
1624 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1625 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1626 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1627 return 2; | |
1628 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1629 return 3; | |
1630 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1631 } | |
1632 | |
1633 //----- (00427102) -------------------------------------------------------- | |
1634 int stru319::_427102(Actor *pActor, signed int a2) | |
1635 { | |
1636 unsigned __int8 v3; // cf@11 | |
1637 unsigned __int8 v4; // zf@11 | |
1638 SpellBuff *v6; // ecx@46 | |
89 | 1639 Player *v7; // esi@49 |
0 | 1640 signed int v8; // edx@50 |
89 | 1641 SpellBuff *v9; // ecx@50 |
0 | 1642 |
597 | 1643 switch(a2) |
0 | 1644 { |
597 | 1645 case 77: |
1646 { | |
1647 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1648 return 0; | |
1649 return 1; | |
1650 } | |
1651 case 80: | |
1652 { | |
1653 v6 = pParty->pPartyBuffs; | |
1654 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1655 { | |
1656 ++v6; | |
1657 if ( v6 > &pParty->pPartyBuffs[19] ) | |
1658 { | |
1659 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1660 v8 = 0; | |
1661 v9 = v7->pPlayerBuffs; | |
1662 while ( v9->uExpireTime <= 0i64 ) | |
1663 { | |
1664 ++v8; | |
1665 ++v9; | |
1666 if ( v8 >= 24 ) | |
1667 { | |
1668 ++v7; | |
1669 if ( v7 <= &pParty->pPlayers[3] ) | |
1670 { | |
1671 v8 = 0; | |
1672 v9 = v7->pPlayerBuffs; | |
1673 } | |
1674 else | |
1675 return 0; | |
1676 } | |
1677 } | |
1678 return 1; | |
1679 } | |
1680 } | |
1681 return 1; | |
1682 } | |
1683 case 85: | |
1684 { | |
1685 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1686 return 1; | |
1687 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1688 return 0; | |
1689 v3 = 0; | |
1690 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1691 break; | |
1692 } | |
1693 case 86: | |
1694 { | |
0 | 1695 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1696 return 1; |
0 | 1697 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1698 return 0; |
0 | 1699 v3 = 0; |
1700 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1701 break; |
1702 } | |
1703 case 95: | |
1704 { | |
1705 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1706 return 1; | |
0 | 1707 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1708 return 0; |
0 | 1709 v3 = 0; |
1710 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1711 break; |
1712 } | |
1713 case 73: | |
1714 { | |
1715 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1716 return 1; | |
1717 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1718 return 0; | |
1719 v3 = 0; | |
1720 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1721 break; | |
1722 } | |
1723 case 5: | |
1724 { | |
1725 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1726 return 1; | |
1727 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1728 return 0; | |
1729 v3 = 0; | |
1730 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1731 break; | |
1732 } | |
1733 case 17: | |
1734 { | |
1735 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1736 return 1; | |
1737 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1738 return 0; | |
1739 v3 = 0; | |
1740 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1741 break; | |
1742 } | |
1743 case 38: | |
89 | 1744 { |
597 | 1745 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1746 return 1; | |
1747 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1748 return 0; | |
1749 v3 = 0; | |
1750 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1751 } | |
1752 case 46: | |
1753 { | |
1754 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1755 return 1; |
597 | 1756 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1757 return 0; | |
1758 v3 = 0; | |
1759 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1760 break; | |
1761 } | |
1762 case 47: | |
1763 { | |
1764 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1765 return 1; | |
1766 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1767 return 0; | |
1768 v3 = 0; | |
1769 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1770 break; | |
1771 } | |
1772 case 51: | |
1773 { | |
1774 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1775 return 1; | |
1776 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1777 { | |
89 | 1778 v3 = 0; |
1779 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1780 } | |
1781 else | |
597 | 1782 return 0; |
1783 break; | |
1784 } | |
1785 default: | |
89 | 1786 { |
597 | 1787 return 1; |
89 | 1788 } |
0 | 1789 } |
1790 if ( !(v3 | v4) ) | |
1791 return 0; | |
1792 return 1; | |
1793 } | |
1794 | |
1795 //----- (004272F5) -------------------------------------------------------- | |
1796 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1797 { | |
1798 signed int v5; // esi@1 | |
1799 signed int v6; // edi@1 | |
1800 int v7; // esi@8 | |
1801 int v8; // eax@9 | |
1802 int v9; // edx@11 | |
1803 int v10; // edx@13 | |
1804 int v11; // esi@13 | |
1805 unsigned __int8 v12; // sf@13 | |
1806 unsigned __int8 v13; // of@13 | |
1807 int v14; // edx@14 | |
1808 int v15; // eax@14 | |
1809 signed int result; // eax@17 | |
1810 | |
1811 v5 = pActor->pMonsterInfo.uAC; | |
1812 v6 = 0; | |
1813 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1814 v5 /= 2; | |
1815 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1816 v6 = pActor->pActorBuffs[15].uPower; | |
1817 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1818 v6 = pActor->pActorBuffs[16].uPower; | |
1819 v7 = v6 + v5; | |
1820 if ( a3 ) | |
1821 v8 = pPlayer->GetRangedAttack(); | |
1822 else | |
1823 v8 = pPlayer->GetActualAttack(0); | |
1824 v9 = rand() % (v7 + 2 * v8 + 30); | |
1825 if ( a3 == 2 ) | |
1826 { | |
1827 v14 = a4 + v9; | |
1828 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1829 } | |
1830 else | |
1831 { | |
1832 if ( a3 != 3 ) | |
1833 { | |
1834 v10 = a4 + v9; | |
1835 v11 = v7 + 15; | |
1836 v13 = __OFSUB__(v10, v11); | |
1837 v12 = v10 - v11 < 0; | |
1838 goto LABEL_16; | |
1839 } | |
1840 v14 = a4 + v9; | |
1841 v15 = 2 * v7 + 30; | |
1842 } | |
1843 v13 = __OFSUB__(v14, v15); | |
1844 v12 = v14 - v15 < 0; | |
1845 LABEL_16: | |
1846 if ( v12 ^ v13 ) | |
1847 result = 0; | |
1848 else | |
1849 result = 1; | |
1850 return result; | |
1851 } | |
1852 | |
1853 //----- (004273BB) -------------------------------------------------------- | |
1854 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1855 { | |
1856 Actor *v5; // ecx@1 | |
1857 signed int v6; // ebx@1 | |
1858 signed int v7; // esi@1 | |
1859 unsigned __int8 v8; // zf@1 | |
1860 unsigned __int8 v9; // sf@1 | |
1861 int v10; // ebx@10 | |
1862 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1863 | |
1864 v5 = a2; | |
1865 v6 = a2->pMonsterInfo.uAC; | |
1866 v7 = 0; | |
1867 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1868 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1869 a2a = 0; | |
1870 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1871 v6 /= 2; | |
1872 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1873 v7 = v5->pActorBuffs[14].uPower; | |
1874 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1875 v7 = v5->pActorBuffs[16].uPower; | |
1876 v10 = v7 + v6; | |
1877 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1878 a2a = pActor->pActorBuffs[14].uPower; | |
1879 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1880 a2a = pActor->pActorBuffs[17].uPower; | |
1881 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1882 { | |
1883 a2a += pActor->pActorBuffs[11].uPower; | |
1884 pActor->pActorBuffs[11].Reset(); | |
1885 } | |
1886 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1887 } | |
1888 | |
1889 //----- (004274AD) -------------------------------------------------------- | |
1890 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1891 { | |
1892 signed int v3; // edi@1 | |
1893 signed int v4; // esi@8 | |
1894 int v5; // esi@8 | |
1895 | |
1896 v3 = 0; | |
1897 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1898 v3 = pActor->pActorBuffs[14].uPower; | |
1899 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1900 v3 = pActor->pActorBuffs[17].uPower; | |
1901 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1902 { | |
1903 v3 += pActor->pActorBuffs[11].uPower; | |
1904 pActor->pActorBuffs[11].Reset(); | |
1905 } | |
1906 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1907 v5 = rand() % v4 + 1; | |
1908 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1909 } | |
1910 | |
1911 //----- (00427546) -------------------------------------------------------- | |
1912 int stru319::_427546(int a2) | |
1913 { | |
1914 int result; // eax@2 | |
1915 | |
1916 if ( a2 >= 0 ) | |
1917 { | |
1918 if ( a2 >= 1 ) | |
1919 result = (a2 >= 2) + 2; | |
1920 else | |
1921 result = 1; | |
1922 } | |
1923 else | |
1924 { | |
1925 result = 0; | |
1926 } | |
1927 return result; | |
1928 } | |
1929 | |
1930 //----- (0042756B) -------------------------------------------------------- | |
1931 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1932 { | |
1933 int v4; // edx@1 | |
1934 int v5; // ecx@1 | |
1935 signed int v6; // eax@4 | |
1936 signed int result; // eax@17 | |
1937 signed int v8; // esi@18 | |
1938 | |
1939 v4 = 0; | |
1940 v5 = 0; | |
1941 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1942 v5 = pActor->pActorBuffs[14].uPower; | |
1943 switch ( a2 ) | |
1944 { | |
1945 case 4: | |
1946 v6 = pActor->pMonsterInfo.uResPhysical; | |
1947 break; | |
1948 case 0: | |
1949 v6 = pActor->pMonsterInfo.uResFire; | |
1950 goto LABEL_12; | |
1951 case 1: | |
1952 v6 = pActor->pMonsterInfo.uResAir; | |
1953 goto LABEL_12; | |
1954 case 2: | |
1955 v6 = pActor->pMonsterInfo.uResWater; | |
1956 goto LABEL_12; | |
1957 case 3: | |
1958 v6 = pActor->pMonsterInfo.uResEarth; | |
1959 goto LABEL_12; | |
1960 case 6: | |
1961 v6 = pActor->pMonsterInfo.uResSpirit; | |
1962 break; | |
1963 case 7: | |
1964 v6 = pActor->pMonsterInfo.uResMind; | |
1965 goto LABEL_12; | |
1966 case 8: | |
1967 v6 = pActor->pMonsterInfo.uResBody; | |
1968 LABEL_12: | |
1969 v4 = v5; | |
1970 break; | |
1971 case 9: | |
1972 v6 = pActor->pMonsterInfo.uResLight; | |
1973 break; | |
1974 case 10: | |
1975 v6 = pActor->pMonsterInfo.uResDark; | |
1976 break; | |
1977 default: | |
1978 v6 = 0; | |
1979 break; | |
1980 } | |
1981 if ( v6 < 200 ) | |
1982 { | |
1983 v8 = v4 + v6 + 30; | |
1984 if ( rand() % v8 >= 30 ) | |
1985 { | |
1986 a3 >>= 1; | |
1987 if ( rand() % v8 >= 30 ) | |
1988 { | |
1989 a3 >>= 1; | |
1990 if ( rand() % v8 >= 30 ) | |
1991 { | |
1992 a3 >>= 1; | |
1993 if ( rand() % v8 >= 30 ) | |
1994 a3 >>= 1; | |
1995 } | |
1996 } | |
1997 } | |
1998 result = a3; | |
1999 } | |
2000 else | |
2001 { | |
2002 result = 0; | |
2003 } | |
2004 return result; | |
2005 } | |
2006 | |
2007 //----- (00427662) -------------------------------------------------------- | |
2008 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
2009 { | |
2010 Actor *v3; // edi@2 | |
2011 signed int v4; // esi@2 | |
2012 bool result; // eax@13 | |
2013 | |
2014 switch ( uType ) | |
2015 { | |
2016 case 0u: | |
2017 v3 = pActor; | |
2018 v4 = pActor->pMonsterInfo.uResFire; | |
2019 goto LABEL_12; | |
2020 case 1u: | |
2021 v3 = pActor; | |
2022 v4 = pActor->pMonsterInfo.uResAir; | |
2023 goto LABEL_12; | |
2024 case 2u: | |
2025 v3 = pActor; | |
2026 v4 = pActor->pMonsterInfo.uResWater; | |
2027 goto LABEL_12; | |
2028 case 3u: | |
2029 v3 = pActor; | |
2030 v4 = pActor->pMonsterInfo.uResEarth; | |
2031 goto LABEL_12; | |
2032 case 7u: | |
2033 v3 = pActor; | |
2034 v4 = pActor->pMonsterInfo.uResMind; | |
2035 goto LABEL_12; | |
2036 case 6u: | |
2037 v3 = pActor; | |
2038 v4 = pActor->pMonsterInfo.uResSpirit; | |
2039 goto LABEL_12; | |
2040 case 8u: | |
2041 v3 = pActor; | |
2042 v4 = pActor->pMonsterInfo.uResBody; | |
2043 goto LABEL_12; | |
2044 case 9u: | |
2045 v3 = pActor; | |
2046 v4 = pActor->pMonsterInfo.uResLight; | |
2047 goto LABEL_12; | |
2048 case 0xAu: | |
2049 v3 = pActor; | |
2050 v4 = pActor->pMonsterInfo.uResDark; | |
2051 goto LABEL_12; | |
2052 case 4u: | |
2053 v3 = pActor; | |
2054 v4 = pActor->pMonsterInfo.uResPhysical; | |
2055 LABEL_12: | |
2056 if ( v4 < 200 ) | |
2057 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2058 else | |
2059 result = 0; | |
2060 break; | |
2061 default: | |
2062 result = 1; | |
2063 break; | |
2064 } | |
2065 return result; | |
2066 } | |
2067 | |
2068 //----- (00427769) -------------------------------------------------------- | |
2069 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2070 { | |
2071 bool result; // eax@2 | |
2072 | |
710 | 2073 __debugbreak(); // refactor |
0 | 2074 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2075 result = 1; | |
2076 else | |
2077 result = 0; | |
2078 return result; | |
2079 } | |
2080 | |
2081 //----- (0042777D) -------------------------------------------------------- | |
319 | 2082 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2083 { |
370 | 2084 //bool result; // eax@2 |
486 | 2085 //__int16 v6; // bx@4 |
437 | 2086 //Player *v7; // eax@4 |
486 | 2087 //char v8; // zf@12 |
0 | 2088 unsigned __int16 v9; // cx@16 |
2089 unsigned int v10; // eax@18 | |
2090 unsigned __int8 v11; // sf@18 | |
2091 unsigned __int8 v12; // of@18 | |
2092 unsigned __int16 v13; // cx@21 | |
2093 unsigned int v14; // eax@23 | |
486 | 2094 //stru277 *v15; // esi@27 |
2095 //stru277 *v16; // eax@28 | |
832 | 2096 //GUIWindow *v17; // eax@43 |
2097 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2098 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2099 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2100 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2101 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2102 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2103 //int v24; // [sp-18h] [bp-30h]@44 | |
2104 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2105 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2106 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2107 //char *v28; // [sp-8h] [bp-20h]@43 | |
2108 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2109 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2110 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2111 | |
2112 //a3a = uPlayerID; | |
2113 //a2a = a1; | |
370 | 2114 |
2115 //if ( pParty->bTurnBasedModeOn != 1 | |
2116 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2117 if (pParty->bTurnBasedModeOn) | |
0 | 2118 { |
370 | 2119 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2120 return; | |
2121 } | |
2122 | |
2123 | |
486 | 2124 //v6 = a5; |
437 | 2125 //v7 = &pParty->pPlayers[uPlayerID]; |
2126 assert(uPlayerID < 4); | |
2127 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2128 if ( !(a5 & 0x10) ) |
2129 { | |
2130 switch ( a1 ) | |
2131 { | |
486 | 2132 case SPELL_SPIRIT_FATE: |
2133 case SPELL_BODY_FIRST_AID: | |
2134 case SPELL_DARK_REANIMATE: | |
2135 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2136 a5 |= 0x0100; | |
0 | 2137 break; |
486 | 2138 |
2139 case SPELL_FIRE_FIRE_AURA: | |
2140 case SPELL_WATER_RECHARGE_ITEM: | |
2141 case SPELL_WATER_ENCHANT_ITEM: | |
2142 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2143 //LOBYTE(v6) = a5 | 0x80; | |
2144 a5 |= 0x0080; | |
0 | 2145 break; |
486 | 2146 |
2147 case SPELL_FIRE_FIRE_BOLT: | |
2148 case SPELL_FIRE_FIREBALL: | |
2149 case SPELL_FIRE_INCINERATE: | |
2150 case SPELL_AIR_LIGHNING_BOLT: | |
2151 case SPELL_AIR_IMPLOSION: | |
2152 case SPELL_WATER_POISON_SPRAY: | |
2153 case SPELL_WATER_ICE_BOLT: | |
2154 case SPELL_WATER_ACID_BURST: | |
2155 case SPELL_WATER_ICE_BLAST: | |
2156 case SPELL_EARTH_STUN: | |
2157 case SPELL_EARTH_SLOW: | |
2158 case SPELL_EARTH_DEADLY_SWARM: | |
2159 case SPELL_EARTH_BLADES: | |
2160 case SPELL_EARTH_MASS_DISTORTION: | |
2161 case SPELL_SPIRIT_SPIRIT_LASH: | |
2162 case SPELL_MIND_MIND_BLAST: | |
2163 case SPELL_MIND_CHARM: | |
2164 case SPELL_MIND_PSYCHIC_SHOCK: | |
2165 case SPELL_BODY_HARM: | |
2166 case SPELL_BODY_FLYING_FIST: | |
2167 case SPELL_LIGHT_LIGHT_BOLT: | |
2168 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2169 case SPELL_LIGHT_SUNRAY: | |
2170 case SPELL_DARK_TOXIC_CLOUD: | |
2171 case SPELL_DARK_SHRINKING_RAY: | |
2172 case SPELL_DARK_SHARPMETAL: | |
2173 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2174 if ( !a6 ) |
486 | 2175 a5 |= 0x0008; |
0 | 2176 break; |
486 | 2177 case SPELL_MIND_TELEPATHY: |
2178 case SPELL_MIND_BERSERK: | |
2179 case SPELL_MIND_ENSLAVE: | |
2180 case SPELL_LIGHT_PARALYZE: | |
2181 case SPELL_DARK_CONTROL_UNDEAD: | |
2182 //LABEL_9: | |
2183 //v6 = a5 | 8; | |
2184 a5 |= 0x0008; | |
0 | 2185 break; |
486 | 2186 |
2187 case SPELL_EARTH_TELEKINESIS: | |
2188 a5 |= 0x0040; | |
2189 break; | |
2190 | |
2191 case SPELL_SPIRIT_BLESS: | |
2192 if (a4 && ~a4 & 0x01C0) | |
2193 goto LABEL_25; | |
2194 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0); | |
0 | 2195 goto LABEL_25; |
2196 break; | |
486 | 2197 |
2198 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2199 v9 = a4; |
2200 if ( !a4 ) | |
437 | 2201 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
0 | 2202 goto LABEL_18; |
486 | 2203 |
2204 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2205 v9 = a4; |
2206 if ( !a4 ) | |
437 | 2207 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
0 | 2208 LABEL_18: |
2209 v10 = SkillToMastery(v9); | |
2210 v12 = __OFSUB__(v10, 3); | |
2211 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2212 goto LABEL_24; | |
486 | 2213 |
2214 case SPELL_BODY_HAMMERHANDS: | |
0 | 2215 v13 = a4; |
2216 if ( !a4 ) | |
437 | 2217 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2218 v14 = SkillToMastery(v13); |
2219 v12 = __OFSUB__(v14, 4); | |
2220 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
2221 LABEL_24: | |
2222 if ( v11 ^ v12 ) | |
2223 goto LABEL_25; | |
2224 break; | |
486 | 2225 |
2226 case SPELL_EARTH_STONE_TO_FLESH: | |
2227 case SPELL_SPIRIT_REMOVE_CURSE: | |
2228 case SPELL_SPIRIT_RAISE_DEAD: | |
2229 case SPELL_SPIRIT_RESSURECTION: | |
2230 case SPELL_MIND_REMOVE_FEAR: | |
2231 case SPELL_MIND_CURE_PARALYSIS: | |
2232 case SPELL_MIND_CURE_INSANITY: | |
2233 case SPELL_BODY_CURE_WEAKNESS: | |
2234 case SPELL_BODY_REGENERATION: | |
2235 case SPELL_BODY_CURE_POISON: | |
2236 case SPELL_BODY_CURE_DISEASE: | |
0 | 2237 LABEL_25: |
486 | 2238 //v6 = a5 | 2; |
2239 a5 |= 0x0002; | |
0 | 2240 break; |
486 | 2241 |
2242 case SPELL_DARK_SACRIFICE: | |
2243 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2244 a5 |= 0x0200; | |
0 | 2245 break; |
2246 default: | |
2247 break; | |
2248 } | |
2249 } | |
370 | 2250 |
486 | 2251 |
2252 if (a5 & 0x3CA) | |
0 | 2253 { |
486 | 2254 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); |
2255 for (uint i = 0; i < 10; ++i) | |
2256 if (pStru277[i].field_8 & 0x3CA) | |
2257 { | |
2258 pStru277[i].spellnum = 0; | |
2259 break; | |
2260 } | |
0 | 2261 } |
486 | 2262 |
2263 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); | |
2264 for (uint i = 0; i < 10; ++i) | |
0 | 2265 { |
486 | 2266 auto spell = pStru277 + i; |
2267 if (!spell->spellnum) | |
2268 continue; | |
2269 | |
2270 spell->spellnum = 0; | |
2271 if (spell->field_8 & 0x3CA) | |
0 | 2272 { |
486 | 2273 pGUIWindow_Settings->Release(); |
2274 pGUIWindow_Settings = nullptr; | |
2275 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2276 GameUI_Footer_TimeLeft = 0; |
486 | 2277 unk_50C9A0 = 0; |
2278 back_to_game(); | |
0 | 2279 } |
2280 } | |
486 | 2281 |
2282 int result = pStru277->PushStru277(a1, uPlayerID, a4, a5, a6); | |
0 | 2283 if ( result != -1 ) |
2284 { | |
486 | 2285 if ( a5 & 2 ) |
0 | 2286 { |
2287 if ( pGUIWindow_Settings ) | |
319 | 2288 return; |
0 | 2289 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
832 | 2290 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2291 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | |
2292 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | |
2293 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | |
319 | 2294 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2295 return; | |
0 | 2296 } |
486 | 2297 if ( a5 & 8 ) |
0 | 2298 { |
2299 if ( pGUIWindow_Settings ) | |
319 | 2300 return; |
832 | 2301 |
2302 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | |
2303 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); | |
319 | 2304 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2305 return; | |
0 | 2306 } |
486 | 2307 if ( a5 & 0x40 ) |
0 | 2308 { |
2309 if ( pGUIWindow_Settings ) | |
319 | 2310 return; |
832 | 2311 |
2312 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | |
2313 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); | |
2314 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2315 return; | |
0 | 2316 } |
486 | 2317 if ( (char)a5 < 0 ) |
0 | 2318 { |
2319 if ( pGUIWindow_Settings ) | |
319 | 2320 return; |
0 | 2321 ++pIcons_LOD->uTexturePacksCount; |
2322 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2323 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
2324 pGUIWindow_Settings = pStru277[result].sub_4219BE(); | |
2325 unk_50C9A0 = 1; | |
2326 some_active_character = uActiveCharacter; | |
319 | 2327 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2328 return; | |
0 | 2329 } |
486 | 2330 if ( HIBYTE(a5) & 1 ) |
0 | 2331 { |
2332 if ( pGUIWindow_Settings ) | |
319 | 2333 return; |
2334 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | |
832 | 2335 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2336 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | |
2337 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | |
2338 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | |
2339 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | |
423 | 2340 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2341 } |
486 | 2342 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2343 { |
319 | 2344 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); |
832 | 2345 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2346 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2347 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
0 | 2348 1, |
2349 0, | |
832 | 2350 UIMSG_ScrollNPCPanel, 0, |
0 | 2351 0, |
2352 "", | |
832 | 2353 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2354 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2355 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2356 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
0 | 2357 1, |
2358 0, | |
832 | 2359 UIMSG_ScrollNPCPanel, 1, |
0 | 2360 0, |
2361 "", | |
832 | 2362 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
2363 pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); | |
2364 pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); | |
0 | 2365 } |
2366 } | |
2367 } | |
2368 | |
2369 //----- (00427D48) -------------------------------------------------------- | |
2370 void stru277::_427D48(unsigned int uPlayerID) | |
2371 { | |
2372 stru277 *v2; // esi@1 | |
2373 signed int v3; // ebx@1 | |
2374 | |
2375 v2 = this; | |
2376 v3 = 10; | |
2377 do | |
2378 { | |
2379 if ( v2->spellnum ) | |
2380 { | |
2381 if ( v2->field_8 & 0x3CA ) | |
2382 { | |
2383 v2->spellnum = 0; | |
2384 pGUIWindow_Settings->Release(); | |
2385 pGUIWindow_Settings = 0; | |
2386 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2387 GameUI_Footer_TimeLeft = 0; |
0 | 2388 unk_50C9A0 = 0; |
2389 back_to_game(); | |
2390 } | |
2391 } | |
2392 ++v2; | |
2393 --v3; | |
2394 } | |
2395 while ( v3 ); | |
2396 } | |
2397 | |
2398 //----- (00427DA0) -------------------------------------------------------- | |
823 | 2399 unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2400 { |
2401 unsigned int result; // eax@1 | |
2402 stru277 *v7; // edx@1 | |
2403 stru277 *v8; // ecx@5 | |
2404 | |
2405 result = 0; | |
2406 v7 = this; | |
2407 while ( v7->spellnum ) | |
2408 { | |
2409 ++result; | |
2410 ++v7; | |
2411 if ( (signed int)result >= 10 ) | |
2412 goto LABEL_8; | |
2413 } | |
2414 v8 = &this[result]; | |
2415 v8->spellnum = a2; | |
2416 v8->uPlayerID = uPlayerID; | |
2417 if ( a5 & 0x10 ) | |
2418 v8->uPlayerID_2 = uPlayerID; | |
2419 v8->field_6 = 0; | |
488 | 2420 v8->spell_target_pid = 0; |
0 | 2421 v8->field_8 = a5; |
488 | 2422 v8->forced_spell_skill_level = skill_level; |
823 | 2423 v8->sound_id = spell_sound_id; |
0 | 2424 LABEL_8: |
2425 if ( result == 10 ) | |
2426 result = -1; | |
2427 return result; | |
2428 } | |
2429 | |
2430 //----- (00427E01) -------------------------------------------------------- | |
2431 void stru277::_427E01_cast_spell() | |
2432 { | |
486 | 2433 //int v1; // esi@1 |
0 | 2434 int v2; // edi@1 |
2435 stru277 *v3; // ebx@2 | |
488 | 2436 //signed int v4; // eax@8 |
2437 //__int16 v5; // ax@9 | |
0 | 2438 signed int v6; // eax@14 |
488 | 2439 //__int16 v7; // ax@23 |
2440 //__int16 v8; // ax@24 | |
2441 //char v9; // al@44 | |
2442 //int v10; // eax@45 | |
0 | 2443 unsigned __int16 v11; // cx@45 |
822 | 2444 //signed int v12; // ecx@48 |
490 | 2445 //int v13; // eax@53 |
0 | 2446 unsigned __int8 v14; // zf@53 |
488 | 2447 //unsigned int v15; // edx@53 |
2448 //signed int v16; // eax@53 | |
0 | 2449 Player *v17; // esi@70 |
822 | 2450 //int v18; // eax@72 |
823 | 2451 //int v19; // eax@74 |
0 | 2452 char *v20; // eax@74 |
2453 signed int i; // esi@76 | |
823 | 2454 //int v22; // eax@88 |
0 | 2455 __int16 v23; // ax@88 |
488 | 2456 //int v24; // ecx@93 |
2457 //int v25; // ecx@94 | |
2458 //signed __int64 v26; // qax@100 | |
2459 //char *v27; // ecx@100 | |
2460 //unsigned __int64 v28; // qax@102 | |
0 | 2461 int v29; // ecx@105 |
2462 int v30; // ecx@106 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2463 //int v31; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2464 //int v32; // eax@112 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
2465 //char *v33; // edx@113 |
823 | 2466 //int v34; // eax@121 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2467 //int v35; // eax@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2468 //int v36; // edx@125 |
823 | 2469 //int v37; // eax@129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2470 //signed int v38; // edi@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2471 //signed int v39; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2472 //int v40; // ecx@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2473 //int v41; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2474 //signed int v42; // eax@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2475 //int *v43; // ecx@129 |
823 | 2476 //int v44; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2477 //int v45; // ecx@132 |
0 | 2478 int v46; // eax@132 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2479 //unsigned int v47; // edx@133 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2480 //int v48; // eax@137 |
823 | 2481 //int v49; // eax@137 |
822 | 2482 //int v50; // eax@141 |
0 | 2483 int v51; // eax@146 |
2484 __int16 v52; // ax@153 | |
823 | 2485 //int v53; // eax@153 |
0 | 2486 signed __int64 v54; // qax@164 |
2487 int v55; // edi@164 | |
488 | 2488 //stru6 *v56; // eax@165 |
0 | 2489 int v57; // eax@169 |
2490 signed __int64 v58; // qax@177 | |
2491 int v59; // edi@177 | |
2492 unsigned __int16 v60; // ax@184 | |
2493 int v61; // ecx@184 | |
823 | 2494 //int v62; // eax@186 |
0 | 2495 int v63; // ecx@187 |
2496 int v64; // ecx@188 | |
2497 int v65; // ecx@189 | |
710 | 2498 //const char *v66; // ecx@200 |
2499 //unsigned int v67; // edx@201 | |
0 | 2500 char v68; // al@207 |
89 | 2501 ItemGen *v69; // esi@211 |
0 | 2502 int v70; // ecx@214 |
2503 int v71; // ecx@215 | |
2504 int v72; // ecx@216 | |
488 | 2505 //__int16 v73; // ST1C_2@222 |
2506 //__int16 v74; // ST18_2@222 | |
2507 //stru6 *v75; // eax@222 | |
0 | 2508 int v76; // ecx@223 |
2509 int v77; // ecx@224 | |
2510 int v78; // ecx@225 | |
2511 int v79; // eax@227 | |
488 | 2512 //int v80; // eax@232 |
2513 //__int16 v81; // ST18_2@245 | |
2514 //stru6 *v82; // eax@245 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2515 //signed int v83; // edi@245 |
488 | 2516 //__int16 v84; // ST18_2@245 |
2517 //stru6 *v85; // eax@245 | |
2518 //__int16 v86; // ST18_2@245 | |
2519 //stru6 *v87; // eax@245 | |
2520 //__int16 v88; // ST18_2@245 | |
2521 //stru6 *v89; // eax@245 | |
0 | 2522 double v90; // st7@245 |
2523 int v91; // eax@250 | |
89 | 2524 Player *v92; // eax@255 |
488 | 2525 //__int16 v93; // ST18_2@260 |
2526 //stru6 *v94; // eax@260 | |
2527 //__int16 v95; // ST18_2@260 | |
2528 //stru6 *v96; // eax@260 | |
2529 //__int16 v97; // ST18_2@260 | |
2530 //stru6 *v98; // eax@260 | |
2531 //__int16 v99; // ST18_2@260 | |
2532 //stru6 *v100; // eax@260 | |
0 | 2533 int v101; // ecx@261 |
2534 int v102; // ecx@262 | |
2535 int v103; // ecx@263 | |
2536 int v104; // eax@265 | |
2537 int v105; // edi@271 | |
488 | 2538 //__int16 v106; // ST18_2@272 |
2539 //stru6 *v107; // eax@272 | |
0 | 2540 __int16 v108; // ST1C_2@274 |
2541 __int16 v109; // ST18_2@274 | |
2542 stru6 *v110; // eax@274 | |
2543 int v111; // eax@274 | |
2544 Actor *v112; // esi@278 | |
2545 int v113; // eax@278 | |
2546 int v114; // ebx@278 | |
2547 unsigned int v115; // ecx@278 | |
2548 int v116; // edx@279 | |
2549 int v117; // edx@281 | |
2550 int v118; // edx@283 | |
2551 int v119; // edi@286 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2552 //int v120; // eax@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2553 //int v121; // eax@286 |
0 | 2554 signed int v122; // eax@286 |
2555 int v123; // ecx@288 | |
2556 int v124; // ecx@289 | |
2557 int v125; // ecx@290 | |
2558 int v126; // eax@292 | |
2559 int v127; // eax@296 | |
488 | 2560 //__int16 v128; // ST18_2@303 |
2561 //stru6 *v129; // eax@303 | |
2562 //__int16 v130; // ST18_2@303 | |
2563 //stru6 *v131; // eax@303 | |
2564 //__int16 v132; // ST18_2@303 | |
2565 //stru6 *v133; // eax@303 | |
2566 //__int16 v134; // ST18_2@303 | |
2567 //stru6 *v135; // eax@303 | |
2568 //unsigned __int64 v136; // qax@304 | |
2569 //char *v137; // ecx@304 | |
0 | 2570 int v138; // ecx@305 |
2571 int v139; // ecx@306 | |
2572 int v140; // eax@308 | |
488 | 2573 //__int16 v141; // ST18_2@311 |
2574 //stru6 *v142; // eax@311 | |
2575 //__int16 v143; // ST18_2@311 | |
2576 //stru6 *v144; // eax@311 | |
2577 //__int16 v145; // ST18_2@311 | |
2578 //stru6 *v146; // eax@311 | |
2579 //__int16 v147; // ST18_2@311 | |
2580 //stru6 *v148; // eax@311 | |
0 | 2581 int v149; // ecx@312 |
2582 int v150; // ecx@313 | |
2583 int v151; // ecx@314 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2584 //signed int v152; // eax@322 |
0 | 2585 int v153; // ecx@322 |
2586 int v154; // eax@322 | |
2587 int v155; // eax@323 | |
2588 int v156; // eax@323 | |
2589 int v157; // eax@326 | |
2590 double v158; // st7@326 | |
2591 double v159; // st6@326 | |
2592 signed __int64 v160; // qtt@334 | |
823 | 2593 //int v161; // eax@339 |
0 | 2594 int v162; // edi@340 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2595 //int v163; // eax@340 |
0 | 2596 signed int v164; // eax@340 |
2597 signed int v165; // edi@340 | |
488 | 2598 //stru6 *v166; // eax@340 |
2599 //stru6 *v167; // eax@340 | |
0 | 2600 signed int v168; // edi@343 |
2601 int v169; // eax@344 | |
2602 int v170; // ecx@346 | |
2603 int v171; // ecx@347 | |
2604 int v172; // ecx@348 | |
2605 int v173; // edi@350 | |
2606 signed int v174; // edi@355 | |
488 | 2607 //__int16 v175; // ST18_2@357 |
2608 //stru6 *v176; // eax@357 | |
2609 //__int16 v177; // ST18_2@357 | |
2610 //stru6 *v178; // eax@357 | |
2611 //__int16 v179; // ST18_2@357 | |
2612 //stru6 *v180; // eax@357 | |
2613 //__int16 v181; // ST18_2@357 | |
2614 //stru6 *v182; // eax@357 | |
2615 //signed __int64 v183; // qax@357 | |
0 | 2616 int v184; // ecx@358 |
2617 int v185; // ecx@359 | |
2618 int v186; // ecx@360 | |
823 | 2619 //int v187; // eax@367 |
0 | 2620 int v188; // esi@369 |
2621 int v189; // edi@369 | |
710 | 2622 //const char *v190; // ecx@377 |
0 | 2623 signed int v191; // edi@379 |
2624 int v192; // ecx@382 | |
2625 int v193; // ecx@383 | |
2626 int v194; // ecx@384 | |
2627 int v195; // eax@386 | |
2628 int v196; // eax@387 | |
488 | 2629 //__int16 v197; // ST18_2@395 |
2630 //stru6 *v198; // eax@395 | |
2631 //__int16 v199; // ST18_2@395 | |
2632 //stru6 *v200; // eax@395 | |
2633 //__int16 v201; // ST18_2@395 | |
2634 //stru6 *v202; // eax@395 | |
2635 //__int16 v203; // ST18_2@395 | |
2636 //stru6 *v204; // eax@395 | |
0 | 2637 signed int v205; // edi@405 |
2638 int v206; // eax@407 | |
2639 __int16 v207; // cx@407 | |
2640 int v208; // eax@411 | |
2641 signed int v209; // ecx@412 | |
2642 int v210; // edx@412 | |
2643 signed int v211; // ecx@412 | |
2644 int v212; // eax@413 | |
2645 int v213; // eax@413 | |
2646 int v214; // eax@413 | |
2647 int v215; // eax@415 | |
2648 double v216; // st7@415 | |
2649 double v217; // st6@415 | |
2650 signed __int64 v218; // qtt@423 | |
2651 int v219; // ecx@425 | |
2652 int v220; // ecx@426 | |
2653 int v221; // edi@428 | |
2654 char *v222; // edi@434 | |
2655 char v223; // al@438 | |
2656 int v224; // ecx@442 | |
2657 int v225; // ecx@443 | |
823 | 2658 //int v226; // eax@451 |
0 | 2659 int v227; // esi@453 |
2660 unsigned int v228; // edi@454 | |
2661 int v229; // edi@466 | |
488 | 2662 //__int16 v230; // ST18_2@469 |
2663 //stru6 *v231; // eax@469 | |
2664 //signed int v232; // esi@469 | |
2665 //__int16 v233; // ST18_2@469 | |
2666 //stru6 *v234; // eax@469 | |
2667 //__int16 v235; // ST18_2@469 | |
2668 //stru6 *v236; // eax@469 | |
2669 //__int16 v237; // ST18_2@469 | |
2670 //stru6 *v238; // eax@469 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2671 //__int16 v239; // ST1C_2@469 |
0 | 2672 char *v240; // ecx@472 |
2673 double v241; // st7@478 | |
2674 signed __int64 v242; // qax@484 | |
2675 char *v243; // ecx@484 | |
2676 char *v244; // eax@488 | |
2677 int v245; // edi@492 | |
2678 int v246; // eax@492 | |
2679 char *v247; // eax@497 | |
2680 char v248; // al@497 | |
2681 char v249; // cf@500 | |
2682 float v250; // esi@507 | |
2683 char v251; // al@507 | |
2684 int v252; // edx@510 | |
2685 int m; // esi@510 | |
2686 int v254; // eax@513 | |
2687 int v255; // esi@513 | |
2688 int v256; // ecx@513 | |
2689 int v257; // edx@514 | |
2690 int v258; // ecx@514 | |
2691 char v259; // al@516 | |
2692 int v260; // eax@518 | |
2693 int v261; // esi@519 | |
2694 int v262; // edx@521 | |
2695 int v263; // ecx@521 | |
2696 int v264; // esi@521 | |
2697 int v265; // edx@521 | |
2698 int *ii; // eax@522 | |
2699 int v267; // eax@524 | |
2700 int v268; // eax@524 | |
2701 int v269; // eax@526 | |
2702 char *v270; // eax@531 | |
2703 char v271; // al@531 | |
2704 char v272; // cf@534 | |
2705 float v273; // esi@541 | |
2706 char v274; // al@541 | |
2707 int v275; // edx@544 | |
2708 int k; // esi@544 | |
2709 int v277; // edx@548 | |
2710 int v278; // ecx@548 | |
2711 char v279; // al@550 | |
2712 int v280; // eax@552 | |
2713 int v281; // esi@553 | |
2714 int v282; // edx@555 | |
2715 int v283; // ecx@555 | |
2716 int v284; // esi@555 | |
2717 int v285; // edx@555 | |
2718 int *l; // eax@556 | |
2719 int v287; // eax@558 | |
2720 int v288; // eax@558 | |
2721 ItemGen *v289; // eax@560 | |
2722 signed int v290; // eax@560 | |
2723 unsigned __int8 v291; // al@564 | |
2724 char v292; // al@573 | |
2725 int v293; // eax@575 | |
2726 ItemGen *v294; // esi@575 | |
2727 int v295; // edx@575 | |
2728 int kk; // edi@575 | |
2729 int v297; // edx@579 | |
2730 int v298; // ecx@579 | |
2731 char v299; // al@581 | |
2732 int v300; // eax@583 | |
2733 int v301; // edi@584 | |
2734 int v302; // edx@586 | |
2735 int v303; // ecx@586 | |
2736 int v304; // edi@586 | |
2737 int v305; // edx@586 | |
2738 int *jj; // eax@587 | |
2739 int v307; // eax@589 | |
2740 int v308; // eax@589 | |
2741 char *v309; // ecx@593 | |
2742 char v310; // sf@593 | |
2743 unsigned __int8 v311; // of@593 | |
2744 char v312; // cl@597 | |
488 | 2745 char v313; // al@606pGame->GetStru6() |
0 | 2746 int v314; // edx@607 |
2747 int j; // esi@607 | |
2748 unsigned int v316; // eax@613 | |
2749 const char *v317; // ecx@617 | |
2750 Player *v318; // ecx@619 | |
2751 unsigned int v319; // edi@627 | |
2752 int v320; // ecx@629 | |
2753 int v321; // ecx@630 | |
2754 int v322; // edi@632 | |
2755 int v323; // edi@635 | |
2756 char *v324; // eax@635 | |
2757 Player *v325; // ecx@640 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2758 //int v326; // eax@643 |
823 | 2759 //int v327; // eax@648 |
0 | 2760 int v328; // ecx@651 |
2761 int v329; // ecx@652 | |
2762 int v330; // edi@654 | |
488 | 2763 //__int16 v331; // ST18_2@658 |
2764 //stru6 *v332; // eax@658 | |
2765 //__int16 v333; // ST18_2@658 | |
2766 //stru6 *v334; // eax@658 | |
2767 //__int16 v335; // ST18_2@658 | |
2768 //stru6 *v336; // eax@658 | |
2769 //__int16 v337; // ST18_2@658 | |
2770 //stru6 *v338; // eax@658 | |
0 | 2771 int v339; // ecx@659 |
2772 int v340; // ecx@660 | |
2773 int v341; // eax@663 | |
2774 signed int v342; // edi@668 | |
2775 signed int v343; // edi@670 | |
2776 unsigned __int64 v344; // ST08_8@670 | |
488 | 2777 //__int16 v345; // ST1C_2@671 |
2778 //__int16 v346; // ST18_2@671 | |
2779 //stru6 *v347; // eax@671 | |
0 | 2780 int v348; // ecx@672 |
2781 int v349; // ecx@673 | |
2782 int v350; // edi@676 | |
2783 Player *v351; // edi@680 | |
488 | 2784 //__int16 v352; // ST18_2@685 |
2785 //stru6 *v353; // eax@685 | |
0 | 2786 int v354; // ecx@686 |
2787 int v355; // ecx@687 | |
2788 int v356; // eax@689 | |
112 | 2789 Player *v357; // edi@694 |
488 | 2790 //unsigned __int16 v358; // ST1C_2@695 |
2791 //__int16 v359; // ST18_2@695 | |
2792 //stru6 *v360; // eax@695 | |
2793 //__int16 v361; // ST1C_2@697 | |
2794 //__int16 v362; // ST18_2@697 | |
2795 //stru6 *v363; // eax@697 | |
0 | 2796 int v364; // ecx@698 |
2797 int v365; // ecx@699 | |
2798 int v366; // eax@701 | |
488 | 2799 //stru6 *v367; // eax@704 |
823 | 2800 //int v368; // eax@704 |
0 | 2801 Actor *v369; // edi@705 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2802 //int v370; // eax@706 |
0 | 2803 int v371; // ecx@709 |
2804 int v372; // ecx@710 | |
2805 int v373; // eax@715 | |
2806 int v374; // eax@717 | |
112 | 2807 Player *v375; // edi@717 |
0 | 2808 int v376; // eax@717 |
2809 Player *v377; // ecx@719 | |
2810 int v378; // ecx@721 | |
2811 int v379; // ecx@722 | |
2812 int v380; // eax@724 | |
2813 int v381; // edi@727 | |
2814 int v382; // ecx@727 | |
2815 Player *v383; // eax@728 | |
2816 int v384; // eax@733 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2817 //int v385; // edi@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2818 //signed int v386; // eax@736 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2819 //Player *v387; // edi@738 |
0 | 2820 int v388; // edi@740 |
488 | 2821 //unsigned __int16 v389; // ST1C_2@740 |
2822 //__int16 v390; // ST18_2@740 | |
2823 //stru6 *v391; // eax@740 | |
0 | 2824 int v392; // ecx@742 |
2825 int v393; // ecx@743 | |
2826 int v394; // ecx@744 | |
2827 int v395; // edi@747 | |
2828 int v396; // eax@752 | |
2829 int v397; // eax@757 | |
2830 int v398; // eax@757 | |
2831 int v399; // eax@757 | |
2832 char *v400; // esi@757 | |
488 | 2833 //Game *v401; // ecx@759 |
2834 //__int16 v402; // ST1C_2@759 | |
2835 //__int16 v403; // ST18_2@759 | |
2836 //stru6 *v404; // eax@759 | |
0 | 2837 int v405; // ecx@761 |
2838 int v406; // ecx@762 | |
2839 int v407; // edi@765 | |
488 | 2840 //__int16 v408; // ST1C_2@769 |
2841 //__int16 v409; // ST18_2@769 | |
2842 //stru6 *v410; // eax@769 | |
0 | 2843 int v411; // ecx@772 |
2844 int v412; // ecx@773 | |
2845 int v413; // edi@775 | |
488 | 2846 //__int16 v414; // ST1C_2@781 |
2847 //__int16 v415; // ST18_2@781 | |
2848 //stru6 *v416; // eax@781 | |
0 | 2849 int v417; // eax@787 |
2850 int v418; // ecx@789 | |
2851 __int16 v419; // ax@791 | |
2852 signed int v420; // eax@793 | |
2853 int v421; // edx@793 | |
2854 const char *v422; // eax@801 | |
2855 int v423; // ecx@808 | |
2856 int v424; // ecx@809 | |
2857 int v425; // eax@811 | |
2858 signed int v426; // eax@815 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2859 //signed int v427; // eax@820 |
0 | 2860 int v428; // ecx@825 |
2861 int v429; // ecx@826 | |
2862 int v430; // eax@828 | |
488 | 2863 //stru6 *v431; // eax@831 |
823 | 2864 //int v432; // eax@831 |
0 | 2865 Actor *v433; // edi@832 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2866 //int v434; // eax@833 |
0 | 2867 int v435; // ecx@837 |
2868 int v436; // ecx@838 | |
488 | 2869 //__int16 v437; // ST1C_2@843 |
2870 //__int16 v438; // ST18_2@843 | |
2871 //stru6 *v439; // eax@843 | |
0 | 2872 int v440; // eax@843 |
2873 int v441; // eax@847 | |
2874 int v442; // ecx@850 | |
2875 int v443; // ecx@851 | |
2876 int v444; // eax@853 | |
2877 signed int v445; // edi@857 | |
2878 int v446; // ecx@862 | |
2879 LevelDecoration *v447; // edi@864 | |
2880 __int16 v448; // ax@864 | |
2881 char *v449; // esi@870 | |
2882 int v450; // eax@870 | |
2883 int v451; // ecx@875 | |
2884 int v452; // ecx@876 | |
2885 int v453; // edi@878 | |
488 | 2886 //__int16 v454; // ST1C_2@884 |
2887 //__int16 v455; // ST18_2@884 | |
2888 //stru6 *v456; // eax@884 | |
0 | 2889 int v457; // ecx@887 |
2890 int v458; // ecx@888 | |
2891 int v459; // eax@890 | |
2892 signed int v460; // eax@895 | |
2893 Actor *v461; // eax@897 | |
2894 unsigned __int16 v462; // cx@897 | |
2895 signed int v463; // edx@897 | |
2896 int v464; // ecx@905 | |
2897 int v465; // ecx@906 | |
2898 int v466; // edi@909 | |
488 | 2899 //__int16 v467; // ST1C_2@913 |
2900 //__int16 v468; // ST18_2@913 | |
2901 //stru6 *v469; // eax@913 | |
0 | 2902 int v470; // edi@913 |
2903 int v471; // eax@917 | |
2904 int v472; // eax@917 | |
2905 char *v473; // esi@918 | |
488 | 2906 //__int16 v474; // ST18_2@920 |
2907 //stru6 *v475; // eax@920 | |
2908 //__int16 v476; // ST18_2@920 | |
2909 //stru6 *v477; // eax@920 | |
2910 //__int16 v478; // ST18_2@920 | |
2911 //stru6 *v479; // eax@920 | |
2912 //__int16 v480; // ST18_2@920 | |
2913 //stru6 *v481; // eax@920 | |
2914 //__int16 v482; // ST18_2@923 | |
2915 //stru6 *v483; // eax@923 | |
2916 //__int16 v484; // ST18_2@923 | |
2917 //stru6 *v485; // eax@923 | |
2918 //__int16 v486; // ST18_2@923 | |
2919 //stru6 *v487; // eax@923 | |
2920 //__int16 v488; // ST18_2@923 | |
2921 //stru6 *v489; // eax@923 | |
2922 //__int16 v490; // ST1C_2@924 | |
2923 //__int16 v491; // ST18_2@924 | |
2924 //stru6 *v492; // eax@924 | |
0 | 2925 int v493; // ecx@925 |
2926 int v494; // ecx@926 | |
488 | 2927 //__int16 v495; // ST1C_2@931 |
2928 //__int16 v496; // ST18_2@931 | |
2929 //stru6 *v497; // eax@931 | |
0 | 2930 int v498; // edi@931 |
2931 int v499; // eax@935 | |
2932 int v500; // eax@935 | |
2933 Player *v501; // edi@939 | |
488 | 2934 //__int16 v502; // ST18_2@940 |
2935 //stru6 *v503; // eax@940 | |
2936 //stru6 *v504; // eax@943 | |
0 | 2937 int v505; // eax@943 |
823 | 2938 //int v506; // eax@943 |
0 | 2939 int v507; // edi@944 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2940 //int v508; // eax@944 |
0 | 2941 signed int v509; // eax@944 |
2942 signed int v510; // edi@944 | |
2943 Actor *v511; // edi@946 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2944 //int v512; // eax@946 |
0 | 2945 SpellBuff *v513; // edi@946 |
2946 int v514; // ecx@950 | |
2947 int v515; // ecx@951 | |
2948 int v516; // eax@953 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2949 //int v517; // eax@956 |
90 | 2950 Actor *v518; // edx@957 |
0 | 2951 __int16 v519; // cx@958 |
2952 int v520; // ecx@968 | |
2953 int v521; // ecx@969 | |
2954 int v522; // eax@971 | |
488 | 2955 //__int16 v523; // ST18_2@975 |
2956 //stru6 *v524; // eax@975 | |
2957 //__int16 v525; // ST18_2@975 | |
2958 //stru6 *v526; // eax@975 | |
2959 //__int16 v527; // ST18_2@975 | |
2960 //stru6 *v528; // eax@975 | |
2961 //__int16 v529; // ST18_2@975 | |
2962 //stru6 *v530; // eax@975 | |
0 | 2963 int v531; // eax@982 |
823 | 2964 //int v532; // eax@982 |
0 | 2965 int v533; // edi@983 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2966 //int v534; // eax@983 |
0 | 2967 signed int v535; // eax@983 |
2968 signed int v536; // edi@983 | |
2969 stru6 *v537; // eax@984 | |
2970 int v538; // ecx@985 | |
2971 int v539; // ecx@986 | |
2972 int v540; // eax@988 | |
488 | 2973 //__int16 v541; // ST18_2@991 |
2974 //stru6 *v542; // eax@991 | |
2975 //__int16 v543; // ST18_2@991 | |
2976 //stru6 *v544; // eax@991 | |
2977 //__int16 v545; // ST18_2@991 | |
2978 //stru6 *v546; // eax@991 | |
2979 //__int16 v547; // ST18_2@991 | |
0 | 2980 stru6 *v548; // eax@991 |
2981 double v549; // st7@991 | |
2982 unsigned __int16 v550; // di@991 | |
2983 int v551; // ecx@993 | |
2984 int v552; // ecx@994 | |
89 | 2985 Player *v553; // edi@1001 |
488 | 2986 //__int16 v554; // ST18_2@1002 |
2987 //stru6 *v555; // eax@1002 | |
2988 //__int16 v556; // ST18_2@1002 | |
2989 //stru6 *v557; // eax@1002 | |
2990 //__int16 v558; // ST18_2@1002 | |
2991 //stru6 *v559; // eax@1002 | |
2992 //__int16 v560; // ST18_2@1002 | |
2993 //stru6 *v561; // eax@1002 | |
0 | 2994 unsigned __int16 v562; // di@1005 |
2995 signed int v563; // eax@1010 | |
2996 unsigned int v564; // ecx@1011 | |
2997 signed int v565; // eax@1012 | |
2998 Player **v566; // ecx@1012 | |
2999 int v567; // eax@1012 | |
488 | 3000 //unsigned __int16 v568; // ST1C_2@1012 |
3001 //__int16 v569; // ST18_2@1012 | |
3002 //stru6 *v570; // eax@1012 | |
0 | 3003 Player *v571; // eax@1013 |
3004 char *v572; // ecx@1013 | |
3005 int v573; // ecx@1017 | |
3006 int v574; // ecx@1018 | |
3007 int v575; // eax@1020 | |
3008 signed int v576; // eax@1025 | |
3009 Player *v577; // eax@1026 | |
3010 int v578; // eax@1028 | |
3011 __int16 v579; // ax@1029 | |
823 | 3012 //int v580; // eax@1031 |
0 | 3013 int v581; // edi@1031 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3014 //int v582; // eax@1031 |
488 | 3015 //__int16 v583; // ST1C_2@1034 |
3016 //__int16 v584; // ST18_2@1034 | |
0 | 3017 char *v585; // esi@1034 |
488 | 3018 //stru6 *v586; // eax@1034 |
0 | 3019 signed int v587; // eax@1035 |
3020 int v588; // ecx@1036 | |
3021 int v589; // ecx@1037 | |
3022 int v590; // ecx@1038 | |
3023 char v591; // al@1048 | |
3024 int v592; // esi@1052 | |
3025 int v593; // ecx@1057 | |
3026 int v594; // ecx@1058 | |
823 | 3027 //int v595; // eax@1064 |
0 | 3028 int v596; // esi@1066 |
3029 unsigned int v597; // edi@1067 | |
3030 int v598; // eax@1079 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3031 //signed int v599; // eax@1082 |
0 | 3032 int v600; // edi@1086 |
3033 int v601; // edx@1086 | |
3034 int v602; // eax@1086 | |
3035 int v603; // ecx@1086 | |
823 | 3036 //int v604; // eax@1087 |
0 | 3037 char *v605; // eax@1089 |
3038 int v606; // edx@1091 | |
3039 int v607; // ecx@1100 | |
3040 __int16 v608; // ax@1102 | |
3041 signed int v609; // eax@1104 | |
3042 int v610; // edi@1106 | |
3043 unsigned int v611; // eax@1106 | |
89 | 3044 Player *v612; // edi@1106 |
3045 DDM_DLV_Header *v613; // eax@1108 | |
0 | 3046 int v614; // eax@1116 |
3047 int v615; // edi@1119 | |
488 | 3048 //__int16 v616; // ST1C_2@1122 |
3049 //__int16 v617; // ST18_2@1122 | |
3050 //stru6 *v618; // eax@1122 | |
112 | 3051 Player *v619; // edi@1123 |
488 | 3052 //unsigned __int16 v620; // ST1C_2@1124 |
3053 //__int16 v621; // ST18_2@1124 | |
3054 //stru6 *v622; // eax@1124 | |
0 | 3055 signed __int64 v623; // qax@1127 |
823 | 3056 //int v624; // eax@1127 |
0 | 3057 int v625; // edi@1129 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3058 //int v626; // eax@1129 |
0 | 3059 signed int v627; // eax@1129 |
3060 signed int v628; // edi@1129 | |
3061 int v629; // ecx@1130 | |
3062 Player *v630; // eax@1131 | |
3063 int v631; // eax@1137 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3064 //int v632; // edi@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3065 //Player *v633; // eax@1140 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3066 //signed int v634; // eax@1140 |
0 | 3067 int v635; // edi@1142 |
488 | 3068 //unsigned __int16 v636; // ST1C_2@1142 |
3069 //__int16 v637; // ST18_2@1142 | |
3070 //stru6 *v638; // eax@1142 | |
3071 //stru6 *v639; // eax@1143 | |
0 | 3072 int v640; // ecx@1146 |
3073 int v641; // ecx@1147 | |
3074 int v642; // edi@1156 | |
3075 int v643; // eax@1156 | |
3076 int v644; // eax@1156 | |
3077 signed int v645; // eax@1158 | |
488 | 3078 //Player *v646; // ebx@1169 |
3079 //int v647; // edi@1169 | |
3080 //signed int v648; // ST1C_4@1170 | |
3081 //Player *v649; // ecx@1170 | |
3082 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103 | |
3083 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100 | |
3084 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304 | |
3085 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3086 //int v654; // [sp-4h] [bp-E88h]@124 |
488 | 3087 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304 |
0 | 3088 unsigned int v656; // [sp-4h] [bp-E88h]@639 |
3089 int v657; // [sp-4h] [bp-E88h]@807 | |
488 | 3090 //int v658; // [sp+0h] [bp-E84h]@100 |
0 | 3091 int v659; // [sp+0h] [bp-E84h]@123 |
3092 int v660; // [sp+0h] [bp-E84h]@146 | |
3093 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
488 | 3094 //int v662; // [sp+0h] [bp-E84h]@304 |
0 | 3095 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 |
3096 const char *v664; // [sp+0h] [bp-E84h]@802 | |
3097 int v665; // [sp+0h] [bp-E84h]@807 | |
3098 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 3099 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
488 | 3100 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3101 //int v669; // [sp+4h] [bp-E80h]@123 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3102 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
0 | 3103 int v671; // [sp+4h] [bp-E80h]@146 |
3104 unsigned int v672; // [sp+4h] [bp-E80h]@164 | |
488 | 3105 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3106 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
0 | 3107 const char *v675; // [sp+4h] [bp-E80h]@800 |
3108 int v676; // [sp+4h] [bp-E80h]@807 | |
3109 int v677; // [sp+4h] [bp-E80h]@861 | |
3110 int v678; // [sp+4h] [bp-E80h]@997 | |
3111 int v679; // [sp+14h] [bp-E70h]@515 | |
3112 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
3113 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
3114 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
3115 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
3116 int v684; // [sp+D04h] [bp-180h]@416 | |
3117 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
3118 int x; // [sp+D20h] [bp-164h]@327 | |
3119 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3120 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3121 //int v689; // [sp+D30h] [bp-154h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3122 //int v690; // [sp+D34h] [bp-150h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3123 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3124 //int v692; // [sp+D3Ch] [bp-148h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3125 //int v693; // [sp+D40h] [bp-144h]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3126 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3127 //int v695; // [sp+D48h] [bp-13Ch]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3128 //int v696; // [sp+D4Ch] [bp-138h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3129 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3130 //int v698; // [sp+D54h] [bp-130h]@129 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3131 //int v699; // [sp+D58h] [bp-12Ch]@129 |
0 | 3132 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3133 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3134 //int v702; // [sp+D6Ch] [bp-118h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3135 //int v703; // [sp+D70h] [bp-114h]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3136 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3137 //int v705; // [sp+D78h] [bp-10Ch]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3138 //int v706; // [sp+D7Ch] [bp-108h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3139 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3140 //int v708; // [sp+D84h] [bp-100h]@1127 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3141 //int v709; // [sp+D88h] [bp-FCh]@1127 |
0 | 3142 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
3143 stru277 *v711; // [sp+D90h] [bp-F4h]@1 | |
3144 __int64 v712; // [sp+D94h] [bp-F0h]@991 | |
3145 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
3146 int n; // [sp+DA0h] [bp-E4h]@1 | |
3147 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
3148 int v716; // [sp+DC0h] [bp-C4h]@272 | |
3149 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
3150 float v718; // [sp+DCCh] [bp-B8h]@176 | |
3151 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
3152 char *y; // [sp+DD4h] [bp-B0h]@325 | |
3153 int v721; // [sp+DD8h] [bp-ACh]@163 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3154 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 |
0 | 3155 int v723; // [sp+E4Ch] [bp-38h]@1 |
3156 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
3157 float v725; // [sp+E54h] [bp-30h]@23 | |
3158 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3159 //int v726b; |
0 | 3160 float v727; // [sp+E5Ch] [bp-28h]@1 |
3161 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
3162 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
3163 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 3164 Player *v730b; |
3165 ItemGen *v730c; | |
0 | 3166 int v731; // [sp+E6Ch] [bp-18h]@48 |
3167 signed int v732; // [sp+E70h] [bp-14h]@325 | |
3168 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
3169 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
3170 int amount; // [sp+E80h] [bp-4h]@1 | |
3171 | |
3172 auto ecx0 = this; | |
3173 | |
3174 v711 = ecx0; | |
3175 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3176 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
|
3177 //SpriteObject::SpriteObject(&a1); |
0 | 3178 |
486 | 3179 //v1 = 0; |
0 | 3180 v2 = 0; |
3181 amount = 0; | |
3182 LODWORD(v733) = 0; | |
3183 v723 = 0; | |
3184 v727 = 0.0; | |
3185 n = 0; | |
3186 while ( 1 ) | |
3187 { | |
3188 v3 = &v711[n]; | |
3189 HIDWORD(v733) = (int)v3; | |
486 | 3190 if ( v3->spellnum == 0 ) |
0 | 3191 goto LABEL_1166; |
486 | 3192 |
3193 if (pParty->Invisible()) | |
3194 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
3195 | |
0 | 3196 if ( v3->field_8 & 0x3CA ) |
3197 { | |
3198 if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) | |
3199 v711->_427D48(1u); | |
3200 goto LABEL_1166; | |
3201 } | |
3202 pPlayer = &pParty->pPlayers[v3->uPlayerID]; | |
488 | 3203 |
3204 a2 = v3->spell_target_pid; | |
3205 if (!a2) | |
0 | 3206 { |
488 | 3207 if (v3->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3208 v3->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
3209 v3->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
3210 v666 = 1; | |
3211 else | |
3212 v666 = 0; | |
3213 | |
3214 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
3215 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3216 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 3217 a2 = pMouse->uPointingObjectID; |
0 | 3218 } |
488 | 3219 |
3220 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3221 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
|
3222 if (a1.uType) |
0 | 3223 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3224 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 3225 { |
830 | 3226 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, v3->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 3227 v2 = v723; |
3228 } | |
3229 else | |
3230 { | |
3231 v715.uYawAngle = pParty->sRotationY; | |
3232 v715.uPitchAngle = pParty->sRotationX; | |
3233 } | |
3234 } | |
488 | 3235 |
486 | 3236 LODWORD(v725) = 0; |
3237 _this = 0; | |
488 | 3238 if (v3->forced_spell_skill_level) |
3239 { | |
3240 v11 = v3->forced_spell_skill_level; | |
3241 v723 = v11 & 0x3F; | |
3242 v2 = v723; | |
3243 } | |
3244 else | |
0 | 3245 { |
488 | 3246 //v667 = PLAYER_SKILL_STAFF; |
3247 if (v3->spellnum < SPELL_AIR_WIZARD_EYE) | |
3248 v667 = PLAYER_SKILL_FIRE; | |
3249 else if (v3->spellnum < SPELL_WATER_AWAKEN) | |
3250 v667 = PLAYER_SKILL_AIR; | |
3251 else if (v3->spellnum < SPELL_EARTH_STUN) | |
3252 v667 = PLAYER_SKILL_WATER; | |
3253 else if (v3->spellnum < SPELL_SPIRIT_DETECT_LIFE) | |
3254 v667 = PLAYER_SKILL_EARTH; | |
3255 else if (v3->spellnum < SPELL_MIND_REMOVE_FEAR) | |
3256 v667 = PLAYER_SKILL_SPIRIT; | |
3257 else if (v3->spellnum < SPELL_BODY_CURE_WEAKNESS) | |
3258 v667 = PLAYER_SKILL_MIND; | |
3259 else if (v3->spellnum < SPELL_LIGHT_LIGHT_BOLT) | |
3260 v667 = PLAYER_SKILL_BODY; | |
3261 else if (v3->spellnum < SPELL_DARK_REANIMATE) | |
3262 v667 = PLAYER_SKILL_LIGHT; | |
3263 else if (v3->spellnum < SPELL_BOW_ARROW) | |
3264 v667 = PLAYER_SKILL_DARK; | |
3265 else if (v3->spellnum == SPELL_BOW_ARROW) | |
3266 v667 = PLAYER_SKILL_BOW; | |
3267 else assert(false && "Unknown spell"); | |
3268 | |
0 | 3269 LODWORD(v725) = v667; |
488 | 3270 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3271 v2 = v723; | |
3272 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 3273 } |
488 | 3274 |
0 | 3275 if ( HIBYTE(v11) & 1 ) |
3276 { | |
3277 v731 = 4; | |
3278 } | |
3279 else | |
3280 { | |
3281 if ( (v11 & 0x80u) == 0 ) | |
3282 { | |
3283 v731 = ((v11 & 0x40) != 0) + 1; | |
3284 } | |
3285 else | |
3286 { | |
3287 v731 = 3; | |
3288 } | |
3289 } | |
488 | 3290 |
3291 if (v3->forced_spell_skill_level) | |
486 | 3292 uRequiredMana = 0; |
488 | 3293 else |
822 | 3294 uRequiredMana = pSpellDatas[v3->spellnum].mana_per_skill[v731 - 1]; |
3295 sRecoveryTime = pSpellDatas[v3->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 3296 |
3297 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 3298 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 3299 uRequiredMana = 0; |
488 | 3300 |
3301 if (v3->spellnum >= PLAYER_SKILL_BOW || pPlayer->sMana >= uRequiredMana) | |
0 | 3302 break; |
488 | 3303 |
3304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
486 | 3305 v3->spellnum = 0; |
0 | 3306 LABEL_1166: |
3307 ++n; | |
3308 if ( n >= 10 ) | |
3309 return; | |
3310 } | |
488 | 3311 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3312 v730 = v3->spellnum; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3313 if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW) |
488 | 3314 if (rand() % 100 < 50) |
3315 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3316 if (!pParty->bTurnBasedModeOn) |
488 | 3317 { |
3318 //v646 = pPlayer; | |
3319 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3320 //v647 = n; | |
3321 } | |
3322 else | |
3323 { | |
3324 //v647 = n; | |
3325 //v646 = pPlayer; | |
3326 //v648 = sRecoveryTime; | |
3327 //v649 = pPlayer; | |
3328 pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; | |
3329 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3330 pTurnEngine->_40471C(); | |
3331 } | |
3332 | |
3333 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3334 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3335 v711[n].spellnum = 0; | |
3336 pPlayer->sMana -= uRequiredMana; | |
3337 return; | |
3338 } | |
3339 | |
0 | 3340 switch ( v3->spellnum ) |
3341 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3342 case SPELL_101: |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3343 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); |
488 | 3344 case SPELL_BOW_ARROW: |
0 | 3345 v17 = pPlayer; |
3346 _this = (ItemGen *)1; | |
488 | 3347 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) |
0 | 3348 _this = (ItemGen *)2; |
816 | 3349 sRecoveryTime = v17->GetAttackRecoveryTime(true); |
0 | 3350 a1.stru_24.Reset(); |
822 | 3351 a1.spell_level = v2; |
3352 a1.spell_id = v3->spellnum; | |
3353 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3354 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3355 if ( v17->WearsItem(510, 2) ) |
3356 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3357 a1.vPosition.x = pParty->vPosition.x; | |
3358 a1.vPosition.y = pParty->vPosition.y; | |
3359 a1.uAttributes = 0; | |
3360 a1.uSpriteFrameID = 0; | |
3361 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
823 | 3362 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3363 a1.spell_target_pid = a2; | |
0 | 3364 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3365 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3366 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3367 v20 = (char *)&pParty->pPlayers[v3->uPlayerID]; |
3368 memcpy(&a1.stru_24, &v20[36 * *((int *)v20 + 1620) + 496], sizeof(a1.stru_24)); | |
3369 a1.uAttributes = 256; | |
3370 if ( pParty->bTurnBasedModeOn == 1 ) | |
3371 a1.uAttributes = 260; | |
3372 for ( i = 0; i < (signed int)this; ++i ) | |
3373 { | |
3374 if ( i ) | |
3375 a1.vPosition.z += 32; | |
3376 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3377 if ( a1.Create( | |
3378 v715.uYawAngle, | |
3379 v715.uPitchAngle, | |
3380 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3381 v3->uPlayerID + 1) != -1 | |
3382 && pParty->bTurnBasedModeOn == 1 ) | |
3383 ++pTurnEngine->field_1C; | |
3384 } | |
488 | 3385 goto play_sound_and_continue; |
3386 | |
490 | 3387 case SPELL_LASER_PROJECTILE: |
0 | 3388 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
3389 a1.stru_24.Reset(); | |
822 | 3390 a1.spell_id = v3->spellnum; |
3391 a1.spell_level = v723; | |
3392 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3393 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3394 a1.vPosition.x = pParty->vPosition.x; |
3395 a1.vPosition.y = pParty->vPosition.y; | |
3396 a1.uAttributes = 0; | |
3397 a1.uSpriteFrameID = 0; | |
3398 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
823 | 3399 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3400 a1.spell_target_pid = a2; | |
0 | 3401 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3402 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3403 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3404 memcpy( |
3405 &a1.stru_24, | |
3406 &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3407 * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand | |
3408 + 5], | |
3409 sizeof(a1.stru_24)); | |
3410 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); | |
3411 HIBYTE(a1.uAttributes) |= 1u; | |
3412 a1.uSectorID = v23; | |
3413 if ( pParty->bTurnBasedModeOn == 1 ) | |
3414 LOBYTE(a1.uAttributes) |= 4u; | |
3415 if ( a1.Create( | |
3416 v715.uYawAngle, | |
3417 v715.uPitchAngle, | |
3418 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3419 v3->uPlayerID + 1) != -1 | |
3420 && pParty->bTurnBasedModeOn == 1 ) | |
3421 ++pTurnEngine->field_1C; | |
488 | 3422 goto play_sound_and_continue; |
3423 | |
3424 case SPELL_FIRE_TORCH_LIGHT: | |
0 | 3425 LODWORD(v733) = 3600 * v2; |
488 | 3426 |
822 | 3427 switch (v731) |
488 | 3428 { |
3429 case 1: amount = 2; break; | |
3430 case 2: amount = 3; break; | |
3431 case 3: | |
3432 case 4: amount = 4; break; | |
3433 default: | |
3434 assert(false); | |
3435 } | |
3436 | |
0 | 3437 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3438 goto play_sound_and_continue; |
3439 | |
3440 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
|
3441 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3442 goto play_sound_and_continue; |
488 | 3443 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3444 case SPELL_FIRE_FIRE_SPIKE: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3445 { |
822 | 3446 v29 = v731 - 2; |
0 | 3447 if ( v29 ) |
3448 { | |
3449 v30 = v29 - 1; | |
3450 if ( v30 ) | |
3451 { | |
3452 if ( v30 == 1 ) | |
3453 amount = 9; | |
3454 else | |
3455 amount = 3; | |
3456 } | |
3457 else | |
3458 { | |
3459 amount = 7; | |
3460 } | |
3461 } | |
3462 else | |
3463 { | |
3464 amount = 5; | |
3465 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3466 //v31 = v3->uPlayerID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3467 //v32 = 8 * v31; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3468 //LOBYTE(v32) = v32 | OBJECT_Player; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3469 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3470 //if ( (signed int)uNumSpriteObjects > 0 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3471 int _v733 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3472 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
|
3473 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3474 auto object = pSpriteObjects + i; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3475 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
|
3476 ++_v733; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3477 /*v33 = (char *)&pSpriteObjects[0].field_48; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3478 v730 = uNumSpriteObjects; |
0 | 3479 do |
3480 { | |
486 | 3481 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) |
0 | 3482 ++HIDWORD(v733); |
3483 v33 += 112; | |
3484 --v730; | |
3485 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3486 while ( v730 );*/ |
0 | 3487 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3488 if (_v733 > amount) |
710 | 3489 { |
3490 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3491 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
|
3492 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3493 goto LABEL_1166; |
710 | 3494 } |
0 | 3495 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3496 goto play_sound_and_continue; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3497 |
0 | 3498 a1.stru_24.Reset(); |
822 | 3499 a1.spell_id = v3->spellnum; |
3500 a1.spell_level = v2; | |
3501 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3502 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3503 a1.vPosition.y = pParty->vPosition.y; |
3504 a1.vPosition.x = pParty->vPosition.x; | |
486 | 3505 a1.uAttributes = 0; |
0 | 3506 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3507 a1.uSectorID = pIndoor->GetSector( | |
3508 pParty->vPosition.x, | |
3509 pParty->vPosition.y, | |
3510 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 3511 a1.uSpriteFrameID = 0; |
823 | 3512 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3513 a1.spell_target_pid = a2; | |
0 | 3514 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3515 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3516 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3517 if ( pParty->bTurnBasedModeOn == 1 ) |
3518 LOBYTE(a1.uAttributes) |= 4u; | |
3519 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3520 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
|
3521 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3522 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3523 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3524 } |
710 | 3525 |
0 | 3526 case 20: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3527 { |
0 | 3528 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3529 goto play_sound_and_continue; |
486 | 3530 if (!a2) |
710 | 3531 { |
3532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3533 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
|
3534 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3535 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3536 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3537 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3538 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3539 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3540 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3541 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3542 v697.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3543 v697.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3544 v697.z = 0; |
0 | 3545 a1.stru_24.Reset(); |
822 | 3546 a1.spell_id = v3->spellnum; |
3547 a1.spell_level = v2; | |
3548 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3549 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 3550 a1.uAttributes = 0; |
3551 a1.uSectorID = 0; | |
3552 a1.uSpriteFrameID = 0; | |
0 | 3553 a1.field_60_distance_related_prolly_lod = 0; |
486 | 3554 a1.uFacing = 0; |
823 | 3555 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3556 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3557 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3558 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3559 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
848 | 3560 a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3561 auto obj_id = a1.Create(0, 0, 0, 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3562 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
|
3563 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3564 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3565 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3566 |
0 | 3567 case 44: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3568 { |
0 | 3569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3570 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3571 |
848 | 3572 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3573 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3574 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3575 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3576 } |
848 | 3577 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3578 v704.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3579 v704.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3580 v704.z = 0; |
0 | 3581 a1.stru_24.Reset(); |
822 | 3582 a1.spell_id = v3->spellnum; |
3583 a1.spell_level = v2; | |
3584 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3585 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 3586 a1.uAttributes = 0; |
3587 a1.uSectorID = 0; | |
3588 a1.uSpriteFrameID = 0; | |
0 | 3589 a1.field_60_distance_related_prolly_lod = 0; |
486 | 3590 a1.uFacing = 0; |
823 | 3591 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3592 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3593 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3594 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3595 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
823 | 3596 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
|
3597 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3598 auto obj_id = a1.Create(0, 0, 0, 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3599 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
|
3600 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3601 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3602 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3603 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3604 |
0 | 3605 case 79: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3606 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3607 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
|
3608 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3609 //v730 = a2 >> 3; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3610 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3611 v691.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3612 v691.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3613 v691.z = 0; |
0 | 3614 a1.stru_24.Reset(); |
822 | 3615 a1.spell_id = v3->spellnum; |
3616 a1.spell_level = v2; | |
3617 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3618 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3619 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3620 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3621 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
486 | 3622 a1.uAttributes = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3623 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); |
486 | 3624 a1.uSpriteFrameID = 0; |
823 | 3625 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3626 a1.spell_target_pid = a2; | |
0 | 3627 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3628 a1.uFacing = LOWORD(v715.uYawAngle); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3629 a1.uAttributes |= 0x80u; |
823 | 3630 a1.uSoundID = LOWORD(v3->sound_id); |
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 auto obj_id = a1.Create(0, 0, 0, 0); |
0 | 3633 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
710 | 3634 { |
3635 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3636 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
|
3637 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3638 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3639 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3640 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
|
3641 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3642 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3643 } |
822 | 3644 |
3645 | |
573 | 3646 case SPELL_FIRE_FIRE_BOLT: |
822 | 3647 case SPELL_FIRE_FIREBALL: |
3648 case SPELL_FIRE_INCINERATE: | |
3649 case SPELL_AIR_LIGHNING_BOLT: | |
3650 case SPELL_WATER_ICE_BOLT: | |
3651 case SPELL_WATER_ICE_BLAST: | |
3652 case SPELL_EARTH_STUN: | |
3653 case SPELL_EARTH_DEADLY_SWARM: | |
3654 case SPELL_MIND_MIND_BLAST: | |
3655 case SPELL_MIND_PSYCHIC_SHOCK: | |
3656 case SPELL_BODY_HARM: | |
3657 case SPELL_LIGHT_LIGHT_BOLT: | |
3658 case SPELL_DARK_DRAGON_BREATH: | |
0 | 3659 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3660 goto play_sound_and_continue; |
0 | 3661 a1.stru_24.Reset(); |
822 | 3662 a1.spell_id = v3->spellnum; |
3663 a1.spell_level = v2; | |
3664 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3665 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3666 a1.vPosition.y = pParty->vPosition.y; |
3667 a1.vPosition.x = pParty->vPosition.x; | |
486 | 3668 a1.uAttributes = 0; |
0 | 3669 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
822 | 3670 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3671 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, | |
3672 pParty->vPosition.y, | |
3673 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3674 else a1.uSectorID = 0; | |
3675 | |
486 | 3676 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3677 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 3678 a1.spell_target_pid = a2; |
0 | 3679 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3680 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3681 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 3682 if ( pParty->bTurnBasedModeOn == 1 ) |
3683 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3684 if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) |
0 | 3685 LOBYTE(a1.uAttributes) |= 0x40u; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3686 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3687 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3688 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
|
3689 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3690 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3691 goto play_sound_and_continue; |
822 | 3692 |
3693 | |
3694 | |
0 | 3695 case 29: |
3696 case 39: | |
3697 case 76: | |
3698 case 90: | |
3699 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3700 goto play_sound_and_continue; |
0 | 3701 a1.stru_24.Reset(); |
822 | 3702 a1.spell_id = v3->spellnum; |
3703 a1.spell_level = v2; | |
3704 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3705 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3706 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3707 a1.vPosition.y = pParty->vPosition.y; | |
3708 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3709 v660 = pParty->vPosition.y; | |
3710 goto LABEL_153; | |
3711 case 87: | |
3712 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | |
3713 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | |
710 | 3714 { |
3715 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3716 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
|
3717 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3718 goto LABEL_1166; |
710 | 3719 } |
0 | 3720 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3721 goto LABEL_152; | |
488 | 3722 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3723 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3724 |
0 | 3725 case 81: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3726 { |
0 | 3727 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3728 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3729 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3730 if (PID_TYPE(a2) != OBJECT_Actor || |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3731 (v730 = PID_ID(a2), |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3732 v721 = (int)&pActors[PID_ID(a2)], |
848 | 3733 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3734 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3735 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3736 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3737 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3738 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); |
0 | 3739 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3740 v55 = v721; | |
486 | 3741 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); |
0 | 3742 *(char *)(v55 + 38) |= 8u; |
486 | 3743 *(short *)(v55 + 148) = 0; |
3744 v672 = 0; | |
3745 *(short *)(v55 + 150) = 0; | |
0 | 3746 v661 = (Actor *)v55; |
3747 goto LABEL_165; | |
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 35: |
822 | 3751 if ( v731 == 2 ) |
0 | 3752 { |
3753 v57 = 300 * v2; | |
3754 } | |
3755 else | |
3756 { | |
822 | 3757 if ( v731 == 3 ) |
0 | 3758 { |
3759 amount = 4; | |
3760 v57 = 300 * v2; | |
3761 goto LABEL_174; | |
3762 } | |
822 | 3763 if ( v731 == 4 ) |
0 | 3764 { |
3765 v57 = 300 * v2; | |
3766 amount = 8; | |
3767 goto LABEL_174; | |
3768 } | |
3769 v57 = 180 * v2; | |
3770 } | |
3771 amount = 2; | |
3772 LABEL_174: | |
3773 LODWORD(v733) = v57; | |
3774 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3775 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3776 if (PID_TYPE(a2) != OBJECT_Actor |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3777 || (v721 = 836 * PID_ID(a2), |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3778 LODWORD(v718) = (int)&pActors[PID_ID(a2)], |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3779 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3780 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3781 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3782 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3783 } |
0 | 3784 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3785 v59 = v721; | |
112 | 3786 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
848 | 3787 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, |
0 | 3788 v731, |
3789 amount, | |
486 | 3790 0, |
3791 0); | |
0 | 3792 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
486 | 3793 v672 = 0; |
0 | 3794 v661 = (Actor *)LODWORD(v718); |
3795 goto LABEL_165; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3796 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3797 |
0 | 3798 case 60: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3799 { |
0 | 3800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 3801 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3802 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3803 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3804 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3805 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3806 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3807 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3808 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3809 uint power = 300 * v2; |
0 | 3810 if ( v731 == 2 ) |
3811 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3812 power = 600 * v2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3813 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3814 else if ( v731 == 3 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3815 power = 29030400; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3816 |
112 | 3817 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3818 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
112 | 3819 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3820 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); |
112 | 3821 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3822 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), |
486 | 3823 v731, 0, 0, 0); |
0 | 3824 a1.stru_24.Reset(); |
822 | 3825 a1.spell_id = v3->spellnum; |
3826 a1.spell_level = v2; | |
3827 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3828 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
848 | 3829 v61 = PID_ID(a2); |
0 | 3830 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3831 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3832 |
0 | 3833 case 92: |
3834 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3835 goto play_sound_and_continue; |
0 | 3836 a1.stru_24.Reset(); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
3837 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 3838 a1.vPosition.x = pParty->vPosition.x; |
3839 a1.vPosition.y = pParty->vPosition.y; | |
486 | 3840 a1.uAttributes = 0; |
0 | 3841 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3842 a1.uSectorID = pIndoor->GetSector( | |
3843 pParty->vPosition.x, | |
3844 pParty->vPosition.y, | |
3845 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 3846 a1.uSpriteFrameID = 0; |
823 | 3847 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
3848 a1.spell_target_pid = a2; | |
0 | 3849 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3850 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 3851 a1.uSoundID = LOWORD(v3->sound_id); |
822 | 3852 a1.spell_skill = v731; |
3853 a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3854 a1.spell_level = 300 * v2; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3855 if ( pParty->bTurnBasedModeOn == 1 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3856 LOBYTE(a1.uAttributes) |= 4u; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3857 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3858 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3859 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3860 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
|
3861 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3862 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3863 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3864 |
0 | 3865 case 4: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3866 { |
822 | 3867 v63 = v731 - 1; |
0 | 3868 if ( !v63 ) |
3869 { | |
3870 amount = 10; | |
3871 goto LABEL_195; | |
3872 } | |
3873 v64 = v63 - 1; | |
3874 if ( !v64 ) | |
3875 { | |
3876 amount = 11; | |
3877 goto LABEL_195; | |
3878 } | |
3879 v65 = v64 - 1; | |
3880 if ( !v65 ) | |
3881 { | |
3882 amount = 12; | |
3883 LABEL_195: | |
3884 LODWORD(v733) = 3600 * v2; | |
3885 goto LABEL_196; | |
3886 } | |
3887 if ( v65 == 1 ) | |
3888 { | |
486 | 3889 LODWORD(v733) = 0; |
0 | 3890 amount = 12; |
3891 } | |
3892 LABEL_196: | |
3893 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 3894 goto play_sound_and_continue; |
89 | 3895 v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3896 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
89 | 3897 v730c->UpdateTempBonus(pParty->uTimePlayed); |
3898 if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) | |
3899 { | |
315 | 3900 if (!v730c->Broken()) |
0 | 3901 { |
486 | 3902 if (!v730c->uSpecEnchantmentType) |
0 | 3903 { |
570 | 3904 if (!v730c->uEnchantmentType) |
0 | 3905 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3906 v68 = _itm->uEquipType; |
0 | 3907 if ( !v68 || v68 == 1 || v68 == 2 ) |
3908 { | |
377 | 3909 if ( !pItemsTable->IsMaterialNonCommon(v730c) ) |
0 | 3910 { |
89 | 3911 v69 = v730c; |
0 | 3912 v14 = v731 == 4; |
3913 *(int *)(v730 + 12) = amount; | |
3914 if ( !v14 ) | |
3915 { | |
3916 *(_QWORD *)(v69 + 28) = pParty->uTimePlayed | |
3917 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3918 * 0.033333335); | |
3919 *(int *)(v69 + 20) |= 8u; | |
3920 } | |
3921 *(int *)(v69 + 20) |= 0x10u; | |
3922 dword_50C9A8 = 256; | |
3923 LODWORD(v727) = 1; | |
488 | 3924 play_sound_and_continue: |
0 | 3925 if ( v3->field_8 & 0x20 ) |
3926 { | |
3927 if ( v727 != 0.0 ) | |
3928 pAudioPlayer->PlaySound( | |
3929 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3930 0, | |
3931 0, | |
3932 -1, | |
3933 0, | |
823 | 3934 v3->sound_id, |
0 | 3935 0, |
3936 0); | |
3937 } | |
3938 else | |
3939 { | |
3940 if ( sRecoveryTime < 0 ) | |
3941 sRecoveryTime = 0; | |
3942 if ( pParty->bTurnBasedModeOn ) | |
3943 { | |
3944 v645 = sRecoveryTime; | |
3945 pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; | |
3946 pPlayer->SetRecoveryTime(v645); | |
3947 if ( !some_active_character ) | |
3948 pTurnEngine->_40471C(); | |
3949 } | |
3950 else | |
3951 { | |
3952 pPlayer->SetRecoveryTime( | |
3953 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3954 } | |
3955 if ( v727 != 0.0 ) | |
3956 { | |
187 | 3957 pPlayer->PlaySound(SPEECH_49, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3958 if ( v727 != 0.0 ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3959 pAudioPlayer->PlaySound( |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3960 (SoundID)word_4EE088_sound_ids[v3->spellnum], |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3961 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3962 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3963 -1, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3964 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3965 v3->sound_id, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3966 0, |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3967 0); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3968 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3969 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3970 v2 = v723; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3971 goto LABEL_1166; |
0 | 3972 } |
3973 } | |
3974 v3->spellnum = 0; | |
3975 v2 = v723; | |
3976 goto LABEL_1166; | |
3977 } | |
3978 } | |
3979 } | |
3980 } | |
3981 } | |
3982 } | |
710 | 3983 |
0 | 3984 dword_50C9D0 = 113; |
486 | 3985 dword_50C9D4 = 0; |
0 | 3986 dword_50C9D8 = 1; |
710 | 3987 |
3988 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
486 | 3989 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
|
3990 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3991 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3992 } |
488 | 3993 |
3994 case SPELL_BODY_REGENERATION: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3995 { |
822 | 3996 v70 = v731 - 1; |
0 | 3997 LODWORD(v733) = 3600 * v2; |
3998 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3999 { | |
4000 v72 = v71 - 1; | |
4001 if ( v72 ) | |
4002 { | |
4003 if ( v72 == 1 ) | |
4004 amount = 10; | |
4005 } | |
4006 else | |
4007 { | |
4008 amount = 3; | |
4009 } | |
4010 } | |
4011 else | |
4012 { | |
4013 amount = 1; | |
4014 } | |
4015 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4016 goto play_sound_and_continue; |
4017 | |
4018 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
4019 | |
4020 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
|
4021 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4022 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4023 } |
488 | 4024 |
4025 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4026 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4027 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4028 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4029 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4030 case SPELL_BODY_PROTECTION_FROM_BODY: | |
822 | 4031 v76 = v731 - 1; |
0 | 4032 LODWORD(v733) = 3600 * v2; |
4033 if ( v76 ) | |
4034 { | |
4035 v77 = v76 - 1; | |
4036 if ( v77 ) | |
4037 { | |
4038 v78 = v77 - 1; | |
4039 if ( v78 ) | |
4040 { | |
4041 if ( v78 != 1 ) | |
4042 goto LABEL_232; | |
4043 v79 = 4 * v2; | |
4044 } | |
4045 else | |
4046 { | |
4047 v79 = 3 * v2; | |
4048 } | |
4049 } | |
4050 else | |
4051 { | |
4052 v79 = 2 * v2; | |
4053 } | |
4054 amount = v79; | |
4055 } | |
4056 else | |
4057 { | |
4058 amount = v2; | |
4059 } | |
4060 LABEL_232: | |
488 | 4061 //v80 = v3->spellnum; |
4062 switch (v3->spellnum) | |
4063 { | |
4064 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4065 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
0 | 4066 break; |
488 | 4067 case SPELL_AIR_PROTECTION_FROM_AIR: |
4068 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
0 | 4069 break; |
488 | 4070 case SPELL_WATER_PROTECTION_FROM_WATER: |
4071 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
4072 break; | |
4073 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4074 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
0 | 4075 break; |
488 | 4076 case SPELL_MIND_PROTECTION_FROM_MIND: |
4077 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
0 | 4078 break; |
488 | 4079 case SPELL_BODY_PROTECTION_FROM_BODY: |
4080 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
0 | 4081 break; |
4082 default: | |
488 | 4083 assert(false); |
4084 goto LABEL_1166; | |
0 | 4085 } |
4086 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4087 goto play_sound_and_continue; |
4088 | |
4089 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4090 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4091 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4092 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4093 | |
0 | 4094 v90 = (double)(signed int)v733 * 4.2666669; |
488 | 4095 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
|
4096 LODWORD(v727) = 1; |
488 | 4097 goto play_sound_and_continue; |
4098 | |
4099 case SPELL_FIRE_HASTE: | |
822 | 4100 if ( v731 <= 0 ) |
0 | 4101 goto LABEL_254; |
822 | 4102 if ( v731 <= 2 ) |
0 | 4103 { |
4104 v91 = 60 * (v2 + 60); | |
4105 } | |
4106 else | |
4107 { | |
822 | 4108 if ( v731 == 3 ) |
0 | 4109 { |
4110 v91 = 180 * (v2 + 20); | |
4111 } | |
4112 else | |
4113 { | |
822 | 4114 if ( v731 != 4 ) |
0 | 4115 goto LABEL_254; |
4116 v91 = 240 * (v2 + 15); | |
4117 } | |
4118 } | |
4119 LODWORD(v733) = v91; | |
4120 LABEL_254: | |
4121 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4122 { | |
89 | 4123 v92 = pParty->pPlayers;//[0].pConditions[1]; |
0 | 4124 LODWORD(v727) = 1; |
4125 do | |
4126 { | |
89 | 4127 if ( v92->pConditions ) |
486 | 4128 LODWORD(v727) = 0; |
89 | 4129 ++v92; |
0 | 4130 } |
89 | 4131 while ( v92 <= &pParty->pPlayers[3] ); |
486 | 4132 if (LODWORD(v727)) |
0 | 4133 { |
488 | 4134 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4135 | |
4136 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4137 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4138 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4139 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 4140 } |
4141 } | |
488 | 4142 goto play_sound_and_continue; |
4143 | |
4144 case SPELL_SPIRIT_BLESS: | |
822 | 4145 v101 = v731 - 1; |
0 | 4146 if ( v101 && (v102 = v101 - 1) != 0 ) |
4147 { | |
4148 v103 = v102 - 1; | |
4149 if ( v103 ) | |
4150 { | |
4151 if ( v103 != 1 ) | |
4152 goto LABEL_269; | |
4153 v104 = 3600 * (v2 + 1); | |
4154 } | |
4155 else | |
4156 { | |
4157 v104 = 900 * (v2 + 4); | |
4158 } | |
4159 } | |
4160 else | |
4161 { | |
4162 v104 = 300 * (v2 + 12); | |
4163 } | |
4164 LODWORD(v733) = v104; | |
4165 LABEL_269: | |
4166 amount = v2 + 5; | |
4167 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4168 goto play_sound_and_continue; |
0 | 4169 if ( v731 == 1 ) |
4170 { | |
4171 v108 = v3->uPlayerID_2; | |
4172 v109 = v3->spellnum; | |
4173 v110 = pGame->GetStru6(); | |
4174 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
486 | 4175 v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); |
488 | 4176 //v668 = 0; |
0 | 4177 v716 = v111; |
488 | 4178 //v658 = v111; |
4179 //v653 = amount; | |
4180 //v651 = 1; | |
4181 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4182 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
4183 //LABEL_103: | |
4184 //HIDWORD(v650) = HIDWORD(v28); | |
4185 //LABEL_104: | |
4186 //LODWORD(v650) = v28; | |
4187 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
|
4188 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4189 goto play_sound_and_continue; |
0 | 4190 } |
4191 v105 = 0; | |
4192 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
89 | 4193 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; |
0 | 4194 do |
4195 { | |
488 | 4196 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); |
486 | 4197 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4198 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
89 | 4199 ++v730b; |
0 | 4200 ++v105; |
4201 } | |
89 | 4202 while ( v730b <= &pParty->pPlayers[3] ); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4203 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4204 goto play_sound_and_continue; |
488 | 4205 |
0 | 4206 case 52: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4207 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
|
4208 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4209 //v730 = a2 >> 3; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4210 v112 = &pActors[PID_ID(a2)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4211 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); |
0 | 4212 v721 = abs(v112->vPosition.y - pParty->vPosition.y); |
4213 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4214 _this = (ItemGen *)v113; | |
4215 v114 = v721; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4216 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); |
0 | 4217 if ( v113 < v721 ) |
4218 { | |
4219 v116 = v113; | |
4220 v113 = v721; | |
4221 v114 = v116; | |
4222 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4223 if ( v113 < (signed int)v115 ) |
0 | 4224 { |
4225 v117 = v113; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4226 v113 = (int)v115; |
0 | 4227 v115 = v117; |
4228 } | |
4229 if ( v114 < (signed int)v115 ) | |
4230 { | |
4231 v118 = v115; | |
4232 v115 = v114; | |
4233 v114 = v118; | |
4234 } | |
4235 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4236 if ( (double)(signed int)this <= 307.2 ) | |
4237 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4238 v701.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4239 v701.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4240 v701.z = 0; |
0 | 4241 a1.stru_24.Reset(); |
4242 v119 = HIDWORD(v733); | |
822 | 4243 a1.spell_id = *(int *)HIDWORD(v733); |
4244 a1.spell_level = v723; | |
4245 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4246 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4247 a1.uAttributes = 0; |
4248 a1.uSectorID = 0; | |
4249 a1.uSpriteFrameID = 0; | |
4250 a1.field_60_distance_related_prolly_lod = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4251 a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); |
0 | 4252 a1.uFacing = 0; |
4253 a1.uSoundID = *(short *)(v119 + 16); | |
4254 a1.vPosition.x = v112->vPosition.x; | |
4255 a1.vPosition.y = v112->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4256 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
|
4257 a1.spell_target_pid = PID(OBJECT_Actor, a2); |
0 | 4258 v122 = a1.Create(0, 0, 0, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4259 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
0 | 4260 LODWORD(v727) = 1; |
4261 } | |
4262 else | |
4263 { | |
4264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4265 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4266 *(int *)HIDWORD(v733) = 0; | |
4267 } | |
4268 v3 = (stru277 *)HIDWORD(v733); | |
4269 } | |
488 | 4270 goto play_sound_and_continue; |
4271 | |
4272 case SPELL_AIR_SHIELD: | |
4273 case SPELL_EARTH_STONESKIN: | |
4274 case SPELL_SPIRIT_HEROISM: | |
822 | 4275 v123 = v731 - 1; |
0 | 4276 if ( v123 && (v124 = v123 - 1) != 0 ) |
4277 { | |
4278 v125 = v124 - 1; | |
4279 if ( v125 ) | |
4280 { | |
4281 if ( v125 != 1 ) | |
4282 goto LABEL_296; | |
4283 v126 = 3600 * (v2 + 1); | |
4284 } | |
4285 else | |
4286 { | |
4287 v126 = 900 * (v2 + 4); | |
4288 } | |
4289 } | |
4290 else | |
4291 { | |
4292 v126 = 300 * (v2 + 12); | |
4293 } | |
4294 LODWORD(v733) = v126; | |
4295 LABEL_296: | |
4296 v127 = v3->spellnum; | |
4297 if ( v127 == 17 ) | |
4298 { | |
486 | 4299 amount = 0; |
0 | 4300 LODWORD(v725) = 14; |
4301 } | |
4302 else | |
4303 { | |
4304 if ( v127 == 38 ) | |
4305 { | |
4306 LODWORD(v725) = 15; | |
4307 amount = v2 + 5; | |
4308 } | |
4309 else | |
4310 { | |
4311 if ( v127 != 51 ) | |
4312 goto LABEL_1166; | |
4313 LODWORD(v725) = 9; | |
4314 amount = v2 + 5; | |
4315 } | |
4316 } | |
4317 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4318 goto play_sound_and_continue; |
4319 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4320 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4321 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4322 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 4323 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
488 | 4324 //LABEL_304: |
4325 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
|
4326 LODWORD(v727) = 1; |
488 | 4327 goto play_sound_and_continue; |
4328 | |
4329 case SPELL_FIRE_IMMOLATION: | |
822 | 4330 v138 = v731 - 2; |
0 | 4331 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) |
4332 v140 = 600 * v2; | |
4333 else | |
4334 v140 = 60 * v2; | |
4335 LODWORD(v733) = v140; | |
4336 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4337 goto play_sound_and_continue; |
4338 | |
4339 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4340 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4341 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4342 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4343 | |
4344 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
|
4345 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4346 goto play_sound_and_continue; |
488 | 4347 |
0 | 4348 case 9: |
822 | 4349 v149 = v731 - 1; |
0 | 4350 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) |
4351 { | |
4352 if ( v151 == 1 ) | |
4353 _this = (ItemGen *)20; | |
4354 } | |
4355 else | |
4356 { | |
4357 _this = (ItemGen *)16; | |
4358 } | |
4359 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4360 { | |
710 | 4361 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4362 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
|
4363 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4364 goto LABEL_1166; |
0 | 4365 } |
4366 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4367 goto play_sound_and_continue; |
848 | 4368 LODWORD(v725) = PID_TYPE(a2); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4369 if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4370 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4371 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4372 v153 = pActors[PID_ID(a2)].vPosition.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4373 v154 = pActors[PID_ID(a2)].vPosition.z; |
0 | 4374 LODWORD(v727) = v153; |
4375 } | |
4376 else | |
4377 { | |
323 | 4378 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
0 | 4379 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); |
323 | 4380 v156 = stru_5C6E00->Sin(pParty->sRotationY); |
0 | 4381 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); |
4382 v154 = pParty->vPosition.z; | |
4383 } | |
4384 HIDWORD(v733) = v154; | |
4385 v713 = v154 + 2500; | |
486 | 4386 v721 = 0; |
4387 LODWORD(v718) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4388 if ( (signed int)_this > 0 ) |
0 | 4389 { |
4390 *(float *)&y = (double)SHIDWORD(v733); | |
4391 *(float *)&v732 = (double)v713; | |
4392 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4393 auto _this_cpy = (int)_this; |
0 | 4394 do |
4395 { | |
4396 v157 = rand(); | |
4397 v158 = (double)SLODWORD(v718); | |
4398 v718 = v158; | |
4399 v159 = (double)v721; | |
4400 *(float *)&v721 = v159; | |
4401 a2 = v157 % 1000; | |
4402 *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; | |
4403 v725 = v159 * v159; | |
4404 *(float *)&_this = v158 * v158; | |
4405 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4406 { | |
486 | 4407 LODWORD(v687) = 0; |
4408 HIDWORD(v687) = 0; | |
0 | 4409 } |
4410 else | |
4411 { | |
4412 x = (signed __int64)sqrt(*(float *)&_this + v725); | |
4413 v687 = __PAIR__( | |
4414 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4415 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
4416 } | |
4417 a1.stru_24.Reset(); | |
822 | 4418 a1.spell_id = v3->spellnum; |
4419 a1.spell_level = v2; | |
4420 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4421 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4422 a1.uAttributes = 0; |
0 | 4423 a1.vPosition.x = uRequiredMana; |
4424 a1.vPosition.y = LODWORD(v727); | |
486 | 4425 a1.uSectorID = 0; |
0 | 4426 a1.vPosition.z = a2 + v713; |
486 | 4427 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4428 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 4429 a1.spell_target_pid = v730; |
0 | 4430 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); |
4431 a1.uFacing = v687; | |
823 | 4432 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4433 if ( pParty->bTurnBasedModeOn == 1 ) |
4434 a1.uAttributes = 4; | |
4435 if ( a1.Create( | |
4436 v687, | |
4437 SHIDWORD(v687), | |
4438 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
486 | 4439 0) != -1 |
0 | 4440 && pParty->bTurnBasedModeOn == 1 ) |
4441 ++pTurnEngine->field_1C; | |
4442 LODWORD(v718) = rand() % 1024 - 512; | |
4443 v160 = rand(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4444 v14 = _this_cpy-- == 1; |
0 | 4445 v721 = (unsigned __int64)(v160 % 1024) - 512; |
4446 } | |
4447 while ( !v14 ); | |
4448 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4449 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4450 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4451 |
0 | 4452 case 10: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4453 { |
710 | 4454 //v67 = 2; |
0 | 4455 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
4456 { | |
710 | 4457 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! |
4458 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
|
4459 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4460 goto LABEL_1166; |
0 | 4461 } |
4462 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4463 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4464 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
486 | 4465 v700.z = 0; |
4466 v700.y = 0; | |
4467 v700.x = 0; | |
0 | 4468 a1.stru_24.Reset(); |
822 | 4469 a1.spell_id = v3->spellnum; |
4470 a1.spell_level = v2; | |
4471 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4472 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4473 a1.uAttributes = 0; |
4474 a1.uSectorID = 0; | |
4475 a1.uSpriteFrameID = 0; | |
0 | 4476 a1.field_60_distance_related_prolly_lod = 0; |
486 | 4477 a1.uFacing = 0; |
823 | 4478 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4479 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 4480 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4481 if ( (signed int)_v726 > 0 ) |
0 | 4482 { |
4483 do | |
4484 { | |
4485 v162 = dword_50BF30[a2]; | |
4486 a1.vPosition.x = pActors[v162].vPosition.x; | |
4487 a1.vPosition.y = pActors[v162].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4488 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
|
4489 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 4490 v164 = a1.Create(0, 0, 0, 0); |
0 | 4491 v165 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4492 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); |
488 | 4493 pGame->GetStru6()->_4A81CA(&a1); |
4494 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
0 | 4495 a2 = v165 + 1; |
4496 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4497 while ( v165 + 1 < (signed int)_v726 ); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4498 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4499 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4500 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4501 } |
488 | 4502 |
4503 case SPELL_AIR_WIZARD_EYE: | |
0 | 4504 LODWORD(v733) = 3600 * v2; |
4505 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4506 goto play_sound_and_continue; |
0 | 4507 v168 = 0; |
4508 do | |
4509 { | |
486 | 4510 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
0 | 4511 v716 = v169; |
4512 } | |
4513 while ( v168 < 4 ); | |
488 | 4514 |
4515 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
|
4516 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4517 goto play_sound_and_continue; |
488 | 4518 |
4519 case SPELL_AIR_FEATHER_FALL: | |
822 | 4520 v170 = v731 - 1; |
0 | 4521 if ( !v170 ) |
4522 { | |
4523 v173 = 300 * v2; | |
4524 goto LABEL_353; | |
4525 } | |
4526 v171 = v170 - 1; | |
4527 if ( !v171 ) | |
4528 { | |
4529 v173 = 600 * v2; | |
4530 goto LABEL_353; | |
4531 } | |
4532 v172 = v171 - 1; | |
4533 if ( !v172 || v172 == 1 ) | |
4534 { | |
4535 v173 = 3600 * v2; | |
4536 LABEL_353: | |
4537 LODWORD(v733) = v173; | |
4538 } | |
4539 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4540 goto play_sound_and_continue; |
0 | 4541 v174 = 0; |
4542 do | |
486 | 4543 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
0 | 4544 while ( v174 < 4 ); |
488 | 4545 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4546 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4547 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4548 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4549 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4550 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
|
4551 LODWORD(v727) = 1; |
488 | 4552 goto play_sound_and_continue; |
4553 | |
4554 case SPELL_AIR_SPARKS: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4555 { |
822 | 4556 v184 = v731 - 1; |
0 | 4557 if ( v184 ) |
4558 { | |
4559 v185 = v184 - 1; | |
4560 if ( v185 ) | |
4561 { | |
4562 v186 = v185 - 1; | |
4563 if ( v186 ) | |
4564 { | |
4565 if ( v186 == 1 ) | |
4566 amount = 9; | |
4567 } | |
4568 else | |
4569 { | |
4570 amount = 7; | |
4571 } | |
4572 } | |
4573 else | |
4574 { | |
4575 amount = 5; | |
4576 } | |
4577 } | |
4578 else | |
4579 { | |
4580 amount = 3; | |
4581 } | |
4582 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4583 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4584 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
0 | 4585 a1.stru_24.Reset(); |
822 | 4586 a1.spell_id = v3->spellnum; |
4587 a1.spell_level = v2; | |
4588 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4589 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4590 a1.vPosition.y = pParty->vPosition.y; |
4591 a1.vPosition.x = pParty->vPosition.x; | |
486 | 4592 a1.uAttributes = 0; |
0 | 4593 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4594 a1.uSectorID = pIndoor->GetSector( | |
4595 pParty->vPosition.x, | |
4596 pParty->vPosition.y, | |
4597 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 4598 a1.uSpriteFrameID = 0; |
823 | 4599 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4600 a1.spell_target_pid = a2; | |
0 | 4601 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 4602 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4603 if ( pParty->bTurnBasedModeOn == 1 ) |
4604 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4605 v188 = (signed int)_v726 / -2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4606 v189 = (signed int)_v726 / 2; |
0 | 4607 while ( v188 <= v189 ) |
4608 { | |
4609 a1.uFacing = v188 + LOWORD(v715.uYawAngle); | |
4610 if ( a1.Create( | |
4611 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
4612 v715.uPitchAngle, | |
4613 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4614 v3->uPlayerID + 1) != -1 | |
4615 && pParty->bTurnBasedModeOn == 1 ) | |
4616 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4617 v188 += _v726 / (amount - 1); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4618 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4619 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4620 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4621 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4622 |
0 | 4623 case 16: |
569 | 4624 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
4625 { | |
710 | 4626 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! |
4627 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4628 goto play_sound_and_continue; | |
0 | 4629 } |
4630 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4631 goto play_sound_and_continue; |
0 | 4632 v191 = 0; |
4633 do | |
486 | 4634 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
0 | 4635 while ( v191 < 4 ); |
4636 BYTE1(pParty->uFlags) |= 1u; | |
4637 pParty->uFallSpeed = 1000; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4638 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4639 goto play_sound_and_continue; |
488 | 4640 |
4641 case SPELL_AIR_INVISIBILITY: | |
822 | 4642 v192 = v731 - 1; |
0 | 4643 if ( !v192 ) |
4644 { | |
4645 amount = v2; | |
4646 goto LABEL_391; | |
4647 } | |
4648 v193 = v192 - 1; | |
4649 if ( !v193 ) | |
4650 { | |
4651 v196 = 2 * v2; | |
4652 LABEL_389: | |
4653 amount = v196; | |
4654 LABEL_391: | |
4655 v195 = 600 * v2; | |
4656 goto LABEL_392; | |
4657 } | |
4658 v194 = v193 - 1; | |
4659 if ( !v194 ) | |
4660 { | |
4661 v196 = 3 * v2; | |
4662 goto LABEL_389; | |
4663 } | |
4664 if ( v194 != 1 ) | |
4665 goto LABEL_393; | |
4666 amount = 4 * v2; | |
4667 v195 = 3600 * v2; | |
4668 LABEL_392: | |
4669 LODWORD(v733) = v195; | |
4670 LABEL_393: | |
710 | 4671 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4672 { | |
4673 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | |
4674 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
|
4675 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4676 goto LABEL_1166; |
0 | 4677 } |
4678 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4679 { | |
488 | 4680 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4681 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4682 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4683 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4684 | |
4685 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
|
4686 LODWORD(v727) = 1; |
0 | 4687 } |
488 | 4688 goto play_sound_and_continue; |
710 | 4689 |
0 | 4690 case 21: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4691 { |
0 | 4692 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4693 { | |
710 | 4694 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! |
486 | 4695 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
488 | 4696 goto play_sound_and_continue; |
0 | 4697 } |
4698 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4699 { | |
710 | 4700 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4701 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4702 goto play_sound_and_continue; | |
0 | 4703 } |
4704 LODWORD(v733) = 3600 * v2; | |
486 | 4705 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) |
0 | 4706 amount = 1; |
4707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4708 goto play_sound_and_continue; |
0 | 4709 v205 = 0; |
4710 do | |
486 | 4711 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); |
0 | 4712 while ( v205 < 4 ); |
486 | 4713 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); |
0 | 4714 v207 = v3->uPlayerID + 1; |
4715 v716 = v206; | |
488 | 4716 |
4717 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
|
4718 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4719 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4720 } |
488 | 4721 |
0 | 4722 case 22: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4723 { |
710 | 4724 //v67 = 2; |
0 | 4725 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4726 { | |
710 | 4727 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! |
4728 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
|
4729 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4730 goto LABEL_1166; |
0 | 4731 } |
4732 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4733 goto play_sound_and_continue; |
848 | 4734 v208 = PID_TYPE(a2); |
4735 LODWORD(v725) = PID_TYPE(a2); | |
0 | 4736 if ( v208 == 3 ) |
4737 { | |
848 | 4738 v209 = PID_ID(a2); |
0 | 4739 LODWORD(v718) = pActors[v209].vPosition.x; |
4740 v210 = pActors[v209].vPosition.y; | |
4741 v211 = pActors[v209].vPosition.z; | |
4742 v713 = v210; | |
4743 } | |
4744 else | |
4745 { | |
323 | 4746 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
0 | 4747 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); |
323 | 4748 v213 = stru_5C6E00->Sin(pParty->sRotationY); |
0 | 4749 v214 = sub_42EBBE(2048, v213); |
4750 v211 = pParty->vPosition.z; | |
4751 v713 = pParty->vPosition.y + v214; | |
4752 v208 = LODWORD(v725); | |
4753 } | |
486 | 4754 HIDWORD(v733) = 0; |
0 | 4755 *(float *)&v732 = (double)v211; |
4756 LODWORD(v725) = v211 + 2500; | |
486 | 4757 v721 = 0; |
0 | 4758 *(float *)&y = (double)(v211 + 2500); |
4759 v730 = v208 == 3 ? a2 : 0; | |
4760 a2 = 20; | |
4761 do | |
4762 { | |
4763 v215 = rand(); | |
4764 v216 = (double)v721; | |
4765 v217 = (double)SHIDWORD(v733); | |
4766 *(float *)&uRequiredMana = v217; | |
4767 _this = (ItemGen *)(v215 % 1000); | |
4768 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4769 *(float *)&v721 = v217 * v217; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4770 //*(float *)&v726 = v216 * v216; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4771 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) |
0 | 4772 { |
486 | 4773 LODWORD(v685) = 0; |
4774 HIDWORD(v685) = 0; | |
0 | 4775 } |
4776 else | |
4777 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4778 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
0 | 4779 v685 = __PAIR__( |
4780 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
|
4781 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); |
0 | 4782 } |
4783 a1.stru_24.Reset(); | |
822 | 4784 a1.spell_id = v3->spellnum; |
4785 a1.spell_level = v2; | |
4786 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4787 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 4788 a1.uAttributes = 0; |
0 | 4789 a1.vPosition.x = LODWORD(v718); |
4790 a1.vPosition.y = v713; | |
486 | 4791 a1.uSectorID = 0; |
0 | 4792 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); |
486 | 4793 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4794 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 4795 a1.spell_target_pid = v730; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4796 __debugbreak(); |
0 | 4797 a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4798 a1.uFacing = v685; | |
823 | 4799 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4800 if ( pParty->bTurnBasedModeOn == 1 ) |
4801 a1.uAttributes = 4; | |
4802 if ( a1.Create( | |
4803 v685, | |
4804 SHIDWORD(v685), | |
4805 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
486 | 4806 0) != -1 |
0 | 4807 && pParty->bTurnBasedModeOn == 1 ) |
4808 ++pTurnEngine->field_1C; | |
4809 v721 = rand() % 1024 - 512; | |
4810 v218 = rand(); | |
4811 v14 = a2-- == 1; | |
4812 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4813 } | |
4814 while ( !v14 ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4815 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4816 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4817 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4818 |
0 | 4819 case 23: |
822 | 4820 v219 = v731 - 2; |
0 | 4821 if ( v219 ) |
4822 { | |
4823 v220 = v219 - 1; | |
4824 if ( v220 ) | |
4825 { | |
4826 if ( v220 == 1 ) | |
4827 { | |
486 | 4828 amount = 0; |
0 | 4829 goto LABEL_433; |
4830 } | |
4831 v221 = 180 * v2; | |
4832 } | |
4833 else | |
4834 { | |
4835 v221 = 86400 * v2; | |
4836 } | |
4837 } | |
4838 else | |
4839 { | |
4840 v221 = 3600 * v2; | |
4841 } | |
4842 amount = v221; | |
4843 LABEL_433: | |
4844 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4845 goto play_sound_and_continue; |
0 | 4846 v222 = (char *)pParty->pPlayers; |
4847 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4848 break; | |
4849 case 24: | |
822 | 4850 v224 = v731 - 2; |
0 | 4851 if ( v224 ) |
4852 { | |
4853 v225 = v224 - 1; | |
4854 if ( v225 ) | |
4855 { | |
4856 if ( v225 == 1 ) | |
4857 amount = 7; | |
4858 else | |
4859 amount = 1; | |
4860 } | |
4861 else | |
4862 { | |
4863 amount = 5; | |
4864 } | |
4865 } | |
4866 else | |
4867 { | |
4868 amount = 3; | |
4869 } | |
4870 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4871 goto play_sound_and_continue; |
0 | 4872 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
4873 if ( amount == 1 ) | |
4874 { | |
4875 LABEL_152: | |
4876 a1.stru_24.Reset(); | |
822 | 4877 a1.spell_id = v3->spellnum; |
4878 a1.spell_skill = v731; | |
4879 a1.spell_level = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4880 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4881 a1.vPosition.y = pParty->vPosition.y; |
4882 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4883 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4884 v660 = pParty->vPosition.y; | |
4885 LABEL_153: | |
486 | 4886 a1.uAttributes = 0; |
0 | 4887 a1.vPosition.x = pParty->vPosition.x; |
4888 a1.vPosition.z = v51; | |
4889 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
486 | 4890 a1.uSpriteFrameID = 0; |
0 | 4891 a1.uSectorID = v52; |
823 | 4892 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4893 a1.spell_target_pid = a2; | |
0 | 4894 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4895 a1.uFacing = LOWORD(v715.uYawAngle); | |
823 | 4896 a1.uSoundID = LOWORD(v3->sound_id); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4897 |
0 | 4898 if ( pParty->bTurnBasedModeOn == 1 ) |
4899 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4900 |
0 | 4901 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4902 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4903 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
0 | 4904 ++pTurnEngine->field_1C; |
4905 } | |
4906 else | |
4907 { | |
4908 a1.stru_24.Reset(); | |
822 | 4909 a1.spell_id = v3->spellnum; |
4910 a1.spell_level = v2; | |
4911 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
4912 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 4913 a1.vPosition.y = pParty->vPosition.y; |
4914 a1.vPosition.x = pParty->vPosition.x; | |
486 | 4915 a1.uAttributes = 0; |
0 | 4916 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4917 a1.uSectorID = pIndoor->GetSector( | |
4918 pParty->vPosition.x, | |
4919 pParty->vPosition.y, | |
4920 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 4921 a1.uSpriteFrameID = 0; |
823 | 4922 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
4923 a1.spell_target_pid = a2; | |
0 | 4924 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 4925 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 4926 if ( pParty->bTurnBasedModeOn == 1 ) |
4927 LOBYTE(a1.uAttributes) |= 4u; | |
4928 v227 = SHIDWORD(v733) / -2; | |
4929 y = (char *)(SHIDWORD(v733) / 2); | |
4930 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4931 { | |
4932 v228 = v715.uYawAngle; | |
4933 do | |
4934 { | |
4935 a1.uFacing = v227 + v228; | |
4936 if ( a1.Create( | |
4937 v227 + v228, | |
4938 v715.uPitchAngle, | |
4939 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4940 v3->uPlayerID + 1) != -1 | |
4941 && pParty->bTurnBasedModeOn == 1 ) | |
4942 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4943 v227 += SHIDWORD(v733) / (amount - 1); |
0 | 4944 } |
4945 while ( v227 <= (signed int)y ); | |
4946 } | |
4947 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4948 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4949 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4950 |
0 | 4951 case 27: |
4952 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
710 | 4953 { |
4954 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4955 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4956 goto play_sound_and_continue; | |
4957 } | |
0 | 4958 if ( v731 == 2 || v731 != 3 && v731 != 4 ) |
4959 v229 = 600 * v2; | |
4960 else | |
4961 v229 = 3600 * v2; | |
4962 LODWORD(v733) = v229; | |
4963 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4964 goto play_sound_and_continue; |
486 | 4965 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); |
488 | 4966 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
4967 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4968 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4969 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4970 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4971 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( |
0 | 4972 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), |
4973 v731, | |
4974 amount, | |
4975 v716, | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4976 v3->uPlayerID + 1); |
0 | 4977 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4978 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; |
488 | 4979 LODWORD(v727) = 1; |
4980 goto play_sound_and_continue; | |
710 | 4981 |
0 | 4982 case 28: |
4983 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 4984 goto play_sound_and_continue; |
0 | 4985 v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; |
4986 y = v240; | |
4987 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
710 | 4988 { |
4989 dword_50C9D0 = 113; | |
4990 dword_50C9D4 = 0; | |
4991 dword_50C9D8 = 1; | |
4992 | |
4993 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4994 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
|
4995 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4996 goto LABEL_1166; |
710 | 4997 } |
0 | 4998 if ( v731 == 1 || v731 == 2 ) |
4999 { | |
5000 v241 = (double)v723 * 0.0099999998 + 0.5; | |
5001 } | |
5002 else | |
5003 { | |
5004 if ( v731 == 3 ) | |
5005 { | |
5006 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
5007 } | |
5008 else | |
5009 { | |
5010 if ( v731 != 4 ) | |
5011 { | |
5012 v241 = 0.0; | |
5013 goto LABEL_484; | |
5014 } | |
5015 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
5016 } | |
5017 } | |
5018 if ( v241 > 1.0 ) | |
5019 v241 = 1.0; | |
5020 LABEL_484: | |
5021 v732 = (unsigned __int8)v240[25]; | |
5022 v242 = (signed __int64)((double)v732 * v241); | |
5023 v243 = y; | |
5024 y[25] = v242; | |
5025 *((int *)v243 + 4) = (unsigned __int8)v242; | |
486 | 5026 if ( (unsigned __int8)v242 <= 0 ) |
5027 { | |
5028 *(int *)v243 = 0; | |
0 | 5029 dword_50C9D0 = 113; |
486 | 5030 dword_50C9D4 = 0; |
0 | 5031 dword_50C9D8 = 1; |
5032 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
486 | 5033 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5034 v3->spellnum = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5035 v2 = v723; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5036 goto LABEL_1166; |
0 | 5037 } |
5038 *((int *)v243 + 5) |= 0x40u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5039 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5040 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5041 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5042 |
0 | 5043 case 30: |
5044 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5045 goto play_sound_and_continue; |
486 | 5046 uRequiredMana = 0; |
0 | 5047 HIDWORD(v733) = 10 * v2; |
5048 v730 = 1; | |
5049 v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
5050 if ( v731 == 1 ) | |
5051 { | |
5052 v245 = (int)&v244[36 * a2 + 532]; | |
5053 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5054 v311 = __OFSUB__(*(int *)v245, 134); | |
5055 v14 = *(int *)v245 == 134; | |
5056 v310 = *(int *)v245 - 134 < 0; | |
5057 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5058 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5059 { | |
486 | 5060 if ( *(int *)&v244[36 * a2 + 544] == 0 ) |
0 | 5061 { |
486 | 5062 if ( *(int *)&v244[36 * a2 + 536] == 0 ) |
0 | 5063 { |
486 | 5064 if ( *(int *)&v244[36 * a2 + 540] == 0 ) |
0 | 5065 { |
5066 v312 = v309[28]; | |
5067 if ( v312 ) | |
5068 { | |
5069 if ( v312 != 1 ) | |
5070 { | |
5071 if ( v312 != 2 ) | |
5072 { | |
5073 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5074 if ( !(v244[36 * a2 + 552] & 2) ) | |
5075 { | |
5076 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5077 { | |
5078 uRequiredMana = 1; | |
486 | 5079 v730 = 0; |
0 | 5080 } |
5081 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5082 uRequiredMana = 1; | |
486 | 5083 if (!uRequiredMana) |
0 | 5084 { |
5085 v313 = *(char *)(LODWORD(v725) + 28); | |
5086 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5087 { | |
224 | 5088 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5089 *(int *)(v245 + 4) = 0; |
222 | 5090 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5091 + 1]; |
5092 ; | |
222 | 5093 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5094 + 1] ) |
5095 { | |
5096 ++*(int *)(v245 + 4); | |
5097 if ( j >= v314 ) | |
5098 break; | |
5099 } | |
5100 v254 = rand(); | |
224 | 5101 v255 = 10;//pItemsTable->field_116D8[17]; |
5102 v256 = 10;//pItemsTable->field_116D8[16]; | |
0 | 5103 LABEL_611: |
5104 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5105 LABEL_612: | |
5106 _this->uItemID |= 0x20u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5107 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5108 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5109 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5110 goto play_sound_and_continue; |
0 | 5111 } |
5112 goto LABEL_615; | |
5113 } | |
5114 LABEL_613: | |
5115 v316 = _this->uItemID; | |
5116 if ( !(BYTE1(v316) & 2) ) | |
5117 { | |
5118 LOBYTE(v316) = v316 | 2; | |
5119 _this->uItemID = v316; | |
5120 } | |
5121 } | |
5122 } | |
5123 } | |
5124 } | |
5125 } | |
5126 } | |
5127 } | |
5128 } | |
5129 LABEL_616: | |
486 | 5130 if ( LODWORD(v727) == 0 ) |
0 | 5131 { |
5132 v317 = pGlobalTXT_LocalizationStrings[428]; | |
486 | 5133 if ( v730 == 0 ) |
0 | 5134 v317 = pGlobalTXT_LocalizationStrings[585]; |
5135 ShowStatusBarString(v317, 2u); | |
486 | 5136 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
|
5137 __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
|
5138 //v318 = v726; |
486 | 5139 v3->spellnum = 0; |
5140 v318->PlaySound(SPEECH_43, 0); | |
0 | 5141 } |
488 | 5142 goto play_sound_and_continue; |
0 | 5143 } |
5144 if ( v731 != 2 ) | |
5145 { | |
5146 if ( v731 == 3 ) | |
5147 { | |
5148 v245 = (int)&v244[36 * a2 + 532]; | |
5149 v269 = *(int *)v245; | |
5150 if ( *(int *)v245 > 134 | |
486 | 5151 || *(int *)(v245 + 12) != 0 |
5152 || *(int *)(v245 + 4) != 0 | |
5153 || *(int *)(v245 + 8) != 0 | |
0 | 5154 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) |
5155 goto LABEL_616; | |
5156 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5157 LODWORD(v725) = (int)v270; | |
5158 v271 = v270[28]; | |
5159 if ( v271 && v271 != 1 && v271 != 2 ) | |
5160 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5161 else | |
5162 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5163 if ( v272 ) | |
5164 { | |
5165 uRequiredMana = 1; | |
486 | 5166 v730 = 0; |
0 | 5167 } |
5168 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5169 uRequiredMana = 1; | |
486 | 5170 if (uRequiredMana) |
0 | 5171 goto LABEL_613; |
5172 v273 = v725; | |
5173 v274 = *(char *)(LODWORD(v725) + 28); | |
5174 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 ) | |
5175 { | |
5176 if ( rand() % 100 < 80 | |
5177 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5178 { | |
224 | 5179 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5180 *(int *)(v245 + 4) = 0; |
222 | 5181 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; |
0 | 5182 ; |
222 | 5183 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5184 + 1] ) |
5185 { | |
5186 ++*(int *)(v245 + 4); | |
5187 if ( k >= v275 ) | |
5188 break; | |
5189 } | |
5190 v254 = rand(); | |
224 | 5191 v255 = 10;//pItemsTable->field_116D8[19]; |
5192 v256 = 10;//pItemsTable->field_116D8[18]; | |
0 | 5193 goto LABEL_611; |
5194 } | |
222 | 5195 v277 = pItemsTable->pSpecialEnchantments_count; |
0 | 5196 v278 = 0; |
5197 v725 = 0.0; | |
5198 HIDWORD(v733) = 0; | |
222 | 5199 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5200 { |
5201 v730 = (int)&v679; | |
5202 do | |
5203 { | |
222 | 5204 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); |
0 | 5205 if ( !v279 || v279 == 1 ) |
5206 { | |
222 | 5207 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5208 + 4] |
5209 + v278 * 28); | |
5210 LODWORD(v725) += v280; | |
5211 if ( v280 ) | |
5212 { | |
5213 v281 = v730; | |
5214 v730 += 4; | |
5215 *(int *)v281 = HIDWORD(v733); | |
5216 } | |
5217 } | |
5218 ++HIDWORD(v733); | |
5219 ++v278; | |
5220 } | |
5221 while ( SHIDWORD(v733) < v277 ); | |
5222 } | |
5223 v282 = rand() % SLODWORD(v725); | |
5224 v283 = v679; | |
5225 *(int *)(v245 + 12) = v679; | |
222 | 5226 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; |
0 | 5227 v285 = v282 + 1; |
5228 if ( v284 < v285 ) | |
5229 { | |
5230 for ( l = &v679; ; l = (int *)v732 ) | |
5231 { | |
5232 v287 = (int)(l + 1); | |
5233 v732 = v287; | |
5234 v288 = *(int *)v287; | |
5235 *(int *)(v245 + 12) = v288; | |
222 | 5236 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5237 + 4]; |
5238 if ( v284 >= v285 ) | |
5239 break; | |
5240 } | |
5241 } | |
5242 goto LABEL_525; | |
5243 } | |
5244 } | |
5245 else | |
5246 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5247 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
0 | 5248 if ( v731 != 4 |
5249 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
486 | 5250 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 |
570 | 5251 || v726->pInventoryItems[a2].uEnchantmentType != 0 |
486 | 5252 || v726->pInventoryItems[a2]._bonus_strength != 0 |
315 | 5253 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) |
0 | 5254 goto LABEL_616; |
5255 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5256 LODWORD(v725) = (int)v247; | |
5257 v248 = v247[28]; | |
5258 if ( v248 && v248 != 1 && v248 != 2 ) | |
5259 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5260 else | |
5261 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5262 if ( v249 ) | |
5263 { | |
5264 uRequiredMana = 1; | |
486 | 5265 v730 = 0; |
0 | 5266 } |
5267 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5268 uRequiredMana = 1; | |
486 | 5269 if (uRequiredMana) |
0 | 5270 goto LABEL_613; |
5271 v250 = v725; | |
5272 v251 = *(char *)(LODWORD(v725) + 28); | |
5273 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 ) | |
5274 { | |
5275 if ( rand() % 100 < 80 | |
5276 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5277 { | |
224 | 5278 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; |
0 | 5279 *(int *)(v245 + 4) = 0; |
222 | 5280 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; |
0 | 5281 ; |
222 | 5282 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5283 + 1] ) |
5284 { | |
5285 ++*(int *)(v245 + 4); | |
5286 if ( m >= v252 ) | |
5287 break; | |
5288 } | |
5289 v254 = rand(); | |
224 | 5290 v255 = 10;// pItemsTable->field_116D8[21]; |
5291 v256 = 10;//pItemsTable->field_116D8[20]; | |
0 | 5292 goto LABEL_611; |
5293 } | |
222 | 5294 v257 = pItemsTable->pSpecialEnchantments_count; |
0 | 5295 v258 = 0; |
5296 v725 = 0.0; | |
5297 HIDWORD(v733) = 0; | |
222 | 5298 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5299 { |
5300 v730 = (int)&v679; | |
5301 do | |
5302 { | |
222 | 5303 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); |
0 | 5304 if ( !v259 || v259 == 1 ) |
5305 { | |
222 | 5306 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5307 + 4] |
5308 + v258 * 28); | |
5309 LODWORD(v725) += v260; | |
5310 if ( v260 ) | |
5311 { | |
5312 v261 = v730; | |
5313 v730 += 4; | |
5314 *(int *)v261 = HIDWORD(v733); | |
5315 } | |
5316 } | |
5317 ++HIDWORD(v733); | |
5318 ++v258; | |
5319 } | |
5320 while ( SHIDWORD(v733) < v257 ); | |
5321 } | |
5322 v262 = rand() % SLODWORD(v725); | |
5323 v263 = v679; | |
5324 *(int *)(v245 + 12) = v679; | |
222 | 5325 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; |
0 | 5326 v265 = v262 + 1; |
5327 if ( v264 < v265 ) | |
5328 { | |
5329 for ( ii = &v679; ; ii = (int *)v732 ) | |
5330 { | |
5331 v267 = (int)(ii + 1); | |
5332 v732 = v267; | |
5333 v268 = *(int *)v267; | |
5334 *(int *)(v245 + 12) = v268; | |
222 | 5335 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType |
0 | 5336 + 4]; |
5337 if ( v264 >= v265 ) | |
5338 break; | |
5339 } | |
5340 } | |
5341 LABEL_525: | |
5342 ++*(int *)(v245 + 12); | |
5343 goto LABEL_612; | |
5344 } | |
5345 } | |
5346 LABEL_615: | |
486 | 5347 //v1 = 0; |
0 | 5348 goto LABEL_616; |
5349 } | |
5350 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5351 _this = v289; | |
5352 v290 = v289->uItemID; | |
5353 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5354 if ( v290 > 134 | |
486 | 5355 || _this->uSpecEnchantmentType != 0 |
570 | 5356 || _this->uEnchantmentType != 0 |
486 | 5357 || _this->_bonus_strength != 0 |
0 | 5358 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 |
5359 || v291 == 1 | |
5360 || v291 == 2 | |
315 | 5361 || _this->Broken()) |
0 | 5362 goto LABEL_616; |
5363 if ( _this->GetValue() < 0x1C2 ) | |
5364 uRequiredMana = 1; | |
5365 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5366 uRequiredMana = 1; | |
486 | 5367 if ( uRequiredMana != 0 ) |
710 | 5368 { |
5369 dword_50C9D0 = 113; | |
5370 dword_50C9D4 = 0; | |
5371 dword_50C9D8 = 1; | |
5372 | |
5373 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5374 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
|
5375 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5376 goto LABEL_1166; |
710 | 5377 } |
0 | 5378 v292 = *(char *)(LODWORD(v725) + 28); |
5379 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5380 { | |
5381 v2 = v723; | |
486 | 5382 //v1 = 0; |
710 | 5383 |
5384 dword_50C9D0 = 113; | |
5385 dword_50C9D4 = 0; | |
5386 dword_50C9D8 = 1; | |
5387 | |
5388 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5389 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
|
5390 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5391 goto LABEL_1166; |
0 | 5392 } |
5393 if ( rand() % 100 >= 80 ) | |
5394 { | |
222 | 5395 v297 = pItemsTable->pSpecialEnchantments_count; |
0 | 5396 v294 = _this; |
5397 v298 = 0; | |
5398 v725 = 0.0; | |
5399 HIDWORD(v733) = 0; | |
222 | 5400 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
0 | 5401 { |
5402 v730 = (int)&v679; | |
5403 do | |
5404 { | |
222 | 5405 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); |
0 | 5406 if ( !v299 || v299 == 1 ) |
5407 { | |
222 | 5408 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] |
0 | 5409 + v298 * 28); |
5410 LODWORD(v725) += v300; | |
5411 if ( v300 ) | |
5412 { | |
5413 v301 = v730; | |
5414 v730 += 4; | |
5415 *(int *)v301 = HIDWORD(v733); | |
5416 } | |
5417 } | |
5418 ++HIDWORD(v733); | |
5419 ++v298; | |
5420 } | |
5421 while ( SHIDWORD(v733) < v297 ); | |
5422 } | |
5423 v302 = rand() % SLODWORD(v725); | |
5424 v303 = v679; | |
377 | 5425 v294->uSpecEnchantmentType = v679; |
222 | 5426 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; |
0 | 5427 v305 = v302 + 1; |
5428 if ( v304 < v305 ) | |
5429 { | |
5430 for ( jj = &v679; ; jj = (int *)v732 ) | |
5431 { | |
5432 v307 = (int)(jj + 1); | |
5433 v732 = v307; | |
5434 v308 = *(int *)v307; | |
377 | 5435 v294->uSpecEnchantmentType = v308; |
222 | 5436 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; |
0 | 5437 if ( v304 >= v305 ) |
5438 break; | |
5439 } | |
5440 } | |
377 | 5441 ++v294->uSpecEnchantmentType; |
0 | 5442 } |
5443 else | |
5444 { | |
5445 v293 = rand(); | |
5446 v294 = _this; | |
224 | 5447 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; |
570 | 5448 _this->uEnchantmentType = 0; |
222 | 5449 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; |
0 | 5450 ; |
570 | 5451 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType |
0 | 5452 + 1] ) |
5453 { | |
570 | 5454 ++v294->uEnchantmentType; |
0 | 5455 if ( kk >= v295 ) |
5456 break; | |
5457 } | |
224 | 5458 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] |
5459 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
0 | 5460 } |
5461 v294->uAttributes |= 0x20u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5462 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5463 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5464 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5465 |
710 | 5466 case SPELL_WATER_TOWN_PORTAL: |
0 | 5467 amount = 10 * v2; |
5468 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
488 | 5469 goto play_sound_and_continue; |
822 | 5470 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) |
710 | 5471 { |
5472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5473 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
|
5474 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5475 goto LABEL_1166; |
710 | 5476 } |
5477 town_portal_caster_id = LOBYTE(v3->uPlayerID); | |
5478 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5479 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5480 goto play_sound_and_continue; |
0 | 5481 case 33: |
5482 LODWORD(v733) = 604800 * v2; | |
5483 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
710 | 5484 { |
5485 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5486 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
|
5487 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5488 goto LABEL_1166; |
710 | 5489 } |
0 | 5490 v319 = uRequiredMana; |
5491 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5492 { | |
5493 pEventTimer->Pause(); | |
486 | 5494 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); |
0 | 5495 qword_506350 = (signed int)v733; |
5496 _506348_current_lloyd_playerid = v3->uPlayerID; | |
5497 ::uRequiredMana = v319; | |
5498 ::sRecoveryTime = sRecoveryTime; | |
823 | 5499 dword_50633C = v3->sound_id; |
0 | 5500 dword_506338 = v3->spellnum; |
5501 LOBYTE(v3->field_8) |= 0x20u; | |
5502 } | |
488 | 5503 goto play_sound_and_continue; |
0 | 5504 case 40: |
822 | 5505 v320 = v731 - 2; |
0 | 5506 if ( !v320 ) |
5507 goto LABEL_632; | |
5508 v321 = v320 - 1; | |
5509 if ( v321 ) | |
5510 { | |
5511 if ( v321 == 1 ) | |
5512 goto LABEL_634; | |
5513 LABEL_632: | |
5514 v322 = 3600 * v2; | |
5515 } | |
5516 else | |
5517 { | |
5518 v322 = 86400 * v2; | |
5519 } | |
5520 amount = v322; | |
5521 LABEL_634: | |
5522 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5523 goto play_sound_and_continue; |
0 | 5524 v323 = v3->uPlayerID_2; |
5525 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
5526 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5527 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5528 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5529 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5530 } |
0 | 5531 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5532 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5533 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5534 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5535 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5536 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5537 } |
0 | 5538 v732 = amount << 7; |
5539 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5540 v656 = 15; | |
5541 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5542 |
0 | 5543 case 41: |
5544 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5545 goto play_sound_and_continue; |
0 | 5546 a1.stru_24.Reset(); |
822 | 5547 a1.spell_id = v3->spellnum; |
5548 a1.spell_level = v2; | |
5549 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5550 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 5551 a1.vPosition.y = pParty->vPosition.y; |
5552 a1.vPosition.x = pParty->vPosition.x; | |
486 | 5553 a1.uAttributes = 0; |
0 | 5554 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5555 a1.uSectorID = pIndoor->GetSector( | |
5556 pParty->vPosition.x, | |
5557 pParty->vPosition.y, | |
5558 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
486 | 5559 a1.uSpriteFrameID = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5560 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
823 | 5561 a1.spell_target_pid = a2; |
0 | 5562 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
5563 a1.uFacing = LOWORD(pParty->sRotationY); | |
823 | 5564 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 5565 if ( pParty->bTurnBasedModeOn == 1 ) |
5566 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5567 |
0 | 5568 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5569 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
|
5570 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5571 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5572 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5573 |
0 | 5574 case 43: |
5575 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
710 | 5576 { |
5577 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5578 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
|
5579 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5580 goto LABEL_1166; |
710 | 5581 } |
0 | 5582 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 5583 goto play_sound_and_continue; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5584 a1.uType = 4090; |
0 | 5585 a1.stru_24.Reset(); |
822 | 5586 a1.spell_id = v3->spellnum; |
5587 a1.spell_level = v2; | |
5588 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5589 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 5590 a1.vPosition.x = pParty->vPosition.x; |
5591 a1.vPosition.y = pParty->vPosition.y; | |
486 | 5592 a1.uAttributes = 0; |
5593 a1.uSectorID = 0; | |
5594 a1.uSpriteFrameID = 0; | |
0 | 5595 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5596 a1.field_60_distance_related_prolly_lod = 0; | |
823 | 5597 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
5598 a1.spell_target_pid = a2; | |
0 | 5599 a1.uFacing = LOWORD(pParty->sRotationY); |
823 | 5600 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 5601 if ( pParty->bTurnBasedModeOn == 1 ) |
5602 a1.uAttributes = 4; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5603 |
0 | 5604 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5605 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
|
5606 ++pTurnEngine->field_1C; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5607 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5608 goto play_sound_and_continue; |
488 | 5609 |
5610 case SPELL_SPIRIT_DETECT_LIFE: | |
822 | 5611 v328 = v731 - 2; |
0 | 5612 if ( v328 ) |
5613 { | |
5614 v329 = v328 - 1; | |
5615 if ( v329 && v329 != 1 ) | |
5616 v330 = 600 * v2; | |
5617 else | |
5618 v330 = 3600 * v2; | |
5619 } | |
5620 else | |
5621 { | |
5622 v330 = 1800 * v2; | |
5623 } | |
5624 LODWORD(v733) = v330; | |
5625 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5626 goto play_sound_and_continue; |
5627 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
5628 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
5629 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
5630 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
5631 | |
5632 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
|
5633 LODWORD(v727) = 1; |
488 | 5634 goto play_sound_and_continue; |
5635 | |
5636 case SPELL_SPIRIT_FATE: | |
0 | 5637 LODWORD(v733) = 300; |
822 | 5638 v339 = v731 - 2; |
0 | 5639 if ( v339 ) |
5640 { | |
5641 v340 = v339 - 1; | |
5642 if ( v340 ) | |
5643 { | |
5644 if ( v340 != 1 ) | |
5645 { | |
5646 amount = v2; | |
5647 goto LABEL_667; | |
5648 } | |
5649 v341 = 6 * v2; | |
5650 } | |
5651 else | |
5652 { | |
5653 v341 = 4 * v2; | |
5654 } | |
5655 } | |
5656 else | |
5657 { | |
5658 v341 = 2 * v2; | |
5659 } | |
5660 amount = v341; | |
5661 LABEL_667: | |
5662 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5663 goto play_sound_and_continue; |
5664 v342 = v3->spell_target_pid; | |
486 | 5665 if ( v342 == 0 ) |
0 | 5666 { |
488 | 5667 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
5668 | |
5669 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
|
5670 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5671 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5672 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5673 if (PID_TYPE(v342) == OBJECT_Actor) |
0 | 5674 { |
848 | 5675 v343 = PID_ID(v342); |
486 | 5676 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); |
0 | 5677 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; |
486 | 5678 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); |
0 | 5679 BYTE2(pActors[v343].uAttributes) |= 8u; |
486 | 5680 v672 = 0; |
0 | 5681 v661 = &pActors[v343]; |
5682 LABEL_165: | |
5683 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5684 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5685 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5686 goto play_sound_and_continue; |
488 | 5687 |
0 | 5688 case 49: |
822 | 5689 v348 = v731 - 2; |
0 | 5690 if ( !v348 ) |
5691 goto LABEL_677; | |
5692 v349 = v348 - 1; | |
5693 if ( v349 ) | |
5694 { | |
5695 if ( v349 == 1 ) | |
5696 { | |
486 | 5697 amount = 0; |
0 | 5698 goto LABEL_679; |
5699 } | |
5700 LABEL_677: | |
5701 v350 = 3600 * v2; | |
5702 } | |
5703 else | |
5704 { | |
5705 v350 = 86400 * v2; | |
5706 } | |
5707 amount = v350; | |
5708 LABEL_679: | |
5709 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5710 goto play_sound_and_continue; |
0 | 5711 v351 = &pParty->pPlayers[v3->uPlayerID_2]; |
5712 if ( !v351->pConditions[0] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5713 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5714 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5715 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5716 } |
0 | 5717 if ( v731 == 4 ) |
5718 { | |
486 | 5719 LODWORD(v351->pConditions[0]) = 0; |
5720 HIDWORD(v351->pConditions[0]) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5721 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5722 else |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5723 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5724 v732 = amount << 7; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5725 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
|
5726 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
|
5727 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5728 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5729 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5730 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5731 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5732 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5733 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5734 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5735 |
488 | 5736 case SPELL_SPIRIT_PRESERVATION: |
822 | 5737 v354 = v731 - 2; |
0 | 5738 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) |
5739 v356 = 900 * (v2 + 4); | |
5740 else | |
5741 v356 = 300 * (v2 + 12); | |
5742 LODWORD(v733) = v356; | |
5743 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5744 goto play_sound_and_continue; |
0 | 5745 if ( v731 == 1 || v731 == 2 ) |
5746 { | |
488 | 5747 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
5748 | |
5749 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
|
5750 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5751 goto play_sound_and_continue; |
0 | 5752 } |
486 | 5753 a2 = 0; |
0 | 5754 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
112 | 5755 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; |
0 | 5756 do |
5757 { | |
488 | 5758 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
5759 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
0 | 5760 ++a2; |
112 | 5761 ++v357;// = (SpellBuff *)((char *)v357 + 6972); |
5762 } | |
5763 while ( v357 <= &pParty->pPlayers[3] ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5764 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5765 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5766 |
0 | 5767 case 48: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5768 { |
822 | 5769 v364 = v731 - 2; |
0 | 5770 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) |
5771 v366 = 60 * (v2 + 3); | |
5772 else | |
5773 v366 = 300 * v2 + 180; | |
5774 LODWORD(v733) = v366; | |
5775 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5776 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5777 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
0 | 5778 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
|
5779 ++a1.uType; |
0 | 5780 a1.stru_24.Reset(); |
822 | 5781 a1.spell_id = v3->spellnum; |
5782 a1.spell_level = v2; | |
5783 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
5784 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 5785 a1.uAttributes = 0; |
5786 a1.uSectorID = 0; | |
5787 a1.uSpriteFrameID = 0; | |
0 | 5788 a1.field_60_distance_related_prolly_lod = 0; |
486 | 5789 a1.uFacing = 0; |
823 | 5790 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
5791 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5792 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
0 | 5793 { |
5794 v369 = &pActors[dword_50BF30[a2]]; | |
5795 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5796 { | |
5797 a1.vPosition.x = v369->vPosition.x; | |
5798 a1.vPosition.y = v369->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5799 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
|
5800 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5801 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 5802 a1.Create(0, 0, 0, 0); |
0 | 5803 v369->pActorBuffs[4].Apply( |
5804 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
486 | 5805 v731, 0, 0, 0); |
0 | 5806 } |
5807 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5808 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5809 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5810 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5811 |
0 | 5812 case 53: |
822 | 5813 v371 = v731 - 2; |
0 | 5814 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) |
486 | 5815 amount = 0; |
0 | 5816 else |
5817 amount = 86400 * v2; | |
5818 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5819 goto play_sound_and_continue; |
486 | 5820 pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); |
0 | 5821 v373 = v3->uPlayerID_2; |
5822 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
|
5823 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5824 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5825 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5826 } |
0 | 5827 v14 = v731 == 4; |
5828 pParty->pPlayers[v373].sHealth = 1; | |
5829 if ( v14 ) | |
5830 { | |
5831 v374 = v3->uPlayerID_2; | |
486 | 5832 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5833 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
0 | 5834 v376 = v3->uPlayerID_2; |
486 | 5835 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5836 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
0 | 5837 } |
5838 else | |
5839 { | |
5840 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5841 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5842 0xEu, | |
5843 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5844 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5845 0xDu, | |
5846 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5847 } | |
112 | 5848 v377 = &pParty->pPlayers[v3->uPlayerID_2]; |
0 | 5849 goto LABEL_720; |
5850 case 54: | |
822 | 5851 v378 = v731 - 2; |
0 | 5852 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) |
5853 v380 = 4 * v2; | |
5854 else | |
5855 v380 = 3 * v2; | |
5856 amount = v380; | |
5857 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5858 goto play_sound_and_continue; |
0 | 5859 v381 = 0; |
5860 HIDWORD(v733) = amount; | |
5861 v730 = 0; | |
5862 v382 = 1; | |
5863 do | |
5864 { | |
5865 v383 = pPlayers[v382]; | |
5866 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5867 v682[v381++] = v382; | |
5868 ++v382; | |
5869 } | |
5870 while ( v382 <= 4 ); | |
5871 v384 = 0; | |
5872 v730 = v381; | |
486 | 5873 if ( v381 > 0 ) |
0 | 5874 { |
5875 do | |
5876 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5877 while ( v384 < v381 ); | |
5878 } | |
5879 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
486 | 5880 HIDWORD(v733) = 0; |
5881 if ( v381 > 0 ) | |
0 | 5882 { |
5883 do | |
5884 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5885 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5886 v726 = pPlayers[v682[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5887 v726->sHealth = v732; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5888 //v386 = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5889 if ( v726->sHealth > v726->GetMaxHealth()) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5890 v726->sHealth = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5891 if ( v726->sHealth > 0 ) |
0 | 5892 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5893 v726->pConditions[Player::Condition_Unconcious] = 0; |
0 | 5894 } |
5895 v388 = HIDWORD(v733); | |
488 | 5896 |
5897 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); | |
0 | 5898 HIDWORD(v733) = v388 + 1; |
5899 } | |
5900 while ( v388 + 1 < v730 ); | |
5901 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5902 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5903 goto play_sound_and_continue; |
488 | 5904 |
0 | 5905 case 55: |
822 | 5906 v392 = v731 - 1; |
0 | 5907 if ( !v392 ) |
5908 { | |
5909 v395 = 180 * v2; | |
5910 goto LABEL_750; | |
5911 } | |
5912 v393 = v392 - 1; | |
5913 if ( !v393 ) | |
5914 { | |
5915 v395 = 10800 * v2; | |
5916 goto LABEL_750; | |
5917 } | |
5918 v394 = v393 - 1; | |
5919 if ( !v394 ) | |
5920 { | |
5921 v395 = 259200 * v2; | |
5922 LABEL_750: | |
5923 amount = v395; | |
5924 goto LABEL_751; | |
5925 } | |
5926 if ( v394 == 1 ) | |
486 | 5927 amount = 0; |
0 | 5928 LABEL_751: |
5929 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5930 goto play_sound_and_continue; |
0 | 5931 v396 = v3->uPlayerID_2; |
5932 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
5933 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5934 { | |
5935 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
486 | 5936 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); |
0 | 5937 if ( v731 == 4 ) |
5938 { | |
5939 v397 = v3->uPlayerID_2; | |
486 | 5940 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5941 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
0 | 5942 v398 = v3->uPlayerID_2; |
486 | 5943 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5944 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
0 | 5945 v399 = v3->uPlayerID_2; |
486 | 5946 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5947 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
0 | 5948 } |
5949 else | |
5950 { | |
5951 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5952 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
0 | 5953 (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
|
5954 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
0 | 5955 (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
|
5956 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
0 | 5957 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5958 } | |
112 | 5959 pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); |
488 | 5960 |
0 | 5961 pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; |
488 | 5962 |
5963 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 5964 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5965 LODWORD(v727) = 1; |
488 | 5966 goto play_sound_and_continue; |
5967 | |
0 | 5968 case 61: |
822 | 5969 v405 = v731 - 2; |
0 | 5970 if ( !v405 ) |
5971 goto LABEL_766; | |
5972 v406 = v405 - 1; | |
5973 if ( v406 ) | |
5974 { | |
5975 if ( v406 == 1 ) | |
5976 { | |
486 | 5977 amount = 0; |
0 | 5978 goto LABEL_768; |
5979 } | |
5980 LABEL_766: | |
5981 v407 = 3600 * v2; | |
5982 } | |
5983 else | |
5984 { | |
5985 v407 = 86400 * v2; | |
5986 } | |
5987 amount = v407; | |
5988 LABEL_768: | |
5989 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 5990 goto play_sound_and_continue; |
5991 | |
5992 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 5993 v323 = v3->uPlayerID_2; |
5994 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
5995 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5996 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5997 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5998 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5999 } |
0 | 6000 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6001 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6002 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6003 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6004 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6005 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6006 } |
0 | 6007 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6008 v656 = 12; | |
6009 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6010 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6011 |
0 | 6012 case 56: |
822 | 6013 v411 = v731 - 2; |
0 | 6014 if ( v411 ) |
6015 { | |
6016 v412 = v411 - 1; | |
6017 if ( v412 ) | |
6018 { | |
6019 if ( v412 == 1 ) | |
6020 { | |
486 | 6021 amount = 0; |
0 | 6022 goto LABEL_780; |
6023 } | |
6024 v413 = 180 * v2; | |
6025 } | |
6026 else | |
6027 { | |
6028 v413 = 86400 * v2; | |
6029 } | |
6030 } | |
6031 else | |
6032 { | |
6033 v413 = 3600 * v2; | |
6034 } | |
6035 amount = v413; | |
6036 LABEL_780: | |
6037 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6038 goto play_sound_and_continue; |
6039 | |
6040 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6041 v323 = v3->uPlayerID_2; |
6042 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
6043 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6044 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6045 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6046 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6047 } |
0 | 6048 if ( v731 == 4 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6049 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6050 *(int *)v324 = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6051 *((int *)v324 + 1) = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6052 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6053 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6054 } |
0 | 6055 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6056 v656 = 3; | |
6057 goto LABEL_640; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6058 |
0 | 6059 case 59: |
6060 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6061 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6062 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6063 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6064 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6065 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6066 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6067 v417 = (int)&pActors[PID_ID(a2)]; |
0 | 6068 v730 = v417; |
6069 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6070 { | |
6071 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6072 v417 = v730; | |
6073 } | |
6074 v418 = *(int *)(v417 + 672); | |
486 | 6075 HIDWORD(v733) = 0; |
0 | 6076 if ( pItemsTable->pItems[v418].uEquipType == 18 ) |
6077 HIDWORD(v733) = *(int *)(v417 + 684); | |
6078 | |
6079 //ItemGen::ItemGen(&v683); | |
6080 v683.Reset(); | |
6081 | |
6082 v419 = *(short *)(v730 + 180); | |
486 | 6083 if (v419) |
0 | 6084 { |
6085 v683.uItemID = v419; | |
6086 goto LABEL_799; | |
6087 } | |
6088 v420 = 0; | |
6089 v421 = v730 + 564; | |
486 | 6090 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) |
0 | 6091 { |
6092 ++v420; | |
6093 v421 += 36; | |
6094 if ( v420 >= 4 ) | |
6095 goto LABEL_799; | |
6096 } | |
6097 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6098 v2 = v723; | |
486 | 6099 //v1 = 0; |
0 | 6100 LABEL_799: |
486 | 6101 if ( HIDWORD(v733) != 0 ) |
0 | 6102 { |
6103 v675 = (const char *)HIDWORD(v733); | |
486 | 6104 if (v683.uItemID) |
0 | 6105 { |
6106 v422 = v683.GetDisplayName(); | |
6107 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6108 goto LABEL_807; | |
6109 } | |
6110 v664 = "%d gold"; | |
6111 goto LABEL_803; | |
6112 } | |
486 | 6113 if (v683.uItemID) |
0 | 6114 { |
6115 v675 = v683.GetDisplayName(); | |
6116 v664 = "(%s)"; | |
6117 LABEL_803: | |
6118 sprintf(pTmpBuf2, v664, v675); | |
6119 goto LABEL_807; | |
6120 } | |
6121 strcpy(pTmpBuf2, "nothing"); | |
6122 LABEL_807: | |
6123 ShowStatusBarString(pTmpBuf2, 2u); | |
6124 a1.stru_24.Reset(); | |
822 | 6125 a1.spell_id = v3->spellnum; |
6126 a1.spell_level = v2; | |
6127 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6128 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 6129 a1.vPosition.x = *(short *)(v730 + 142); |
6130 a1.vPosition.y = *(short *)(v730 + 144); | |
6131 v676 = *(short *)(v730 + 138); | |
6132 v665 = a1.vPosition.y; | |
6133 a1.vPosition.z = *(short *)(v730 + 138); | |
6134 v657 = a1.vPosition.x; | |
6135 goto LABEL_1087; | |
6136 case 62: | |
822 | 6137 v423 = v731 - 2; |
0 | 6138 if ( !v423 ) |
6139 goto LABEL_813; | |
6140 v424 = v423 - 1; | |
6141 if ( v424 ) | |
6142 { | |
6143 if ( v424 == 1 ) | |
6144 v425 = 3600 * v2; | |
6145 else | |
6146 LABEL_813: | |
6147 v425 = 300 * v2; | |
6148 } | |
6149 else | |
6150 { | |
6151 v425 = 600 * v2; | |
6152 } | |
6153 amount = v425; | |
6154 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6155 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6156 v426 = PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6157 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6158 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6159 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6160 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6161 } |
0 | 6162 v730 = 836 * v426; |
6163 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6164 { | |
90 | 6165 pActors[v426].pActorBuffs[1].Reset(); |
6166 pActors[v426].pActorBuffs[12].Reset(); | |
6167 pActors[v426].pActorBuffs[9].Apply( | |
0 | 6168 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6169 v731, 0, 0, 0); |
90 | 6170 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 6171 } |
6172 a1.stru_24.Reset(); | |
822 | 6173 a1.spell_id = v3->spellnum; |
6174 a1.spell_level = v2; | |
6175 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6176 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
90 | 6177 v61 = v426; |
0 | 6178 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6179 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6180 |
0 | 6181 case 66: |
6182 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6183 goto play_sound_and_continue; |
0 | 6184 amount = 600 * v2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6185 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6186 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6187 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6188 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6189 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6190 v730 = 836 * PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6191 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
|
6192 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6193 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6194 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6195 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6196 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6197 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6198 v731, 0, 0, 0); |
0 | 6199 } |
6200 a1.stru_24.Reset(); | |
822 | 6201 a1.spell_id = v3->spellnum; |
6202 a1.spell_level = v2; | |
6203 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6204 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6205 v61 = PID_ID(a2); |
0 | 6206 goto LABEL_1086; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6207 |
0 | 6208 case 63: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6209 { |
822 | 6210 v428 = v731 - 2; |
0 | 6211 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) |
6212 v430 = 300 * v2; | |
6213 else | |
6214 v430 = 180 * v2; | |
6215 amount = v430; | |
6216 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6217 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6218 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
0 | 6219 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
|
6220 ++a1.uType; |
0 | 6221 a1.stru_24.Reset(); |
822 | 6222 a1.spell_id = v3->spellnum; |
6223 a1.spell_level = v2; | |
6224 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6225 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6226 a1.uAttributes = 0; |
6227 a1.uSectorID = 0; | |
6228 a1.uSpriteFrameID = 0; | |
0 | 6229 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6230 a1.uFacing = 0; |
823 | 6231 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6232 a1.uSoundID = LOWORD(v3->sound_id); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6233 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
0 | 6234 { |
6235 v433 = &pActors[dword_50BF30[a2]]; | |
6236 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6237 break; | |
6238 a1.vPosition.x = v433->vPosition.x; | |
6239 a1.vPosition.y = v433->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6240 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
|
6241 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6242 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6243 a1.Create(0, 0, 0, 0); |
0 | 6244 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6245 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6246 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
486 | 6247 v731, 0, 0, 0); |
0 | 6248 } |
6249 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6250 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6251 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6252 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6253 |
0 | 6254 case 64: |
822 | 6255 v435 = v731 - 2; |
0 | 6256 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) |
486 | 6257 amount = 0; |
0 | 6258 else |
6259 amount = 86400 * v2; | |
6260 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6261 goto play_sound_and_continue; |
6262 | |
6263 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6264 v440 = v3->uPlayerID_2; |
6265 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
6266 { | |
6267 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
486 | 6268 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); |
0 | 6269 if ( v731 == 4 ) |
6270 { | |
6271 v441 = v3->uPlayerID_2; | |
486 | 6272 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6273 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
0 | 6274 } |
6275 else | |
6276 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6277 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
0 | 6278 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6279 } | |
6280 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6281 LABEL_720: | |
486 | 6282 v377->SetCondition(1, 0); |
0 | 6283 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6284 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6285 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6286 |
0 | 6287 case 42: |
822 | 6288 v442 = v731 - 2; |
0 | 6289 if ( !v442 ) |
6290 goto LABEL_855; | |
6291 v443 = v442 - 1; | |
6292 if ( v443 ) | |
6293 { | |
6294 if ( v443 == 1 ) | |
6295 v444 = 4 * v2; | |
6296 else | |
6297 LABEL_855: | |
6298 v444 = 2 * v2; | |
6299 } | |
6300 else | |
6301 { | |
6302 v444 = 3 * v2; | |
6303 } | |
6304 amount = v444; | |
6305 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6306 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6307 v445 = PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6308 if (PID_TYPE(a2) == OBJECT_Item) |
0 | 6309 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6310 v449 = (char *)&pSpriteObjects[v445].stru_24; |
0 | 6311 v450 = *(int *)v449; |
6312 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6313 { | |
6314 party_finds_gold(*((int *)v449 + 3), 0); | |
6315 viewparams->bRedrawGameUI = 1; | |
6316 } | |
6317 else | |
6318 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6319 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
0 | 6320 ShowStatusBarString(pTmpBuf2, 2u); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6321 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
|
6322 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); |
0 | 6323 } |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6324 SpriteObject::OnInteraction(v445); |
0 | 6325 } |
6326 else | |
6327 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6328 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 6329 { |
6330 stru_50C198.LootActor(&pActors[v445]); | |
6331 } | |
6332 else | |
6333 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6334 if (PID_TYPE(a2) != OBJECT_Decoration) |
0 | 6335 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6336 if (PID_TYPE(a2) != OBJECT_BModel) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6337 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6338 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6339 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6340 } |
0 | 6341 dword_507CD8 = 1; |
6342 v677 = 1; | |
6343 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6344 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6345 else | |
6346 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
|
6347 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6348 EventProcessor(v446, a2, v677); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6349 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6350 goto play_sound_and_continue; |
0 | 6351 } |
6352 v447 = &pLevelDecorations[v445]; | |
6353 dword_507CD8 = 1; | |
6354 v448 = v447->field_16_event_id; | |
486 | 6355 if (v448) |
0 | 6356 { |
6357 v677 = 1; | |
6358 v446 = v448; | |
6359 EventProcessor(v446, a2, v677); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6360 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6361 goto play_sound_and_continue; |
0 | 6362 } |
6363 if ( v447->IsInteractive() ) | |
6364 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6365 activeLevelDecoration = v447; |
0 | 6366 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
|
6367 activeLevelDecoration = NULL; |
0 | 6368 } |
6369 } | |
6370 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6371 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6372 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6373 |
0 | 6374 case 67: |
822 | 6375 v451 = v731 - 2; |
0 | 6376 if ( v451 ) |
6377 { | |
6378 v452 = v451 - 1; | |
6379 if ( v452 ) | |
6380 { | |
6381 if ( v452 == 1 ) | |
6382 { | |
486 | 6383 amount = 0; |
0 | 6384 goto LABEL_883; |
6385 } | |
6386 v453 = 180 * v2; | |
6387 } | |
6388 else | |
6389 { | |
6390 v453 = 86400 * v2; | |
6391 } | |
6392 } | |
6393 else | |
6394 { | |
6395 v453 = 3600 * v2; | |
6396 } | |
6397 amount = v453; | |
6398 LABEL_883: | |
6399 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6400 goto play_sound_and_continue; |
6401 | |
6402 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6403 v323 = v3->uPlayerID_2; |
6404 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
6405 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6406 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6407 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6408 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6409 } |
0 | 6410 if ( v731 == 4 ) |
6411 { | |
486 | 6412 *(int *)v324 = 0; |
6413 *((int *)v324 + 1) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6414 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6415 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6416 } |
0 | 6417 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6418 v656 = 1; | |
6419 LABEL_640: | |
6420 v325 = &pParty->pPlayers[v323]; | |
6421 goto LABEL_641; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6422 |
0 | 6423 case 68: |
822 | 6424 v457 = v731 - 2; |
0 | 6425 if ( v457 ) |
6426 { | |
6427 v458 = v457 - 1; | |
6428 if ( v458 ) | |
6429 { | |
6430 if ( v458 == 1 ) | |
6431 v459 = 5 * v2 + 5; | |
6432 else | |
6433 v459 = 2 * v2 + 5; | |
6434 } | |
6435 else | |
6436 { | |
6437 v459 = 4 * v2 + 5; | |
6438 } | |
6439 } | |
6440 else | |
6441 { | |
6442 v459 = 3 * v2 + 5; | |
6443 } | |
6444 amount = v459; | |
6445 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6446 goto play_sound_and_continue; |
6447 v460 = v3->spell_target_pid; | |
486 | 6448 if (!v460) |
0 | 6449 { |
6450 pParty->pPlayers[v3->uPlayerID_2].Heal(amount); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6451 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0 | 6452 } |
6453 else | |
6454 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6455 if (PID_TYPE(v460) == OBJECT_Actor) |
0 | 6456 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6457 v461 = &pActors[PID_ID(v460)]; |
0 | 6458 v462 = v461->uAIState; |
6459 v463 = v461->pMonsterInfo.uHP; | |
6460 if ( v462 != 5 ) | |
6461 { | |
6462 if ( v462 != 4 ) | |
6463 { | |
6464 if ( v462 != 19 ) | |
6465 { | |
6466 if ( v462 != 11 ) | |
6467 { | |
6468 v461->sCurrentHP += amount; | |
6469 if ( v461->sCurrentHP > v463 ) | |
6470 v461->sCurrentHP = v463; | |
6471 } | |
6472 } | |
6473 } | |
6474 } | |
6475 } | |
6476 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6477 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6478 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6479 |
0 | 6480 case 72: |
822 | 6481 v464 = v731 - 2; |
0 | 6482 if ( !v464 ) |
6483 goto LABEL_910; | |
6484 v465 = v464 - 1; | |
6485 if ( v465 ) | |
6486 { | |
6487 if ( v465 == 1 ) | |
6488 { | |
486 | 6489 amount = 0; |
0 | 6490 goto LABEL_912; |
6491 } | |
6492 LABEL_910: | |
6493 v466 = 3600 * v2; | |
6494 } | |
6495 else | |
6496 { | |
6497 v466 = 86400 * v2; | |
6498 } | |
6499 amount = v466; | |
6500 LABEL_912: | |
6501 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6502 goto play_sound_and_continue; |
6503 | |
6504 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6505 v470 = v3->uPlayerID_2; |
6506 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
6507 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6508 && !(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
|
6509 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6510 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6511 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6512 } |
0 | 6513 if ( v731 == 4 ) |
6514 { | |
486 | 6515 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; |
6516 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
0 | 6517 v471 = v3->uPlayerID_2; |
486 | 6518 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6519 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
0 | 6520 v472 = v3->uPlayerID_2; |
486 | 6521 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6522 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6523 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6524 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6525 } |
0 | 6526 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
6527 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6528 6u, | |
6529 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6530 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6531 8u, | |
6532 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6533 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6534 v656 = 10; | |
6535 goto LABEL_937; | |
488 | 6536 |
6537 | |
0 | 6538 case 75: |
6539 amount = v2; | |
6540 LODWORD(v733) = 3600 * v2; | |
6541 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6542 goto play_sound_and_continue; |
6543 | |
6544 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6545 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6546 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6547 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6548 | |
6549 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
|
6550 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6551 goto play_sound_and_continue; |
488 | 6552 |
0 | 6553 case 73: |
6554 LODWORD(v733) = 3600 * v2; | |
6555 amount = v2; | |
6556 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6557 goto play_sound_and_continue; |
0 | 6558 if ( v731 == 4 ) |
6559 { | |
488 | 6560 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
6561 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6562 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6563 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
0 | 6564 v732 = (int)v733 << 7; |
6565 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
488 | 6566 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); |
6567 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6568 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6569 | |
6570 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
|
6571 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6572 goto play_sound_and_continue; |
488 | 6573 } |
6574 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6575 | |
6576 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
|
6577 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6578 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6579 |
0 | 6580 case 74: |
822 | 6581 v493 = v731 - 2; |
0 | 6582 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) |
486 | 6583 amount = 0; |
0 | 6584 else |
6585 amount = 86400 * v2; | |
6586 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6587 goto play_sound_and_continue; |
6588 | |
6589 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
0 | 6590 v498 = v3->uPlayerID_2; |
6591 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
6592 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6593 && !(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
|
6594 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6595 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6596 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6597 } |
0 | 6598 if ( v731 == 4 ) |
6599 { | |
486 | 6600 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; |
6601 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
0 | 6602 v499 = v3->uPlayerID_2; |
486 | 6603 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6604 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
0 | 6605 v500 = v3->uPlayerID_2; |
486 | 6606 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6607 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
0 | 6608 } |
6609 else | |
6610 { | |
6611 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6612 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6613 7u, | |
6614 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6615 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6616 9u, | |
6617 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6618 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6619 v656 = 11; | |
6620 LABEL_937: | |
112 | 6621 v325 = &pParty->pPlayers[v3->uPlayerID_2]; |
0 | 6622 LABEL_641: |
6623 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6624 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6625 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6626 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6627 |
0 | 6628 case 77: |
486 | 6629 { |
0 | 6630 amount = 5 * v2 + 10; |
6631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6632 goto play_sound_and_continue; |
0 | 6633 v501 = pParty->pPlayers; |
486 | 6634 int v1 = 0; |
0 | 6635 do |
6636 { | |
488 | 6637 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); |
0 | 6638 v501->Heal(amount); |
6639 ++v501; | |
6640 ++v1; | |
6641 } | |
6642 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6643 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6644 goto play_sound_and_continue; |
486 | 6645 } |
0 | 6646 case 80: |
6647 sRecoveryTime -= v2; | |
6648 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6649 goto play_sound_and_continue; |
6650 | |
0 | 6651 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); |
6652 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
|
6653 ++a1.uType; |
0 | 6654 HIDWORD(v733) = v505; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6655 v688.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6656 v688.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6657 v688.z = 0; |
0 | 6658 a1.stru_24.Reset(); |
822 | 6659 a1.spell_id = v3->spellnum; |
6660 a1.spell_level = v2; | |
6661 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6662 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6663 a1.uAttributes = 0; |
6664 a1.uSectorID = 0; | |
6665 a1.uSpriteFrameID = 0; | |
0 | 6666 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6667 a1.uFacing = 0; |
823 | 6668 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6669 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 6670 a2 = 0; |
6671 if ( SHIDWORD(v733) > 0 ) | |
0 | 6672 { |
6673 do | |
6674 { | |
6675 v507 = dword_50BF30[a2]; | |
6676 a1.vPosition.x = pActors[v507].vPosition.x; | |
6677 a1.vPosition.y = pActors[v507].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6678 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
|
6679 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6680 v509 = a1.Create(0, 0, 0, 0); |
0 | 6681 v510 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6682 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); |
0 | 6683 a2 = v510 + 1; |
6684 } | |
6685 while ( v510 + 1 < SHIDWORD(v733) ); | |
6686 } | |
486 | 6687 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) |
0 | 6688 { |
6689 v511 = &pActors[dword_50BF30[a2]]; | |
6690 a1.vPosition.x = v511->vPosition.x; | |
6691 a1.vPosition.y = v511->vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6692 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
|
6693 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6694 a1.Create(0, 0, 0, 0); |
0 | 6695 v513 = v511->pActorBuffs; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6696 for (int _v726 = 22; _v726 != 0; --_v726) |
0 | 6697 { |
6698 v513->Reset(); | |
6699 ++v513; | |
6700 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6701 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6702 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6703 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6704 |
0 | 6705 case 82: |
822 | 6706 v514 = v731 - 2; |
0 | 6707 if ( !v514 ) |
6708 goto LABEL_955; | |
6709 v515 = v514 - 1; | |
6710 if ( v515 ) | |
6711 { | |
6712 if ( v515 == 1 ) | |
6713 { | |
6714 v516 = 900 * v2; | |
6715 amount = 5; | |
6716 } | |
6717 else | |
6718 { | |
6719 LABEL_955: | |
6720 v516 = 300 * v2; | |
6721 amount = 1; | |
6722 } | |
6723 } | |
6724 else | |
6725 { | |
6726 v516 = 900 * v2; | |
6727 amount = 3; | |
6728 } | |
486 | 6729 v733 = __PAIR__(0, v516); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6730 |
486 | 6731 if ( (signed int)uNumActors > 0 ) |
0 | 6732 { |
90 | 6733 v518 = pActors;//[0].uAIState; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6734 auto _v726 = uNumActors; |
0 | 6735 do |
6736 { | |
90 | 6737 v519 = v518->uAIState; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6738 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) |
0 | 6739 ++HIDWORD(v733); |
90 | 6740 ++v518; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6741 --_v726; |
0 | 6742 } |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6743 while ( _v726 != 0 ); |
0 | 6744 } |
6745 if ( SHIDWORD(v733) >= amount ) | |
6746 { | |
710 | 6747 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! |
6748 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
|
6749 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6750 goto LABEL_1166; |
0 | 6751 } |
6752 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6753 goto play_sound_and_continue; |
0 | 6754 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
|
6755 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6756 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6757 |
0 | 6758 case 83: |
822 | 6759 v520 = v731 - 2; |
0 | 6760 if ( !v520 ) |
6761 goto LABEL_973; | |
6762 v521 = v520 - 1; | |
6763 if ( v521 ) | |
6764 { | |
6765 if ( v521 == 1 ) | |
6766 { | |
6767 LODWORD(v733) = 18000 * v2; | |
6768 v522 = 5 * v2 + 10; | |
6769 } | |
6770 else | |
6771 { | |
6772 LABEL_973: | |
6773 LODWORD(v733) = 10800 * v2; | |
6774 v522 = 3 * v2 + 10; | |
6775 } | |
6776 } | |
6777 else | |
6778 { | |
6779 LODWORD(v733) = 14400 * v2; | |
6780 v522 = 4 * v2 + 10; | |
6781 } | |
6782 amount = v522; | |
6783 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6784 goto play_sound_and_continue; |
6785 | |
6786 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6787 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6788 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6789 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6790 | |
6791 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
|
6792 LODWORD(v727) = 1; |
488 | 6793 goto play_sound_and_continue; |
6794 | |
0 | 6795 case 84: |
710 | 6796 //v67 = 2; |
0 | 6797 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
6798 { | |
710 | 6799 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! |
6800 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
|
6801 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6802 goto LABEL_1166; |
0 | 6803 } |
6804 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6805 goto play_sound_and_continue; |
0 | 6806 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
|
6807 ++a1.uType; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6808 v694.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6809 v694.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6810 v694.z = 0; |
0 | 6811 a1.stru_24.Reset(); |
822 | 6812 a1.spell_id = v3->spellnum; |
6813 a1.spell_level = v2; | |
6814 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
6815 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 6816 a1.uAttributes = 0; |
6817 a1.uSectorID = 0; | |
6818 a1.uSpriteFrameID = 0; | |
0 | 6819 a1.field_60_distance_related_prolly_lod = 0; |
486 | 6820 a1.uFacing = 0; |
823 | 6821 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
6822 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 6823 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6824 if ( (signed int)v531 > 0 ) |
0 | 6825 { |
6826 do | |
6827 { | |
6828 v533 = dword_50BF30[a2]; | |
6829 a1.vPosition.x = pActors[v533].vPosition.x; | |
6830 a1.vPosition.y = pActors[v533].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6831 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
|
6832 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 6833 v535 = a1.Create(0, 0, 0, 0); |
0 | 6834 v536 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6835 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); |
0 | 6836 a2 = v536 + 1; |
6837 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6838 while ( v536 + 1 < (signed int)v531 ); |
0 | 6839 } |
6840 v537 = pGame->GetStru6(); | |
6841 pGame->GetStru6()->_4A8BFC(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6842 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6843 goto play_sound_and_continue; |
488 | 6844 |
6845 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6846 { |
822 | 6847 v538 = v731 - 2; |
0 | 6848 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) |
6849 { | |
6850 amount = 5 * v2; | |
6851 v540 = 18000 * v2; | |
6852 } | |
6853 else | |
6854 { | |
6855 amount = 4 * v2; | |
6856 v540 = 14400 * v2; | |
6857 } | |
6858 v730 = v540; | |
6859 LODWORD(v733) = v540; | |
6860 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6861 goto play_sound_and_continue; |
6862 | |
6863 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6864 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6865 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6866 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6867 | |
0 | 6868 v732 = v730 << 7; |
6869 v549 = (double)(v730 << 7) * 0.033333335; | |
6870 *((float *)&v733 + 1) = v549; | |
6871 v712 = (signed __int64)v549; | |
488 | 6872 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); |
6873 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6874 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6875 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6876 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6877 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
0 | 6878 v550 = v2 + 5; |
488 | 6879 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( |
0 | 6880 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), |
6881 v731, | |
486 | 6882 v550, 0, 0); |
488 | 6883 |
6884 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
|
6885 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6886 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6887 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6888 |
0 | 6889 case 86: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6890 { |
822 | 6891 v551 = v731 - 2; |
0 | 6892 if ( !v551 ) |
6893 goto LABEL_998; | |
6894 v552 = v551 - 1; | |
6895 if ( v552 ) | |
6896 { | |
6897 if ( v552 == 1 ) | |
6898 { | |
6899 amount = 15; | |
6900 HIDWORD(v733) = 20; | |
6901 goto LABEL_1000; | |
6902 } | |
6903 LABEL_998: | |
6904 v678 = 4; | |
6905 } | |
6906 else | |
6907 { | |
6908 v678 = 12; | |
6909 } | |
6910 amount = v678; | |
6911 HIDWORD(v733) = v678; | |
6912 LABEL_1000: | |
6913 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 6914 goto play_sound_and_continue; |
0 | 6915 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); |
6916 v732 = (300 * amount * v2 + 60) << 7; | |
6917 v730 = v2 + 5; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6918 int _v726 = 0; |
89 | 6919 v553 = pParty->pPlayers;//[0].pConditions[1]; |
0 | 6920 *((float *)&v733 + 1) = (double)v732 * 0.033333335; |
6921 do | |
6922 { | |
488 | 6923 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); |
6924 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6925 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6926 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6927 | |
89 | 6928 //((SpellBuff *)(v553 + 6056))->Apply( |
488 | 6929 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); |
0 | 6930 if ( *(_QWORD *)v553 ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6931 _v726 = 1; |
89 | 6932 ++v553; |
6933 } | |
6934 while ( v553 <= &pParty->pPlayers[3] ); | |
0 | 6935 v562 = v731; |
488 | 6936 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); |
6937 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6938 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
|
6939 if (!_v726) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6940 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6941 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
|
6942 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6943 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6944 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6945 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6946 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6947 |
0 | 6948 case 88: |
6949 amount = 3; | |
6950 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
710 | 6951 { |
6952 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6953 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
|
6954 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6955 goto LABEL_1166; |
710 | 6956 } |
0 | 6957 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 6958 goto play_sound_and_continue; |
486 | 6959 a2 = 0; |
0 | 6960 _this = (ItemGen *)&pPlayers[1]; |
6961 do | |
6962 { | |
6963 v563 = 0; | |
6964 do | |
6965 { | |
6966 v564 = _this->uItemID; | |
486 | 6967 *(int *)(v563 + _this->uItemID) = 0; |
0 | 6968 v563 += 8; |
486 | 6969 *(int *)(v563 + v564 - 4) = 0; |
0 | 6970 } |
6971 while ( v563 <= 128 ); | |
6972 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6973 v566 = (Player **)_this; | |
6974 *(int *)(_this->uItemID + 6460) = v565; | |
6975 v567 = (*v566)->GetMaxMana(); | |
6976 *(int *)(_this->uItemID + 6464) = v567; | |
488 | 6977 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
0 | 6978 ++a2; |
6979 _this = (ItemGen *)((char *)_this + 4); | |
6980 } | |
6981 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6982 v571 = pPlayer; | |
6983 v572 = (char *)&pPlayer->sAgeModifier; | |
6984 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6985 *(short *)v572 = 120; | |
6986 else | |
6987 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6988 sRecoveryTime += -5 * v2; | |
6989 ++v571->uNumDivineInterventionCastsThisDay; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6990 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6991 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6992 |
0 | 6993 case 89: |
822 | 6994 v573 = v731 - 2; |
0 | 6995 if ( v573 ) |
6996 { | |
6997 v574 = v573 - 1; | |
6998 if ( v574 ) | |
6999 { | |
7000 if ( v574 == 1 ) | |
7001 v575 = 5 * v2; | |
7002 else | |
7003 v575 = 2 * v2; | |
7004 } | |
7005 else | |
7006 { | |
7007 v575 = 4 * v2; | |
7008 } | |
7009 } | |
7010 else | |
7011 { | |
7012 v575 = 3 * v2; | |
7013 } | |
7014 amount = v575; | |
7015 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7016 goto play_sound_and_continue; |
7017 v576 = v3->spell_target_pid; | |
486 | 7018 if (!v576) |
0 | 7019 { |
7020 v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
488 | 7021 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
0 | 7022 if ( *((_QWORD *)v585 + 14) ) |
7023 { | |
7024 ((Player *)v585)->SetCondition(0x11u, 1); | |
7025 v587 = ((Player *)v585)->GetSexByVoice(); | |
7026 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); | |
7027 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
7028 } | |
488 | 7029 goto play_sound_and_continue; |
0 | 7030 } |
848 | 7031 v577 = (Player *)(PID_ID(v576)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7032 //v726 = v577; |
0 | 7033 if ( v577 == (Player *)-1 ) |
7034 { | |
710 | 7035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! |
7036 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
|
7037 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7038 goto LABEL_1166; |
0 | 7039 } |
7040 v578 = (int)&pActors[(int)v577]; | |
7041 v721 = v578; | |
486 | 7042 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) |
710 | 7043 { |
7044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7045 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
|
7046 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7047 goto LABEL_1166; |
710 | 7048 } |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7049 ++a1.uType; |
0 | 7050 a1.stru_24.Reset(); |
822 | 7051 a1.spell_id = v3->spellnum; |
7052 a1.spell_level = v2; | |
7053 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7054 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 7055 a1.uAttributes = 0; |
7056 a1.uSectorID = 0; | |
7057 a1.uSpriteFrameID = 0; | |
0 | 7058 a1.field_60_distance_related_prolly_lod = 0; |
7059 v581 = v721; | |
486 | 7060 a1.uFacing = 0; |
823 | 7061 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7062 a1.uSoundID = LOWORD(v3->sound_id); | |
0 | 7063 a1.vPosition.x = *(short *)(v721 + 142); |
7064 a1.vPosition.y = *(short *)(v721 + 144); | |
7065 v732 = *(short *)(v721 + 138); | |
7066 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
|
7067 a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); |
486 | 7068 a1.Create(0, 0, 0, 0); |
0 | 7069 if ( *(char *)(v581 + 52) > amount ) |
488 | 7070 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7071 Actor::Resurrect((unsigned int)v577); |
0 | 7072 *(char *)(v581 + 61) = 0; |
7073 *(char *)(v581 + 53) = 0; | |
7074 *(char *)(v581 + 54) = 0; | |
7075 *(char *)(v581 + 55) = 0; | |
7076 *(char *)(v581 + 56) = 0; | |
7077 *(char *)(v581 + 57) = 0; | |
7078 *(int *)(v581 + 712) = 9999; | |
7079 *(char *)(v581 + 38) &= 0xF7u; | |
486 | 7080 *(int *)(v581 + 708) = 0; |
0 | 7081 ((SpellBuff *)(v581 + 356))->Reset(); |
7082 ((SpellBuff *)(v581 + 228))->Reset(); | |
7083 ((SpellBuff *)(v581 + 404))->Reset(); | |
7084 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7085 *(short *)(v581 + 40) = 10 * amount; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7086 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7087 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7088 |
0 | 7089 case 91: |
822 | 7090 v588 = v731 - 1; |
0 | 7091 amount = 16; |
7092 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7093 { | |
7094 if ( v590 == 1 ) | |
486 | 7095 LODWORD(v733) = 0; |
0 | 7096 } |
7097 else | |
7098 { | |
7099 LODWORD(v733) = 3600 * v2; | |
7100 } | |
7101 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7102 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7103 __debugbreak(); |
0 | 7104 HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; |
7105 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; | |
7106 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7107 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7108 || *(char *)(HIDWORD(v733) + 20) & 2 | |
486 | 7109 || *(int *)(HIDWORD(v733) + 12) != 0 |
7110 || *(int *)(HIDWORD(v733) + 4) != 0 | |
0 | 7111 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 |
377 | 7112 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) |
710 | 7113 { |
7114 dword_50C9D0 = 113; | |
7115 dword_50C9D4 = 0; | |
7116 dword_50C9D8 = 1; | |
7117 | |
7118 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7119 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
|
7120 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7121 goto LABEL_1166; |
710 | 7122 } |
0 | 7123 v592 = HIDWORD(v733); |
7124 v14 = v731 == 4; | |
7125 *(int *)(HIDWORD(v733) + 12) = 16; | |
7126 if ( !v14 ) | |
7127 { | |
7128 v732 = (int)v733 << 7; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7129 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
0 | 7130 *(int *)(v592 + 20) |= 8u; |
7131 } | |
7132 *(char *)(v592 + 20) |= 0x80u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7133 dword_50C9A8 = 256; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7134 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7135 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7136 |
0 | 7137 case 93: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7138 { |
822 | 7139 v593 = v731 - 2; |
0 | 7140 if ( !v593 ) |
7141 goto LABEL_1062; | |
7142 v594 = v593 - 1; | |
7143 if ( v594 ) | |
7144 { | |
7145 if ( v594 == 1 ) | |
7146 amount = 9; | |
7147 else | |
7148 LABEL_1062: | |
7149 amount = 5; | |
7150 } | |
7151 else | |
7152 { | |
7153 amount = 7; | |
7154 } | |
7155 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7156 goto play_sound_and_continue; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7157 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); |
0 | 7158 a1.stru_24.Reset(); |
822 | 7159 a1.spell_id = v3->spellnum; |
7160 a1.spell_level = v2; | |
7161 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7162 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
0 | 7163 a1.vPosition.x = pParty->vPosition.x; |
7164 a1.vPosition.y = pParty->vPosition.y; | |
486 | 7165 a1.uAttributes = 0; |
0 | 7166 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
7167 a1.uSectorID = pIndoor->GetSector( | |
7168 pParty->vPosition.x, | |
7169 pParty->vPosition.y, | |
7170 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
486 | 7171 a1.uSpriteFrameID = 0; |
823 | 7172 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7173 a1.spell_target_pid = a2; | |
0 | 7174 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
823 | 7175 a1.uSoundID = LOWORD(v3->sound_id); |
0 | 7176 if ( pParty->bTurnBasedModeOn == 1 ) |
7177 LOBYTE(a1.uAttributes) |= 4u; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7178 v596 = (signed int)_v726 / -2; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7179 y = (char *)((signed int)_v726 / 2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7180 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) |
0 | 7181 { |
7182 v597 = v715.uYawAngle; | |
7183 do | |
7184 { | |
7185 a1.uFacing = v596 + v597; | |
7186 if ( a1.Create( | |
7187 v596 + v597, | |
7188 v715.uPitchAngle, | |
7189 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
7190 v3->uPlayerID + 1) != -1 | |
7191 && pParty->bTurnBasedModeOn == 1 ) | |
7192 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7193 v596 += _v726 / (amount - 1); |
0 | 7194 } |
7195 while ( v596 <= (signed int)y ); | |
7196 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7197 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7198 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7199 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7200 |
0 | 7201 case 94: |
7202 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7203 goto play_sound_and_continue; |
0 | 7204 if ( v731 == 1 || v731 == 2 ) |
7205 { | |
7206 v598 = 180 * v2; | |
7207 goto LABEL_1081; | |
7208 } | |
7209 if ( v731 == 3 ) | |
7210 { | |
7211 v598 = 300 * v2; | |
7212 LABEL_1081: | |
7213 LODWORD(v733) = v598; | |
7214 goto LABEL_1082; | |
7215 } | |
7216 if ( v731 == 4 ) | |
7217 LODWORD(v733) = 29030400; | |
7218 LABEL_1082: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7219 if (PID_TYPE(a2) != OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7220 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7221 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7222 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7223 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7224 v730 = 836 * PID_ID(a2); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7225 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
|
7226 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7227 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) |
710 | 7228 { |
7229 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7230 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
|
7231 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7232 goto LABEL_1166; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7233 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7234 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7235 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7236 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
486 | 7237 v731, 0, 0, 0); |
0 | 7238 a1.stru_24.Reset(); |
822 | 7239 a1.spell_id = v3->spellnum; |
7240 a1.spell_level = v2; | |
7241 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7242 v60 = pObjectList->ObjectIDByItemID(a1.uType); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7243 v61 = PID_ID(a2); |
0 | 7244 LABEL_1086: |
90 | 7245 v600 = pActors[v61].vPosition.y; |
7246 v601 = pActors[v61].vPosition.x; | |
0 | 7247 a1.uObjectDescID = v60; |
7248 a1.vPosition.x = v601; | |
90 | 7249 v602 = pActors[v61].uActorHeight; |
7250 v603 = pActors[v61].vPosition.z; | |
0 | 7251 a1.vPosition.y = v600; |
7252 v676 = v603 + v602; | |
7253 v665 = v600; | |
7254 a1.vPosition.z = v603 + v602; | |
7255 v657 = v601; | |
7256 LABEL_1087: | |
486 | 7257 a1.uAttributes = 0; |
0 | 7258 a1.uSectorID = pIndoor->GetSector(v657, v665, v676); |
486 | 7259 a1.uSpriteFrameID = 0; |
823 | 7260 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7261 a1.spell_target_pid = a2; | |
0 | 7262 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
7263 a1.uFacing = LOWORD(v715.uYawAngle); | |
7264 LOBYTE(a1.uAttributes) |= 0x80u; | |
823 | 7265 a1.uSoundID = LOWORD(v3->sound_id); |
486 | 7266 a1.Create(0, 0, 0, v3->uPlayerID + 1); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7267 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7268 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7269 |
0 | 7270 case 96: |
7271 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7272 goto play_sound_and_continue; |
486 | 7273 HIDWORD(v733) = 0; |
521 | 7274 memset(&achievedAwardsIndex, 0, 4000); |
486 | 7275 _this = 0; |
0 | 7276 v605 = (char *)pParty->pHirelings; |
7277 do | |
7278 { | |
486 | 7279 if ( *(int *)v605) |
0 | 7280 { |
7281 v606 = HIDWORD(v733)++; | |
521 | 7282 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); |
0 | 7283 } |
7284 _this = (ItemGen *)((char *)_this + 1); | |
7285 v605 += 76; | |
7286 } | |
7287 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
486 | 7288 _this = 0; |
7289 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
0 | 7290 { |
7291 v730 = (int)pNPCStats->pNewNPCData; | |
7292 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7293 do | |
7294 { | |
7295 if ( *(char *)(v730 + 8) & 0x80 | |
486 | 7296 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) |
7297 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
0 | 7298 { |
7299 v607 = HIDWORD(v733); | |
7300 HIDWORD(v733) += 4; | |
7301 *(int *)v607 = (int)_this + 3; | |
7302 } | |
7303 _this = (ItemGen *)((char *)_this + 1); | |
7304 v730 += 76; | |
7305 } | |
7306 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7307 } | |
7308 v608 = v3->uPlayerID_2; | |
7309 if ( v608 != 4 && v608 != 5 | |
486 | 7310 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) |
0 | 7311 || v609 >= 3 ) |
710 | 7312 { |
7313 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7314 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
|
7315 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7316 goto LABEL_1166; |
710 | 7317 } |
0 | 7318 v610 = 76 * v609; |
486 | 7319 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; |
0 | 7320 v611 = pIconsFrameTable->FindIcon("spell96"); |
488 | 7321 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); |
0 | 7322 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; |
89 | 7323 v612 = pParty->pPlayers; |
0 | 7324 do |
7325 { | |
89 | 7326 v612->sHealth = v612->GetMaxHealth(); |
7327 v612->sMana = v612->GetMaxMana(); | |
7328 ++v612; | |
7329 } | |
7330 while ( v612 <= &pParty->pPlayers[3] ); | |
7331 v613 = &pOutdoor->ddm; | |
0 | 7332 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) |
89 | 7333 v613 = &pIndoor->dlv; |
7334 v613->uReputation += 15; | |
7335 if ( v613->uReputation > 10000 ) | |
7336 v613->uReputation = 10000; | |
488 | 7337 LODWORD(v727) = 1; |
7338 goto play_sound_and_continue; | |
0 | 7339 case 95: |
822 | 7340 if ( v731 <= 0 ) |
0 | 7341 goto LABEL_1119; |
822 | 7342 if ( v731 <= 3 ) |
0 | 7343 { |
7344 v614 = 300 * (v2 + 12); | |
7345 } | |
7346 else | |
7347 { | |
822 | 7348 if ( v731 != 4 ) |
0 | 7349 goto LABEL_1119; |
7350 v614 = 900 * (v2 + 4); | |
7351 } | |
7352 LODWORD(v733) = v614; | |
7353 LABEL_1119: | |
7354 v615 = v2 + 5; | |
7355 amount = v615; | |
7356 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
488 | 7357 goto play_sound_and_continue; |
0 | 7358 if ( v731 != 3 && v731 != 4 ) |
7359 { | |
488 | 7360 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); |
7361 | |
7362 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
|
7363 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7364 goto play_sound_and_continue; |
0 | 7365 } |
486 | 7366 a2 = 0; |
0 | 7367 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
112 | 7368 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; |
0 | 7369 do |
7370 { | |
488 | 7371 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); |
7372 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
0 | 7373 ++a2; |
112 | 7374 ++v619; |
7375 } | |
7376 while ( v619 <= &pParty->pPlayers[3] ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7377 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7378 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7379 |
0 | 7380 case 99: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7381 { |
0 | 7382 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 7383 goto play_sound_and_continue; |
0 | 7384 pGame->GetIndoorCamera(); |
871 | 7385 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); |
0 | 7386 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
|
7387 v707.x = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7388 v707.y = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7389 v707.z = 0; |
0 | 7390 a1.stru_24.Reset(); |
822 | 7391 a1.spell_id = v3->spellnum; |
7392 a1.spell_level = v2; | |
7393 a1.spell_skill = v731; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7394 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); |
486 | 7395 a1.uAttributes = 0; |
7396 a1.uSectorID = 0; | |
7397 a1.uSpriteFrameID = 0; | |
0 | 7398 a1.field_60_distance_related_prolly_lod = 0; |
486 | 7399 a1.uFacing = 0; |
823 | 7400 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); |
7401 a1.uSoundID = LOWORD(v3->sound_id); | |
486 | 7402 a2 = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7403 int _v726 = 0; |
486 | 7404 if ( SHIDWORD(v733) > 0 ) |
0 | 7405 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7406 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); |
0 | 7407 do |
7408 { | |
7409 v625 = dword_50BF30[a2]; | |
7410 a1.vPosition.x = pActors[v625].vPosition.x; | |
7411 a1.vPosition.y = pActors[v625].vPosition.y; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7412 //v732 = pActors[v625].uActorHeight; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7413 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
|
7414 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
486 | 7415 v627 = a1.Create(0, 0, 0, 0); |
0 | 7416 v628 = a2; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7417 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); |
0 | 7418 a2 = v628 + 1; |
7419 } | |
7420 while ( v628 + 1 < SHIDWORD(v733) ); | |
7421 } | |
486 | 7422 v730 = 0; |
0 | 7423 v629 = 1; |
7424 do | |
7425 { | |
7426 v630 = pPlayers[v629]; | |
7427 if ( !v630->pConditions[2] | |
7428 && !v630->pConditions[12] | |
7429 && !v630->pConditions[13] | |
7430 && !v630->pConditions[14] | |
7431 && !v630->pConditions[15] | |
7432 && !v630->pConditions[16] ) | |
7433 { | |
7434 v631 = v730++; | |
7435 v681[v631] = v629; | |
7436 } | |
7437 ++v629; | |
7438 } | |
7439 while ( v629 <= 4 ); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7440 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); |
486 | 7441 HIDWORD(v733) = 0; |
7442 if ( v730 > 0 ) | |
0 | 7443 { |
7444 do | |
7445 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7446 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7447 v726 = pPlayers[v681[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7448 //v633 = pPlayers[v681[HIDWORD(v733)]]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7449 v726->sHealth += v732; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7450 //v726 = *(Player **)v632; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7451 //v634 = v726->GetMaxHealth(); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7452 if ( v726->sHealth > v726->GetMaxHealth()) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7453 v726->sHealth = v726->GetMaxHealth(); |
0 | 7454 v635 = HIDWORD(v733); |
488 | 7455 |
7456 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); | |
0 | 7457 HIDWORD(v733) = v635 + 1; |
7458 } | |
7459 while ( v635 + 1 < v730 ); | |
7460 } | |
486 | 7461 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
|
7462 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7463 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7464 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7465 |
0 | 7466 case 98: |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7467 { |
0 | 7468 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7469 { | |
710 | 7470 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! |
7471 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
|
7472 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7473 goto LABEL_1166; |
0 | 7474 } |
822 | 7475 v640 = v731 - 2; |
0 | 7476 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) |
7477 amount = 3; | |
486 | 7478 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) |
710 | 7479 { |
7480 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7481 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
|
7482 v3->spellnum = 0; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7483 goto LABEL_1166; |
710 | 7484 } |
0 | 7485 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
488 | 7486 goto play_sound_and_continue; |
349 | 7487 pParty->armageddon_timer = 256; |
0 | 7488 pParty->field_16140 = v2; |
7489 ++pPlayer->uNumArmageddonCasts; | |
7490 if ( pParty->bTurnBasedModeOn == 1 ) | |
7491 ++pTurnEngine->field_1C; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7492 auto _v726 = 50; |
0 | 7493 do |
7494 { | |
7495 v642 = rand() % 4096 - 2048; | |
7496 v643 = rand(); | |
7497 v721 = v642 + pParty->vPosition.x; | |
7498 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
486 | 7499 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); |
0 | 7500 v644 = rand(); |
486 | 7501 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
|
7502 --_v726; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7503 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7504 while ( _v726 != 0 ); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7505 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7506 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7507 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7508 |
0 | 7509 default: |
488 | 7510 goto play_sound_and_continue; |
0 | 7511 } |
7512 while ( 2 ) | |
7513 { | |
7514 if ( v731 == 4 ) | |
7515 { | |
7516 if ( *((_QWORD *)v222 + 2) ) | |
7517 { | |
486 | 7518 *((int *)v222 + 4) = 0; |
7519 *((int *)v222 + 5) = 0; | |
0 | 7520 goto LABEL_439; |
7521 } | |
7522 } | |
7523 else | |
7524 { | |
7525 v223 = ((Player *)v222)->DiscardConditionIfLastsLongerThan( | |
7526 2u, | |
7527 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
7528 v222 = (char *)HIDWORD(v733); | |
7529 if ( v223 ) | |
7530 LABEL_439: | |
486 | 7531 ((Player *)v222)->PlaySound(SPEECH_103, 0); |
0 | 7532 } |
7533 v222 += 6972; | |
7534 HIDWORD(v733) = (int)v222; | |
7535 if ( (signed int)v222 >= (signed int)pParty->pHirelings ) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7536 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7537 LODWORD(v727) = 1; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7538 goto play_sound_and_continue; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7539 } |
0 | 7540 continue; |
7541 } | |
7542 } | |
7543 //----- (0042EB42) -------------------------------------------------------- | |
7544 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
7545 { | |
7546 unsigned int v2; // edx@1 | |
7547 signed int v3; // eax@1 | |
7548 char *v4; // ecx@2 | |
7549 | |
7550 v2 = this->uNumObjects; | |
7551 v3 = 0; | |
7552 if ( (signed int)this->uNumObjects <= 0 ) | |
7553 { | |
7554 LABEL_5: | |
7555 LOWORD(v3) = 0; | |
7556 } | |
7557 else | |
7558 { | |
7559 v4 = (char *)&this->pObjects->uObjectID; | |
7560 while ( uItemID != *(short *)v4 ) | |
7561 { | |
7562 ++v3; | |
7563 v4 += 56; | |
7564 if ( v3 >= (signed int)v2 ) | |
7565 goto LABEL_5; | |
7566 } | |
7567 } | |
7568 return v3; | |
7569 } | |
7570 | |
7571 //----- (0042EB78) -------------------------------------------------------- | |
7572 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
7573 { | |
7574 return 8 * this->pIcons[uIconID].uAnimLength; | |
7575 } | |
7576 | |
437 | 7577 const wchar_t *UIMessage2String(UIMessageType msg) |
7578 { | |
7579 #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; | |
7580 static wchar_t b[256]; // bad for threads | |
7581 switch (msg) | |
7582 { | |
7583 CASE(UIMSG_SelectSpell) | |
7584 CASE(UIMSG_ChangeGameState) | |
7585 CASE(UIMSG_Attack) | |
7586 CASE(UIMSG_PlayArcomage) | |
7587 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
7588 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
7589 CASE(UIMSG_ShowCredits) | |
7590 CASE(UIMSG_ExitToWindows) | |
7591 CASE(UIMSG_PlayerCreationChangeName) | |
7592 CASE(UIMSG_PlayerCreationClickPlus) | |
7593 CASE(UIMSG_PlayerCreationClickMinus) | |
7594 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
7595 CASE(UIMSG_PlayerCreationSelectClass) | |
7596 CASE(UIMSG_PlayerCreationClickOK) | |
7597 CASE(UIMSG_PlayerCreationClickReset) | |
7598 CASE(UIMSG_AutonotesBook) | |
7599 CASE(UIMSG_PlayerCreationRemoveUpSkill) | |
7600 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
7601 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
7602 CASE(UIMSG_LoadGame) | |
7603 CASE(UIMSG_SaveGame) | |
7604 CASE(UIMSG_ShowStatus_DateTime) | |
7605 CASE(UIMSG_ShowStatus_ManaHP) | |
7606 CASE(UIMSG_ShowStatus_Player) | |
7607 CASE(UIMSG_Wait5Minutes) | |
7608 CASE(UIMSG_Wait1Hour) | |
7609 CASE(UIMSG_ShowStatus_Food) | |
7610 CASE(UIMSG_ShowStatus_Funds) | |
7611 CASE(UIMSG_QuickReference) | |
7612 CASE(UIMSG_GameMenuButton) | |
7613 CASE(UIMSG_AlreadyResting) | |
7614 CASE(UIMSG_SelectCharacter) | |
7615 CASE(UIMSG_ChangeSoundVolume) | |
7616 CASE(UIMSG_ChangeMusicVolume) | |
7617 CASE(UIMSG_Escape) | |
7618 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
7619 CASE(UIMSG_InventoryLeftClick) | |
7620 CASE(UIMSG_SkillUp) | |
7621 CASE(UIMSG_GameMenu_ReturnToGame) | |
7622 CASE(UIMSG_StartNewGame) | |
7623 CASE(UIMSG_Game_OpenLoadGameDialog) | |
7624 CASE(UIMSG_Game_OpenSaveGameDialog) | |
7625 CASE(UIMSG_Game_OpenOptionsDialog) | |
7626 CASE(UIMSG_SetGraphicsMode) | |
7627 CASE(UIMSG_Quit) | |
7628 CASE(UIMSG_StartHireling1Dialogue) | |
7629 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 7630 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 7631 CASE(UIMSG_CastSpellFromBook) |
7632 CASE(UIMSG_PlayerCreation_VoicePrev) | |
7633 CASE(UIMSG_PlayerCreation_VoiceNext) | |
7634 CASE(UIMSG_StartNPCDialogue) | |
7635 CASE(UIMSG_ArrowUp) | |
7636 CASE(UIMSG_DownArrow) | |
7637 CASE(UIMSG_LoadSlot) | |
7638 CASE(UIMSG_SelectLoadSlot) | |
7639 CASE(UIMSG_Cancel) | |
7640 CASE(UIMSG_ExitRest) | |
7641 CASE(UIMSG_PlayerCreation_FacePrev) | |
7642 CASE(UIMSG_PlayerCreation_FaceNext) | |
7643 CASE(UIMSG_CycleCharacters) | |
7644 CASE(UIMSG_SetTurnSpeed) | |
7645 CASE(UIMSG_ToggleWalkSound) | |
7646 CASE(UIMSG_ChangeVoiceVolume) | |
7647 CASE(UIMSG_ToggleShowDamage) | |
7648 CASE(UIMSG_ScrollNPCPanel) | |
7649 CASE(UIMSG_ShowFinalWindow) | |
7650 CASE(UIMSG_OpenQuestBook) | |
7651 CASE(UIMSG_OpenAutonotes) | |
7652 CASE(UIMSG_OpenMapBook) | |
7653 CASE(UIMSG_OpenCalendar) | |
7654 CASE(UIMSG_OpenHistoryBook) | |
7655 CASE(UIMSG_ToggleAlwaysRun) | |
7656 CASE(UIMSG_ToggleFlipOnExit) | |
7657 CASE(UIMSG_Game_Action) | |
7658 CASE(UIMSG_OpenRestUI) | |
7659 CASE(UIMSG_TransitionUI_Confirm) | |
7660 CASE(UIMSG_OpenKeyMappingOptions) | |
7661 CASE(UIMSG_SelectKeyPage1) | |
7662 CASE(UIMSG_SelectKeyPage2) | |
7663 CASE(UIMSG_ResetKeyMapping) | |
7664 CASE(UIMSG_ChangeKeyButton) | |
7665 CASE(UIMSG_OpenVideoOptions) | |
7666 CASE(UIMSG_ToggleBloodsplats) | |
7667 CASE(UIMSG_ToggleColoredLights) | |
7668 CASE(UIMSG_ToggleTint) | |
7669 default: | |
7670 _swprintf(b, L"UIMSG_%03X", msg); return b; | |
7671 }; | |
7672 #undef CASE | |
7673 } | |
7674 | |
0 | 7675 //----- (0042EB8D) -------------------------------------------------------- |
437 | 7676 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 7677 { |
482 | 7678 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 7679 if (uNumMessages < 40) |
7680 { | |
437 | 7681 files[uNumMessages] = file; |
7682 lines[uNumMessages] = line; | |
7683 | |
0 | 7684 pMessages[uNumMessages].eType = msg; |
7685 pMessages[uNumMessages].param = param; | |
7686 pMessages[uNumMessages++].field_8 = a4; | |
7687 } | |
7688 } | |
7689 | |
7690 //----- (0042EBBE) -------------------------------------------------------- | |
7691 int __fastcall sub_42EBBE(int a1, int a2) | |
7692 { | |
7693 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
7694 } | |
7695 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
7696 | |
7697 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 7698 int stru193_math::Sin(int angle) |
0 | 7699 { |
323 | 7700 return Cos(angle - this->uIntegerHalfPi); |
0 | 7701 } |
7702 | |
7703 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 7704 void _42ECB5_PlayerAttacksActor() |
0 | 7705 { |
271 | 7706 //unsigned int v0; // ebx@1 |
7707 //Player *v1; // esi@1 | |
7708 //bool result; // eax@1 | |
295 | 7709 //int v3; // edi@2 |
271 | 7710 //unsigned int v4; // eax@7 |
0 | 7711 char *v5; // eax@8 |
271 | 7712 //int v6; // ecx@9 |
7713 //signed int v7; // eax@16 | |
295 | 7714 //Actor *v8; // edi@20 |
0 | 7715 unsigned int v9; // ecx@21 |
295 | 7716 //char *v10; // eax@26 |
0 | 7717 char *v11; // eax@26 |
7718 unsigned int v12; // eax@47 | |
295 | 7719 //char *v13; // eax@47 |
7720 //char *v14; // eax@47 | |
7721 //unsigned int v15; // ebx@54 | |
7722 //int v16; // [sp-10h] [bp-4Ch]@24 | |
7723 //int v17; // [sp-10h] [bp-4Ch]@44 | |
7724 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
7725 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
7726 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
7727 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
7728 //int v22; // [sp-4h] [bp-40h]@24 | |
7729 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 7730 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 7731 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 7732 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
7733 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 7734 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 7735 //unsigned int *v28b; |
295 | 7736 //int v29; // [sp+24h] [bp-18h]@16 |
7737 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 7738 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 7739 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 7740 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 7741 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 7742 |
271 | 7743 //v0 = uActiveCharacter; |
7744 //v27 = 6972 * uActiveCharacter; | |
7745 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
7746 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
7747 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
7748 if (!player->CanAct()) | |
7749 return; | |
7750 | |
7751 pStru277->_427D48(uActiveCharacter); | |
295 | 7752 //v3 = 0; |
271 | 7753 if (pParty->Invisible()) |
7754 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7755 | |
7756 //v31 = player->pEquipment.uBow; | |
7757 int bow_idx = player->pEquipment.uBow; | |
7758 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
7759 bow_idx = 0; | |
7760 | |
295 | 7761 //v32 = 0; |
7762 int wand_item_id = 0; | |
271 | 7763 //v33 = 0; |
7764 //v4 = v1->pEquipment.uMainHand; | |
7765 int laser_weapon_item_id = 0; | |
7766 | |
7767 int main_hand_idx = player->pEquipment.uMainHand; | |
7768 if (main_hand_idx) | |
0 | 7769 { |
271 | 7770 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 7771 //v5 = (char *)v1 + 36 * v4; |
271 | 7772 if (!item->Broken()) |
7773 { | |
7774 //v28b = &v1->pInventoryItems[v4].uItemID; | |
7775 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 7776 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 7777 { |
295 | 7778 if (item->uNumCharges <= 0) |
7779 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 7780 else |
295 | 7781 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 7782 } |
271 | 7783 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
7784 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 7785 } |
271 | 7786 } |
7787 | |
295 | 7788 //v30 = 0; |
7789 //v29 = 0; | |
7790 //v28 = 0; | |
271 | 7791 //v7 = pMouse->uPointingObjectID; |
7792 | |
7793 int target_pid = pMouse->uPointingObjectID; | |
848 | 7794 int target_type = PID_TYPE(target_pid), |
7795 target_id = PID_ID(target_pid); | |
271 | 7796 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
7797 { | |
7798 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 7799 target_type = PID_TYPE(target_pid); |
7800 target_id = PID_ID(target_pid); | |
271 | 7801 } |
295 | 7802 |
7803 auto actor = &pActors[target_id]; | |
7804 int actor_distance = 0; | |
271 | 7805 if (target_type == OBJECT_Actor) |
7806 { | |
295 | 7807 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
7808 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
7809 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
7810 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
7811 if (actor_distance < 0) | |
7812 actor_distance = 0; | |
7813 } | |
7814 | |
7815 bool shooting_bow = false, | |
7816 shotting_laser = false, | |
816 | 7817 shooting_wand = false, |
7818 melee_attack = false; | |
295 | 7819 if (laser_weapon_item_id) |
7820 { | |
7821 shotting_laser = true; | |
490 | 7822 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 7823 } |
7824 else if (wand_item_id) | |
7825 { | |
7826 shooting_wand = true; | |
7827 | |
7828 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 7829 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 7830 |
7831 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
7832 player->pEquipment.uMainHand = 0; | |
7833 } | |
303 | 7834 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 7835 { |
816 | 7836 melee_attack = true; |
7837 | |
303 | 7838 Vec3_int_ a3; |
7839 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
7840 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
7841 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
7842 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
7843 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7844 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
305 | 7845 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, 1) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, 0)) |
295 | 7846 _42FA66_do_explosive_impact( |
7847 actor->vPosition.x, | |
7848 actor->vPosition.y, | |
7849 actor->vPosition.z + actor->uActorHeight / 2, | |
7850 0, 512, uActiveCharacter); | |
303 | 7851 } |
7852 else if (bow_idx) | |
7853 { | |
7854 shooting_bow = true; | |
490 | 7855 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 7856 } |
7857 else | |
7858 { | |
816 | 7859 melee_attack = true; |
303 | 7860 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
7861 } | |
7862 | |
816 | 7863 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 7864 { |
816 | 7865 int recovery = player->GetAttackRecoveryTime(false); |
303 | 7866 if (recovery < 30 ) |
7867 recovery = 30; | |
816 | 7868 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 7869 } |
7870 | |
7871 | |
7872 int v34 = 0; | |
7873 if (shooting_wand) | |
7874 return; | |
7875 else if (shooting_bow) | |
7876 { | |
7877 v34 = 5; | |
7878 player->PlaySound(SPEECH_50, 0); | |
7879 } | |
7880 if (shotting_laser) | |
7881 v34 = 7; | |
7882 else | |
7883 { | |
7884 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 7885 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 7886 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
7887 pTurnEngine->_40471C(); | |
7888 } | |
7889 | |
7890 switch (v34) | |
7891 { | |
7892 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
7893 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
7894 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
7895 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
7896 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
7897 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
7898 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
7899 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
7900 } | |
0 | 7901 } |
7902 | |
7903 //----- (0042F184) -------------------------------------------------------- | |
295 | 7904 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 7905 { |
7906 int v4; // edi@1 | |
7907 stru319 *v5; // esi@1 | |
7908 int v6; // eax@2 | |
7909 int v7; // eax@4 | |
7910 int result; // eax@5 | |
7911 int *v9; // edx@8 | |
7912 signed int v10; // ebx@10 | |
7913 int v11; // edi@11 | |
7914 Actor *v12; // esi@12 | |
7915 unsigned __int16 v13; // ax@12 | |
7916 int v14; // eax@22 | |
7917 char v15; // zf@30 | |
7918 int v16; // esi@32 | |
7919 int v17; // ecx@34 | |
7920 stru319 *v18; // eax@39 | |
7921 int v19; // edx@39 | |
7922 int v20; // ecx@41 | |
7923 unsigned __int16 v21; // ax@42 | |
7924 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
7925 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
7926 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
7927 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
7928 int *v26; // [sp+18h] [bp-14h]@8 | |
7929 int v27; // [sp+1Ch] [bp-10h]@10 | |
7930 int *v28; // [sp+20h] [bp-Ch]@10 | |
7931 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
7932 int v30; // [sp+28h] [bp-4h]@6 | |
7933 int i; // [sp+38h] [bp+Ch]@33 | |
7934 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
7935 | |
7936 v4 = 0; | |
7937 v5 = this; | |
7938 v24 = this; | |
7939 if ( pRenderer->pRenderD3D ) | |
7940 { | |
7941 v6 = a3 != 0; | |
7942 if ( a4 ) | |
7943 LOBYTE(v6) = v6 | 8; | |
295 | 7944 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 7945 if ( v7 != -1 ) |
7946 return (unsigned __int16)v7; | |
295 | 7947 else return 0; |
0 | 7948 } |
7949 else | |
7950 { | |
7951 v30 = 0; | |
7952 if ( pRenderer->pActiveZBuffer ) | |
7953 { | |
692 | 7954 v29 = viewparams->uScreen_topL_X; |
7955 v23 = viewparams->uScreen_BttmR_X; | |
7956 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 7957 { |
692 | 7958 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
7959 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
7960 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 7961 do |
7962 { | |
7963 if ( (signed int)v29 < (signed int)v23 ) | |
7964 { | |
7965 v28 = v9; | |
7966 v10 = v4; | |
7967 v27 = v23 - v29; | |
7968 do | |
7969 { | |
7970 v22 = *v28; | |
7971 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7972 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 7973 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7974 v12 = &pActors[PID_ID(v11)]; |
0 | 7975 v13 = v12->uAIState; |
7976 if ( v13 != 5 ) | |
7977 { | |
7978 if ( v13 != 4 | |
7979 && v13 != 11 | |
7980 && v13 != 19 | |
7981 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7982 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 7983 { |
7984 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 7985 && v22 <= pick_depth << 16 ) |
0 | 7986 { |
7987 v14 = 0; | |
7988 if ( v10 > 0 ) | |
7989 { | |
7990 do | |
7991 { | |
7992 if ( dword_50BDA0[v14] == v11 ) | |
7993 break; | |
7994 ++v14; | |
7995 } | |
7996 while ( v14 < v30 ); | |
7997 } | |
7998 if ( v14 == v30 && v10 < 100 ) | |
7999 { | |
8000 ++v30; | |
8001 dword_50BC10[v10] = v22; | |
8002 dword_50BDA0[v10] = v11; | |
8003 ++v10; | |
8004 } | |
8005 } | |
8006 } | |
8007 } | |
8008 } | |
8009 ++v28; | |
8010 --v27; | |
8011 } | |
8012 while ( v27 ); | |
8013 v4 = v30; | |
8014 v5 = v24; | |
8015 } | |
8016 v9 = v26 + 640; | |
8017 v15 = v25-- == 1; | |
8018 v26 += 640; | |
8019 } | |
8020 while ( !v15 ); | |
8021 } | |
8022 if ( v4 > 0 ) | |
8023 { | |
8024 v32 = 1; | |
8025 v16 = (int)dword_50BC10; | |
8026 do | |
8027 { | |
8028 for ( i = v32; i < v4; ++i ) | |
8029 { | |
8030 v17 = dword_50BC10[i]; | |
8031 if ( v17 < *(int *)v16 ) | |
8032 { | |
8033 dword_50BC10[i] = *(int *)v16; | |
8034 *(int *)v16 = v17; | |
8035 } | |
8036 } | |
8037 ++v32; | |
8038 v16 += 4; | |
8039 } | |
8040 while ( v32 - 1 < v4 ); | |
8041 v5 = v24; | |
8042 if ( v4 > 0 ) | |
8043 { | |
8044 v18 = v24; | |
8045 v19 = v4; | |
8046 do | |
8047 { | |
8048 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF; | |
8049 v18 += 4; | |
8050 --v19; | |
8051 } | |
8052 while ( v19 ); | |
8053 } | |
8054 } | |
8055 v20 = 0; | |
8056 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
8057 { | |
8058 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
8059 if ( v21 != 4 && v21 != 5 ) | |
8060 break; | |
8061 } | |
8062 if ( v20 != v4 ) | |
8063 { | |
8064 result = 8 * *(int *)&v5[4 * v20].field_0; | |
8065 LOBYTE(result) = result | 3; | |
8066 return result; | |
8067 } | |
8068 } | |
8069 } | |
8070 return 0; | |
8071 } | |
8072 | |
8073 //----- (0042F3D6) -------------------------------------------------------- | |
8074 void InitializeTurnBasedAnimations(void *_this) | |
8075 { | |
8076 unsigned int *v1; // edi@1 | |
8077 | |
8078 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
8079 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
8080 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
8081 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
8082 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
8083 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
8084 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
8085 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
8086 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
8087 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
8088 v1 = pIconIDs_Turn; | |
8089 do | |
8090 { | |
8091 pIconsFrameTable->InitializeAnimation(*v1); | |
8092 ++v1; | |
8093 } | |
8094 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
8095 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
8096 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
8097 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
8098 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
8099 } | |
8100 | |
8101 //----- (0042F4DA) -------------------------------------------------------- | |
8102 signed int __cdecl sub_42F4DA() | |
8103 { | |
8104 signed int v0; // edi@1 | |
82 | 8105 Actor *v1; // esi@4 |
0 | 8106 int v2; // ebx@5 |
8107 int v3; // eax@5 | |
8108 int v4; // ebx@5 | |
8109 unsigned int v5; // ecx@5 | |
8110 int v6; // edx@6 | |
8111 unsigned int v7; // edx@8 | |
8112 unsigned int v8; // edx@10 | |
8113 __int16 v9; // ax@12 | |
8114 signed int result; // eax@20 | |
8115 int v11; // [sp+Ch] [bp-10h]@5 | |
8116 int v12; // [sp+10h] [bp-Ch]@5 | |
8117 signed int v13; // [sp+14h] [bp-8h]@3 | |
8118 | |
8119 v0 = 5120; | |
8120 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
8121 v0 = 2560; | |
8122 v13 = 0; | |
8123 if ( (signed int)uNumActors <= 0 ) | |
8124 { | |
8125 LABEL_20: | |
8126 result = 0; | |
8127 } | |
8128 else | |
8129 { | |
82 | 8130 v1 = pActors; |
0 | 8131 while ( 1 ) |
8132 { | |
82 | 8133 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
8134 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
8135 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 8136 v3 = v2; |
8137 v4 = v11; | |
8138 v5 = v12; | |
8139 if ( v3 < v11 ) | |
8140 { | |
8141 v6 = v3; | |
8142 v3 = v11; | |
8143 v4 = v6; | |
8144 } | |
8145 if ( v3 < v12 ) | |
8146 { | |
8147 v7 = v3; | |
8148 v3 = v12; | |
8149 v5 = v7; | |
8150 } | |
8151 if ( v4 < (signed int)v5 ) | |
8152 { | |
8153 v8 = v5; | |
8154 v5 = v4; | |
8155 v4 = v8; | |
8156 } | |
8157 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
8158 { | |
82 | 8159 v9 = v1->uAIState; |
8160 if ( v1->uAIState != 5 ) | |
0 | 8161 { |
8162 if ( v9 != 4 | |
8163 && v9 != 11 | |
8164 && v9 != 19 | |
8165 && v9 != 17 | |
82 | 8166 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 8167 break; |
8168 } | |
8169 } | |
8170 ++v13; | |
82 | 8171 ++v1; |
0 | 8172 if ( v13 >= (signed int)uNumActors ) |
8173 goto LABEL_20; | |
8174 } | |
8175 result = 1; | |
8176 } | |
8177 return result; | |
8178 } | |
8179 | |
8180 //----- (0042F7EB) -------------------------------------------------------- | |
8181 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) | |
8182 { | |
8183 unsigned int v9; // edi@1 | |
8184 signed int v10; // edx@3 | |
8185 char *v11; // ecx@4 | |
8186 unsigned __int16 v12; // ax@7 | |
8187 unsigned int v13; // edx@9 | |
8188 char *v14; // ecx@10 | |
8189 int v15; // esi@17 | |
8190 int v16; // eax@18 | |
8191 int v17; // edi@20 | |
8192 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8193 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 8194 int v21; // [sp+7Ch] [bp-8h]@1 |
8195 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
8196 | |
8197 v9 = uSpriteID; | |
8198 v21 = x; | |
8199 v22 = uSpriteID; | |
8200 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8201 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
|
8202 //SpriteObject::SpriteObject(&a1a); |
0 | 8203 a1a.stru_24.Reset(); |
8204 | |
8205 if ( a9 ) | |
8206 { | |
8207 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
8208 v9 = v22; | |
8209 } | |
8210 v10 = 0; | |
822 | 8211 a1a.spell_skill = 0; |
8212 a1a.spell_level = 0; | |
8213 a1a.spell_id = 0; | |
0 | 8214 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8215 a1a.uType = v9; |
0 | 8216 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8217 { | |
8218 LABEL_7: | |
8219 v12 = 0; | |
8220 } | |
8221 else | |
8222 { | |
8223 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
8224 while ( (short)v9 != *(short *)v11 ) | |
8225 { | |
8226 ++v10; | |
8227 v11 += 56; | |
8228 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
8229 goto LABEL_7; | |
8230 } | |
8231 v12 = v10; | |
8232 } | |
8233 a1a.uObjectDescID = v12; | |
8234 a1a.vPosition.z = z; | |
8235 a1a.vPosition.x = v21; | |
8236 a1a.vPosition.y = y; | |
8237 a1a.uSoundID = 0; | |
8238 a1a.uAttributes = attributes; | |
8239 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
8240 a1a.uSpriteFrameID = 0; | |
822 | 8241 a1a.spell_caster_pid = 0; |
823 | 8242 a1a.spell_target_pid = 0; |
0 | 8243 if ( !(a1a.uAttributes & 0x10) ) |
8244 { | |
8245 v13 = 0; | |
222 | 8246 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 8247 { |
8248 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
8249 while ( *(short *)v14 != v9 ) | |
8250 { | |
8251 ++v13; | |
8252 v14 += 48; | |
222 | 8253 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 8254 goto LABEL_16; |
8255 } | |
8256 a1a.stru_24.uItemID = v13; | |
8257 } | |
8258 } | |
8259 LABEL_16: | |
8260 if ( a7 ) | |
8261 { | |
8262 v15 = count; | |
8263 if ( count > 0 ) | |
8264 { | |
8265 do | |
8266 { | |
8267 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
8268 v16 = rand(); | |
8269 a1a.Create( | |
8270 (signed __int16)a1a.uFacing, | |
8271 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
8272 a4, | |
8273 0); | |
8274 --v15; | |
8275 } | |
8276 while ( v15 ); | |
8277 } | |
8278 } | |
8279 else | |
8280 { | |
8281 v17 = count; | |
8282 v18 = stru_5C6E00->uIntegerHalfPi; | |
8283 a1a.uFacing = 0; | |
8284 if ( count > 0 ) | |
8285 { | |
8286 do | |
8287 { | |
8288 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
8289 --v17; | |
8290 } | |
8291 while ( v17 ); | |
8292 } | |
8293 } | |
8294 return 1; | |
8295 } | |
8296 | |
8297 //----- (0042F960) -------------------------------------------------------- | |
8298 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
8299 { | |
8300 int v3; // ebx@1 | |
8301 int v4; // edi@1 | |
8302 signed int v5; // edx@1 | |
8303 char *v6; // ecx@2 | |
8304 unsigned __int16 v7; // ax@5 | |
8305 signed int v8; // eax@6 | |
8306 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8307 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 8308 |
8309 v3 = x; | |
8310 v4 = y; | |
8311 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8312 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
|
8313 //SpriteObject::SpriteObject(&a1); |
0 | 8314 a1.stru_24.Reset(); |
8315 | |
8316 v5 = 0; | |
822 | 8317 a1.spell_skill = 0; |
8318 a1.spell_level = 0; | |
8319 a1.spell_id = 0; | |
0 | 8320 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8321 a1.uType = 800; |
0 | 8322 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
8323 { | |
8324 LABEL_5: | |
8325 v7 = 0; | |
8326 } | |
8327 else | |
8328 { | |
8329 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
8330 while ( *(short *)v6 != 800 ) | |
8331 { | |
8332 ++v5; | |
8333 v6 += 56; | |
8334 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
8335 goto LABEL_5; | |
8336 } | |
8337 v7 = v5; | |
8338 } | |
8339 a1.uObjectDescID = v7; | |
8340 a1.vPosition.x = v3; | |
8341 a1.vPosition.y = v4; | |
8342 a1.vPosition.z = z; | |
8343 a1.uSoundID = 0; | |
8344 a1.uAttributes = 0; | |
8345 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
8346 a1.uSpriteFrameID = 0; | |
822 | 8347 a1.spell_caster_pid = 0; |
823 | 8348 a1.spell_target_pid = 0; |
0 | 8349 v8 = a1.Create(0, 0, 0, 0); |
8350 if ( v8 != -1 ) | |
8351 { | |
8352 v9 = 8 * v8; | |
8353 LOBYTE(v9) = v9 | 2; | |
8354 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
8355 } | |
8356 } | |
8357 | |
810 | 8358 |
0 | 8359 |
8360 //----- (0042FA66) -------------------------------------------------------- | |
8361 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
8362 { | |
8363 int v6; // edi@1 | |
8364 int v7; // esi@1 | |
8365 char *v8; // ecx@2 | |
8366 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8367 //int v10; // eax@10 |
0 | 8368 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8369 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8370 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 8371 int v14; // [sp+7Ch] [bp-4h]@1 |
8372 | |
8373 v6 = a1; | |
8374 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8375 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
|
8376 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8377 a1a.uType = 600; |
0 | 8378 a1a.stru_24.Reset(); |
8379 | |
822 | 8380 a1a.spell_id = SPELL_FIRE_FIREBALL; |
8381 a1a.spell_level = 8; | |
8382 a1a.spell_skill = 3; | |
0 | 8383 v14 = 0; |
8384 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
8385 { | |
8386 LABEL_5: | |
8387 v9 = 0; | |
8388 } | |
8389 else | |
8390 { | |
8391 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
8392 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 8393 { |
8394 ++v14; | |
8395 v8 += 56; | |
8396 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
8397 goto LABEL_5; | |
8398 } | |
8399 v9 = v14; | |
8400 } | |
8401 a1a.uObjectDescID = v9; | |
8402 a1a.vPosition.x = v6; | |
8403 a1a.vPosition.y = v7; | |
8404 a1a.vPosition.z = a3; | |
8405 a1a.uAttributes = 0; | |
8406 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
8407 a1a.uSpriteFrameID = 0; | |
823 | 8408 a1a.spell_target_pid = 0; |
0 | 8409 a1a.field_60_distance_related_prolly_lod = 0; |
8410 a1a.uFacing = 0; | |
8411 a1a.uSoundID = 0; | |
8412 if ( a6 >= 1 || a6 <= 4 ) | |
8413 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8414 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 8415 } |
8416 else | |
8417 { | |
822 | 8418 a1a.spell_caster_pid = 0; |
0 | 8419 } |
8420 result = a1a.Create(0, 0, 0, 0); | |
8421 if ( result != -1 ) | |
8422 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8423 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 8424 a5, |
8425 SLOWORD(a1a.vPosition.x), | |
8426 SLOWORD(a1a.vPosition.y), | |
8427 SLOWORD(a1a.vPosition.z), | |
8428 0, | |
8429 0); | |
8430 } | |
8431 return result; | |
8432 } | |
8433 | |
8434 //----- (0042FB5C) -------------------------------------------------------- | |
8435 bool __fastcall sub_42FB5C(signed int a1) | |
8436 { | |
8437 int v1; // ecx@3 | |
8438 int v2; // ecx@4 | |
8439 int v3; // ecx@5 | |
8440 int v4; // ecx@6 | |
8441 int v5; // ecx@7 | |
8442 int v6; // ecx@8 | |
8443 char v7; // zf@9 | |
8444 | |
8445 if ( a1 > 39 ) | |
8446 { | |
8447 if ( a1 > 77 ) | |
8448 { | |
8449 if ( a1 == 80 ) | |
8450 return 0; | |
8451 if ( a1 > 84 ) | |
8452 { | |
8453 if ( a1 <= 86 ) | |
8454 return 0; | |
8455 v7 = a1 == 95; | |
8456 goto LABEL_20; | |
8457 } | |
8458 } | |
8459 else | |
8460 { | |
8461 if ( a1 == 77 ) | |
8462 return 0; | |
8463 if ( a1 >= 46 ) | |
8464 { | |
8465 if ( a1 <= 47 || a1 == 51 ) | |
8466 return 0; | |
8467 v7 = a1 == 73; | |
8468 goto LABEL_20; | |
8469 } | |
8470 } | |
8471 return 1; | |
8472 } | |
8473 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
8474 return 1; | |
8475 v2 = v1 - 3; | |
8476 if ( !v2 ) | |
8477 return 0; | |
8478 v3 = v2 - 1; | |
8479 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
8480 return 1; | |
8481 v5 = v4 - 8; | |
8482 if ( !v5 ) | |
8483 return 0; | |
8484 v6 = v5 - 1; | |
8485 if ( !v6 ) | |
8486 return 1; | |
8487 v7 = v6 == 20; | |
8488 LABEL_20: | |
8489 if ( !v7 ) | |
8490 return 1; | |
8491 return 0; | |
8492 } | |
8493 | |
8494 //----- (0042FBDD) -------------------------------------------------------- | |
8495 void __cdecl sub_42FBDD() | |
8496 { | |
388 | 8497 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 8498 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
8499 pRenderer->Present(); | |
8500 } | |
8501 | |
8502 //----- (0042FC15) -------------------------------------------------------- | |
11 | 8503 void __cdecl CloseWindowBackground() |
0 | 8504 { |
388 | 8505 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 8506 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
8507 pRenderer->Present(); | |
8508 } | |
8509 | |
8510 //----- (0042FC4E) -------------------------------------------------------- | |
8511 void __cdecl ProcessInputActions() | |
8512 { | |
8513 ActionQueue *pActionQueue; // esi@7 | |
832 | 8514 //Keyboard *v3; // ecx@8 |
0 | 8515 char v4; // al@9 |
8516 ActionQueue *v5; // ecx@19 | |
8517 Player *v6; // ecx@86 | |
8518 Player *v7; // esi@100 | |
8519 char v8; // bl@100 | |
8520 unsigned __int16 v9; // ax@102 | |
8521 int v10; // eax@103 | |
8522 unsigned int v11; // eax@127 | |
8523 signed int v12; // esi@157 | |
8524 Keyboard *v13; // ecx@158 | |
8525 char v14; // al@159 | |
8526 unsigned int v15; // eax@168 | |
8527 void *v16; // esi@177 | |
8528 int v17; // [sp-14h] [bp-1Ch]@8 | |
8529 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
8530 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 | |
271 | 8531 //__int16 v20; // [sp-14h] [bp-1Ch]@60 |
0 | 8532 int v21; // [sp-14h] [bp-1Ch]@68 |
8533 int v22; // [sp-Ch] [bp-14h]@158 | |
8534 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
8535 int v24; // [sp+4h] [bp-4h]@87 | |
8536 | |
8537 pGame->pKeyboardInstance->EnterCriticalSection(); | |
8538 auto pKeyboard = pGame->pKeyboardInstance; | |
8539 if (!bAlwaysRun) | |
8540 { | |
8541 if (pKeyboard->IsShiftHeld()) | |
8542 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8543 else | |
8544 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8545 } | |
8546 else | |
8547 { | |
8548 if (pKeyboard->IsShiftHeld()) | |
8549 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
8550 else | |
8551 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
8552 } | |
8553 | |
140 | 8554 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
486 | 8555 //LABEL_6: |
0 | 8556 if ( !pEventTimer->bPaused ) |
8557 { | |
8558 inputAction = (InputAction)0; | |
8559 pActionQueue = pPartyActionQueue; | |
8560 while ( 1 ) | |
8561 { | |
8562 v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; | |
8563 if ( pKeyActionMap->pToggleTypes[inputAction] ) | |
832 | 8564 v4 = pKeyboard->WasKeyPressed(v17); |
0 | 8565 else |
832 | 8566 v4 = pKeyboard->IsKeyBeingHeld(v17); |
0 | 8567 if ( v4 ) |
8568 { | |
8569 switch ( inputAction ) | |
8570 { | |
8571 case INPUT_MoveForward: | |
271 | 8572 if (pCurrentScreen != SCREEN_GAME) |
0 | 8573 break; |
8574 if (!pParty->bTurnBasedModeOn) | |
163 | 8575 //goto _do_move_forward; |
0 | 8576 { |
8577 v5 = pActionQueue; | |
140 | 8578 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 8579 partyAction = PARTY_RunForward; |
8580 else | |
8581 partyAction = PARTY_WalkForward; | |
163 | 8582 //goto _add_action_and_continue; |
8583 v5->Add(partyAction); | |
8584 break; | |
8585 } | |
8586 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
8587 { | |
8588 pTurnEngine->uActionPointsLeft -= 26; | |
8589 //_do_move_forward: | |
8590 v5 = pActionQueue; | |
8591 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
8592 partyAction = PARTY_RunForward; | |
8593 else | |
8594 partyAction = PARTY_WalkForward; | |
8595 //goto _add_action_and_continue; | |
8596 v5->Add(partyAction); | |
8597 break; | |
0 | 8598 } |
8599 break; | |
8600 case INPUT_MoveBackwards: | |
17 | 8601 //__debugbreak(); |
271 | 8602 if (pCurrentScreen != SCREEN_GAME) |
0 | 8603 break; |
8604 if (!pParty->bTurnBasedModeOn) | |
17 | 8605 //goto _do_move_backwards; |
8606 { | |
8607 v5 = pActionQueue; | |
8608 if ( pParty->uFlags2 & 2 ) | |
8609 partyAction = PARTY_RunBackward; | |
8610 else | |
8611 partyAction = PARTY_WalkBackward; | |
163 | 8612 //goto _add_action_and_continue; |
8613 v5->Add(partyAction); | |
8614 break; | |
17 | 8615 } |
0 | 8616 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
8617 { | |
8618 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8619 //_do_move_backwards: |
0 | 8620 v5 = pActionQueue; |
8621 if ( pParty->uFlags2 & 2 ) | |
8622 partyAction = PARTY_RunBackward; | |
8623 else | |
8624 partyAction = PARTY_WalkBackward; | |
163 | 8625 //goto _add_action_and_continue; |
8626 v5->Add(partyAction); | |
8627 break; | |
0 | 8628 } |
8629 break; | |
8630 case INPUT_StrafeLeft: | |
17 | 8631 //__debugbreak(); |
271 | 8632 if (pCurrentScreen != SCREEN_GAME) |
0 | 8633 break; |
8634 if (!pParty->bTurnBasedModeOn) | |
17 | 8635 //goto _do_strafe_left; |
8636 { | |
8637 partyAction = PARTY_StrafeLeft; | |
163 | 8638 //goto _add_action_and_continue_; |
8639 v5 = pActionQueue; | |
8640 v5->Add(partyAction); | |
8641 break; | |
17 | 8642 } |
0 | 8643 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8644 break; | |
8645 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8646 //_do_strafe_left: |
0 | 8647 partyAction = PARTY_StrafeLeft; |
163 | 8648 //goto _add_action_and_continue_; |
8649 v5 = pActionQueue; | |
8650 v5->Add(partyAction); | |
8651 break; | |
0 | 8652 case INPUT_StrafeRight: |
17 | 8653 //__debugbreak(); |
271 | 8654 if (pCurrentScreen != SCREEN_GAME) |
0 | 8655 break; |
8656 if (!pParty->bTurnBasedModeOn) | |
17 | 8657 //goto _do_strafe_right; |
8658 { | |
8659 partyAction = PARTY_StrafeRight; | |
163 | 8660 //goto _add_action_and_continue_; |
8661 v5 = pActionQueue; | |
8662 v5->Add(partyAction); | |
8663 break; | |
17 | 8664 } |
0 | 8665 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
8666 break; | |
8667 pTurnEngine->uActionPointsLeft -= 26; | |
17 | 8668 //_do_strafe_right: |
0 | 8669 partyAction = PARTY_StrafeRight; |
163 | 8670 //goto _add_action_and_continue_; |
8671 v5 = pActionQueue; | |
8672 v5->Add(partyAction); | |
8673 break; | |
0 | 8674 case INPUT_TurnLeft: |
271 | 8675 if (pCurrentScreen != SCREEN_GAME) |
0 | 8676 break; |
8677 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
8678 { | |
8679 if (pParty->bTurnBasedModeOn) | |
8680 { | |
8681 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
8682 break; | |
8683 pTurnEngine->uActionPointsLeft -= 26; | |
8684 } | |
8685 partyAction_ = PARTY_StrafeLeft; | |
8686 } | |
8687 else | |
8688 { | |
8689 if ( pParty->uFlags2 & 2 ) | |
8690 partyAction_ = PARTY_FastTurnLeft; | |
8691 else | |
8692 partyAction_ = PARTY_TurnLeft; | |
8693 } | |
8694 pActionQueue->Add(partyAction_); | |
8695 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8696 { | |
271 | 8697 pWeather->OnPlayerTurn(10); |
0 | 8698 } |
8699 break; | |
8700 case INPUT_TurnRight: | |
271 | 8701 if (pCurrentScreen != SCREEN_GAME) |
0 | 8702 break; |
8703 if ( GetAsyncKeyState(17) ) // 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 } | |
271 | 8711 v21 = PARTY_StrafeRight; |
0 | 8712 } |
8713 else | |
8714 { | |
8715 if ( pParty->uFlags2 & 2 ) | |
271 | 8716 v21 = PARTY_FastTurnRight; |
0 | 8717 else |
271 | 8718 v21 = PARTY_TurnRight; |
0 | 8719 } |
8720 pActionQueue->Add((PartyAction)v21); | |
8721 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) | |
8722 { | |
271 | 8723 pWeather->OnPlayerTurn(-10); |
0 | 8724 } |
8725 break; | |
8726 case INPUT_Jump: | |
17 | 8727 //__debugbreak(); |
271 | 8728 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 8729 break; |
8730 partyAction = (PartyAction)12; | |
163 | 8731 //goto _add_action_and_continue_; |
8732 v5 = pActionQueue; | |
8733 v5->Add(partyAction); | |
8734 break; | |
0 | 8735 case INPUT_Yell: |
187 | 8736 if (!pCurrentScreen && uActiveCharacter) |
0 | 8737 { |
8738 pParty->Yell(); | |
187 | 8739 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 8740 } |
187 | 8741 break; |
0 | 8742 case INPUT_Pass: |
17 | 8743 //__debugbreak(); |
0 | 8744 if ( pCurrentScreen ) |
8745 break; | |
8746 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8747 //goto LABEL_118; |
8748 { | |
8749 pTurnEngine->field_18 |= 8u; | |
8750 break; | |
8751 } | |
0 | 8752 if ( uActiveCharacter ) |
8753 { | |
8754 v6 = pPlayers[uActiveCharacter]; | |
8755 if ( !v6->uTimeToRecovery ) | |
8756 { | |
816 | 8757 v24 = v6->GetAttackRecoveryTime(false); |
0 | 8758 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8759 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
0 | 8760 pStru277->_427D48(uActiveCharacter); |
8761 pTurnEngine->_40471C(); | |
8762 } | |
8763 } | |
8764 break; | |
8765 case INPUT_Combat: | |
17 | 8766 //__debugbreak(); |
271 | 8767 if (pCurrentScreen == SCREEN_GAME) |
0 | 8768 { |
8769 if (pParty->bTurnBasedModeOn) | |
8770 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
8771 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 8772 { |
8773 pParty->bTurnBasedModeOn = 0; | |
8774 pTurnEngine->End(true); | |
8775 } | |
8776 } | |
8777 else | |
8778 { | |
8779 pTurnEngine->Start(); | |
8780 pParty->bTurnBasedModeOn = true; | |
8781 } | |
8782 } | |
8783 break; | |
8784 case INPUT_CastReady: | |
17 | 8785 //__debugbreak(); |
271 | 8786 if (pCurrentScreen != SCREEN_GAME) |
0 | 8787 break; |
8788 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 8789 //goto LABEL_118; |
8790 { | |
8791 pTurnEngine->field_18 |= 8u; | |
8792 break; | |
8793 } | |
0 | 8794 if ( !uActiveCharacter ) |
8795 break; | |
8796 v7 = pPlayers[uActiveCharacter]; | |
8797 v8 = v7->uQuickSpell; | |
8798 if ( !v8 | |
8799 || bUnderwater | |
8800 || ((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)), | |
8801 v10 > v7->sMana) ) | |
8802 { | |
8803 pActionQueue = pPartyActionQueue; | |
8804 LABEL_120: | |
437 | 8805 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
8806 break; | |
8807 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8808 { |
271 | 8809 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; |
163 | 8810 //goto _send_message; |
8811 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8812 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8813 ++pMessageQueue_50CBD0->uNumMessages; | |
8814 break; | |
437 | 8815 }*/ |
0 | 8816 } |
8817 else | |
8818 { | |
8819 pActionQueue = pPartyActionQueue; | |
8820 if ( dword_50C9E8 < 40 ) | |
8821 { | |
8822 dword_50C9EC[3 * dword_50C9E8] = 25; | |
437 | 8823 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8824 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8825 ++dword_50C9E8; |
8826 } | |
8827 } | |
8828 break; | |
8829 case INPUT_Attack: | |
17 | 8830 //__debugbreak(); |
271 | 8831 if (pCurrentScreen != SCREEN_GAME) |
0 | 8832 break; |
8833 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) | |
8834 goto LABEL_120; | |
17 | 8835 //LABEL_118: |
0 | 8836 pTurnEngine->field_18 |= 8u; |
8837 break; | |
8838 case INPUT_EventTrigger: | |
271 | 8839 if (pCurrentScreen == SCREEN_GAME) |
0 | 8840 { |
437 | 8841 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8842 break; |
271 | 8843 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; |
163 | 8844 //goto _send_message; |
8845 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8846 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8847 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8848 break;*/ |
8849 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
163 | 8850 break; |
0 | 8851 } |
151 | 8852 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 8853 { |
8854 v11 = pMessageQueue_50CBD0->uNumMessages; | |
8855 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8856 { | |
437 | 8857 v11 = 0; |
8858 pMessageQueue_50CBD0->uNumMessages = 0; | |
0 | 8859 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
8860 { | |
8861 v11 = 1; | |
8862 pMessageQueue_50CBD0->uNumMessages = 1; | |
163 | 8863 //LABEL_132: |
271 | 8864 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8865 //_send_message: |
0 | 8866 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8867 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8868 ++pMessageQueue_50CBD0->uNumMessages; | |
8869 break; | |
8870 } | |
437 | 8871 break; |
0 | 8872 } |
437 | 8873 /*if ( (signed int)v11 < 40 ) |
163 | 8874 //goto LABEL_132; |
8875 { | |
271 | 8876 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; |
163 | 8877 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
8878 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8879 ++pMessageQueue_50CBD0->uNumMessages; | |
8880 break; | |
437 | 8881 }*/ |
8882 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 8883 } |
8884 break; | |
8885 case INPUT_CharCycle: | |
17 | 8886 //__debugbreak(); |
151 | 8887 if ( pCurrentScreen == SCREEN_SPELL_BOOK |
0 | 8888 || dword_50C9E8 >= 40 ) |
8889 break; | |
8890 dword_50C9EC[3 * dword_50C9E8] = 176; | |
163 | 8891 //goto LABEL_155; |
437 | 8892 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8893 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8894 ++dword_50C9E8; |
8895 break; | |
0 | 8896 case INPUT_LookUp: |
17 | 8897 //__debugbreak(); |
0 | 8898 if ( pEventTimer->bPaused ) |
8899 break; | |
8900 partyAction = (PartyAction)7; | |
163 | 8901 //goto _add_action_and_continue_; |
8902 v5 = pActionQueue; | |
8903 v5->Add(partyAction); | |
8904 break; | |
0 | 8905 case INPUT_CenterView: |
17 | 8906 //__debugbreak(); |
0 | 8907 if ( pEventTimer->bPaused ) |
8908 break; | |
8909 partyAction = (PartyAction)9; | |
163 | 8910 //goto _add_action_and_continue_; |
8911 v5 = pActionQueue; | |
8912 v5->Add(partyAction); | |
8913 break; | |
0 | 8914 case INPUT_LookDown: |
17 | 8915 //__debugbreak(); |
0 | 8916 if ( pEventTimer->bPaused ) |
8917 break; | |
8918 partyAction = (PartyAction)8; | |
163 | 8919 //goto _add_action_and_continue_; |
8920 v5 = pActionQueue; | |
8921 v5->Add(partyAction); | |
8922 break; | |
0 | 8923 case INPUT_FlyUp: |
17 | 8924 //__debugbreak(); |
0 | 8925 if ( pCurrentScreen |
8926 || pEventTimer->bPaused ) | |
8927 break; | |
8928 partyAction = (PartyAction)13; | |
163 | 8929 //goto _add_action_and_continue_; |
8930 v5 = pActionQueue; | |
8931 v5->Add(partyAction); | |
8932 break; | |
0 | 8933 case INPUT_Land: |
17 | 8934 //__debugbreak(); |
0 | 8935 if ( pCurrentScreen |
8936 || pEventTimer->bPaused ) | |
8937 break; | |
8938 partyAction = (PartyAction)15; | |
163 | 8939 //goto _add_action_and_continue_; |
8940 v5 = pActionQueue; | |
8941 v5->Add(partyAction); | |
8942 break; | |
0 | 8943 case INPUT_FlyDown: |
17 | 8944 //__debugbreak(); |
0 | 8945 if ( !pCurrentScreen |
8946 && !pEventTimer->bPaused ) | |
8947 { | |
8948 partyAction = (PartyAction)14; | |
163 | 8949 //_add_action_and_continue_: |
0 | 8950 v5 = pActionQueue; |
163 | 8951 //_add_action_and_continue: |
0 | 8952 v5->Add(partyAction); |
8953 } | |
8954 break; | |
8955 case INPUT_ZoomIn: | |
17 | 8956 //__debugbreak(); |
0 | 8957 if ( dword_50C9E8 >= 40 ) |
8958 break; | |
8959 dword_50C9EC[3 * dword_50C9E8] = 367; | |
163 | 8960 //goto LABEL_155; |
437 | 8961 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8962 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
163 | 8963 ++dword_50C9E8; |
8964 break; | |
0 | 8965 case INPUT_ZoomOut: |
17 | 8966 //__debugbreak(); |
0 | 8967 if ( dword_50C9E8 < 40 ) |
8968 { | |
8969 dword_50C9EC[3 * dword_50C9E8] = 368; | |
163 | 8970 //LABEL_155: |
437 | 8971 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
8972 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 8973 ++dword_50C9E8; |
8974 } | |
8975 break; | |
8976 case INPUT_AlwaysRun: | |
8977 bAlwaysRun = bAlwaysRun == 0; | |
8978 break; | |
17 | 8979 default: |
8980 //__debugbreak(); | |
8981 break; | |
0 | 8982 } |
8983 } | |
8984 inputAction = (InputAction)((int)inputAction + 1); | |
8985 if ( (signed int)inputAction >= 30 ) | |
8986 goto LABEL_176; | |
8987 } | |
8988 } | |
8989 v12 = 0; | |
8990 do | |
8991 { | |
8992 v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; | |
8993 v13 = pGame->pKeyboardInstance; | |
8994 if ( pKeyActionMap->pToggleTypes[v12] ) | |
8995 v14 = v13->WasKeyPressed(v22); | |
8996 else | |
8997 v14 = v13->IsKeyBeingHeld(v22); | |
8998 if ( v14 && v12 == 9 ) | |
8999 { | |
9000 if ( !pCurrentScreen ) | |
9001 { | |
437 | 9002 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9003 goto LABEL_175; |
9004 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; | |
17 | 9005 //goto LABEL_174; |
9006 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9007 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9008 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9009 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
17 | 9010 goto LABEL_175; |
0 | 9011 } |
151 | 9012 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE |
9013 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
0 | 9014 { |
9015 v15 = pMessageQueue_50CBD0->uNumMessages; | |
9016 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9017 { | |
9018 v15 = 0; | |
9019 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) | |
9020 { | |
9021 v15 = 1; | |
437 | 9022 pMessageQueue_50CBD0->uNumMessages = 0; |
17 | 9023 //goto LABEL_173; |
437 | 9024 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; |
17 | 9025 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9026 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9027 ++pMessageQueue_50CBD0->uNumMessages; | |
9028 goto LABEL_175; | |
0 | 9029 } |
9030 pMessageQueue_50CBD0->uNumMessages = 0; | |
9031 } | |
437 | 9032 /*if ( (signed int)v15 >= 40 ) |
0 | 9033 goto LABEL_175; |
17 | 9034 //LABEL_173: |
0 | 9035 pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; |
17 | 9036 //LABEL_174: |
0 | 9037 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9038 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 9039 ++pMessageQueue_50CBD0->uNumMessages;*/ |
9040 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 9041 goto LABEL_175; |
9042 } | |
9043 } | |
9044 LABEL_175: | |
9045 ++v12; | |
9046 } | |
9047 while ( v12 < 30 ); | |
9048 LABEL_176: | |
9049 if (pGame->pKeyboardInstance->bUsingAsynKeyboard) | |
9050 { | |
9051 AsyncKeyboard::LeaveCriticalSection(); | |
9052 v16 = pAsyncKeyboard; | |
9053 AsyncKeyboard::EnterCriticalSection(); | |
9054 memset((char *)v16 + 521, 0, 0x100u); | |
9055 AsyncKeyboard::LeaveCriticalSection(); | |
9056 } | |
9057 } |