Mercurial > mm7
annotate mm7_6.cpp @ 1216:de876af42e0d
removing ArcomageCard array
author | Grumpy7 |
---|---|
date | Sun, 09 Jun 2013 16:30:07 +0200 |
parents | 96a81634669e |
children | 1803172dffd9 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
0 | 5 #include "MM7.h" |
6 | |
1016 | 7 |
8 | |
9 #include "Sprites.h" | |
10 #include "BSPModel.h" | |
11 #include "OutdoorCamera.h" | |
12 #include "Mouse.h" | |
13 #include "Keyboard.h" | |
14 #include "stru6.h" | |
15 | |
16 #include "Vis.h" | |
0 | 17 #include "Game.h" |
18 #include "GUIWindow.h" | |
19 #include "GUIFont.h" | |
20 #include "Party.h" | |
21 #include "AudioPlayer.h" | |
22 #include "Outdoor.h" | |
23 #include "Overlays.h" | |
24 #include "LOD.h" | |
25 #include "Actor.h" | |
26 #include "Events.h" | |
27 #include "Viewport.h" | |
28 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
29 #include "SpriteObject.h" |
0 | 30 #include "ObjectList.h" |
31 #include "stru123.h" | |
32 #include "Time.h" | |
33 #include "IconFrameTable.h" | |
34 #include "Awards.h" | |
35 #include "TurnEngine.h" | |
924 | 36 #include "CastSpellInfo.h" |
0 | 37 #include "stru298.h" |
189 | 38 #include "texts.h" |
0 | 39 |
40 #include "mm7_data.h" | |
41 | |
42 | |
43 | |
44 //----- (00424EE0) -------------------------------------------------------- | |
45 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID) | |
46 { | |
47 unsigned int v1; // edx@1 | |
48 double v2; // st7@1 | |
49 signed int v3; // edi@1 | |
50 char *v4; // esi@4 | |
51 char *v5; // ecx@4 | |
52 unsigned int v6; // eax@4 | |
53 char *v7; // edx@4 | |
54 double v8; // st6@10 | |
55 double v9; // st5@10 | |
56 double v10; // st6@11 | |
57 unsigned __int8 v11; // c2@15 | |
58 unsigned __int8 v12; // c3@15 | |
59 void *v13; // edi@22 | |
60 char *v14; // eax@22 | |
61 double v15; // st6@22 | |
62 char *v16; // ecx@22 | |
63 signed int result; // eax@24 | |
64 unsigned int v18; // [sp+8h] [bp-2Ch]@4 | |
65 bool v19; // [sp+Ch] [bp-28h]@6 | |
66 char *v20; // [sp+10h] [bp-24h]@4 | |
67 char *v21; // [sp+14h] [bp-20h]@4 | |
68 signed int v22; // [sp+18h] [bp-1Ch]@1 | |
69 char *v23; // [sp+1Ch] [bp-18h]@4 | |
70 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4 | |
71 char *v25; // [sp+24h] [bp-10h]@4 | |
72 char *v26; // [sp+28h] [bp-Ch]@4 | |
73 char *v27; // [sp+2Ch] [bp-8h]@4 | |
74 char *v28; // [sp+30h] [bp-4h]@4 | |
75 | |
76 v1 = uVertexID; | |
77 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
78 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 79 v3 = 0; |
80 v22 = 0; | |
81 if ( array_50AC10[0].vWorldViewPosition.x <= v2 ) | |
82 v3 = 1; | |
83 if ( (signed int)(uVertexID + 1) <= 1 ) | |
84 return 0; | |
85 v4 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
86 v5 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
87 v6 = v1; | |
88 v23 = (char *)&array_507D30[0].flt_2C; | |
168 | 89 v26 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
90 v24 = array_507D30; |
0 | 91 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; |
92 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
93 v25 = (char *)&array_507D30[0].vWorldViewPosition; | |
94 v27 = (char *)&array_507D30[0].v; | |
95 v28 = (char *)&array_507D30[0].u; | |
96 v7 = (char *)&array_50AC10[0].v; | |
97 v18 = v6; | |
98 do | |
99 { | |
100 v19 = v2 >= *((float *)v7 + 5); | |
101 if ( v3 != v19 ) | |
102 { | |
103 if ( v19 ) | |
104 { | |
105 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7)); | |
106 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6); | |
107 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5); | |
108 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1); | |
109 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7; | |
110 } | |
111 else | |
112 { | |
113 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5)); | |
114 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6); | |
115 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7); | |
116 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11); | |
117 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12); | |
118 } | |
119 *(float *)v27 = v9; | |
120 *(float *)v25 = v2; | |
121 *(float *)v26 = 1.0 / v2; | |
122 if ( v3 ) | |
123 { | |
124 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) | |
125 { | |
126 v11 = 0; | |
127 v12 = *(float *)v4 == *((float *)v7 - 5); | |
128 goto LABEL_19; | |
129 } | |
130 } | |
131 else | |
132 { | |
133 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) | |
134 { | |
135 v11 = 0; | |
136 v12 = *(float *)v4 == *((float *)v7 + 7); | |
137 LABEL_19: | |
138 if ( v12 | v11 ) | |
139 goto LABEL_21; | |
140 goto LABEL_20; | |
141 } | |
142 } | |
143 LABEL_20: | |
144 v26 += 48; | |
145 ++v24; | |
146 v25 += 48; | |
147 v27 += 48; | |
148 v28 += 48; | |
149 v5 += 48; | |
150 v4 += 48; | |
151 ++v22; | |
152 v23 += 48; | |
153 v21 = v5; | |
154 v20 = v4; | |
155 } | |
156 LABEL_21: | |
157 if ( v19 ) | |
158 { | |
159 v13 = v24; | |
160 v14 = v26; | |
161 v21 += 48; | |
162 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001); | |
163 v20 += 48; | |
164 ++v22; | |
165 v28 += 48; | |
166 v27 += 48; | |
167 v25 += 48; | |
168 ++v24; | |
169 v26 += 48; | |
170 memcpy(v13, v7 + 8, 0x30u); | |
171 v16 = v23; | |
172 v23 += 48; | |
173 v4 = v20; | |
174 *(float *)v14 = v15; | |
175 *(int *)v16 = *((int *)v7 + 13); | |
176 v5 = v21; | |
177 } | |
178 v3 = v19; | |
179 v7 += 48; | |
180 --v18; | |
181 } | |
182 while ( v18 ); | |
183 result = v22; | |
184 if ( v22 < 3 ) | |
185 return 0; | |
186 return result; | |
187 } | |
188 | |
189 //----- (004250FE) -------------------------------------------------------- | |
190 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
191 { | |
192 unsigned int v1; // edx@1 | |
193 char *v2; // edi@5 | |
194 char *v3; // esi@5 | |
195 char *v4; // ecx@5 | |
196 int v5; // ebx@6 | |
197 double v6; // st6@11 | |
198 double v7; // st5@11 | |
199 double v8; // st6@12 | |
200 unsigned __int8 v9; // c2@16 | |
201 unsigned __int8 v10; // c3@16 | |
202 void *v11; // edi@23 | |
203 double v12; // st6@23 | |
204 char *v13; // ecx@23 | |
205 char v14; // zf@24 | |
206 signed int result; // eax@25 | |
207 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
208 bool v17; // [sp+Ch] [bp-24h]@2 | |
209 bool v18; // [sp+10h] [bp-20h]@7 | |
210 char *v19; // [sp+14h] [bp-1Ch]@5 | |
211 char *v20; // [sp+18h] [bp-18h]@5 | |
212 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
213 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
214 char *v23; // [sp+24h] [bp-Ch]@5 | |
215 char *v24; // [sp+28h] [bp-8h]@5 | |
216 char *v25; // [sp+2Ch] [bp-4h]@5 | |
217 | |
218 v1 = uVertexID; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
219 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 220 v21 = 0; |
221 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
222 if ( (signed int)(uVertexID + 1) <= 1 ) | |
223 return 0; | |
224 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
225 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 226 v24 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
227 v22 = array_507D30; |
0 | 228 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; |
229 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
230 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
231 v25 = (char *)&array_507D30[0].flt_2C; | |
232 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
233 v16 = v1; | |
234 do | |
235 { | |
236 v5 = (int)(v4 + 48); | |
237 v18 = *((float *)v4 + 12) >= 8.0; | |
238 if ( v17 != v18 ) | |
239 { | |
240 if ( v18 ) | |
241 { | |
242 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
243 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
244 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
245 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
246 } | |
247 else | |
248 { | |
249 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
250 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
251 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
252 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
253 } | |
254 *(float *)v25 = v7; | |
255 *(float *)v23 = 8.0; | |
256 *(int *)v24 = 0x3E000000u; | |
257 if ( v17 ) | |
258 { | |
259 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
260 { | |
261 v9 = 0; | |
262 v10 = *(float *)v2 == *((float *)v4 + 2); | |
263 goto LABEL_20; | |
264 } | |
265 } | |
266 else | |
267 { | |
268 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
269 { | |
270 v9 = 0; | |
271 v10 = *(float *)v2 == *((float *)v4 + 14); | |
272 LABEL_20: | |
273 if ( v10 | v9 ) | |
274 goto LABEL_22; | |
275 goto LABEL_21; | |
276 } | |
277 } | |
278 LABEL_21: | |
279 ++v22; | |
280 v23 += 48; | |
281 v25 += 48; | |
282 v3 += 48; | |
283 v2 += 48; | |
284 ++v21; | |
285 v24 += 48; | |
286 v20 = v3; | |
287 v19 = v2; | |
288 } | |
289 LABEL_22: | |
290 if ( v18 ) | |
291 { | |
292 v11 = v22; | |
293 v20 += 48; | |
294 v19 += 48; | |
295 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
296 ++v21; | |
297 v25 += 48; | |
298 v23 += 48; | |
299 ++v22; | |
300 memcpy(v11, v4 + 36, 0x30u); | |
301 v13 = v24; | |
302 v24 += 48; | |
303 v3 = v20; | |
304 v2 = v19; | |
305 *(float *)v13 = v12; | |
306 } | |
307 v14 = v16-- == 1; | |
308 v17 = v18; | |
309 v4 = (char *)v5; | |
310 } | |
311 while ( !v14 ); | |
312 result = v21; | |
313 if ( v21 < 3 ) | |
314 return 0; | |
315 return result; | |
316 } | |
317 | |
318 //----- (004252E8) -------------------------------------------------------- | |
319 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
320 { | |
321 unsigned int v1; // edx@1 | |
322 double v2; // st7@1 | |
323 char *v3; // edi@5 | |
324 char *v4; // esi@5 | |
325 char *v5; // ecx@5 | |
326 int v6; // ebx@6 | |
327 double v7; // st6@11 | |
328 double v8; // st5@11 | |
329 double v9; // st6@12 | |
330 unsigned __int8 v10; // c2@16 | |
331 unsigned __int8 v11; // c3@16 | |
332 void *v12; // edi@23 | |
333 double v13; // st6@23 | |
334 char *v14; // ecx@23 | |
335 char v15; // zf@24 | |
336 signed int result; // eax@25 | |
337 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
338 bool v18; // [sp+Ch] [bp-24h]@2 | |
339 bool v19; // [sp+10h] [bp-20h]@7 | |
340 char *v20; // [sp+14h] [bp-1Ch]@5 | |
341 char *v21; // [sp+18h] [bp-18h]@5 | |
342 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
343 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
344 char *v24; // [sp+24h] [bp-Ch]@5 | |
345 char *v25; // [sp+28h] [bp-8h]@5 | |
346 char *v26; // [sp+2Ch] [bp-4h]@5 | |
347 | |
348 v1 = uVertexID; | |
349 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
350 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); |
0 | 351 v22 = 0; |
352 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
353 if ( (signed int)(uVertexID + 1) <= 1 ) | |
354 return 0; | |
355 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
356 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
168 | 357 v25 = (char *)&array_507D30[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
358 v23 = array_507D30; |
0 | 359 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; |
360 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
361 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
362 v26 = (char *)&array_507D30[0].flt_2C; | |
363 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
364 v17 = v1; | |
365 do | |
366 { | |
367 v6 = (int)(v5 + 48); | |
368 v19 = v2 >= *((float *)v5 + 12); | |
369 if ( v18 != v19 ) | |
370 { | |
371 if ( v19 ) | |
372 { | |
373 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
374 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
375 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
376 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
377 } | |
378 else | |
379 { | |
380 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
381 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
382 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
383 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
384 } | |
385 *(float *)v26 = v8; | |
386 *(float *)v24 = v2; | |
387 *(float *)v25 = 1.0 / v2; | |
388 if ( v18 ) | |
389 { | |
390 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
391 { | |
392 v10 = 0; | |
393 v11 = *(float *)v3 == *((float *)v5 + 2); | |
394 goto LABEL_20; | |
395 } | |
396 } | |
397 else | |
398 { | |
399 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
400 { | |
401 v10 = 0; | |
402 v11 = *(float *)v3 == *((float *)v5 + 14); | |
403 LABEL_20: | |
404 if ( v11 | v10 ) | |
405 goto LABEL_22; | |
406 goto LABEL_21; | |
407 } | |
408 } | |
409 LABEL_21: | |
410 ++v23; | |
411 v24 += 48; | |
412 v26 += 48; | |
413 v4 += 48; | |
414 v3 += 48; | |
415 ++v22; | |
416 v25 += 48; | |
417 v21 = v4; | |
418 v20 = v3; | |
419 } | |
420 LABEL_22: | |
421 if ( v19 ) | |
422 { | |
423 v12 = v23; | |
424 v21 += 48; | |
425 v20 += 48; | |
426 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
427 ++v22; | |
428 v26 += 48; | |
429 v24 += 48; | |
430 ++v23; | |
431 memcpy(v12, v5 + 36, 0x30u); | |
432 v14 = v25; | |
433 v25 += 48; | |
434 v4 = v21; | |
435 v3 = v20; | |
436 *(float *)v14 = v13; | |
437 } | |
438 v15 = v17-- == 1; | |
439 v18 = v19; | |
440 v5 = (char *)v6; | |
441 } | |
442 while ( !v15 ); | |
443 result = v22; | |
444 if ( v22 < 3 ) | |
445 return 0; | |
446 return result; | |
447 } | |
448 | |
449 //----- (004254D2) -------------------------------------------------------- | |
450 int __fastcall sr_4254D2(signed int a1) | |
451 { | |
452 signed int v1; // ebx@2 | |
453 int v2; // ecx@2 | |
454 int result; // eax@11 | |
455 double v4; // ST74_8@12 | |
456 bool v5; // edi@12 | |
457 char *v6; // esi@13 | |
458 char *v7; // ebx@13 | |
459 double v8; // st7@15 | |
460 double v9; // st7@16 | |
461 double v10; // st6@16 | |
462 double v11; // st7@17 | |
463 float v12; // eax@18 | |
464 double v13; // ST4C_8@19 | |
465 double v14; // ST10_8@19 | |
466 double v15; // ST28_8@20 | |
467 double v16; // ST34_8@20 | |
468 char v17; // zf@20 | |
469 double v18; // ST18_8@21 | |
470 double v19; // ST3C_8@21 | |
471 double v20; // ST44_8@22 | |
472 double v21; // ST54_8@22 | |
473 void *v22; // edi@26 | |
474 double v23; // ST54_8@29 | |
475 bool v24; // esi@29 | |
476 char *v25; // edi@30 | |
477 char *v26; // ebx@30 | |
478 bool v27; // ecx@32 | |
479 double v28; // st7@33 | |
480 double v29; // st7@34 | |
481 double v30; // st6@34 | |
482 double v31; // st7@35 | |
483 double v32; // ST44_8@37 | |
484 double v33; // ST3C_8@37 | |
485 double v34; // ST18_8@38 | |
486 double v35; // ST34_8@38 | |
487 char v36; // zf@38 | |
488 double v37; // ST28_8@39 | |
489 double v38; // ST10_8@39 | |
490 double v39; // ST20_8@40 | |
491 double v40; // ST5C_8@40 | |
492 void *v41; // edi@44 | |
493 double v42; // ST5C_8@47 | |
494 bool v43; // edi@47 | |
495 char *v44; // esi@48 | |
496 char *v45; // ebx@48 | |
497 bool v46; // ecx@49 | |
498 double v47; // st6@50 | |
499 double v48; // st6@51 | |
500 double v49; // st5@51 | |
501 double v50; // st6@52 | |
502 double v51; // ST20_8@54 | |
503 double v52; // ST54_8@54 | |
504 double v53; // ST44_8@55 | |
505 double v54; // ST3C_8@55 | |
506 char v55; // zf@55 | |
507 double v56; // ST18_8@56 | |
508 double v57; // ST34_8@56 | |
509 double v58; // ST28_8@57 | |
510 double v59; // ST10_8@57 | |
511 void *v60; // edi@61 | |
512 double v61; // ST5C_8@64 | |
513 bool v62; // edi@64 | |
514 char *v63; // esi@65 | |
515 char *v64; // ebx@65 | |
516 bool v65; // ecx@66 | |
517 double v66; // st6@67 | |
518 double v67; // st6@68 | |
519 double v68; // st5@68 | |
520 double v69; // st6@69 | |
521 double v70; // ST20_8@71 | |
522 double v71; // ST54_8@71 | |
523 double v72; // ST44_8@72 | |
524 double v73; // ST3C_8@72 | |
525 char v74; // zf@72 | |
526 double v75; // ST18_8@73 | |
527 double v76; // ST34_8@73 | |
528 double v77; // ST28_8@74 | |
529 double v78; // ST10_8@74 | |
530 void *v79; // edi@78 | |
531 int v80; // ebx@81 | |
532 char *v81; // ecx@82 | |
533 signed int v82; // esi@82 | |
534 float v83; // ST78_4@83 | |
535 double v84; // ST5C_8@83 | |
536 float v85; // eax@84 | |
537 double v86; // ST20_8@85 | |
538 double v87; // ST54_8@88 | |
539 float v88; // eax@89 | |
540 double v89; // ST44_8@90 | |
541 unsigned __int8 v90; // sf@94 | |
542 unsigned __int8 v91; // of@94 | |
543 int v92; // edx@97 | |
544 int v93; // esi@97 | |
545 int v94; // edi@97 | |
546 int v95; // eax@97 | |
547 int v96; // eax@104 | |
548 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
549 double v98; // [sp+54h] [bp-84h]@49 | |
550 double v99; // [sp+54h] [bp-84h]@66 | |
551 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
552 float v101; // [sp+60h] [bp-78h]@1 | |
553 float v102; // [sp+64h] [bp-74h]@1 | |
554 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
555 float v104; // [sp+A8h] [bp-30h]@1 | |
556 signed int v105; // [sp+A8h] [bp-30h]@96 | |
557 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
558 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
559 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
560 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
561 signed int v110; // [sp+B0h] [bp-28h]@12 | |
562 char *v111; // [sp+B8h] [bp-20h]@30 | |
563 signed int v112; // [sp+B8h] [bp-20h]@48 | |
564 signed int v113; // [sp+B8h] [bp-20h]@65 | |
565 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
566 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
567 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
568 signed int v117; // [sp+C0h] [bp-18h]@1 | |
569 char *v118; // [sp+C0h] [bp-18h]@30 | |
570 char *v119; // [sp+C0h] [bp-18h]@48 | |
571 char *v120; // [sp+C0h] [bp-18h]@65 | |
572 char *v121; // [sp+C4h] [bp-14h]@13 | |
573 char *v122; // [sp+C4h] [bp-14h]@30 | |
574 signed int v123; // [sp+C4h] [bp-14h]@47 | |
575 char *v124; // [sp+C8h] [bp-10h]@30 | |
576 char *v125; // [sp+C8h] [bp-10h]@48 | |
577 char *v126; // [sp+C8h] [bp-10h]@65 | |
578 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
579 char *v128; // [sp+CCh] [bp-Ch]@13 | |
580 char *v129; // [sp+CCh] [bp-Ch]@30 | |
581 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
582 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
583 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
584 char *v133; // [sp+D0h] [bp-8h]@30 | |
585 char *v134; // [sp+D0h] [bp-8h]@48 | |
586 char *v135; // [sp+D0h] [bp-8h]@65 | |
587 signed int v136; // [sp+D4h] [bp-4h]@1 | |
588 char *v137; // [sp+D4h] [bp-4h]@13 | |
589 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
590 char *v139; // [sp+D4h] [bp-4h]@48 | |
591 char *v140; // [sp+D4h] [bp-4h]@65 | |
592 | |
693 | 593 v101 = (double)(signed int)pViewport->uViewportTL_X; |
594 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
0 | 595 v117 = a1; |
596 v136 = 1; | |
693 | 597 v104 = (double)(signed int)pViewport->uViewportTL_Y; |
598 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
0 | 599 if ( a1 <= 0 ) |
600 return v117; | |
601 v127 = a1; | |
602 v1 = a1; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
603 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); |
0 | 604 v2 = 0; |
605 do | |
606 { | |
607 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
608 v136 = 0; | |
609 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
610 v136 = 0; | |
611 ++v2; | |
612 --v127; | |
613 } | |
614 while ( v127 ); | |
615 if ( v136 ) | |
616 return v117; | |
617 v110 = 0; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
618 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); |
0 | 619 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; |
693 | 620 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; |
0 | 621 if ( v117 < 1 ) |
622 goto LABEL_112; | |
623 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
624 v132 = array_50A2B0; |
0 | 625 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; |
626 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
627 v121 = (char *)&array_50A2B0[0].flt_2C; | |
168 | 628 v114 = (char *)&array_50A2B0[0]._rhw; |
0 | 629 v7 = (char *)&array_50AC10[0].flt_2C; |
630 do | |
631 { | |
632 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
693 | 633 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; |
0 | 634 if ( !(v5 ^ v106) ) |
635 goto LABEL_25; | |
636 v8 = v101; | |
693 | 637 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) |
0 | 638 { |
639 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
640 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
641 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
642 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
643 } | |
644 else | |
645 { | |
646 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
647 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
648 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
649 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
650 } | |
651 *(float *)v121 = v10; | |
652 *(int *)v137 = LODWORD(v101); | |
653 LODWORD(v12) = *(int *)v6; | |
654 if ( v5 ) | |
655 { | |
656 v13 = v12 + 6.7553994e15; | |
657 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
658 if ( LODWORD(v13) == LODWORD(v14) ) | |
659 { | |
660 v15 = *(float *)v137 + 6.7553994e15; | |
661 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
662 v17 = LODWORD(v15) == LODWORD(v16); | |
663 goto LABEL_23; | |
664 } | |
665 } | |
666 else | |
667 { | |
668 v18 = v12 + 6.7553994e15; | |
669 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
670 if ( LODWORD(v18) == LODWORD(v19) ) | |
671 { | |
672 v20 = *(float *)v137 + 6.7553994e15; | |
673 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
674 v17 = LODWORD(v20) == LODWORD(v21); | |
675 LABEL_23: | |
676 if ( v17 ) | |
677 goto LABEL_25; | |
678 goto LABEL_24; | |
679 } | |
680 } | |
681 LABEL_24: | |
682 v121 += 48; | |
683 v114 += 48; | |
684 v6 += 48; | |
685 ++v110; | |
686 ++v132; | |
687 v128 = v6; | |
688 v137 += 48; | |
689 LABEL_25: | |
690 if ( v106 ) | |
691 { | |
692 v22 = v132; | |
693 v128 += 48; | |
694 ++v110; | |
695 v114 += 48; | |
696 v121 += 48; | |
697 v137 += 48; | |
698 ++v132; | |
699 memcpy(v22, v7 + 4, 0x30u); | |
700 v6 = v128; | |
701 } | |
702 v5 = v106; | |
703 v7 += 48; | |
704 --v117; | |
705 } | |
706 while ( v117 ); | |
707 if ( v110 < 3 | |
708 || (v115 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
709 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), |
0 | 710 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, |
693 | 711 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, |
0 | 712 v110 < 1) ) |
713 goto LABEL_112; | |
168 | 714 v25 = (char *)&array_509950[0]._rhw; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
715 v138 = array_509950; |
0 | 716 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; |
717 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
718 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
719 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
720 v124 = (char *)&array_509950[0].flt_2C; | |
168 | 721 v111 = (char *)&array_509950[0]._rhw; |
0 | 722 v26 = (char *)&array_50A2B0[0].flt_2C; |
723 while ( 2 ) | |
724 { | |
725 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
693 | 726 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; |
727 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
0 | 728 if ( v24 != v27 ) |
729 { | |
730 v28 = v100; | |
693 | 731 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) |
0 | 732 { |
733 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
734 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
735 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
736 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
737 } | |
738 else | |
739 { | |
740 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
741 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
742 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
743 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
744 } | |
745 *(float *)v124 = v30; | |
746 *(int *)v133 = LODWORD(v100); | |
747 if ( v24 ) | |
748 { | |
749 v32 = *(float *)v122 + 6.7553994e15; | |
750 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
751 if ( LODWORD(v32) == LODWORD(v33) ) | |
752 { | |
753 v34 = *(float *)v133 + 6.7553994e15; | |
754 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
755 v36 = LODWORD(v34) == LODWORD(v35); | |
756 goto LABEL_41; | |
757 } | |
758 goto LABEL_42; | |
759 } | |
760 v37 = *(float *)v118 + 6.7553994e15; | |
761 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
762 if ( LODWORD(v37) != LODWORD(v38) ) | |
763 goto LABEL_42; | |
764 v39 = *(float *)v129 + 6.7553994e15; | |
765 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
766 v36 = LODWORD(v39) == LODWORD(v40); | |
767 LABEL_41: | |
768 if ( !v36 ) | |
769 { | |
770 LABEL_42: | |
771 v129 += 48; | |
772 v118 += 48; | |
773 v133 += 48; | |
774 v122 += 48; | |
775 v124 += 48; | |
776 v111 += 48; | |
777 ++v115; | |
778 ++v138; | |
779 } | |
780 } | |
781 if ( v27 ) | |
782 { | |
783 v41 = v138; | |
784 ++v115; | |
785 v111 += 48; | |
786 v124 += 48; | |
787 v122 += 48; | |
788 v133 += 48; | |
789 v118 += 48; | |
790 v129 += 48; | |
791 ++v138; | |
792 memcpy(v41, v26 + 4, 0x30u); | |
793 } | |
794 v24 = v107; | |
795 v26 += 48; | |
796 --v110; | |
797 if ( v110 ) | |
798 { | |
799 v25 = v111; | |
800 continue; | |
801 } | |
802 break; | |
803 } | |
804 if ( v115 < 3 | |
805 || (v123 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
806 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), |
0 | 807 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, |
693 | 808 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, |
0 | 809 v115 < 1) ) |
810 goto LABEL_112; | |
811 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
812 v130 = array_508FF0; |
0 | 813 v119 = (char *)&array_508FF0[0].vWorldViewProjX; |
814 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
815 v125 = (char *)&array_508FF0[0].flt_2C; | |
168 | 816 v134 = (char *)&array_508FF0[0]._rhw; |
0 | 817 v45 = (char *)&array_509950[0].flt_2C; |
818 v112 = v115; | |
819 while ( 2 ) | |
820 { | |
821 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
693 | 822 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; |
823 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
0 | 824 if ( v43 != v46 ) |
825 { | |
826 v47 = v104; | |
693 | 827 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) |
0 | 828 { |
829 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
830 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
831 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
832 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
833 } | |
834 else | |
835 { | |
836 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
837 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
838 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
839 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
840 } | |
841 *(float *)v125 = v49; | |
842 *(float *)v139 = v104; | |
843 if ( v43 ) | |
844 { | |
845 v51 = v104 + 6.7553994e15; | |
846 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
847 if ( LODWORD(v51) == LODWORD(v52) ) | |
848 { | |
849 v53 = *(float *)v44 + 6.7553994e15; | |
850 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
851 v55 = LODWORD(v53) == LODWORD(v54); | |
852 goto LABEL_58; | |
853 } | |
854 goto LABEL_59; | |
855 } | |
856 v56 = v104 + 6.7553994e15; | |
857 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
858 if ( LODWORD(v56) != LODWORD(v57) ) | |
859 goto LABEL_59; | |
860 v58 = *(float *)v44 + 6.7553994e15; | |
861 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
862 v55 = LODWORD(v58) == LODWORD(v59); | |
863 LABEL_58: | |
864 if ( !v55 ) | |
865 { | |
866 LABEL_59: | |
867 v139 += 48; | |
868 v125 += 48; | |
869 v134 += 48; | |
870 v44 += 48; | |
871 ++v123; | |
872 ++v130; | |
873 v119 = v44; | |
874 } | |
875 } | |
876 if ( v46 ) | |
877 { | |
878 v60 = v130; | |
879 v119 += 48; | |
880 ++v123; | |
881 v134 += 48; | |
882 v125 += 48; | |
883 v139 += 48; | |
884 ++v130; | |
885 memcpy(v60, v45 + 4, 0x30u); | |
886 v44 = v119; | |
887 } | |
888 v43 = v108; | |
889 v45 += 48; | |
890 --v112; | |
891 if ( v112 ) | |
892 continue; | |
893 break; | |
894 } | |
895 if ( v123 < 3 | |
896 || (v116 = 0, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
897 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), |
0 | 898 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, |
693 | 899 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, |
0 | 900 v123 < 1) ) |
901 goto LABEL_112; | |
902 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
903 v131 = array_508690; |
0 | 904 v120 = (char *)&array_508690[0].vWorldViewProjX; |
905 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
906 v126 = (char *)&array_508690[0].flt_2C; | |
168 | 907 v135 = (char *)&array_508690[0]._rhw; |
0 | 908 v64 = (char *)&array_508FF0[0].flt_2C; |
909 v113 = v123; | |
910 while ( 2 ) | |
911 { | |
912 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
693 | 913 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; |
914 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
0 | 915 if ( v62 != v65 ) |
916 { | |
917 v66 = v102; | |
693 | 918 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) |
0 | 919 { |
920 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
921 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
922 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
923 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
924 } | |
925 else | |
926 { | |
927 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
928 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
929 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
930 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
931 } | |
932 *(float *)v126 = v68; | |
933 *(float *)v140 = v102; | |
934 if ( v62 ) | |
935 { | |
936 v70 = v102 + 6.7553994e15; | |
937 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
938 if ( LODWORD(v70) == LODWORD(v71) ) | |
939 { | |
940 v72 = *(float *)v63 + 6.7553994e15; | |
941 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
942 v74 = LODWORD(v72) == LODWORD(v73); | |
943 goto LABEL_75; | |
944 } | |
945 goto LABEL_76; | |
946 } | |
947 v75 = v102 + 6.7553994e15; | |
948 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
949 if ( LODWORD(v75) != LODWORD(v76) ) | |
950 goto LABEL_76; | |
951 v77 = *(float *)v63 + 6.7553994e15; | |
952 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
953 v74 = LODWORD(v77) == LODWORD(v78); | |
954 LABEL_75: | |
955 if ( !v74 ) | |
956 { | |
957 LABEL_76: | |
958 v140 += 48; | |
959 v126 += 48; | |
960 v135 += 48; | |
961 v63 += 48; | |
962 ++v116; | |
963 ++v131; | |
964 v120 = v63; | |
965 } | |
966 } | |
967 if ( v65 ) | |
968 { | |
969 v79 = v131; | |
970 v120 += 48; | |
971 ++v116; | |
972 v135 += 48; | |
973 v126 += 48; | |
974 v140 += 48; | |
975 ++v131; | |
976 memcpy(v79, v64 + 4, 0x30u); | |
977 v63 = v120; | |
978 } | |
979 v62 = v109; | |
980 v64 += 48; | |
981 --v113; | |
982 if ( v113 ) | |
983 continue; | |
984 break; | |
985 } | |
986 if ( v116 < 3 ) | |
987 goto LABEL_112; | |
988 v80 = v116; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
989 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); |
0 | 990 if ( v116 > 0 ) |
991 { | |
992 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
993 v82 = v116; | |
994 do | |
995 { | |
996 LODWORD(v83) = *(int *)v81; | |
997 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
998 v84 = v83 + 6.7553994e15; | |
693 | 999 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) |
0 | 1000 { |
1001 v86 = *(float *)v81 + 6.7553994e15; | |
693 | 1002 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) |
0 | 1003 goto LABEL_88; |
1004 v85 = v101; | |
1005 } | |
1006 else | |
1007 { | |
1008 v85 = v100; | |
1009 } | |
1010 *(int *)v81 = LODWORD(v85); | |
1011 LABEL_88: | |
1012 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1013 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) |
0 | 1014 { |
1015 v88 = v102; | |
1016 LABEL_92: | |
1017 *((int *)v81 + 1) = LODWORD(v88); | |
1018 goto LABEL_93; | |
1019 } | |
1020 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
693 | 1021 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) |
0 | 1022 { |
1023 v88 = v104; | |
1024 goto LABEL_92; | |
1025 } | |
1026 LABEL_93: | |
1027 v81 += 48; | |
1028 --v82; | |
1029 } | |
1030 while ( v82 ); | |
1031 } | |
1032 v91 = __OFSUB__(v116, 3); | |
1033 v90 = v116 - 3 < 0; | |
1034 if ( v116 > 3 ) | |
1035 { | |
1036 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
1037 if ( v116 > 0 ) | |
1038 { | |
1039 v105 = 1; | |
1040 do | |
1041 { | |
1042 v92 = v105; | |
1043 v93 = v105 - 1; | |
1044 v94 = v105 + 1; | |
1045 v95 = v105 + 1; | |
1046 if ( v105 - 1 >= v80 ) | |
1047 v93 -= v80; | |
1048 if ( v105 >= v80 ) | |
1049 v92 = v105 - v80; | |
1050 if ( v94 >= v80 ) | |
1051 v95 = v94 - v80; | |
1052 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1053 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
1054 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
1055 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
1056 { | |
1057 ++v105; | |
1058 } | |
1059 else | |
1060 { | |
1061 v96 = v105; | |
1062 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
1063 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
1064 --v80; | |
1065 } | |
1066 } | |
1067 while ( v105 - 1 < v80 ); | |
1068 } | |
1069 v91 = __OFSUB__(v80, 3); | |
1070 v90 = v80 - 3 < 0; | |
1071 } | |
1072 if ( v90 ^ v91 ) | |
1073 LABEL_112: | |
1074 result = 0; | |
1075 else | |
1076 result = v80; | |
1077 return result; | |
1078 } | |
1079 | |
1080 //----- (0042620A) -------------------------------------------------------- | |
1081 bool __thiscall sr_42620A(RenderVertexSoft *p) | |
1082 { | |
1083 __int16 v1; // fps@1 | |
1084 unsigned __int8 v2; // c0@2 | |
1085 char v3; // c2@2 | |
1086 unsigned __int8 v4; // c3@2 | |
1087 bool result; // eax@2 | |
1088 unsigned __int8 v6; // c0@4 | |
1089 char v7; // c2@4 | |
1090 unsigned __int8 v8; // c3@4 | |
1091 unsigned __int8 v9; // c0@6 | |
1092 char v10; // c2@6 | |
1093 unsigned __int8 v11; // c3@6 | |
1094 double v12; // st6@7 | |
1095 float v13; // ST04_4@7 | |
1096 float v14; // ST00_4@7 | |
1097 double v15; // st7@7 | |
1098 double v16; // st6@8 | |
1099 float v17; // ST04_4@8 | |
1100 float v18; // ST00_4@8 | |
1101 double v19; // st7@8 | |
1102 | |
1103 //UNDEF(v1); | |
1104 if ( p->vWorldViewPosition.x < 300.0 | |
1105 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
1106 v3 = 0, | |
1107 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
921 | 1108 //BYTE1(result) = HIBYTE(v1), |
0 | 1109 !(v2 | v4)) ) |
1110 { | |
1111 if ( p->vWorldViewPosition.x < 300.0 ) | |
1112 { | |
1113 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
1114 v7 = 0; | |
1115 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
921 | 1116 //BYTE1(result) = HIBYTE(v1); |
0 | 1117 if ( !(v6 | v8) ) |
1118 { | |
921 | 1119 //LOBYTE(result) = 0; |
1120 return false; | |
0 | 1121 } |
1122 } | |
1123 v9 = 300.0 < p->vWorldViewPosition.x; | |
1124 v10 = 0; | |
1125 v11 = 300.0 == p->vWorldViewPosition.x; | |
921 | 1126 //BYTE1(result) = HIBYTE(v1); |
0 | 1127 if ( v9 | v11 ) |
1128 { | |
1129 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
1130 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
1131 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
1132 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
1133 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
1134 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
1135 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
1136 } | |
1137 else | |
1138 { | |
1139 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
1140 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
1141 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
1142 v15 = 300.0 - p->vWorldViewPosition.x; | |
1143 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
1144 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
1145 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
1146 } | |
1147 } | |
921 | 1148 //LOBYTE(result) = 1; |
1149 return true; | |
0 | 1150 } |
1151 | |
1152 //----- (004268E3) -------------------------------------------------------- | |
1153 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) | |
1154 { | |
1155 unsigned int v1; // eax@1 | |
1156 unsigned int v2; // edx@1 | |
1157 int v3; // eax@1 | |
1158 int v4; // edx@1 | |
1159 unsigned int v5; // ecx@1 | |
1160 | |
1161 v1 = uColor >> 9; | |
1162 v2 = uColor >> 6; | |
1163 LOWORD(v1) = (uColor >> 9) & 0x7C00; | |
1164 LOWORD(v2) = (uColor >> 6) & 0x3E0; | |
1165 v3 = v2 | v1; | |
1166 v4 = (unsigned __int8)uColor >> 3; | |
1167 v5 = uColor >> 16; | |
1168 LOWORD(v5) = v5 & 0x8000; | |
1169 return v5 | v4 | v3; | |
1170 } | |
1171 | |
1172 //----- (0042690D) -------------------------------------------------------- | |
1173 int __fastcall _42690D_colors_cvt(unsigned int a1) | |
1174 { | |
1175 unsigned int v1; // eax@1 | |
1176 unsigned int v2; // edx@1 | |
1177 | |
1178 v1 = a1 >> 8; | |
1179 v2 = a1 >> 5; | |
1180 LOWORD(v1) = (a1 >> 8) & 0xF800; | |
1181 LOWORD(v2) = (a1 >> 5) & 0x7E0; | |
1182 return ((unsigned __int8)a1 >> 3) | v2 | v1; | |
1183 } | |
1184 //----- (00426947) -------------------------------------------------------- | |
1185 void __cdecl sub_426947() | |
1186 { | |
893 | 1187 stru_50C198.field_0 = 0; |
0 | 1188 dword_50C994 = 0; |
1189 dword_50C998_turnbased_icon_1A = 0; | |
1190 } | |
1191 // 50C968: using guessed type int dword_50C968; | |
1192 // 50C994: using guessed type int dword_50C994; | |
1193 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
1194 | |
1195 //----- (004269A2) -------------------------------------------------------- | |
958 | 1196 void __fastcall GivePartyExp(unsigned int pEXPNum) |
0 | 1197 { |
958 | 1198 signed int pActivePlayerCount; // ecx@1 |
1199 int pLearningPercent; // eax@13 | |
1200 | |
1201 pActivePlayerCount = 0; | |
1202 for ( uint i = 0; i < 4; ++i ) | |
1203 { | |
1204 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) | |
1205 pActivePlayerCount ++; | |
1206 } | |
1207 if ( pActivePlayerCount ) | |
0 | 1208 { |
958 | 1209 pEXPNum = pEXPNum / pActivePlayerCount; |
1210 for ( uint i = 0; i < 4; ++i ) | |
0 | 1211 { |
958 | 1212 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] ) |
0 | 1213 { |
958 | 1214 if ( pEXPNum ) |
0 | 1215 { |
958 | 1216 pLearningPercent = pParty->pPlayers[i].GetLearningPercent(); |
1217 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100; | |
1218 pParty->pPlayers[i].uExperience += pEXPNum; | |
1219 if ( pParty->pPlayers[i].uExperience > 4000000000i64 ) | |
0 | 1220 { |
958 | 1221 pParty->pPlayers[i].uExperience = 0; |
0 | 1222 } |
1223 } | |
1224 } | |
1225 } | |
1226 } | |
1227 } | |
1228 | |
1229 //----- (00426A5A) -------------------------------------------------------- | |
1230 void stru319::LootActor(Actor *pActor) | |
1231 { | |
1232 signed int v2; // edi@1 | |
1233 char v3; // zf@1 | |
1234 unsigned int v4; // eax@13 | |
1235 unsigned int v5; // esi@13 | |
1236 int v6; // eax@14 | |
1237 unsigned __int8 v7; // al@30 | |
1238 Party *v8; // esi@34 | |
1239 char *v9; // [sp-4h] [bp-3Ch]@10 | |
1240 char *v10; // [sp-4h] [bp-3Ch]@31 | |
1241 char *v11; // [sp-4h] [bp-3Ch]@38 | |
1242 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1 | |
1243 int v13; // [sp+30h] [bp-8h]@1 | |
1244 int v14; // [sp+34h] [bp-4h]@1 | |
1245 | |
1246 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1247 Dst.Reset(); | |
1248 v2 = 0; | |
1249 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; | |
1250 v13 = 0; | |
1251 v14 = 0; | |
1252 if ( v3 ) | |
1253 { | |
1254 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) | |
1255 goto LABEL_9; | |
1256 do | |
1257 { | |
1258 ++v2; | |
1259 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; | |
1260 } | |
1261 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); | |
1262 } | |
1263 else | |
1264 { | |
1265 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) | |
1266 goto LABEL_9; | |
377 | 1267 v14 = pActor->array_000234[3].uSpecEnchantmentType; |
0 | 1268 pActor->array_000234[3].Reset(); |
1269 } | |
1270 if ( v14 ) | |
1271 { | |
1272 party_finds_gold(v14, 0); | |
1273 viewparams->bRedrawGameUI = 1; | |
1274 } | |
1275 LABEL_9: | |
1276 if ( pActor->uCarriedItemID ) | |
1277 { | |
1278 Dst.Reset(); | |
1279 Dst.uItemID = pActor->uCarriedItemID; | |
1280 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1281 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1282 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9); |
0 | 1283 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1284 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1285 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1286 v4 = Dst.uItemID; |
1287 v5 = Dst.uItemID; | |
1288 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) | |
1289 { | |
1290 v5 = Dst.uItemID; | |
1291 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; | |
1292 Dst.uNumCharges = v6; | |
1293 Dst.uMaxCharges = v6; | |
1294 v4 = Dst.uItemID; | |
1295 } | |
1296 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 ) | |
570 | 1297 Dst.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 1298 pItemsTable->SetSpecialBonus(&Dst); |
1299 if ( !pParty->AddItem(&Dst) ) | |
1300 pParty->SetHoldingItem(&Dst); | |
1301 pActor->uCarriedItemID = 0; | |
1302 if ( pActor->array_000234[0].uItemID ) | |
1303 { | |
1304 if ( !pParty->AddItem(pActor->array_000234) ) | |
1305 { | |
1306 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1307 pParty->SetHoldingItem(pActor->array_000234); | |
1308 } | |
1309 pActor->array_000234[0].Reset(); | |
1310 } | |
1311 if ( pActor->array_000234[1].uItemID ) | |
1312 { | |
1313 if ( !pParty->AddItem(&pActor->array_000234[1]) ) | |
1314 { | |
1315 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1316 pParty->SetHoldingItem(&pActor->array_000234[1]); | |
1317 } | |
1318 pActor->array_000234[1].Reset(); | |
1319 } | |
1320 LABEL_55: | |
1321 pActor->Remove(); | |
1322 return; | |
1323 } | |
1324 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) | |
1325 { | |
1326 if ( pActor->array_000234[3].uItemID ) | |
1327 { | |
1328 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst)); | |
1329 pActor->array_000234[3].Reset(); | |
1330 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1331 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1332 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11); |
0 | 1333 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1334 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1335 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1336 if ( !pParty->AddItem(&Dst) ) |
1337 pParty->SetHoldingItem(&Dst); | |
1338 v13 = 1; | |
1339 } | |
1340 goto LABEL_44; | |
1341 } | |
1342 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 ) | |
1343 { | |
1344 LABEL_44: | |
1345 v8 = pParty; | |
1346 goto LABEL_45; | |
1347 } | |
1348 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst); | |
1349 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; | |
1350 if ( v14 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1351 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10); |
0 | 1352 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1353 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1354 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 1355 v8 = pParty; |
1356 if ( !pParty->AddItem(&Dst) ) | |
1357 pParty->SetHoldingItem(&Dst); | |
1358 v13 = 1; | |
1359 LABEL_45: | |
1360 if ( pActor->array_000234[0].uItemID ) | |
1361 { | |
1362 if ( !v8->AddItem(pActor->array_000234) ) | |
1363 { | |
1364 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1365 v8->SetHoldingItem(pActor->array_000234); | |
1366 v13 = 1; | |
1367 } | |
1368 pActor->array_000234[0].Reset(); | |
1369 } | |
1370 if ( pActor->array_000234[1].uItemID ) | |
1371 { | |
1372 if ( !v8->AddItem(&pActor->array_000234[1]) ) | |
1373 { | |
1374 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
1375 v8->SetHoldingItem(&pActor->array_000234[1]); | |
1376 v13 = 1; | |
1377 } | |
1378 pActor->array_000234[1].Reset(); | |
1379 } | |
1380 if ( !v13 || rand() % 100 < 90 ) | |
1381 goto LABEL_55; | |
1382 } | |
1383 | |
1384 //----- (00426E10) -------------------------------------------------------- | |
1385 int stru319::which_player_would_attack(Actor *pActor) | |
1386 { | |
1387 signed int v2; // ebx@1 | |
1388 int v3; // ecx@2 | |
1389 signed int v4; // edx@3 | |
1390 char v5; // zf@3 | |
1391 unsigned int v6; // eax@3 | |
1392 int v7; // eax@6 | |
1393 int v8; // eax@7 | |
1394 int v9; // eax@8 | |
1395 int v10; // eax@9 | |
1396 int v11; // eax@10 | |
1397 int v12; // eax@11 | |
1398 int v13; // esi@35 | |
1399 signed int v14; // edi@37 | |
1400 enum CHARACTER_RACE v15; // eax@44 | |
1401 Player *v16; // ecx@47 | |
1402 unsigned __int8 v17; // sf@50 | |
1403 unsigned __int8 v18; // of@50 | |
1404 int v19; // esi@52 | |
1405 Player *v20; // ecx@53 | |
1406 int result; // eax@57 | |
1407 int v22[16]; // [sp+8h] [bp-140h]@3 | |
1408 int v23[60]; // [sp+48h] [bp-100h]@48 | |
1409 int v24; // [sp+138h] [bp-10h]@2 | |
1410 int v25; // [sp+13Ch] [bp-Ch]@1 | |
1411 int v26; // [sp+140h] [bp-8h]@1 | |
1412 int v27; // [sp+144h] [bp-4h]@1 | |
1413 | |
1414 v27 = -1; | |
1415 v26 = -1; | |
1416 v25 = -1; | |
1417 v2 = 0; | |
1418 if ( pActor->pMonsterInfo.uAttackPreference ) | |
1419 { | |
1420 v3 = 0; | |
1421 v24 = 0; | |
1422 do | |
1423 { | |
1424 v4 = 1; | |
1425 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3); | |
1426 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0; | |
1427 v22[v3] = v6; | |
1428 if ( !v5 ) | |
1429 { | |
1430 if ( (signed int)v6 > 128 ) | |
1431 { | |
1432 switch ( v6 ) | |
1433 { | |
1434 case 0x100u: | |
1435 v27 = 8; | |
1436 break; | |
1437 case 0x200u: | |
1438 v25 = 0; | |
1439 break; | |
1440 case 0x400u: | |
1441 v25 = 1; | |
1442 break; | |
1443 case 0x800u: | |
1444 v26 = 0; | |
1445 break; | |
1446 case 0x1000u: | |
1447 v26 = 1; | |
1448 break; | |
1449 case 0x2000u: | |
1450 v26 = 3; | |
1451 break; | |
1452 case 0x4000u: | |
1453 v26 = 2; | |
1454 break; | |
1455 } | |
1456 } | |
1457 else | |
1458 { | |
1459 if ( v6 == 128 ) | |
1460 { | |
1461 v27 = 4; | |
1462 } | |
1463 else | |
1464 { | |
1465 v7 = v6 - 1; | |
1466 if ( v7 ) | |
1467 { | |
1468 v8 = v7 - 1; | |
1469 if ( v8 ) | |
1470 { | |
1471 v9 = v8 - 2; | |
1472 if ( v9 ) | |
1473 { | |
1474 v10 = v9 - 4; | |
1475 if ( v10 ) | |
1476 { | |
1477 v11 = v10 - 8; | |
1478 if ( v11 ) | |
1479 { | |
1480 v12 = v11 - 16; | |
1481 if ( v12 ) | |
1482 { | |
1483 if ( v12 == 32 ) | |
1484 v27 = 20; | |
1485 } | |
1486 else | |
1487 { | |
1488 v27 = 32; | |
1489 } | |
1490 } | |
1491 else | |
1492 { | |
1493 v27 = 24; | |
1494 } | |
1495 } | |
1496 else | |
1497 { | |
1498 v27 = 28; | |
1499 } | |
1500 } | |
1501 else | |
1502 { | |
1503 v27 = 16; | |
1504 } | |
1505 } | |
1506 else | |
1507 { | |
1508 v27 = 12; | |
1509 } | |
1510 } | |
1511 else | |
1512 { | |
1513 v27 = 0; | |
1514 } | |
1515 } | |
1516 } | |
1517 v2 = 0; | |
1518 v13 = 0; | |
1519 while ( 1 ) | |
1520 { | |
1521 v14 = 0; | |
135 | 1522 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType ) |
0 | 1523 v14 = v4; |
1524 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex ) | |
1525 v14 = v4; | |
1526 if ( v26 != -1 ) | |
1527 { | |
1528 v15 = pPlayers[v13 + 1]->GetRace(); | |
1529 if ( v26 == v15 ) | |
1530 v14 = 1; | |
1531 } | |
1532 if ( v14 == 1 ) | |
1533 { | |
1534 v16 = pPlayers[v13 + 1]; | |
1535 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) ) | |
1536 v23[v2++] = v13; | |
1537 } | |
1538 ++v13; | |
1539 if ( v13 >= 4 ) | |
1540 break; | |
1541 v4 = 1; | |
1542 } | |
1543 } | |
1544 v3 = v24 + 1; | |
1545 v18 = __OFSUB__(v24 + 1, 15); | |
1546 v17 = v24++ - 14 < 0; | |
1547 } | |
1548 while ( v17 ^ v18 ); | |
1549 if ( v2 ) | |
1550 goto LABEL_61; | |
1551 } | |
1552 v19 = 0; | |
1553 do | |
1554 { | |
1555 v20 = pPlayers[v19 + 1]; | |
1556 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) ) | |
1557 v23[v2++] = v19; | |
1558 ++v19; | |
1559 } | |
1560 while ( v19 < 4 ); | |
1561 if ( v2 ) | |
1562 LABEL_61: | |
1563 result = v23[rand() % v2]; | |
1564 else | |
1565 result = 0; | |
1566 return result; | |
1567 } | |
1568 | |
1569 //----- (0042704B) -------------------------------------------------------- | |
1570 bool stru319::special_ability_use_check(Actor *pActor, int a2) | |
1571 { | |
1572 stru319 *v3; // edi@1 | |
1573 signed int v4; // ebx@5 | |
1574 signed int v5; // edi@5 | |
1575 | |
1576 v3 = this; | |
1577 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2 | |
1578 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u | |
1579 && rand() % 100 < 5 ) | |
1580 pActor->_44FD29(a2); | |
1581 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID); | |
1582 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID); | |
1583 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance ) | |
1584 return 2; | |
1585 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance ) | |
1586 return 3; | |
1587 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance; | |
1588 } | |
1589 | |
1590 //----- (00427102) -------------------------------------------------------- | |
1591 int stru319::_427102(Actor *pActor, signed int a2) | |
1592 { | |
1593 unsigned __int8 v3; // cf@11 | |
1594 unsigned __int8 v4; // zf@11 | |
1595 SpellBuff *v6; // ecx@46 | |
89 | 1596 Player *v7; // esi@49 |
0 | 1597 signed int v8; // edx@50 |
89 | 1598 SpellBuff *v9; // ecx@50 |
0 | 1599 |
597 | 1600 switch(a2) |
0 | 1601 { |
597 | 1602 case 77: |
1603 { | |
1604 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP ) | |
1605 return 0; | |
1606 return 1; | |
1607 } | |
1608 case 80: | |
1609 { | |
1610 v6 = pParty->pPartyBuffs; | |
1611 while ( (signed __int64)v6->uExpireTime <= 0 ) | |
1612 { | |
1613 ++v6; | |
1167 | 1614 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] ) |
597 | 1615 { |
1616 v7 = pParty->pPlayers;//[0].pPlayerBuffs; | |
1617 v8 = 0; | |
1618 v9 = v7->pPlayerBuffs; | |
1619 while ( v9->uExpireTime <= 0i64 ) | |
1620 { | |
1621 ++v8; | |
1622 ++v9; | |
1623 if ( v8 >= 24 ) | |
1624 { | |
1625 ++v7; | |
1626 if ( v7 <= &pParty->pPlayers[3] ) | |
1627 { | |
1628 v8 = 0; | |
1629 v9 = v7->pPlayerBuffs; | |
1630 } | |
1631 else | |
1632 return 0; | |
1633 } | |
1634 } | |
1635 return 1; | |
1636 } | |
1637 } | |
1638 return 1; | |
1639 } | |
1640 case 85: | |
1641 { | |
1642 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 ) | |
1643 return 1; | |
1644 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 ) | |
1645 return 0; | |
1646 v3 = 0; | |
1647 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0; | |
1648 break; | |
1649 } | |
1650 case 86: | |
1651 { | |
0 | 1652 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 ) |
597 | 1653 return 1; |
0 | 1654 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 ) |
597 | 1655 return 0; |
0 | 1656 v3 = 0; |
1657 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0; | |
597 | 1658 break; |
1659 } | |
1660 case 95: | |
1661 { | |
1662 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 ) | |
1663 return 1; | |
0 | 1664 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 ) |
597 | 1665 return 0; |
0 | 1666 v3 = 0; |
1667 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0; | |
597 | 1668 break; |
1669 } | |
1670 case 73: | |
1671 { | |
1672 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 ) | |
1673 return 1; | |
1674 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 ) | |
1675 return 0; | |
1676 v3 = 0; | |
1677 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0; | |
1678 break; | |
1679 } | |
1680 case 5: | |
1681 { | |
1682 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 ) | |
1683 return 1; | |
1684 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 ) | |
1685 return 0; | |
1686 v3 = 0; | |
1687 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0; | |
1688 break; | |
1689 } | |
1690 case 17: | |
1691 { | |
1692 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 ) | |
1693 return 1; | |
1694 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 ) | |
1695 return 0; | |
1696 v3 = 0; | |
1697 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0; | |
1698 break; | |
1699 } | |
1700 case 38: | |
89 | 1701 { |
597 | 1702 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 ) |
1703 return 1; | |
1704 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 ) | |
1705 return 0; | |
1706 v3 = 0; | |
1707 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0; | |
1708 } | |
1709 case 46: | |
1710 { | |
1711 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 ) | |
89 | 1712 return 1; |
597 | 1713 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 ) |
1714 return 0; | |
1715 v3 = 0; | |
1716 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0; | |
1717 break; | |
1718 } | |
1719 case 47: | |
1720 { | |
1721 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 ) | |
1722 return 1; | |
1723 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 ) | |
1724 return 0; | |
1725 v3 = 0; | |
1726 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0; | |
1727 break; | |
1728 } | |
1729 case 51: | |
1730 { | |
1731 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 ) | |
1732 return 1; | |
1733 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 ) | |
1734 { | |
89 | 1735 v3 = 0; |
1736 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0; | |
1737 } | |
1738 else | |
597 | 1739 return 0; |
1740 break; | |
1741 } | |
1742 default: | |
89 | 1743 { |
597 | 1744 return 1; |
89 | 1745 } |
0 | 1746 } |
1747 if ( !(v3 | v4) ) | |
1748 return 0; | |
1749 return 1; | |
1750 } | |
1751 | |
1752 //----- (004272F5) -------------------------------------------------------- | |
1753 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4) | |
1754 { | |
1755 signed int v5; // esi@1 | |
1756 signed int v6; // edi@1 | |
1757 int v7; // esi@8 | |
1758 int v8; // eax@9 | |
1759 int v9; // edx@11 | |
1760 int v10; // edx@13 | |
1761 int v11; // esi@13 | |
1762 unsigned __int8 v12; // sf@13 | |
1763 unsigned __int8 v13; // of@13 | |
1764 int v14; // edx@14 | |
1765 int v15; // eax@14 | |
1766 signed int result; // eax@17 | |
1767 | |
1768 v5 = pActor->pMonsterInfo.uAC; | |
1769 v6 = 0; | |
1770 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 ) | |
1771 v5 /= 2; | |
1772 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1773 v6 = pActor->pActorBuffs[15].uPower; | |
1774 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 ) | |
1775 v6 = pActor->pActorBuffs[16].uPower; | |
1776 v7 = v6 + v5; | |
1777 if ( a3 ) | |
1778 v8 = pPlayer->GetRangedAttack(); | |
1779 else | |
1780 v8 = pPlayer->GetActualAttack(0); | |
1781 v9 = rand() % (v7 + 2 * v8 + 30); | |
1782 if ( a3 == 2 ) | |
1783 { | |
1784 v14 = a4 + v9; | |
1785 v15 = ((v7 + 15) >> 1) + v7 + 15; | |
1786 } | |
1787 else | |
1788 { | |
1789 if ( a3 != 3 ) | |
1790 { | |
1791 v10 = a4 + v9; | |
1792 v11 = v7 + 15; | |
1793 v13 = __OFSUB__(v10, v11); | |
1794 v12 = v10 - v11 < 0; | |
1795 goto LABEL_16; | |
1796 } | |
1797 v14 = a4 + v9; | |
1798 v15 = 2 * v7 + 30; | |
1799 } | |
1800 v13 = __OFSUB__(v14, v15); | |
1801 v12 = v14 - v15 < 0; | |
1802 LABEL_16: | |
1803 if ( v12 ^ v13 ) | |
1804 result = 0; | |
1805 else | |
1806 result = 1; | |
1807 return result; | |
1808 } | |
1809 | |
1810 //----- (004273BB) -------------------------------------------------------- | |
1811 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4) | |
1812 { | |
1813 Actor *v5; // ecx@1 | |
1814 signed int v6; // ebx@1 | |
1815 signed int v7; // esi@1 | |
1816 unsigned __int8 v8; // zf@1 | |
1817 unsigned __int8 v9; // sf@1 | |
1818 int v10; // ebx@10 | |
1819 signed int a2a; // [sp+18h] [bp+Ch]@1 | |
1820 | |
1821 v5 = a2; | |
1822 v6 = a2->pMonsterInfo.uAC; | |
1823 v7 = 0; | |
1824 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0; | |
1825 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0; | |
1826 a2a = 0; | |
1827 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) ) | |
1828 v6 /= 2; | |
1829 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 ) | |
1830 v7 = v5->pActorBuffs[14].uPower; | |
1831 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 ) | |
1832 v7 = v5->pActorBuffs[16].uPower; | |
1833 v10 = v7 + v6; | |
1834 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1835 a2a = pActor->pActorBuffs[14].uPower; | |
1836 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a ) | |
1837 a2a = pActor->pActorBuffs[17].uPower; | |
1838 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1839 { | |
1840 a2a += pActor->pActorBuffs[11].uPower; | |
1841 pActor->pActorBuffs[11].Reset(); | |
1842 } | |
1843 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5; | |
1844 } | |
1845 | |
1846 //----- (004274AD) -------------------------------------------------------- | |
1847 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer) | |
1848 { | |
1849 signed int v3; // edi@1 | |
1850 signed int v4; // esi@8 | |
1851 int v5; // esi@8 | |
1852 | |
1853 v3 = 0; | |
1854 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1855 v3 = pActor->pActorBuffs[14].uPower; | |
1856 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 ) | |
1857 v3 = pActor->pActorBuffs[17].uPower; | |
1858 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 ) | |
1859 { | |
1860 v3 += pActor->pActorBuffs[11].uPower; | |
1861 pActor->pActorBuffs[11].Reset(); | |
1862 } | |
1863 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10; | |
1864 v5 = rand() % v4 + 1; | |
1865 return v3 + v5 > pPlayer->GetActualAC() + 5; | |
1866 } | |
1867 | |
1868 //----- (00427546) -------------------------------------------------------- | |
1869 int stru319::_427546(int a2) | |
1870 { | |
1871 int result; // eax@2 | |
1872 | |
1873 if ( a2 >= 0 ) | |
1874 { | |
1875 if ( a2 >= 1 ) | |
1876 result = (a2 >= 2) + 2; | |
1877 else | |
1878 result = 1; | |
1879 } | |
1880 else | |
1881 { | |
1882 result = 0; | |
1883 } | |
1884 return result; | |
1885 } | |
1886 | |
1887 //----- (0042756B) -------------------------------------------------------- | |
1888 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3) | |
1889 { | |
1890 int v4; // edx@1 | |
1891 int v5; // ecx@1 | |
1892 signed int v6; // eax@4 | |
1893 signed int result; // eax@17 | |
1894 signed int v8; // esi@18 | |
1895 | |
1896 v4 = 0; | |
1897 v5 = 0; | |
1898 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 ) | |
1899 v5 = pActor->pActorBuffs[14].uPower; | |
1900 switch ( a2 ) | |
1901 { | |
1902 case 4: | |
1903 v6 = pActor->pMonsterInfo.uResPhysical; | |
1904 break; | |
1905 case 0: | |
1906 v6 = pActor->pMonsterInfo.uResFire; | |
1907 goto LABEL_12; | |
1908 case 1: | |
1909 v6 = pActor->pMonsterInfo.uResAir; | |
1910 goto LABEL_12; | |
1911 case 2: | |
1912 v6 = pActor->pMonsterInfo.uResWater; | |
1913 goto LABEL_12; | |
1914 case 3: | |
1915 v6 = pActor->pMonsterInfo.uResEarth; | |
1916 goto LABEL_12; | |
1917 case 6: | |
1918 v6 = pActor->pMonsterInfo.uResSpirit; | |
1919 break; | |
1920 case 7: | |
1921 v6 = pActor->pMonsterInfo.uResMind; | |
1922 goto LABEL_12; | |
1923 case 8: | |
1924 v6 = pActor->pMonsterInfo.uResBody; | |
1925 LABEL_12: | |
1926 v4 = v5; | |
1927 break; | |
1928 case 9: | |
1929 v6 = pActor->pMonsterInfo.uResLight; | |
1930 break; | |
1931 case 10: | |
1932 v6 = pActor->pMonsterInfo.uResDark; | |
1933 break; | |
1934 default: | |
1935 v6 = 0; | |
1936 break; | |
1937 } | |
1938 if ( v6 < 200 ) | |
1939 { | |
1940 v8 = v4 + v6 + 30; | |
1941 if ( rand() % v8 >= 30 ) | |
1942 { | |
1943 a3 >>= 1; | |
1944 if ( rand() % v8 >= 30 ) | |
1945 { | |
1946 a3 >>= 1; | |
1947 if ( rand() % v8 >= 30 ) | |
1948 { | |
1949 a3 >>= 1; | |
1950 if ( rand() % v8 >= 30 ) | |
1951 a3 >>= 1; | |
1952 } | |
1953 } | |
1954 } | |
1955 result = a3; | |
1956 } | |
1957 else | |
1958 { | |
1959 result = 0; | |
1960 } | |
1961 return result; | |
1962 } | |
1963 | |
1964 //----- (00427662) -------------------------------------------------------- | |
1965 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType) | |
1966 { | |
1967 Actor *v3; // edi@2 | |
1968 signed int v4; // esi@2 | |
1969 bool result; // eax@13 | |
1970 | |
1971 switch ( uType ) | |
1972 { | |
1973 case 0u: | |
1974 v3 = pActor; | |
1975 v4 = pActor->pMonsterInfo.uResFire; | |
1976 goto LABEL_12; | |
1977 case 1u: | |
1978 v3 = pActor; | |
1979 v4 = pActor->pMonsterInfo.uResAir; | |
1980 goto LABEL_12; | |
1981 case 2u: | |
1982 v3 = pActor; | |
1983 v4 = pActor->pMonsterInfo.uResWater; | |
1984 goto LABEL_12; | |
1985 case 3u: | |
1986 v3 = pActor; | |
1987 v4 = pActor->pMonsterInfo.uResEarth; | |
1988 goto LABEL_12; | |
1989 case 7u: | |
1990 v3 = pActor; | |
1991 v4 = pActor->pMonsterInfo.uResMind; | |
1992 goto LABEL_12; | |
1993 case 6u: | |
1994 v3 = pActor; | |
1995 v4 = pActor->pMonsterInfo.uResSpirit; | |
1996 goto LABEL_12; | |
1997 case 8u: | |
1998 v3 = pActor; | |
1999 v4 = pActor->pMonsterInfo.uResBody; | |
2000 goto LABEL_12; | |
2001 case 9u: | |
2002 v3 = pActor; | |
2003 v4 = pActor->pMonsterInfo.uResLight; | |
2004 goto LABEL_12; | |
2005 case 0xAu: | |
2006 v3 = pActor; | |
2007 v4 = pActor->pMonsterInfo.uResDark; | |
2008 goto LABEL_12; | |
2009 case 4u: | |
2010 v3 = pActor; | |
2011 v4 = pActor->pMonsterInfo.uResPhysical; | |
2012 LABEL_12: | |
2013 if ( v4 < 200 ) | |
2014 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; | |
2015 else | |
2016 result = 0; | |
2017 break; | |
2018 default: | |
2019 result = 1; | |
2020 break; | |
2021 } | |
2022 return result; | |
2023 } | |
2024 | |
2025 //----- (00427769) -------------------------------------------------------- | |
2026 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
2027 { | |
2028 bool result; // eax@2 | |
2029 | |
710 | 2030 __debugbreak(); // refactor |
0 | 2031 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) |
2032 result = 1; | |
2033 else | |
2034 result = 0; | |
2035 return result; | |
2036 } | |
2037 | |
2038 //----- (0042777D) -------------------------------------------------------- | |
319 | 2039 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) |
0 | 2040 { |
370 | 2041 //bool result; // eax@2 |
486 | 2042 //__int16 v6; // bx@4 |
437 | 2043 //Player *v7; // eax@4 |
486 | 2044 //char v8; // zf@12 |
0 | 2045 unsigned __int16 v9; // cx@16 |
2046 unsigned int v10; // eax@18 | |
2047 unsigned __int8 v11; // sf@18 | |
2048 unsigned __int8 v12; // of@18 | |
2049 unsigned __int16 v13; // cx@21 | |
2050 unsigned int v14; // eax@23 | |
486 | 2051 //stru277 *v15; // esi@27 |
2052 //stru277 *v16; // eax@28 | |
832 | 2053 //GUIWindow *v17; // eax@43 |
2054 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
2055 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
2056 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
2057 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
2058 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
2059 //int v23; // [sp-1Ch] [bp-34h]@44 | |
2060 //int v24; // [sp-18h] [bp-30h]@44 | |
2061 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
2062 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
2063 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
2064 //char *v28; // [sp-8h] [bp-20h]@43 | |
2065 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
486 | 2066 //__int16 a3a; // [sp+10h] [bp-8h]@1 |
2067 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
2068 | |
2069 //a3a = uPlayerID; | |
2070 //a2a = a1; | |
370 | 2071 |
2072 //if ( pParty->bTurnBasedModeOn != 1 | |
2073 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
2074 if (pParty->bTurnBasedModeOn) | |
0 | 2075 { |
370 | 2076 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) |
2077 return; | |
2078 } | |
2079 | |
2080 | |
486 | 2081 //v6 = a5; |
437 | 2082 //v7 = &pParty->pPlayers[uPlayerID]; |
2083 assert(uPlayerID < 4); | |
2084 auto player = &pParty->pPlayers[uPlayerID]; | |
0 | 2085 if ( !(a5 & 0x10) ) |
2086 { | |
2087 switch ( a1 ) | |
2088 { | |
486 | 2089 case SPELL_SPIRIT_FATE: |
2090 case SPELL_BODY_FIRST_AID: | |
2091 case SPELL_DARK_REANIMATE: | |
2092 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
2093 a5 |= 0x0100; | |
0 | 2094 break; |
486 | 2095 |
2096 case SPELL_FIRE_FIRE_AURA: | |
2097 case SPELL_WATER_RECHARGE_ITEM: | |
2098 case SPELL_WATER_ENCHANT_ITEM: | |
2099 case SPELL_DARK_VAMPIRIC_WEAPON: | |
2100 //LOBYTE(v6) = a5 | 0x80; | |
2101 a5 |= 0x0080; | |
0 | 2102 break; |
486 | 2103 |
2104 case SPELL_FIRE_FIRE_BOLT: | |
2105 case SPELL_FIRE_FIREBALL: | |
2106 case SPELL_FIRE_INCINERATE: | |
2107 case SPELL_AIR_LIGHNING_BOLT: | |
2108 case SPELL_AIR_IMPLOSION: | |
2109 case SPELL_WATER_POISON_SPRAY: | |
2110 case SPELL_WATER_ICE_BOLT: | |
2111 case SPELL_WATER_ACID_BURST: | |
2112 case SPELL_WATER_ICE_BLAST: | |
2113 case SPELL_EARTH_STUN: | |
2114 case SPELL_EARTH_SLOW: | |
2115 case SPELL_EARTH_DEADLY_SWARM: | |
2116 case SPELL_EARTH_BLADES: | |
2117 case SPELL_EARTH_MASS_DISTORTION: | |
2118 case SPELL_SPIRIT_SPIRIT_LASH: | |
2119 case SPELL_MIND_MIND_BLAST: | |
2120 case SPELL_MIND_CHARM: | |
2121 case SPELL_MIND_PSYCHIC_SHOCK: | |
2122 case SPELL_BODY_HARM: | |
2123 case SPELL_BODY_FLYING_FIST: | |
2124 case SPELL_LIGHT_LIGHT_BOLT: | |
2125 case SPELL_LIGHT_DESTROY_UNDEAD: | |
2126 case SPELL_LIGHT_SUNRAY: | |
2127 case SPELL_DARK_TOXIC_CLOUD: | |
2128 case SPELL_DARK_SHRINKING_RAY: | |
2129 case SPELL_DARK_SHARPMETAL: | |
2130 case SPELL_DARK_DRAGON_BREATH: | |
0 | 2131 if ( !a6 ) |
486 | 2132 a5 |= 0x0008; |
0 | 2133 break; |
486 | 2134 case SPELL_MIND_TELEPATHY: |
2135 case SPELL_MIND_BERSERK: | |
2136 case SPELL_MIND_ENSLAVE: | |
2137 case SPELL_LIGHT_PARALYZE: | |
2138 case SPELL_DARK_CONTROL_UNDEAD: | |
2139 //LABEL_9: | |
2140 //v6 = a5 | 8; | |
2141 a5 |= 0x0008; | |
0 | 2142 break; |
486 | 2143 |
2144 case SPELL_EARTH_TELEKINESIS: | |
2145 a5 |= 0x0040; | |
2146 break; | |
2147 | |
2148 case SPELL_SPIRIT_BLESS: | |
2149 if (a4 && ~a4 & 0x01C0) | |
961 | 2150 //goto LABEL_25; |
2151 { | |
2152 a5 |= 0x0002; | |
2153 break; | |
2154 } | |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1106
diff
changeset
|
2155 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0) |
961 | 2156 //goto LABEL_25; |
2157 { | |
2158 a5 |= 0x0002; | |
2159 break; | |
2160 } | |
0 | 2161 break; |
486 | 2162 |
2163 case SPELL_SPIRIT_PRESERVATION: | |
0 | 2164 v9 = a4; |
2165 if ( !a4 ) | |
437 | 2166 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; |
961 | 2167 //goto LABEL_18; |
2168 v10 = SkillToMastery(v9); | |
2169 v12 = __OFSUB__(v10, 3); | |
2170 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
2171 //goto LABEL_24; | |
2172 if ( v11 ^ v12 ) | |
2173 { | |
2174 a5 |= 0x0002; | |
2175 break; | |
2176 } | |
2177 break; | |
486 | 2178 |
2179 case SPELL_DARK_PAIN_REFLECTION: | |
0 | 2180 v9 = a4; |
2181 if ( !a4 ) | |
437 | 2182 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; |
961 | 2183 //LABEL_18: |
0 | 2184 v10 = SkillToMastery(v9); |
2185 v12 = __OFSUB__(v10, 3); | |
2186 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
961 | 2187 //goto LABEL_24; |
2188 if ( v11 ^ v12 ) | |
2189 { | |
2190 a5 |= 0x0002; | |
2191 break; | |
2192 } | |
2193 break; | |
486 | 2194 |
2195 case SPELL_BODY_HAMMERHANDS: | |
0 | 2196 v13 = a4; |
2197 if ( !a4 ) | |
437 | 2198 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; |
0 | 2199 v14 = SkillToMastery(v13); |
2200 v12 = __OFSUB__(v14, 4); | |
2201 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
961 | 2202 //LABEL_24: |
0 | 2203 if ( v11 ^ v12 ) |
961 | 2204 //goto LABEL_25; |
2205 { | |
2206 a5 |= 0x0002; | |
2207 break; | |
2208 } | |
0 | 2209 break; |
486 | 2210 |
2211 case SPELL_EARTH_STONE_TO_FLESH: | |
2212 case SPELL_SPIRIT_REMOVE_CURSE: | |
2213 case SPELL_SPIRIT_RAISE_DEAD: | |
2214 case SPELL_SPIRIT_RESSURECTION: | |
2215 case SPELL_MIND_REMOVE_FEAR: | |
2216 case SPELL_MIND_CURE_PARALYSIS: | |
2217 case SPELL_MIND_CURE_INSANITY: | |
2218 case SPELL_BODY_CURE_WEAKNESS: | |
2219 case SPELL_BODY_REGENERATION: | |
2220 case SPELL_BODY_CURE_POISON: | |
2221 case SPELL_BODY_CURE_DISEASE: | |
961 | 2222 //LABEL_25: |
486 | 2223 //v6 = a5 | 2; |
2224 a5 |= 0x0002; | |
0 | 2225 break; |
486 | 2226 |
2227 case SPELL_DARK_SACRIFICE: | |
2228 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
2229 a5 |= 0x0200; | |
0 | 2230 break; |
2231 default: | |
2232 break; | |
2233 } | |
2234 } | |
370 | 2235 |
486 | 2236 |
2237 if (a5 & 0x3CA) | |
0 | 2238 { |
1202 | 2239 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10); |
486 | 2240 for (uint i = 0; i < 10; ++i) |
924 | 2241 if (pCastSpellInfo[i].field_8 & 0x3CA) |
486 | 2242 { |
924 | 2243 pCastSpellInfo[i].spellnum = 0; |
486 | 2244 break; |
2245 } | |
0 | 2246 } |
486 | 2247 |
1202 | 2248 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10); |
486 | 2249 for (uint i = 0; i < 10; ++i) |
0 | 2250 { |
1202 | 2251 auto spell = &pCastSpellInfo[i]; |
486 | 2252 if (!spell->spellnum) |
2253 continue; | |
2254 | |
2255 spell->spellnum = 0; | |
2256 if (spell->field_8 & 0x3CA) | |
0 | 2257 { |
486 | 2258 pGUIWindow_Settings->Release(); |
2259 pGUIWindow_Settings = nullptr; | |
2260 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2261 GameUI_Footer_TimeLeft = 0; |
486 | 2262 unk_50C9A0 = 0; |
2263 back_to_game(); | |
0 | 2264 } |
2265 } | |
486 | 2266 |
1202 | 2267 int result = pCastSpellInfo.data()->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
0 | 2268 if ( result != -1 ) |
2269 { | |
486 | 2270 if ( a5 & 2 ) |
0 | 2271 { |
2272 if ( pGUIWindow_Settings ) | |
319 | 2273 return; |
961 | 2274 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2275 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); |
2276 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); | |
2277 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); | |
2278 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); | |
319 | 2279 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2280 return; | |
0 | 2281 } |
486 | 2282 if ( a5 & 8 ) |
0 | 2283 { |
2284 if ( pGUIWindow_Settings ) | |
319 | 2285 return; |
832 | 2286 |
961 | 2287 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2288 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); |
319 | 2289 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2290 return; | |
0 | 2291 } |
486 | 2292 if ( a5 & 0x40 ) |
0 | 2293 { |
2294 if ( pGUIWindow_Settings ) | |
319 | 2295 return; |
832 | 2296 |
961 | 2297 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
2298 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0); | |
832 | 2299 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2300 return; | |
0 | 2301 } |
486 | 2302 if ( (char)a5 < 0 ) |
0 | 2303 { |
2304 if ( pGUIWindow_Settings ) | |
319 | 2305 return; |
0 | 2306 ++pIcons_LOD->uTexturePacksCount; |
2307 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2308 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
924 | 2309 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
0 | 2310 unk_50C9A0 = 1; |
2311 some_active_character = uActiveCharacter; | |
319 | 2312 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2313 return; | |
0 | 2314 } |
486 | 2315 if ( HIBYTE(a5) & 1 ) |
0 | 2316 { |
2317 if ( pGUIWindow_Settings ) | |
319 | 2318 return; |
961 | 2319 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
998 | 2320 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); |
2321 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); | |
2322 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); | |
2323 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); | |
2324 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); | |
961 | 2325 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
0 | 2326 } |
486 | 2327 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
0 | 2328 { |
961 | 2329 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); |
832 | 2330 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2331 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
2332 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
960 | 2333 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", |
832 | 2334 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); |
2335 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
2336 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
2337 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
960 | 2338 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", |
832 | 2339 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); |
998 | 2340 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); |
2341 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); | |
0 | 2342 } |
2343 } | |
2344 } | |
2345 | |
2346 //----- (00427D48) -------------------------------------------------------- | |
924 | 2347 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
0 | 2348 { |
924 | 2349 CastSpellInfo *v2; // esi@1 |
0 | 2350 signed int v3; // ebx@1 |
2351 | |
2352 v2 = this; | |
2353 v3 = 10; | |
2354 do | |
2355 { | |
2356 if ( v2->spellnum ) | |
2357 { | |
2358 if ( v2->field_8 & 0x3CA ) | |
2359 { | |
2360 v2->spellnum = 0; | |
2361 pGUIWindow_Settings->Release(); | |
2362 pGUIWindow_Settings = 0; | |
2363 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2364 GameUI_Footer_TimeLeft = 0; |
0 | 2365 unk_50C9A0 = 0; |
2366 back_to_game(); | |
2367 } | |
2368 } | |
2369 ++v2; | |
2370 --v3; | |
2371 } | |
2372 while ( v3 ); | |
2373 } | |
2374 | |
2375 //----- (00427DA0) -------------------------------------------------------- | |
924 | 2376 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
0 | 2377 { |
2378 unsigned int result; // eax@1 | |
924 | 2379 CastSpellInfo *v7; // edx@1 |
2380 CastSpellInfo *v8; // ecx@5 | |
0 | 2381 |
2382 result = 0; | |
2383 v7 = this; | |
2384 while ( v7->spellnum ) | |
2385 { | |
2386 ++result; | |
2387 ++v7; | |
2388 if ( (signed int)result >= 10 ) | |
2389 goto LABEL_8; | |
2390 } | |
2391 v8 = &this[result]; | |
2392 v8->spellnum = a2; | |
2393 v8->uPlayerID = uPlayerID; | |
2394 if ( a5 & 0x10 ) | |
2395 v8->uPlayerID_2 = uPlayerID; | |
2396 v8->field_6 = 0; | |
488 | 2397 v8->spell_target_pid = 0; |
0 | 2398 v8->field_8 = a5; |
488 | 2399 v8->forced_spell_skill_level = skill_level; |
823 | 2400 v8->sound_id = spell_sound_id; |
0 | 2401 LABEL_8: |
2402 if ( result == 10 ) | |
2403 result = -1; | |
2404 return result; | |
2405 } | |
2406 | |
2407 //----- (00427E01) -------------------------------------------------------- | |
924 | 2408 void CastSpellInfo::_427E01_cast_spell() |
0 | 2409 { |
2410 int v2; // edi@1 | |
924 | 2411 CastSpellInfo *pCastSpell; // ebx@2 |
0 | 2412 signed int v6; // eax@14 |
2413 unsigned __int16 v11; // cx@45 | |
2414 unsigned __int8 v14; // zf@53 | |
2415 signed int i; // esi@76 | |
2416 __int16 v23; // ax@88 | |
2417 int v51; // eax@146 | |
2418 __int16 v52; // ax@153 | |
2419 signed __int64 v54; // qax@164 | |
1005 | 2420 Actor *v55; // edi@164 |
0 | 2421 signed __int64 v58; // qax@177 |
1005 | 2422 Actor *pActor; // edi@177 |
0 | 2423 unsigned __int16 v60; // ax@184 |
2424 int v61; // ecx@184 | |
89 | 2425 ItemGen *v69; // esi@211 |
0 | 2426 double v90; // st7@245 |
89 | 2427 Player *v92; // eax@255 |
0 | 2428 int v105; // edi@271 |
2429 __int16 v108; // ST1C_2@274 | |
2430 __int16 v109; // ST18_2@274 | |
2431 stru6 *v110; // eax@274 | |
2432 int v111; // eax@274 | |
2433 Actor *v112; // esi@278 | |
2434 int v113; // eax@278 | |
2435 int v114; // ebx@278 | |
2436 unsigned int v115; // ecx@278 | |
2437 int v116; // edx@279 | |
2438 int v117; // edx@281 | |
2439 int v118; // edx@283 | |
2440 signed int v122; // eax@286 | |
2441 int v127; // eax@296 | |
2442 int v153; // ecx@322 | |
2443 int v154; // eax@322 | |
2444 int v155; // eax@323 | |
2445 int v156; // eax@323 | |
2446 int v162; // edi@340 | |
2447 signed int v164; // eax@340 | |
2448 signed int v165; // edi@340 | |
2449 signed int v168; // edi@343 | |
2450 int v169; // eax@344 | |
2451 signed int v174; // edi@355 | |
2452 int v188; // esi@369 | |
2453 int v189; // edi@369 | |
2454 signed int v191; // edi@379 | |
2455 signed int v205; // edi@405 | |
2456 int v206; // eax@407 | |
2457 __int16 v207; // cx@407 | |
2458 int v208; // eax@411 | |
2459 signed int v209; // ecx@412 | |
2460 int v210; // edx@412 | |
2461 signed int v211; // ecx@412 | |
2462 int v212; // eax@413 | |
2463 int v213; // eax@413 | |
2464 int v214; // eax@413 | |
2465 int v215; // eax@415 | |
2466 double v216; // st7@415 | |
2467 double v217; // st6@415 | |
2468 signed __int64 v218; // qtt@423 | |
2469 char v223; // al@438 | |
1009 | 2470 |
0 | 2471 int v227; // esi@453 |
2472 unsigned int v228; // edi@454 | |
2473 int v229; // edi@466 | |
1009 | 2474 |
1013 | 2475 ItemGen *v240; // ecx@472 |
0 | 2476 double v241; // st7@478 |
1013 | 2477 ItemGen *v245; // edi@492 |
0 | 2478 int v254; // eax@513 |
2479 int v255; // esi@513 | |
2480 int v256; // ecx@513 | |
2481 int v257; // edx@514 | |
2482 int v258; // ecx@514 | |
2483 char v259; // al@516 | |
2484 int v260; // eax@518 | |
2485 int v261; // esi@519 | |
2486 int v262; // edx@521 | |
1013 | 2487 int *v263; // ecx@521 |
0 | 2488 int v264; // esi@521 |
2489 int v265; // edx@521 | |
2490 int *ii; // eax@522 | |
2491 int v267; // eax@524 | |
2492 int v268; // eax@524 | |
2493 char v271; // al@531 | |
2494 int v277; // edx@548 | |
2495 int v278; // ecx@548 | |
2496 char v279; // al@550 | |
2497 int v280; // eax@552 | |
1013 | 2498 int *v281; // esi@553 |
0 | 2499 int v282; // edx@555 |
1013 | 2500 int *v283; // ecx@555 |
0 | 2501 int v284; // esi@555 |
2502 int v285; // edx@555 | |
2503 int *l; // eax@556 | |
2504 ItemGen *v294; // esi@575 | |
2505 int v295; // edx@575 | |
2506 int kk; // edi@575 | |
488 | 2507 char v313; // al@606pGame->GetStru6() |
0 | 2508 const char *v317; // ecx@617 |
2509 Player *v318; // ecx@619 | |
2510 unsigned int v319; // edi@627 | |
2511 int v323; // edi@635 | |
2512 char *v324; // eax@635 | |
2513 Player *v325; // ecx@640 | |
2514 int v328; // ecx@651 | |
2515 int v329; // ecx@652 | |
2516 int v330; // edi@654 | |
2517 signed int v342; // edi@668 | |
2518 signed int v343; // edi@670 | |
2519 unsigned __int64 v344; // ST08_8@670 | |
2520 Player *v351; // edi@680 | |
112 | 2521 Player *v357; // edi@694 |
0 | 2522 Actor *v369; // edi@705 |
2523 int v373; // eax@715 | |
2524 int v374; // eax@717 | |
2525 int v376; // eax@717 | |
2526 Player *v377; // ecx@719 | |
2527 int v381; // edi@727 | |
2528 int v382; // ecx@727 | |
2529 Player *v383; // eax@728 | |
2530 int v384; // eax@733 | |
2531 int v388; // edi@740 | |
2532 int v396; // eax@752 | |
2533 int v397; // eax@757 | |
2534 int v398; // eax@757 | |
2535 int v399; // eax@757 | |
1013 | 2536 Actor *v417; // eax@787 |
0 | 2537 int v418; // ecx@789 |
2538 __int16 v419; // ax@791 | |
2539 signed int v420; // eax@793 | |
1013 | 2540 ItemGen *v421; // edx@793 |
0 | 2541 const char *v422; // eax@801 |
2542 signed int v426; // eax@815 | |
2543 Actor *v433; // edi@832 | |
2544 int v435; // ecx@837 | |
2545 int v440; // eax@843 | |
2546 int v441; // eax@847 | |
2547 signed int v445; // edi@857 | |
2548 int v446; // ecx@862 | |
2549 LevelDecoration *v447; // edi@864 | |
2550 __int16 v448; // ax@864 | |
2551 char *v449; // esi@870 | |
2552 int v450; // eax@870 | |
2553 signed int v460; // eax@895 | |
2554 Actor *v461; // eax@897 | |
2555 unsigned __int16 v462; // cx@897 | |
2556 signed int v463; // edx@897 | |
2557 int v470; // edi@913 | |
2558 int v471; // eax@917 | |
2559 int v472; // eax@917 | |
2560 int v498; // edi@931 | |
2561 int v499; // eax@935 | |
2562 int v500; // eax@935 | |
2563 Player *v501; // edi@939 | |
2564 int v505; // eax@943 | |
2565 int v507; // edi@944 | |
2566 signed int v509; // eax@944 | |
1102 | 2567 //signed int v510; // edi@944 |
90 | 2568 Actor *v518; // edx@957 |
0 | 2569 __int16 v519; // cx@958 |
2570 int v531; // eax@982 | |
2571 int v533; // edi@983 | |
2572 signed int v535; // eax@983 | |
2573 signed int v536; // edi@983 | |
2574 stru6 *v537; // eax@984 | |
2575 double v549; // st7@991 | |
2576 unsigned __int16 v550; // di@991 | |
89 | 2577 Player *v553; // edi@1001 |
0 | 2578 unsigned __int16 v562; // di@1005 |
2579 signed int v563; // eax@1010 | |
2580 unsigned int v564; // ecx@1011 | |
2581 signed int v565; // eax@1012 | |
2582 Player **v566; // ecx@1012 | |
2583 int v567; // eax@1012 | |
2584 Player *v571; // eax@1013 | |
2585 char *v572; // ecx@1013 | |
2586 signed int v576; // eax@1025 | |
2587 Player *v577; // eax@1026 | |
2588 int v578; // eax@1028 | |
2589 __int16 v579; // ax@1029 | |
2590 int v581; // edi@1031 | |
2591 char *v585; // esi@1034 | |
2592 signed int v587; // eax@1035 | |
2593 char v591; // al@1048 | |
1013 | 2594 ItemGen *v592; // esi@1052 |
0 | 2595 int v596; // esi@1066 |
2596 unsigned int v597; // edi@1067 | |
2597 int v600; // edi@1086 | |
2598 int v601; // edx@1086 | |
2599 int v602; // eax@1086 | |
2600 int v603; // ecx@1086 | |
1009 | 2601 NPCData *pNPCData; // eax@1089 |
0 | 2602 int v606; // edx@1091 |
1013 | 2603 AwardType *v607; // ecx@1100 |
0 | 2604 __int16 v608; // ax@1102 |
2605 signed int v609; // eax@1104 | |
1160 | 2606 int v610; // edi@1106 |
0 | 2607 unsigned int v611; // eax@1106 |
89 | 2608 Player *v612; // edi@1106 |
2609 DDM_DLV_Header *v613; // eax@1108 | |
0 | 2610 int v615; // edi@1119 |
112 | 2611 Player *v619; // edi@1123 |
0 | 2612 signed __int64 v623; // qax@1127 |
2613 int v625; // edi@1129 | |
2614 signed int v627; // eax@1129 | |
2615 signed int v628; // edi@1129 | |
2616 int v629; // ecx@1130 | |
2617 Player *v630; // eax@1131 | |
2618 int v631; // eax@1137 | |
2619 int v635; // edi@1142 | |
2620 int v642; // edi@1156 | |
2621 int v643; // eax@1156 | |
2622 int v644; // eax@1156 | |
2623 signed int v645; // eax@1158 | |
2624 unsigned int v656; // [sp-4h] [bp-E88h]@639 | |
2625 int v657; // [sp-4h] [bp-E88h]@807 | |
2626 int v659; // [sp+0h] [bp-E84h]@123 | |
2627 int v660; // [sp+0h] [bp-E84h]@146 | |
2628 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
2629 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 | |
2630 const char *v664; // [sp+0h] [bp-E84h]@802 | |
2631 int v665; // [sp+0h] [bp-E84h]@807 | |
2632 int v666; // [sp+4h] [bp-E80h]@12 | |
821 | 2633 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
0 | 2634 int v671; // [sp+4h] [bp-E80h]@146 |
1013 | 2635 int v675; // [sp+4h] [bp-E80h]@800 |
0 | 2636 int v676; // [sp+4h] [bp-E80h]@807 |
2637 int v677; // [sp+4h] [bp-E80h]@861 | |
1013 | 2638 int v679[800]; // [sp+14h] [bp-E70h]@515 |
0 | 2639 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 |
2640 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
2641 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
2642 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
2643 int v684; // [sp+D04h] [bp-180h]@416 | |
2644 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
2645 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2646 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2647 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2648 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2649 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 |
0 | 2650 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2651 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2652 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2653 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
1119 | 2654 int v710; // [sp+D8Ch] [bp-F8h]@1156 |
0 | 2655 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
2656 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
2657 int n; // [sp+DA0h] [bp-E4h]@1 | |
2658 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
2659 int v716; // [sp+DC0h] [bp-C4h]@272 | |
2660 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
2661 float v718; // [sp+DCCh] [bp-B8h]@176 | |
2662 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
2663 char *y; // [sp+DD4h] [bp-B0h]@325 | |
2664 int v721; // [sp+DD8h] [bp-ACh]@163 | |
2665 int v723; // [sp+E4Ch] [bp-38h]@1 | |
2666 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
2667 float v725; // [sp+E54h] [bp-30h]@23 | |
2668 Player *v726; // [sp+E58h] [bp-2Ch]@131 | |
2669 float v727; // [sp+E5Ch] [bp-28h]@1 | |
2670 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
2671 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
2672 int v730; // [sp+E68h] [bp-1Ch]@53 | |
89 | 2673 Player *v730b; |
2674 ItemGen *v730c; | |
0 | 2675 int v731; // [sp+E6Ch] [bp-18h]@48 |
2676 signed int v732; // [sp+E70h] [bp-14h]@325 | |
2677 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
2678 signed int a2; // [sp+E7Ch] [bp-8h]@14 | |
2679 int amount; // [sp+E80h] [bp-4h]@1 | |
2680 | |
924 | 2681 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 |
1009 | 2682 |
0 | 2683 v2 = 0; |
2684 amount = 0; | |
2685 LODWORD(v733) = 0; | |
2686 v723 = 0; | |
2687 v727 = 0.0; | |
889 | 2688 for(n = 0; n < 10; ++n) |
0 | 2689 { |
924 | 2690 pCastSpell = &this[n]; |
2691 HIDWORD(v733) = (int)pCastSpell; | |
2692 if ( pCastSpell->spellnum == 0 ) | |
889 | 2693 continue; |
486 | 2694 |
2695 if (pParty->Invisible()) | |
2696 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2697 | |
924 | 2698 if ( pCastSpell->field_8 & 0x3CA ) |
0 | 2699 { |
924 | 2700 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
2701 this->_427D48(1); | |
889 | 2702 continue; |
0 | 2703 } |
924 | 2704 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2705 | |
2706 a2 = pCastSpell->spell_target_pid; | |
2707 if (!pCastSpell->spell_target_pid) | |
0 | 2708 { |
924 | 2709 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
2710 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | |
2711 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | |
488 | 2712 v666 = 1; |
2713 else | |
2714 v666 = 0; | |
2715 | |
2716 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
2717 v6 = pMouse->uPointingObjectID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2718 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
488 | 2719 a2 = pMouse->uPointingObjectID; |
0 | 2720 } |
488 | 2721 |
2722 | |
924 | 2723 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
2724 if (pSpellSprite.uType) | |
0 | 2725 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
2726 if (PID_TYPE(a2) == OBJECT_Actor) |
0 | 2727 { |
924 | 2728 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
0 | 2729 v2 = v723; |
2730 } | |
2731 else | |
2732 { | |
2733 v715.uYawAngle = pParty->sRotationY; | |
2734 v715.uPitchAngle = pParty->sRotationX; | |
2735 } | |
2736 } | |
488 | 2737 |
486 | 2738 LODWORD(v725) = 0; |
2739 _this = 0; | |
924 | 2740 if (pCastSpell->forced_spell_skill_level) |
488 | 2741 { |
924 | 2742 v11 = pCastSpell->forced_spell_skill_level; |
993 | 2743 v723 = v11 & 0x3F; // 6 bytes |
488 | 2744 v2 = v723; |
2745 } | |
2746 else | |
0 | 2747 { |
488 | 2748 //v667 = PLAYER_SKILL_STAFF; |
924 | 2749 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
488 | 2750 v667 = PLAYER_SKILL_FIRE; |
924 | 2751 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
488 | 2752 v667 = PLAYER_SKILL_AIR; |
924 | 2753 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
488 | 2754 v667 = PLAYER_SKILL_WATER; |
924 | 2755 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
488 | 2756 v667 = PLAYER_SKILL_EARTH; |
924 | 2757 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
488 | 2758 v667 = PLAYER_SKILL_SPIRIT; |
924 | 2759 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
488 | 2760 v667 = PLAYER_SKILL_MIND; |
924 | 2761 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
488 | 2762 v667 = PLAYER_SKILL_BODY; |
924 | 2763 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
488 | 2764 v667 = PLAYER_SKILL_LIGHT; |
924 | 2765 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
488 | 2766 v667 = PLAYER_SKILL_DARK; |
924 | 2767 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
488 | 2768 v667 = PLAYER_SKILL_BOW; |
2769 else assert(false && "Unknown spell"); | |
2770 | |
0 | 2771 LODWORD(v725) = v667; |
488 | 2772 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
2773 v2 = v723; | |
2774 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; | |
0 | 2775 } |
488 | 2776 |
993 | 2777 v731 = SkillToMastery(v11); |
488 | 2778 |
924 | 2779 if (pCastSpell->forced_spell_skill_level) |
486 | 2780 uRequiredMana = 0; |
488 | 2781 else |
924 | 2782 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
2783 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; | |
488 | 2784 |
2785 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
490 | 2786 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
486 | 2787 uRequiredMana = 0; |
488 | 2788 |
924 | 2789 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
2790 { | |
2791 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | |
2792 pCastSpell->spellnum = 0; | |
2793 continue; | |
2794 } | |
2795 v730 = pCastSpell->spellnum; | |
2796 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | |
2797 { | |
2798 if (!pParty->bTurnBasedModeOn) | |
2799 { | |
2800 //v646 = pPlayer; | |
2801 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
2802 //v647 = n; | |
2803 } | |
2804 else | |
2805 { | |
2806 //v647 = n; | |
2807 //v646 = pPlayer; | |
2808 //v648 = sRecoveryTime; | |
2809 //v649 = pPlayer; | |
2810 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; | |
2811 pPlayer->SetRecoveryTime(sRecoveryTime); | |
2812 pTurnEngine->_40471C(); | |
2813 } | |
2814 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
2815 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2816 this[n].spellnum = 0; | |
2817 pPlayer->sMana -= uRequiredMana; | |
2818 return; | |
2819 } | |
2820 | |
2821 switch ( pCastSpell->spellnum ) | |
2822 { | |
1005 | 2823 case SPELL_101: |
2824 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
2825 case SPELL_BOW_ARROW: | |
2826 { | |
2827 amount = 1; | |
2828 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
2829 amount = 2; | |
2830 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); | |
2831 pSpellSprite.stru_24.Reset(); | |
2832 pSpellSprite.spell_level = v2; | |
2833 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2834 pSpellSprite.spell_skill = v731; | |
2835 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1080 | 2836 if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) ) |
1005 | 2837 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
2838 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2839 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2840 pSpellSprite.uAttributes = 0; | |
2841 pSpellSprite.uSpriteFrameID = 0; | |
2842 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2843 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2844 pSpellSprite.spell_target_pid = a2; | |
2845 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2846 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2847 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2848 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
1100 | 2849 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); |
1005 | 2850 pSpellSprite.uAttributes = 256; |
2851 if ( pParty->bTurnBasedModeOn == 1 ) | |
2852 pSpellSprite.uAttributes = 260; | |
2853 for ( i = 0; i < amount; ++i ) | |
2854 { | |
2855 if ( i ) | |
2856 pSpellSprite.vPosition.z += 32; | |
2857 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
2858 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2859 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2860 ++pTurnEngine->field_1C; | |
2861 } | |
2862 break; | |
2863 } | |
2864 case SPELL_LASER_PROJECTILE: | |
2865 { | |
924 | 2866 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
2867 pSpellSprite.stru_24.Reset(); | |
2868 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2869 pSpellSprite.spell_level = v723; | |
2870 pSpellSprite.spell_skill = v731; | |
2871 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2872 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2873 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2874 pSpellSprite.uAttributes = 0; | |
2875 pSpellSprite.uSpriteFrameID = 0; | |
2876 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
2877 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2878 pSpellSprite.spell_target_pid = a2; | |
2879 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2880 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2881 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1005 | 2882 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
2883 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); | |
2884 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
2885 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); | |
924 | 2886 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); |
2887 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
2888 pSpellSprite.uSectorID = v23; | |
889 | 2889 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 2890 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
2891 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
2892 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 2893 ++pTurnEngine->field_1C; |
924 | 2894 break; |
1005 | 2895 } |
2896 case SPELL_FIRE_TORCH_LIGHT: | |
2897 { | |
889 | 2898 switch (v731) |
2899 { | |
890 | 2900 case 1: amount = 2; break; |
2901 case 2: amount = 3; break; | |
2902 case 3: | |
2903 case 4: amount = 4; break; | |
2904 default: | |
889 | 2905 assert(false); |
2906 } | |
2907 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 2908 break; |
889 | 2909 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
2910 LODWORD(v727) = 1; | |
890 | 2911 break; |
1005 | 2912 } |
2913 case SPELL_FIRE_FIRE_SPIKE: | |
2914 { | |
2915 switch (v731) | |
2916 { | |
2917 case 1: amount = 3; break; | |
2918 case 2: amount = 5; break; | |
2919 case 3: amount = 7; break; | |
2920 case 4: amount = 9; break; | |
2921 default: | |
2922 assert(false); | |
2923 } | |
2924 | |
2925 //v31 = v3->uPlayerID; | |
2926 //v32 = 8 * v31; | |
2927 //LOBYTE(v32) = v32 | OBJECT_Player; | |
2928 | |
2929 //if ( (signed int)uNumSpriteObjects > 0 ) | |
2930 int _v733 = 0; | |
2931 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
2932 { | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2933 auto object = &pSpriteObjects[i]; |
1005 | 2934 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
2935 ++_v733; | |
2936 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
2937 v730 = uNumSpriteObjects; | |
2938 do | |
2939 { | |
2940 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
2941 ++HIDWORD(v733); | |
2942 v33 += 112; | |
2943 --v730; | |
2944 } | |
2945 while ( v730 );*/ | |
2946 } | |
2947 if (_v733 > amount) | |
2948 { | |
2949 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2950 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2951 pCastSpell->spellnum = 0; | |
2952 continue; | |
2953 } | |
2954 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2955 break; | |
2956 pSpellSprite.stru_24.Reset(); | |
2957 pSpellSprite.spell_id = pCastSpell->spellnum; | |
2958 pSpellSprite.spell_level = v2; | |
2959 pSpellSprite.spell_skill = v731; | |
2960 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
2961 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2962 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2963 pSpellSprite.uAttributes = 0; | |
2964 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2965 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
2966 pSpellSprite.uSpriteFrameID = 0; | |
2967 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2968 pSpellSprite.spell_target_pid = a2; | |
2969 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2970 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2971 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2972 if ( pParty->bTurnBasedModeOn == 1 ) | |
2973 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
2974 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
2975 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
2976 ++pTurnEngine->field_1C; | |
889 | 2977 LODWORD(v727) = 1; |
890 | 2978 break; |
2979 } | |
1005 | 2980 case SPELL_AIR_IMPLOSION: |
2981 { | |
2982 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2983 break; | |
2984 if (!a2) | |
2985 { | |
2986 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2987 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
2988 pCastSpell->spellnum = 0; | |
2989 continue; | |
2990 } | |
2991 if (PID_TYPE(a2) != OBJECT_Actor) | |
2992 { | |
2993 LODWORD(v727) = 1; | |
2994 break; | |
2995 } | |
2996 v697.x = 0; | |
2997 v697.y = 0; | |
2998 v697.z = 0; | |
2999 pSpellSprite.stru_24.Reset(); | |
3000 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3001 pSpellSprite.spell_level = v2; | |
3002 pSpellSprite.spell_skill = v731; | |
3003 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3004 pSpellSprite.uAttributes = 0; | |
3005 pSpellSprite.uSectorID = 0; | |
3006 pSpellSprite.uSpriteFrameID = 0; | |
3007 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3008 pSpellSprite.uFacing = 0; | |
3009 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3010 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3011 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3012 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3013 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3014 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3015 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
3016 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
890 | 3017 LODWORD(v727) = 1; |
3018 break; | |
3019 } | |
1005 | 3020 case SPELL_EARTH_MASS_DISTORTION: |
3021 { | |
3022 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3023 break; | |
3024 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3025 { | |
3026 LODWORD(v727) = 1; | |
3027 break; | |
3028 } | |
3029 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3030 v704.x = 0; | |
3031 v704.y = 0; | |
3032 v704.z = 0; | |
3033 pSpellSprite.stru_24.Reset(); | |
3034 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3035 pSpellSprite.spell_level = v2; | |
3036 pSpellSprite.spell_skill = v731; | |
3037 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3038 pSpellSprite.uAttributes = 0; | |
3039 pSpellSprite.uSectorID = 0; | |
3040 pSpellSprite.uSpriteFrameID = 0; | |
3041 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3042 pSpellSprite.uFacing = 0; | |
3043 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3044 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3045 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3046 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3047 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
1090 | 3048 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); |
1005 | 3049 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3050 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | |
3051 LODWORD(v727) = 1; | |
890 | 3052 break; |
1005 | 3053 } |
3054 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3055 { | |
3056 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
3057 break; | |
3058 //v730 = a2 >> 3; | |
3059 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3060 v691.x = 0; | |
3061 v691.y = 0; | |
3062 v691.z = 0; | |
3063 pSpellSprite.stru_24.Reset(); | |
3064 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3065 pSpellSprite.spell_level = v2; | |
3066 pSpellSprite.spell_skill = v731; | |
3067 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3068 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3069 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3070 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3071 pSpellSprite.uAttributes = 0; | |
3072 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3073 pSpellSprite.uSpriteFrameID = 0; | |
3074 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3075 pSpellSprite.spell_target_pid = a2; | |
3076 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3077 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3078 pSpellSprite.uAttributes |= 0x80u; | |
3079 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3080 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 3081 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
1005 | 3082 { |
3083 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3084 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3085 pCastSpell->spellnum = 0; | |
3086 continue; | |
3087 } | |
3088 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3089 LODWORD(v727) = 1; | |
3090 break; | |
3091 } | |
3092 case SPELL_FIRE_FIRE_BOLT: | |
3093 case SPELL_FIRE_FIREBALL: | |
3094 case SPELL_FIRE_INCINERATE: | |
3095 case SPELL_AIR_LIGHNING_BOLT: | |
3096 case SPELL_WATER_ICE_BOLT: | |
3097 case SPELL_WATER_ICE_BLAST: | |
3098 case SPELL_EARTH_STUN: | |
3099 case SPELL_EARTH_DEADLY_SWARM: | |
3100 case SPELL_MIND_MIND_BLAST: | |
3101 case SPELL_MIND_PSYCHIC_SHOCK: | |
3102 case SPELL_BODY_HARM: | |
3103 case SPELL_LIGHT_LIGHT_BOLT: | |
3104 case SPELL_DARK_DRAGON_BREATH: | |
3105 { | |
889 | 3106 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3107 break; |
924 | 3108 pSpellSprite.stru_24.Reset(); |
3109 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3110 pSpellSprite.spell_level = v2; | |
3111 pSpellSprite.spell_skill = v731; | |
3112 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3113 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3114 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3115 pSpellSprite.uAttributes = 0; | |
3116 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
889 | 3117 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
924 | 3118 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3119 else | |
3120 pSpellSprite.uSectorID = 0; | |
3121 pSpellSprite.uSpriteFrameID = 0; | |
3122 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3123 pSpellSprite.spell_target_pid = a2; | |
3124 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3125 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3126 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
889 | 3127 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3128 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3129 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3130 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; | |
3131 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3132 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3133 ++pTurnEngine->field_1C; |
3134 LODWORD(v727) = 1; | |
890 | 3135 break; |
1005 | 3136 } |
3137 case SPELL_WATER_ACID_BURST: | |
3138 case SPELL_EARTH_BLADES: | |
3139 case SPELL_BODY_FLYING_FIST: | |
3140 case SPELL_DARK_TOXIC_CLOUD: | |
3141 { | |
889 | 3142 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3143 break; |
924 | 3144 pSpellSprite.stru_24.Reset(); |
3145 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3146 pSpellSprite.spell_level = v2; | |
3147 pSpellSprite.spell_skill = v731; | |
3148 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
889 | 3149 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
924 | 3150 pSpellSprite.vPosition.y = pParty->vPosition.y; |
889 | 3151 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3152 v660 = pParty->vPosition.y; | |
993 | 3153 pSpellSprite.uAttributes = 0; |
3154 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3155 pSpellSprite.vPosition.z = v51; | |
3156 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3157 pSpellSprite.uSpriteFrameID = 0; | |
3158 pSpellSprite.uSectorID = v52; | |
3159 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3160 pSpellSprite.spell_target_pid = a2; | |
3161 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3162 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3163 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3164 if ( pParty->bTurnBasedModeOn == 1 ) | |
3165 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3166 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3167 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3168 ++pTurnEngine->field_1C; | |
3169 LODWORD(v727) = 1; | |
3170 break; | |
1009 | 3171 } |
1005 | 3172 case SPELL_LIGHT_SUNRAY: |
3173 { | |
889 | 3174 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
1009 | 3175 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) ) |
890 | 3176 { |
3177 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3178 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3179 pCastSpell->spellnum = 0; |
890 | 3180 continue; |
889 | 3181 } |
3182 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
924 | 3183 { |
3184 pSpellSprite.stru_24.Reset(); | |
3185 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3186 pSpellSprite.spell_skill = v731; | |
3187 pSpellSprite.spell_level = v2; | |
3188 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3189 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3190 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3191 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3192 v660 = pParty->vPosition.y; | |
993 | 3193 pSpellSprite.uAttributes = 0; |
3194 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3195 pSpellSprite.vPosition.z = v51; | |
3196 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
3197 pSpellSprite.uSpriteFrameID = 0; | |
3198 pSpellSprite.uSectorID = v52; | |
3199 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3200 pSpellSprite.spell_target_pid = a2; | |
3201 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3202 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3203 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3204 if ( pParty->bTurnBasedModeOn == 1 ) | |
3205 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3206 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3207 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3208 ++pTurnEngine->field_1C; | |
3209 LODWORD(v727) = 1; | |
924 | 3210 } |
3211 break; | |
1005 | 3212 } |
3213 case SPELL_LIGHT_PARALYZE: | |
3214 { | |
3215 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3216 break; | |
3217 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], | |
3218 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | |
3219 { | |
3220 LODWORD(v727) = 1; | |
3221 break; | |
3222 } | |
3223 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3224 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3225 v55 = &pActors[PID_ID(a2)]; | |
3226 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3227 BYTE2(v55->uAttributes) |= 8u; | |
3228 v55->vVelocity.x = 0; | |
3229 //v672 = 0; | |
3230 v55->vVelocity.y = 0; | |
3231 v661 = v55; | |
3232 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
3233 LODWORD(v727) = 1; | |
890 | 3234 break; |
1005 | 3235 } |
3236 case SPELL_EARTH_SLOW: | |
3237 { | |
3238 switch (v731) | |
3239 { | |
3240 case 1: LODWORD(v733) = 180 * v2; amount = 2; break; | |
3241 case 2: LODWORD(v733) = 300 * v2; amount = 2; break; | |
3242 case 3: LODWORD(v733) = 300 * v2; amount = 4; break; | |
3243 case 4: LODWORD(v733) = 300 * v2; amount = 8; break; | |
3244 default: | |
3245 assert(false); | |
3246 } | |
889 | 3247 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3248 break; |
889 | 3249 if (PID_TYPE(a2) != OBJECT_Actor |
890 | 3250 || (v721 = 836 * PID_ID(a2), |
3251 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3252 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3253 { | |
3254 LODWORD(v727) = 1; | |
3255 break; | |
889 | 3256 } |
3257 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
1005 | 3258 //v59 = v721; |
3259 pActor = &pActors[PID_ID(a2)]; | |
889 | 3260 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
1005 | 3261 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0); |
3262 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3263 BYTE2(pActor->uAttributes) |= 8u; | |
3264 //v672 = 0; | |
889 | 3265 v661 = (Actor *)LODWORD(v718); |
1005 | 3266 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
993 | 3267 LODWORD(v727) = 1; |
3268 break; | |
924 | 3269 } |
1005 | 3270 case SPELL_MIND_CHARM: |
3271 { | |
890 | 3272 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3273 break; | |
3274 | |
3275 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3276 { | |
3277 LODWORD(v727) = 1; | |
3278 break; | |
3279 } | |
3280 | |
3281 uint power = 300 * v2; | |
3282 if ( v731 == 2 ) | |
3283 { | |
3284 power = 600 * v2; | |
3285 } | |
3286 else if ( v731 == 3 ) | |
3287 power = 29030400; | |
3288 | |
3289 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3290 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3291 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3292 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3293 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3294 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3295 v731, 0, 0, 0); | |
924 | 3296 pSpellSprite.stru_24.Reset(); |
3297 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3298 pSpellSprite.spell_level = v2; | |
3299 pSpellSprite.spell_skill = v731; | |
3300 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
890 | 3301 v61 = PID_ID(a2); |
993 | 3302 v600 = pActors[v61].vPosition.y; |
3303 v601 = pActors[v61].vPosition.x; | |
3304 pSpellSprite.uObjectDescID = v60; | |
3305 pSpellSprite.vPosition.x = v601; | |
3306 v602 = pActors[v61].uActorHeight; | |
3307 v603 = pActors[v61].vPosition.z; | |
3308 pSpellSprite.vPosition.y = v600; | |
3309 v676 = v603 + v602; | |
3310 v665 = v600; | |
3311 pSpellSprite.vPosition.z = v603 + v602; | |
3312 v657 = v601; | |
3313 pSpellSprite.uAttributes = 0; | |
3314 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
3315 pSpellSprite.uSpriteFrameID = 0; | |
3316 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3317 pSpellSprite.spell_target_pid = a2; | |
3318 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3319 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3320 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3321 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3322 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3323 LODWORD(v727) = 1; | |
3324 break; | |
1005 | 3325 } |
3326 case SPELL_DARK_SHRINKING_RAY: | |
3327 { | |
889 | 3328 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3329 break; |
924 | 3330 pSpellSprite.stru_24.Reset(); |
3331 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3332 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3333 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3334 pSpellSprite.uAttributes = 0; | |
3335 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3336 pSpellSprite.uSectorID = pIndoor->GetSector( | |
890 | 3337 pParty->vPosition.x, |
3338 pParty->vPosition.y, | |
3339 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
924 | 3340 pSpellSprite.uSpriteFrameID = 0; |
3341 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3342 pSpellSprite.spell_target_pid = a2; | |
3343 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3344 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3345 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3346 pSpellSprite.spell_skill = v731; | |
3347 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3348 pSpellSprite.spell_level = 300 * v2; | |
890 | 3349 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 3350 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3351 | |
3352 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3353 | |
3354 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
889 | 3355 ++pTurnEngine->field_1C; |
3356 LODWORD(v727) = 1; | |
890 | 3357 break; |
1005 | 3358 } |
3359 case SPELL_FIRE_FIRE_AURA: | |
3360 { | |
1009 | 3361 switch (v731) |
3362 { | |
3363 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3364 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break; | |
3365 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break; | |
3366 case 4: LODWORD(v733) = 0; amount = 12; break; | |
3367 default: | |
3368 assert(false); | |
3369 } | |
3370 | |
889 | 3371 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3372 break; |
924 | 3373 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
889 | 3374 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3375 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
890 | 3376 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3377 && !v730c->Broken() | |
3378 && !v730c->uSpecEnchantmentType | |
3379 && !v730c->uEnchantmentType | |
3380 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2) | |
3381 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3382 { | |
3383 v69 = v730c; | |
3384 v14 = v731 == 4; | |
3385 v730c->uSpecEnchantmentType = amount; | |
3386 if ( !v14 ) | |
889 | 3387 { |
890 | 3388 v69->uExpireTime = pParty->uTimePlayed |
3389 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3390 * 0.033333335); | |
3391 v69->uAttributes |= 8u; | |
889 | 3392 } |
890 | 3393 v69->uAttributes |= 0x10u; |
984 | 3394 _50C9A8_item_enchantment_timer = 256; |
890 | 3395 LODWORD(v727) = 1; |
3396 break; | |
889 | 3397 } |
3398 | |
3399 dword_50C9D0 = 113; | |
3400 dword_50C9D4 = 0; | |
3401 dword_50C9D8 = 1; | |
3402 | |
3403 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3404 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3405 pCastSpell->spellnum = 0; |
890 | 3406 continue; |
1005 | 3407 } |
3408 case SPELL_BODY_REGENERATION: | |
3409 { | |
1009 | 3410 switch (v731) |
3411 { | |
3412 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3413 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break; | |
3414 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break; | |
3415 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break; | |
3416 default: | |
3417 assert(false); | |
3418 } | |
3419 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3420 break; | |
3421 | |
3422 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
3423 | |
3424 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | |
3425 LODWORD(v727) = 1; | |
890 | 3426 break; |
1005 | 3427 } |
3428 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3429 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3430 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3431 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3432 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3433 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3434 { | |
1009 | 3435 switch (v731) |
3436 { | |
3437 case 1: | |
3438 case 2: | |
3439 case 3: | |
3440 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break; | |
3441 default: | |
3442 assert(false); | |
3443 } | |
3444 | |
3445 switch (pCastSpell->spellnum) | |
3446 { | |
3447 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
3448 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
3449 break; | |
3450 case SPELL_AIR_PROTECTION_FROM_AIR: | |
3451 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
3452 break; | |
3453 case SPELL_WATER_PROTECTION_FROM_WATER: | |
3454 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
3455 break; | |
3456 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
3457 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
3458 break; | |
3459 case SPELL_MIND_PROTECTION_FROM_MIND: | |
3460 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
3461 break; | |
3462 case SPELL_BODY_PROTECTION_FROM_BODY: | |
3463 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
3464 break; | |
3465 default: | |
3466 assert(false); | |
3467 continue; | |
3468 } | |
3469 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3470 break; | |
3471 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3472 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3473 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3474 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
3475 v90 = (double)(signed int)v733 * 4.2666669; | |
3476 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3477 LODWORD(v727) = 1; | |
3478 break; | |
1005 | 3479 } |
3480 case SPELL_FIRE_HASTE: | |
3481 { | |
1009 | 3482 switch (v731) |
3483 { | |
3484 case 1: LODWORD(v733) = 60 * (v2 + 60); break; | |
3485 case 2: LODWORD(v733) = 60 * (v2 + 60); break; | |
3486 case 3: LODWORD(v733) = 180 * (v2 + 20); break; | |
3487 case 4: LODWORD(v733) = 240 * (v2 + 15); break; | |
3488 default: | |
3489 assert(false); | |
993 | 3490 } |
889 | 3491 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3492 { | |
890 | 3493 v92 = pParty->pPlayers;//[0].pConditions[1]; |
3494 LODWORD(v727) = 1; | |
3495 do | |
3496 { | |
1090 | 3497 if ( v92->pConditions[1] ) |
993 | 3498 LODWORD(v727) = 0; |
3499 ++v92; | |
890 | 3500 } |
3501 while ( v92 <= &pParty->pPlayers[3] ); | |
3502 if (LODWORD(v727)) | |
3503 { | |
993 | 3504 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
3505 | |
3506 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
3507 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3508 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3509 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3510 } |
3511 } | |
3512 break; | |
1005 | 3513 } |
3514 case SPELL_SPIRIT_BLESS: | |
3515 { | |
1009 | 3516 switch (v731) |
3517 { | |
3518 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3519 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3520 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3521 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3522 default: | |
3523 assert(false); | |
3524 } | |
889 | 3525 amount = v2 + 5; |
3526 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3527 break; |
889 | 3528 if ( v731 == 1 ) |
3529 { | |
924 | 3530 v108 = pCastSpell->uPlayerID_2; |
3531 v109 = pCastSpell->spellnum; | |
890 | 3532 v110 = pGame->GetStru6(); |
3533 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
924 | 3534 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
890 | 3535 //v668 = 0; |
3536 v716 = v111; | |
3537 //v658 = v111; | |
3538 //v653 = amount; | |
3539 //v651 = 1; | |
3540 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3541 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
1009 | 3542 //LABEL_103: |
3543 //HIDWORD(v650) = HIDWORD(v28); | |
3544 //LABEL_104: | |
3545 //LODWORD(v650) = v28; | |
3546 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); | |
3547 LODWORD(v727) = 1; | |
3548 break; | |
889 | 3549 } |
3550 v105 = 0; | |
3551 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3552 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
3553 do | |
3554 { | |
924 | 3555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
890 | 3556 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
3557 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
3558 ++v730b; | |
3559 ++v105; | |
889 | 3560 } |
3561 while ( v730b <= &pParty->pPlayers[3] ); | |
3562 LODWORD(v727) = 1; | |
890 | 3563 break; |
1005 | 3564 } |
890 | 3565 case SPELL_SPIRIT_SPIRIT_LASH: |
1005 | 3566 { |
889 | 3567 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
3568 { | |
890 | 3569 //v730 = a2 >> 3; |
3570 v112 = &pActors[PID_ID(a2)]; | |
3571 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
3572 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
3573 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
3574 _this = (ItemGen *)v113; | |
3575 v114 = v721; | |
3576 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
3577 if ( v113 < v721 ) | |
3578 { | |
1009 | 3579 v116 = v113; |
3580 v113 = v721; | |
3581 v114 = v116; | |
890 | 3582 } |
3583 if ( v113 < (signed int)v115 ) | |
3584 { | |
1009 | 3585 v117 = v113; |
3586 v113 = (int)v115; | |
3587 v115 = v117; | |
890 | 3588 } |
3589 if ( v114 < (signed int)v115 ) | |
3590 { | |
1009 | 3591 v118 = v115; |
3592 v115 = v114; | |
3593 v114 = v118; | |
890 | 3594 } |
3595 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
3596 if ( (double)(signed int)this <= 307.2 ) | |
3597 { | |
1009 | 3598 v701.x = 0; |
3599 v701.y = 0; | |
3600 v701.z = 0; | |
3601 pSpellSprite.stru_24.Reset(); | |
1013 | 3602 pSpellSprite.spell_id = pCastSpell->spellnum; |
1009 | 3603 pSpellSprite.spell_level = v723; |
3604 pSpellSprite.spell_skill = v731; | |
3605 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3606 pSpellSprite.uAttributes = 0; | |
3607 pSpellSprite.uSectorID = 0; | |
3608 pSpellSprite.uSpriteFrameID = 0; | |
3609 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
1013 | 3610 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
1009 | 3611 pSpellSprite.uFacing = 0; |
1013 | 3612 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
1009 | 3613 pSpellSprite.vPosition.x = v112->vPosition.x; |
3614 pSpellSprite.vPosition.y = v112->vPosition.y; | |
3615 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
3616 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
3617 v122 = pSpellSprite.Create(0, 0, 0, 0); | |
3618 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | |
3619 LODWORD(v727) = 1; | |
890 | 3620 } |
3621 else | |
3622 { | |
1009 | 3623 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
3624 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1013 | 3625 pCastSpell->spellnum = 0; |
890 | 3626 } |
1013 | 3627 //pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
890 | 3628 } |
3629 break; | |
3630 } | |
3631 case SPELL_AIR_SHIELD: | |
3632 case SPELL_EARTH_STONESKIN: | |
3633 case SPELL_SPIRIT_HEROISM: | |
993 | 3634 { |
1009 | 3635 switch (v731) |
3636 { | |
3637 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
3638 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
3639 case 3: LODWORD(v733) = 900 * (v2 + 4); break; | |
3640 case 4: LODWORD(v733) = 3600 * (v2 + 1); break; | |
3641 default: | |
3642 assert(false); | |
3643 } | |
924 | 3644 v127 = pCastSpell->spellnum; |
889 | 3645 if ( v127 == 17 ) |
3646 { | |
890 | 3647 amount = 0; |
3648 LODWORD(v725) = 14; | |
889 | 3649 } |
3650 else | |
3651 { | |
890 | 3652 if ( v127 == 38 ) |
3653 { | |
1009 | 3654 LODWORD(v725) = 15; |
3655 amount = v2 + 5; | |
890 | 3656 } |
3657 else | |
3658 { | |
1009 | 3659 if ( v127 != 51 ) |
3660 continue; | |
3661 LODWORD(v725) = 9; | |
3662 amount = v2 + 5; | |
890 | 3663 } |
889 | 3664 } |
3665 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3666 break; |
924 | 3667 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3668 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3669 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3670 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3671 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
3672 //LABEL_304: | |
3673 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
3674 LODWORD(v727) = 1; | |
890 | 3675 break; |
1005 | 3676 } |
890 | 3677 case SPELL_FIRE_IMMOLATION: |
1005 | 3678 { |
1013 | 3679 if ( v731 == 4 ) |
993 | 3680 LODWORD(v733) = 600 * v2; |
889 | 3681 else |
993 | 3682 LODWORD(v733) = 60 * v2; |
889 | 3683 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 3684 break; |
889 | 3685 |
924 | 3686 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3687 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3688 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3689 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3690 |
3691 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
3692 LODWORD(v727) = 1; | |
890 | 3693 break; |
1005 | 3694 } |
890 | 3695 case SPELL_FIRE_METEOR_SHOWER: |
1005 | 3696 { |
1009 | 3697 //v149 = v731 - 1; |
3698 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
1013 | 3699 int i; |
1009 | 3700 if ( v731 == 4 ) |
889 | 3701 { |
1013 | 3702 i = 20; |
889 | 3703 } |
3704 else | |
3705 { | |
1013 | 3706 i = 16; |
889 | 3707 } |
3708 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3709 { | |
890 | 3710 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
3711 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3712 pCastSpell->spellnum = 0; |
890 | 3713 continue; |
889 | 3714 } |
3715 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3716 break; |
889 | 3717 LODWORD(v725) = PID_TYPE(a2); |
3718 if (PID_TYPE(a2) == OBJECT_Actor) | |
3719 { | |
890 | 3720 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; |
3721 v153 = pActors[PID_ID(a2)].vPosition.y; | |
3722 v154 = pActors[PID_ID(a2)].vPosition.z; | |
3723 LODWORD(v727) = v153; | |
889 | 3724 } |
3725 else | |
3726 { | |
890 | 3727 v155 = stru_5C6E00->Cos(pParty->sRotationY); |
3728 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
3729 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
3730 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
3731 v154 = pParty->vPosition.z; | |
889 | 3732 } |
1013 | 3733 unsigned __int64 k = 0; |
3734 int j = 0; | |
3735 if ( (signed int)i > 0 ) | |
3736 { | |
890 | 3737 v730 = LODWORD(v725) == 3 ? a2 : 0; |
3738 do | |
3739 { | |
1009 | 3740 a2 = rand() % 1000; |
1013 | 3741 if ( sqrt((double)(rand() % 1000) - 2500 * |
3742 (double)(rand() % 1000) - 2500 + | |
3743 j * j + k * k) <= 1.0 ) | |
1009 | 3744 { |
3745 LODWORD(v687) = 0; | |
3746 HIDWORD(v687) = 0; | |
3747 } | |
3748 else | |
3749 { | |
3750 v687 = __PAIR__( | |
1013 | 3751 stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), |
3752 (double)(rand() % 1000) - 2500), | |
3753 stru_5C6E00->Atan2(j, k)); | |
1009 | 3754 } |
3755 pSpellSprite.stru_24.Reset(); | |
3756 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3757 pSpellSprite.spell_level = v2; | |
3758 pSpellSprite.spell_skill = v731; | |
3759 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3760 pSpellSprite.uAttributes = 0; | |
3761 pSpellSprite.vPosition.x = uRequiredMana; | |
3762 pSpellSprite.vPosition.y = LODWORD(v727); | |
3763 pSpellSprite.uSectorID = 0; | |
1090 | 3764 pSpellSprite.vPosition.z = a2 + v154; |
1009 | 3765 pSpellSprite.uSpriteFrameID = 0; |
3766 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3767 pSpellSprite.spell_target_pid = v730; | |
3768 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
3769 pSpellSprite.uFacing = v687; | |
3770 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3771 if ( pParty->bTurnBasedModeOn == 1 ) | |
3772 pSpellSprite.uAttributes = 4; | |
3773 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
3774 && pParty->bTurnBasedModeOn == 1 ) | |
3775 ++pTurnEngine->field_1C; | |
1013 | 3776 j = rand() % 1024 - 512; |
3777 k = rand() % 1024 - 512; | |
890 | 3778 } |
1013 | 3779 while ( i-- != 1 ); |
889 | 3780 } |
3781 LODWORD(v727) = 1; | |
890 | 3782 break; |
3783 } | |
3784 case SPELL_FIRE_INFERNO: | |
3785 { | |
1009 | 3786 //v67 = 2; |
3787 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3788 { | |
3789 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
3790 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3791 pCastSpell->spellnum = 0; | |
3792 continue; | |
3793 } | |
3794 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3795 break; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3796 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); |
1009 | 3797 v700.z = 0; |
3798 v700.y = 0; | |
3799 v700.x = 0; | |
3800 pSpellSprite.stru_24.Reset(); | |
3801 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3802 pSpellSprite.spell_level = v2; | |
3803 pSpellSprite.spell_skill = v731; | |
3804 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3805 pSpellSprite.uAttributes = 0; | |
3806 pSpellSprite.uSectorID = 0; | |
3807 pSpellSprite.uSpriteFrameID = 0; | |
3808 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3809 pSpellSprite.uFacing = 0; | |
3810 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3811 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3812 a2 = 0; | |
3813 if ( (signed int)_v726 > 0 ) | |
3814 { | |
3815 do | |
3816 { | |
3817 v162 = dword_50BF30[a2]; | |
3818 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; | |
3819 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; | |
3820 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
3821 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
3822 v164 = pSpellSprite.Create(0, 0, 0, 0); | |
3823 v165 = a2; | |
3824 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
3825 pGame->GetStru6()->_4A81CA(&pSpellSprite); | |
3826 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
3827 a2 = v165 + 1; | |
3828 } | |
3829 while ( v165 + 1 < (signed int)_v726 ); | |
3830 } | |
3831 LODWORD(v727) = 1; | |
890 | 3832 break; |
1009 | 3833 } |
3834 case SPELL_AIR_WIZARD_EYE: | |
890 | 3835 { |
889 | 3836 LODWORD(v733) = 3600 * v2; |
3837 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3838 break; |
889 | 3839 v168 = 0; |
3840 do | |
3841 { | |
890 | 3842 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); |
3843 v716 = v169; | |
889 | 3844 } |
3845 while ( v168 < 4 ); | |
3846 | |
3847 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
3848 LODWORD(v727) = 1; | |
890 | 3849 break; |
1005 | 3850 } |
890 | 3851 case SPELL_AIR_FEATHER_FALL: |
1005 | 3852 { |
3853 switch (v731) | |
3854 { | |
3855 case 1: LODWORD(v733) = 300 * v2; break; | |
3856 case 2: LODWORD(v733) = 600 * v2; break; | |
1009 | 3857 case 3: LODWORD(v733) = 3600 * v2; break; |
1005 | 3858 case 4: LODWORD(v733) = 3600 * v2; break; |
3859 default: | |
3860 assert(false); | |
889 | 3861 } |
3862 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3863 break; |
889 | 3864 v174 = 0; |
3865 do | |
890 | 3866 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
889 | 3867 while ( v174 < 4 ); |
924 | 3868 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3869 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3870 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3871 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 3872 |
3873 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); | |
3874 LODWORD(v727) = 1; | |
890 | 3875 break; |
1005 | 3876 } |
890 | 3877 case SPELL_AIR_SPARKS: |
3878 { | |
1005 | 3879 switch (v731) |
3880 { | |
3881 case 1: amount = 3; break; | |
3882 case 2: amount = 5; break; | |
3883 case 3: amount = 7; break; | |
3884 case 4: amount = 9; break; | |
3885 default: | |
3886 assert(false); | |
3887 } | |
3888 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3889 break; | |
3890 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
3891 pSpellSprite.stru_24.Reset(); | |
3892 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3893 pSpellSprite.spell_level = v2; | |
3894 pSpellSprite.spell_skill = v731; | |
3895 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3896 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3897 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3898 pSpellSprite.uAttributes = 0; | |
3899 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3900 pSpellSprite.uSectorID = pIndoor->GetSector( | |
3901 pParty->vPosition.x, | |
3902 pParty->vPosition.y, | |
3903 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3904 pSpellSprite.uSpriteFrameID = 0; | |
3905 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3906 pSpellSprite.spell_target_pid = a2; | |
3907 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3908 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3909 if ( pParty->bTurnBasedModeOn == 1 ) | |
3910 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3911 v188 = (signed int)_v726 / -2; | |
3912 v189 = (signed int)_v726 / 2; | |
3913 while ( v188 <= v189 ) | |
3914 { | |
3915 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); | |
3916 if ( pSpellSprite.Create( | |
3917 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
3918 v715.uPitchAngle, | |
3919 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3920 pCastSpell->uPlayerID + 1) != -1 | |
1009 | 3921 && pParty->bTurnBasedModeOn == 1 ) |
1106
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1104
diff
changeset
|
3922 ++pTurnEngine->field_1C; |
1005 | 3923 v188 += _v726 / (amount - 1); |
3924 } | |
3925 LODWORD(v727) = 1; | |
890 | 3926 break; |
1005 | 3927 } |
890 | 3928 case SPELL_AIR_JUMP: |
1005 | 3929 { |
890 | 3930 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
3931 { | |
3932 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
3933 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3934 break; | |
889 | 3935 } |
3936 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 3937 break; |
889 | 3938 v191 = 0; |
3939 do | |
890 | 3940 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); |
889 | 3941 while ( v191 < 4 ); |
3942 BYTE1(pParty->uFlags) |= 1u; | |
3943 pParty->uFallSpeed = 1000; | |
3944 LODWORD(v727) = 1; | |
890 | 3945 break; |
1005 | 3946 } |
890 | 3947 case SPELL_AIR_INVISIBILITY: |
1005 | 3948 { |
3949 switch (v731) | |
3950 { | |
3951 case 1: LODWORD(v733) = 600 * v2; amount = v2; break; | |
3952 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break; | |
3953 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break; | |
3954 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break; | |
3955 default: | |
3956 assert(false); | |
3957 } | |
889 | 3958 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
3959 { | |
890 | 3960 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
3961 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
924 | 3962 pCastSpell->spellnum = 0; |
890 | 3963 continue; |
889 | 3964 } |
3965 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3966 { | |
924 | 3967 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
3968 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
3969 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
3970 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
890 | 3971 |
3972 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
3973 LODWORD(v727) = 1; | |
3974 } | |
3975 break; | |
1005 | 3976 } |
890 | 3977 case SPELL_AIR_FLY: |
3978 { | |
1005 | 3979 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3980 { | |
3981 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
3982 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3983 break; | |
3984 } | |
3985 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
3986 { | |
3987 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3988 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3989 break; | |
3990 } | |
3991 LODWORD(v733) = 3600 * v2; | |
1009 | 3992 if ( v731 == 1 || v731 == 2 || v731 == 3 ) |
1005 | 3993 amount = 1; |
1009 | 3994 else |
3995 amount = 0; | |
1005 | 3996 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3997 break; | |
3998 v205 = 0; | |
3999 do | |
4000 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4001 while ( v205 < 4 ); | |
4002 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
4003 v207 = pCastSpell->uPlayerID + 1; | |
4004 v716 = v206; | |
4005 | |
4006 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4007 LODWORD(v727) = 1; | |
890 | 4008 break; |
4009 } | |
4010 case SPELL_AIR_STARBURST: | |
4011 { | |
1005 | 4012 //v67 = 2; |
4013 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4014 { | |
4015 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4016 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4017 pCastSpell->spellnum = 0; | |
4018 continue; | |
4019 } | |
4020 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4021 break; | |
4022 v208 = PID_TYPE(a2); | |
4023 LODWORD(v725) = PID_TYPE(a2); | |
4024 if ( v208 == 3 ) | |
4025 { | |
4026 v209 = PID_ID(a2); | |
4027 LODWORD(v718) = pActors[v209].vPosition.x; | |
4028 v210 = pActors[v209].vPosition.y; | |
4029 v211 = pActors[v209].vPosition.z; | |
4030 v713 = v210; | |
889 | 4031 } |
4032 else | |
4033 { | |
1005 | 4034 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
4035 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4036 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4037 v214 = sub_42EBBE(2048, v213); | |
4038 v211 = pParty->vPosition.z; | |
4039 v713 = pParty->vPosition.y + v214; | |
4040 v208 = LODWORD(v725); | |
4041 } | |
1013 | 4042 signed int _v733 = 0; |
1005 | 4043 *(float *)&v732 = (double)v211; |
4044 LODWORD(v725) = v211 + 2500; | |
4045 v721 = 0; | |
4046 *(float *)&y = (double)(v211 + 2500); | |
4047 v730 = v208 == 3 ? a2 : 0; | |
4048 a2 = 20; | |
4049 do | |
4050 { | |
4051 v215 = rand(); | |
4052 v216 = (double)v721; | |
1013 | 4053 v217 = (double)_v733; |
1005 | 4054 *(float *)&uRequiredMana = v217; |
4055 _this = (ItemGen *)(v215 % 1000); | |
4056 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4057 *(float *)&v721 = v217 * v217; | |
4058 //*(float *)&v726 = v216 * v216; | |
4059 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4060 { | |
1009 | 4061 LODWORD(v685) = 0; |
4062 HIDWORD(v685) = 0; | |
1005 | 4063 } |
4064 else | |
4065 { | |
1009 | 4066 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4067 v685 = __PAIR__( | |
4068 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4069 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
1005 | 4070 } |
4071 pSpellSprite.stru_24.Reset(); | |
4072 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4073 pSpellSprite.spell_level = v2; | |
4074 pSpellSprite.spell_skill = v731; | |
4075 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4076 pSpellSprite.uAttributes = 0; | |
4077 pSpellSprite.vPosition.x = LODWORD(v718); | |
4078 pSpellSprite.vPosition.y = v713; | |
4079 pSpellSprite.uSectorID = 0; | |
4080 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4081 pSpellSprite.uSpriteFrameID = 0; | |
4082 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4083 pSpellSprite.spell_target_pid = v730; | |
4084 //__debugbreak();//çâåçäîïàä | |
4085 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4086 pSpellSprite.uFacing = v685; | |
4087 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4088 if ( pParty->bTurnBasedModeOn == 1 ) | |
4089 pSpellSprite.uAttributes = 4; | |
4090 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4091 && pParty->bTurnBasedModeOn == 1 ) | |
4092 ++pTurnEngine->field_1C; | |
4093 v721 = rand() % 1024 - 512; | |
4094 v218 = rand(); | |
4095 v14 = a2-- == 1; | |
1013 | 4096 _v733 = (unsigned __int64)(v218 % 1024) - 512; |
1005 | 4097 } |
4098 while ( !v14 ); | |
4099 LODWORD(v727) = 1; | |
4100 break; | |
4101 } | |
890 | 4102 case SPELL_WATER_AWAKEN: |
993 | 4103 { |
1005 | 4104 switch (v731) |
4105 { | |
4106 case 1: amount = 180 * v2; break; | |
4107 case 2: amount = 3600 * v2; break; | |
4108 case 3: amount = 86400 * v2; break; | |
4109 case 4: amount = 0; break; | |
4110 default: | |
4111 assert(false); | |
4112 } | |
889 | 4113 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4114 break; |
1005 | 4115 for( int i=0; i < 4; i++ ) |
4116 { | |
4117 pPlayer = &pParty->pPlayers[i]; | |
890 | 4118 if ( v731 == 4 ) |
4119 { | |
1005 | 4120 if ( pPlayer->pConditions[2] ) |
4121 { | |
4122 //*((int *)v222 + 4) = 0; | |
4123 //*((int *)v222 + 5) = 0; | |
4124 pPlayer->pConditions[2] = 0; | |
4125 pPlayer->PlaySound(SPEECH_103, 0); | |
4126 } | |
890 | 4127 } |
4128 else | |
889 | 4129 { |
1005 | 4130 v223 = pPlayer->DiscardConditionIfLastsLongerThan( |
4131 2u, | |
4132 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
4133 if ( v223 ) | |
4134 pPlayer->PlaySound(SPEECH_103, 0); | |
890 | 4135 } |
1005 | 4136 } |
4137 LODWORD(v727) = 1; | |
4138 break; | |
4139 } | |
890 | 4140 case SPELL_WATER_POISON_SPRAY: |
993 | 4141 { |
1009 | 4142 switch (v731) |
4143 { | |
4144 case 1: amount = 1; break; | |
4145 case 2: amount = 3; break; | |
4146 case 3: amount = 5; break; | |
4147 case 4: amount = 7; break; | |
4148 default: | |
4149 assert(false); | |
4150 } | |
889 | 4151 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
890 | 4152 break; |
1013 | 4153 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
890 | 4154 if ( amount == 1 ) |
4155 { | |
924 | 4156 pSpellSprite.stru_24.Reset(); |
4157 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4158 pSpellSprite.spell_skill = v731; | |
4159 pSpellSprite.spell_level = v2; | |
4160 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4161 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
890 | 4162 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4163 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4164 v660 = pParty->vPosition.y; | |
993 | 4165 // LABEL_153: |
924 | 4166 pSpellSprite.uAttributes = 0; |
4167 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4168 pSpellSprite.vPosition.z = v51; | |
890 | 4169 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
924 | 4170 pSpellSprite.uSpriteFrameID = 0; |
4171 pSpellSprite.uSectorID = v52; | |
4172 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4173 pSpellSprite.spell_target_pid = a2; | |
4174 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4175 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
4176 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4177 if ( pParty->bTurnBasedModeOn == 1 ) |
924 | 4178 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4179 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4180 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4181 ++pTurnEngine->field_1C; | |
890 | 4182 } |
4183 else | |
4184 { | |
924 | 4185 pSpellSprite.stru_24.Reset(); |
4186 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4187 pSpellSprite.spell_level = v2; | |
4188 pSpellSprite.spell_skill = v731; | |
4189 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4190 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4191 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4192 pSpellSprite.uAttributes = 0; | |
4193 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4194 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4195 pSpellSprite.uSpriteFrameID = 0; | |
4196 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4197 pSpellSprite.spell_target_pid = a2; | |
4198 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4199 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
890 | 4200 if ( pParty->bTurnBasedModeOn == 1 ) |
1009 | 4201 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
1088 | 4202 v227 = _v733 / -2; |
1013 | 4203 signed int _y = _v733 / 2; |
4204 if ( _v733 / -2 <= _v733 / 2 ) | |
890 | 4205 { |
1009 | 4206 v228 = v715.uYawAngle; |
4207 do | |
4208 { | |
4209 pSpellSprite.uFacing = v227 + v228; | |
4210 if ( pSpellSprite.Create( | |
4211 v227 + v228, | |
4212 v715.uPitchAngle, | |
4213 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
4214 pCastSpell->uPlayerID + 1) != -1 | |
4215 && pParty->bTurnBasedModeOn == 1 ) | |
4216 ++pTurnEngine->field_1C; | |
1013 | 4217 v227 += _v733 / (amount - 1); |
1009 | 4218 } |
1013 | 4219 while ( v227 <= _y ); |
890 | 4220 } |
889 | 4221 } |
4222 LODWORD(v727) = 1; | |
890 | 4223 break; |
4224 } | |
4225 case SPELL_WATER_WATER_WALK: | |
1009 | 4226 { |
4227 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
4228 { | |
4229 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4231 break; | |
4232 } | |
4233 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4234 v229 = 600 * v2; | |
4235 else | |
4236 v229 = 3600 * v2; | |
4237 LODWORD(v733) = v229; | |
4238 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4239 break; | |
4240 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
4241 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4242 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4243 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4244 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4245 | |
4246 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4247 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4248 v731, | |
4249 amount, | |
4250 v716, | |
4251 pCastSpell->uPlayerID + 1); | |
4252 if ( v731 == 4 ) | |
4253 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4254 LODWORD(v727) = 1; | |
4255 break; | |
4256 } | |
4257 case SPELL_WATER_RECHARGE_ITEM: | |
890 | 4258 { |
1009 | 4259 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4260 break; | |
1013 | 4261 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
4262 | |
4263 if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) | |
1009 | 4264 { |
4265 dword_50C9D0 = 113; | |
4266 dword_50C9D4 = 0; | |
4267 dword_50C9D8 = 1; | |
4268 | |
4269 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4270 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4271 pCastSpell->spellnum = 0; | |
4272 continue; | |
4273 } | |
4274 if ( v731 == 1 || v731 == 2 ) | |
4275 { | |
4276 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4277 } | |
4278 else if ( v731 == 3 ) | |
4279 { | |
4280 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
4281 } | |
4282 else if ( v731 == 4 ) | |
4283 { | |
4284 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
4285 } | |
4286 else | |
4287 { | |
4288 v241 = 0.0; | |
4289 } | |
4290 if ( v241 > 1.0 ) | |
4291 v241 = 1.0; | |
1013 | 4292 int uNewCharges = v240->uMaxCharges * v241; |
4293 v240->uMaxCharges = uNewCharges; | |
4294 v240->uNumCharges = uNewCharges; | |
4295 if ( uNewCharges <= 0 ) | |
4296 { | |
4297 v240 = 0; | |
1009 | 4298 dword_50C9D0 = 113; |
4299 dword_50C9D4 = 0; | |
4300 dword_50C9D8 = 1; | |
4301 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4302 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4303 pCastSpell->spellnum = 0; | |
4304 v2 = v723; | |
4305 continue; | |
4306 } | |
1013 | 4307 v240->uAttributes |= 0x40u; |
1009 | 4308 _50C9A8_item_enchantment_timer = 256; |
4309 LODWORD(v727) = 1; | |
890 | 4310 break; |
4311 } | |
1009 | 4312 case SPELL_WATER_ENCHANT_ITEM: |
890 | 4313 { |
1009 | 4314 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4315 break; | |
4316 uRequiredMana = 0; | |
1013 | 4317 amount = 10 * v2; |
1009 | 4318 v730 = 1; |
1013 | 4319 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
4320 v245 = &pPlayer->pInventoryItems[a2]; | |
4321 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; | |
4322 if ( | |
4323 v731 == 1 || v731 == 2 && _v725->uEquipType > 2 || | |
4324 v731 == 3 || v731 == 4 && | |
4325 v245->uItemID <= 134 && | |
4326 v245->uSpecEnchantmentType == 0 && | |
4327 v245->uEnchantmentType == 0 && | |
4328 v245->_bonus_strength== 0 && | |
4329 !v245->Broken() ) | |
4330 { | |
4331 if ( v245->GetValue() < 450 || | |
4332 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2) | |
4333 ) | |
890 | 4334 { |
1013 | 4335 v730 = 0; |
889 | 4336 } |
1013 | 4337 if ( rand() % 100 < 10 * v2 || |
4338 (rand() % 100 < 80 && (v731 == 3 || v731 == 4 )) || | |
4339 v245->GetValue() < 450 || | |
4340 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && v271 >= 0 && v271 <= 2) | |
4341 ) | |
1009 | 4342 { |
1013 | 4343 v313 = _v725->uEquipType; |
4344 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 ) | |
1009 | 4345 { |
1013 | 4346 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; |
4347 v245->uEnchantmentType = 0; | |
4348 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1]; | |
4349 ; | |
4350 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] ) | |
1009 | 4351 { |
1013 | 4352 ++v245->uEnchantmentType; |
4353 if ( kk >= v295 ) | |
1009 | 4354 break; |
4355 } | |
1013 | 4356 v255 = 10;//pItemsTable->field_116D8[17]; |
4357 v256 = 10;//pItemsTable->field_116D8[16]; | |
4358 v245->_bonus_strength = v256 + rand() % (v255 - v256 + 1); | |
4359 v245->uAttributes |= 0x20u; | |
993 | 4360 _50C9A8_item_enchantment_timer = 256; |
4361 LODWORD(v727) = 1; | |
4362 break; | |
890 | 4363 } |
1013 | 4364 else if ( v731 == 3 || v731 == 4) |
993 | 4365 { |
4366 v257 = pItemsTable->pSpecialEnchantments_count; | |
4367 v258 = 0; | |
4368 v725 = 0.0; | |
1013 | 4369 int _v733 = 0; |
993 | 4370 if ( pItemsTable->pSpecialEnchantments_count > 0 ) |
890 | 4371 { |
993 | 4372 v730 = (int)&v679; |
4373 do | |
4374 { | |
4375 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
4376 if ( !v259 || v259 == 1 ) | |
4377 { | |
4378 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4379 + 4] | |
4380 + v258 * 28); | |
4381 LODWORD(v725) += v260; | |
4382 if ( v260 ) | |
4383 { | |
4384 v261 = v730; | |
4385 v730 += 4; | |
1013 | 4386 *(int *)v261 = _v733; |
993 | 4387 } |
4388 } | |
1013 | 4389 ++_v733; |
993 | 4390 ++v258; |
4391 } | |
1013 | 4392 while ( _v733 < v257 ); |
890 | 4393 } |
993 | 4394 v262 = rand() % SLODWORD(v725); |
4395 v263 = v679; | |
1013 | 4396 v245->uSpecEnchantmentType = v679[0]; |
4397 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
993 | 4398 v265 = v262 + 1; |
4399 if ( v264 < v265 ) | |
4400 { | |
1013 | 4401 for ( ii = v679; ; ii = (int *)v732 ) |
993 | 4402 { |
4403 v267 = (int)(ii + 1); | |
4404 v732 = v267; | |
4405 v268 = *(int *)v267; | |
4406 *(int *)(v245 + 12) = v268; | |
4407 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
4408 + 4]; | |
4409 if ( v264 >= v265 ) | |
1009 | 4410 break; |
993 | 4411 } |
4412 } | |
1013 | 4413 |
4414 v277 = pItemsTable->pSpecialEnchantments_count; | |
4415 v278 = 0; | |
4416 v725 = 0.0; | |
4417 _v733 = 0; | |
4418 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
4419 { | |
4420 int *_v730 = v679; | |
4421 do | |
4422 { | |
4423 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); | |
4424 if ( !v279 || v279 == 1 ) | |
4425 { | |
4426 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]); | |
4427 _v733 += v280; | |
4428 if ( v280 ) | |
4429 { | |
4430 v281 = _v730; | |
4431 ++_v730; | |
4432 *v281 = _v733; | |
4433 } | |
4434 } | |
4435 ++_v733; | |
4436 ++v278; | |
4437 } | |
4438 while ( _v733 < v277 ); | |
4439 } | |
4440 v282 = rand() % _v733; | |
4441 v283 = v679; | |
4442 v245->uSpecEnchantmentType = v679[0]; | |
4443 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ]; | |
4444 v285 = v282 + 1; | |
4445 for ( l = v679; v284 < v285; ++l ) | |
4446 { | |
4447 v245->uSpecEnchantmentType = *(l+1); | |
4448 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]; | |
4449 } | |
4450 ++v245->uSpecEnchantmentType; | |
4451 v245->uAttributes |= 0x20u; | |
4452 _50C9A8_item_enchantment_timer = 256; | |
4453 LODWORD(v727) = 1; | |
4454 break; | |
4455 } | |
890 | 4456 } |
1013 | 4457 else |
1009 | 4458 { |
1013 | 4459 if ( !(BYTE1(v245->uAttributes) & 2) ) |
4460 { | |
4461 v245->uAttributes |= 2; | |
4462 } | |
1009 | 4463 } |
1013 | 4464 |
4465 } | |
4466 | |
4467 if ( LODWORD(v727) == 0 ) | |
4468 { | |
4469 v317 = pGlobalTXT_LocalizationStrings[428]; | |
4470 if ( v730 == 0 ) | |
4471 v317 = pGlobalTXT_LocalizationStrings[585]; | |
4472 ShowStatusBarString(v317, 2u); | |
4473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4474 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4475 pCastSpell->spellnum = 0; | |
4476 v318->PlaySound(SPEECH_43, 0); | |
4477 } | |
4478 | |
993 | 4479 break; |
890 | 4480 } |
1009 | 4481 case SPELL_WATER_TOWN_PORTAL: |
4482 { | |
4483 amount = 10 * v2; | |
4484 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
4485 break; | |
4486 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
4487 { | |
4488 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4489 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4490 pCastSpell->spellnum = 0; | |
4491 continue; | |
4492 } | |
4493 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); | |
4494 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
4495 LODWORD(v727) = 1; | |
4496 break; | |
4497 } | |
4498 case SPELL_WATER_LLOYDS_BEACON: | |
993 | 4499 { |
1009 | 4500 LODWORD(v733) = 604800 * v2; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4501 if ( !_stricmp(pCurrentMapName.data(), "d05.blv") ) |
1009 | 4502 { |
4503 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
993 | 4504 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4505 pCastSpell->spellnum = 0; | |
1009 | 4506 continue; |
4507 } | |
4508 v319 = uRequiredMana; | |
4509 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
4510 { | |
4511 pEventTimer->Pause(); | |
4512 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); | |
4513 qword_506350 = (signed int)v733; | |
4514 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; | |
4515 ::uRequiredMana = v319; | |
4516 ::sRecoveryTime = sRecoveryTime; | |
4517 dword_50633C = pCastSpell->sound_id; | |
4518 dword_506338 = pCastSpell->spellnum; | |
4519 LOBYTE(pCastSpell->field_8) |= 0x20u; | |
993 | 4520 } |
4521 break; | |
4522 } | |
1009 | 4523 case SPELL_EARTH_STONE_TO_FLESH: |
890 | 4524 { |
1009 | 4525 __debugbreak(); // missing GM ? |
4526 switch (v731) | |
4527 { | |
4528 case 1: amount = 3600 * v2; break; | |
4529 case 2: amount = 3600 * v2; break; | |
4530 case 3: amount = 86400 * v2; break; | |
4531 case 4: break; | |
4532 default: | |
4533 assert(false); | |
4534 } | |
4535 //LABEL_634: | |
4536 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
890 | 4537 break; |
1009 | 4538 v323 = pCastSpell->uPlayerID_2; |
4539 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
4540 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
4541 { | |
4542 LODWORD(v727) = 1; | |
4543 break; | |
4544 } | |
4545 if ( v731 == 4 ) | |
4546 { | |
4547 *(int *)v324 = 0; | |
4548 *((int *)v324 + 1) = 0; | |
4549 LODWORD(v727) = 1; | |
4550 break; | |
4551 } | |
4552 v732 = amount << 7; | |
4553 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4554 v656 = 15; | |
4555 v325 = &pParty->pPlayers[v323]; | |
4556 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4557 LODWORD(v727) = 1; | |
4558 break; | |
890 | 4559 } |
1009 | 4560 case SPELL_EARTH_ROCK_BLAST: |
890 | 4561 { |
1009 | 4562 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4563 break; | |
4564 pSpellSprite.stru_24.Reset(); | |
4565 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4566 pSpellSprite.spell_level = v2; | |
4567 pSpellSprite.spell_skill = v731; | |
4568 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4569 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4570 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4571 pSpellSprite.uAttributes = 0; | |
4572 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4573 pSpellSprite.uSectorID = pIndoor->GetSector( | |
4574 pParty->vPosition.x, | |
4575 pParty->vPosition.y, | |
4576 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4577 pSpellSprite.uSpriteFrameID = 0; | |
4578 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4579 pSpellSprite.spell_target_pid = a2; | |
4580 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4581 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4582 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4583 if ( pParty->bTurnBasedModeOn == 1 ) | |
4584 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
4585 | |
4586 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4587 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4588 ++pTurnEngine->field_1C; | |
890 | 4589 LODWORD(v727) = 1; |
4590 break; | |
4591 } | |
1009 | 4592 case SPELL_EARTH_DEATH_BLOSSOM: |
890 | 4593 { |
1009 | 4594 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4595 { | |
4596 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4597 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4598 pCastSpell->spellnum = 0; | |
4599 continue; | |
4600 } | |
4601 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4602 break; | |
4603 pSpellSprite.uType = 4090; | |
4604 pSpellSprite.stru_24.Reset(); | |
4605 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4606 pSpellSprite.spell_level = v2; | |
4607 pSpellSprite.spell_skill = v731; | |
4608 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4609 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
4610 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
4611 pSpellSprite.uAttributes = 0; | |
4612 pSpellSprite.uSectorID = 0; | |
4613 pSpellSprite.uSpriteFrameID = 0; | |
4614 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4615 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4616 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4617 pSpellSprite.spell_target_pid = a2; | |
4618 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
4619 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4620 if ( pParty->bTurnBasedModeOn == 1 ) | |
4621 pSpellSprite.uAttributes = 4; | |
4622 | |
4623 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
4624 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4625 ++pTurnEngine->field_1C; | |
4626 LODWORD(v727) = 1; | |
4627 break; | |
4628 } | |
4629 case SPELL_SPIRIT_DETECT_LIFE: | |
4630 { | |
4631 v328 = v731 - 2; | |
4632 if ( v328 ) | |
4633 { | |
4634 v329 = v328 - 1; | |
4635 if ( v329 && v329 != 1 ) | |
4636 v330 = 600 * v2; | |
4637 else | |
4638 v330 = 3600 * v2; | |
4639 } | |
4640 else | |
4641 { | |
4642 v330 = 1800 * v2; | |
4643 } | |
4644 LODWORD(v733) = v330; | |
4645 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4646 break; | |
4647 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
4648 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
4649 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
4650 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
4651 | |
4652 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); | |
890 | 4653 LODWORD(v727) = 1; |
4654 break; | |
4655 } | |
1009 | 4656 case SPELL_SPIRIT_FATE: |
890 | 4657 { |
1009 | 4658 switch (v731) |
4659 { | |
4660 case 1: amount = 1 * v2; break; | |
4661 case 2: amount = 2 * v2; break; | |
4662 case 3: amount = 4 * v2; break; | |
4663 case 4: amount = 6 * v2; break; | |
4664 default: | |
4665 assert(false); | |
4666 } | |
4667 LODWORD(v733) = 300; | |
4668 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4669 break; | |
4670 v342 = pCastSpell->spell_target_pid; | |
4671 if ( v342 == 0 ) | |
4672 { | |
4673 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4674 | |
4675 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
4676 LODWORD(v727) = 1; | |
4677 break; | |
4678 } | |
4679 if (PID_TYPE(v342) == OBJECT_Actor) | |
4680 { | |
4681 v343 = PID_ID(v342); | |
4682 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
4683 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
4684 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
4685 BYTE2(pActors[v343].uAttributes) |= 8u; | |
4686 //v672 = 0; | |
4687 v661 = &pActors[v343]; | |
4688 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
4689 } | |
4690 LODWORD(v727) = 1; | |
890 | 4691 break; |
1009 | 4692 } |
4693 case SPELL_SPIRIT_REMOVE_CURSE: | |
890 | 4694 { |
1009 | 4695 switch (v731) |
4696 { | |
4697 case 1: amount = 3600 * v2; break; | |
4698 case 2: amount = 3600 * v2; break; | |
4699 case 3: amount = 86400 * v2; break; | |
4700 case 4: amount = 0; break; | |
4701 default: | |
4702 assert(false); | |
4703 } | |
4704 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4705 break; | |
4706 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4707 if ( !v351->pConditions[0] ) | |
4708 { | |
4709 LODWORD(v727) = 1; | |
4710 break; | |
4711 } | |
4712 if ( v731 == 4 ) | |
4713 { | |
4714 LODWORD(v351->pConditions[0]) = 0; | |
4715 HIDWORD(v351->pConditions[0]) = 0; | |
4716 } | |
890 | 4717 else |
1009 | 4718 { |
4719 v732 = amount << 7; | |
4720 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
4721 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) | |
4722 { | |
4723 LODWORD(v727) = 1; | |
4724 break; | |
4725 } | |
4726 } | |
924 | 4727 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
890 | 4728 LODWORD(v727) = 1; |
4729 break; | |
4730 } | |
1009 | 4731 case SPELL_SPIRIT_PRESERVATION: |
890 | 4732 { |
1009 | 4733 if ( v731 == 4 ) |
4734 LODWORD(v733) = 900 * (v2 + 4); | |
4735 else | |
4736 LODWORD(v733) = 300 * (v2 + 12); | |
4737 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4738 break; | |
4739 if ( v731 == 1 || v731 == 2 ) | |
4740 { | |
4741 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4742 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4743 LODWORD(v727) = 1; | |
4744 break; | |
4745 } | |
4746 a2 = 0; | |
4747 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4748 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
4749 do | |
4750 { | |
4751 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
4752 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
4753 ++a2; | |
4754 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
4755 } | |
4756 while ( v357 <= &pParty->pPlayers[3] ); | |
890 | 4757 LODWORD(v727) = 1; |
4758 break; | |
4759 } | |
4760 case SPELL_SPIRIT_TURN_UNDEAD: | |
4761 { | |
1009 | 4762 if ( v731 == 1 || v731 == 2) |
4763 LODWORD(v733) = 60 * (v2 + 3); | |
4764 else | |
4765 LODWORD(v733) = 300 * v2 + 180; | |
4766 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4767 break; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4768 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); |
1009 | 4769 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); |
4770 ++pSpellSprite.uType; | |
4771 pSpellSprite.stru_24.Reset(); | |
4772 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4773 pSpellSprite.spell_level = v2; | |
4774 pSpellSprite.spell_skill = v731; | |
4775 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4776 pSpellSprite.uAttributes = 0; | |
4777 pSpellSprite.uSectorID = 0; | |
4778 pSpellSprite.uSpriteFrameID = 0; | |
4779 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
4780 pSpellSprite.uFacing = 0; | |
4781 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4782 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4783 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
4784 { | |
4785 v369 = &pActors[dword_50BF30[a2]]; | |
4786 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
4787 { | |
4788 pSpellSprite.vPosition.x = v369->vPosition.x; | |
4789 pSpellSprite.vPosition.y = v369->vPosition.y; | |
4790 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
4791 | |
4792 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4793 pSpellSprite.Create(0, 0, 0, 0); | |
4794 v369->pActorBuffs[4].Apply( | |
4795 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
4796 v731, 0, 0, 0); | |
4797 } | |
4798 } | |
4799 LODWORD(v727) = 1; | |
890 | 4800 break; |
4801 } | |
1009 | 4802 case SPELL_SPIRIT_RAISE_DEAD: |
890 | 4803 { |
4804 if ( v731 == 4 ) | |
1009 | 4805 amount = 0; |
4806 else | |
4807 amount = 86400 * v2; | |
4808 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4809 break; | |
4810 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); | |
4811 v373 = pCastSpell->uPlayerID_2; | |
4812 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
4813 { | |
4814 LODWORD(v727) = 1; | |
4815 break; | |
4816 } | |
4817 v14 = v731 == 4; | |
4818 pParty->pPlayers[v373].sHealth = 1; | |
4819 if ( v14 ) | |
4820 { | |
4821 v374 = pCastSpell->uPlayerID_2; | |
4822 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4823 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
4824 v376 = pCastSpell->uPlayerID_2; | |
4825 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
4826 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
890 | 4827 } |
889 | 4828 else |
890 | 4829 { |
1009 | 4830 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
4831 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
4832 0xEu, | |
890 | 4833 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
1009 | 4834 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
4835 0xDu, | |
4836 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4837 } | |
4838 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
4839 v377->SetCondition(1, 0); | |
889 | 4840 LODWORD(v727) = 1; |
890 | 4841 break; |
4842 } | |
1009 | 4843 case SPELL_SPIRIT_SHARED_LIFE: |
993 | 4844 { |
1009 | 4845 if ( v731 == 4 ) |
4846 amount = 4 * v2; | |
4847 else | |
4848 amount = 3 * v2; | |
4849 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4850 break; | |
4851 v381 = 0; | |
1013 | 4852 signed int _v733 = amount; |
1009 | 4853 v730 = 0; |
4854 v382 = 1; | |
4855 do | |
4856 { | |
4857 v383 = pPlayers[v382]; | |
4858 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
4859 v682[v381++] = v382; | |
4860 ++v382; | |
4861 } | |
4862 while ( v382 <= 4 ); | |
4863 v384 = 0; | |
4864 v730 = v381; | |
4865 if ( v381 > 0 ) | |
4866 { | |
4867 do | |
1013 | 4868 _v733 += pPlayers[v682[v384++]]->sHealth; |
1009 | 4869 while ( v384 < v381 ); |
4870 } | |
1013 | 4871 v732 = (signed __int64)((double)_v733 / (double)v730); |
4872 _v733 = 0; | |
1009 | 4873 if ( v381 > 0 ) |
4874 { | |
4875 do | |
4876 { | |
4877 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
1013 | 4878 v726 = pPlayers[v682[_v733]]; |
1009 | 4879 v726->sHealth = v732; |
4880 //v386 = v726->GetMaxHealth(); | |
4881 if ( v726->sHealth > v726->GetMaxHealth()) | |
4882 v726->sHealth = v726->GetMaxHealth(); | |
4883 if ( v726->sHealth > 0 ) | |
4884 { | |
4885 v726->pConditions[Player::Condition_Unconcious] = 0; | |
4886 } | |
1013 | 4887 v388 = _v733; |
4888 | |
4889 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[_v733]) - 1); | |
4890 _v733 = v388 + 1; | |
1009 | 4891 } |
4892 while ( v388 + 1 < v730 ); | |
4893 } | |
890 | 4894 LODWORD(v727) = 1; |
4895 break; | |
4896 } | |
1009 | 4897 case SPELL_SPIRIT_RESSURECTION: |
4898 { | |
4899 switch (v731) | |
4900 { | |
4901 case 1: amount = 180 * v2; break; | |
4902 case 2: amount = 10800 * v2; break; | |
4903 case 3: amount = 259200 * v2; break; | |
4904 case 4: amount = 0; break; | |
4905 default: | |
4906 assert(false); | |
4907 } | |
4908 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4909 break; | |
4910 v396 = pCastSpell->uPlayerID_2; | |
4911 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
4912 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
4913 { | |
4914 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
4915 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
4916 if ( v731 == 4 ) | |
4917 { | |
4918 v397 = pCastSpell->uPlayerID_2; | |
4919 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4920 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
4921 v398 = pCastSpell->uPlayerID_2; | |
4922 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4923 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
4924 v399 = pCastSpell->uPlayerID_2; | |
4925 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4926 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
4927 } | |
4928 else | |
4929 { | |
4930 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
4931 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
4932 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4933 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
4934 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4935 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
4936 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
4937 } | |
4938 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); | |
4939 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
4940 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4941 } | |
4942 LODWORD(v727) = 1; | |
4943 break; | |
4944 } | |
4945 case SPELL_MIND_CURE_PARALYSIS: | |
4946 { | |
4947 switch (v731) | |
4948 { | |
4949 case 1: amount = 3600 * v2; break; | |
4950 case 2: amount = 3600 * v2; break; | |
4951 case 3: amount = 86400 * v2; break; | |
4952 case 4: amount = 0; break; | |
4953 default: | |
4954 assert(false); | |
4955 } | |
4956 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4957 break; | |
4958 | |
4959 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4960 v323 = pCastSpell->uPlayerID_2; | |
4961 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
4962 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
4963 { | |
4964 LODWORD(v727) = 1; | |
4965 break; | |
4966 } | |
4967 if ( v731 == 4 ) | |
4968 { | |
4969 *(int *)v324 = 0; | |
4970 *((int *)v324 + 1) = 0; | |
4971 LODWORD(v727) = 1; | |
4972 break; | |
4973 } | |
4974 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
4975 v656 = 12; | |
4976 v325 = &pParty->pPlayers[v323]; | |
4977 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
4978 LODWORD(v727) = 1; | |
4979 break; | |
4980 } | |
4981 case SPELL_MIND_REMOVE_FEAR: | |
4982 { | |
4983 switch (v731) | |
4984 { | |
4985 case 1: amount = 180 * v2; break; | |
4986 case 2: amount = 3600 * v2; break; | |
4987 case 3: amount = 86400 * v2; break; | |
4988 case 4: amount = 0; break; | |
4989 default: | |
4990 assert(false); | |
4991 } | |
4992 | |
4993 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4994 break; | |
4995 | |
4996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
4997 v323 = pCastSpell->uPlayerID_2; | |
4998 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
4999 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
5000 { | |
5001 LODWORD(v727) = 1; | |
5002 break; | |
5003 } | |
5004 if ( v731 == 4 ) | |
5005 { | |
5006 *(int *)v324 = 0; | |
5007 *((int *)v324 + 1) = 0; | |
5008 LODWORD(v727) = 1; | |
5009 break; | |
5010 } | |
5011 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5012 v656 = 3; | |
5013 v325 = &pParty->pPlayers[v323]; | |
5014 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5015 LODWORD(v727) = 1; | |
5016 break; | |
993 | 5017 } |
890 | 5018 case SPELL_MIND_TELEPATHY: |
993 | 5019 { |
5020 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5021 break; | |
5022 if (PID_TYPE(a2) != OBJECT_Actor) | |
5023 { | |
5024 LODWORD(v727) = 1; | |
5025 break; | |
5026 } | |
1013 | 5027 v417 = &pActors[PID_ID(a2)]; |
5028 Actor * _v730 = v417; | |
5029 if ( !(BYTE2(v417->uAttributes) & 0x80) ) | |
5030 { | |
5031 v417->SetRandomGoldIfTheresNoItem(); | |
5032 v417 = _v730; | |
5033 } | |
5034 v418 = v417->array_000234[3].uItemID; | |
5035 signed int _v733 = 0; | |
993 | 5036 if ( pItemsTable->pItems[v418].uEquipType == 18 ) |
1013 | 5037 _v733 = v417->array_000234[3].uSpecEnchantmentType; |
993 | 5038 |
5039 //ItemGen::ItemGen(&v683); | |
5040 v683.Reset(); | |
5041 | |
1013 | 5042 v419 = _v730->uCarriedItemID; |
993 | 5043 if (v419) |
5044 { | |
5045 v683.uItemID = v419; | |
5046 //goto LABEL_799; | |
5047 } | |
5048 else | |
5049 { | |
5050 v420 = 0; | |
1013 | 5051 v421 = _v730->array_000234; |
5052 while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 ) | |
993 | 5053 { |
5054 ++v420; | |
1013 | 5055 ++v421; |
993 | 5056 if ( v420 >= 4 ) |
5057 break; | |
5058 } | |
5059 if ( v420 < 4 ) | |
5060 { | |
1013 | 5061 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683)); |
1009 | 5062 v2 = v723; |
5063 //v1 = 0; | |
993 | 5064 } |
5065 } | |
5066 // LABEL_799: | |
1013 | 5067 if ( _v733 != 0 ) |
5068 { | |
5069 v675 = _v733; | |
993 | 5070 if (v683.uItemID) |
5071 { | |
5072 v422 = v683.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5073 sprintf(pTmpBuf2.data(), "(%s), and %d gold", v422, v675); |
1013 | 5074 |
993 | 5075 } |
5076 else | |
5077 { | |
5078 v664 = "%d gold"; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5079 sprintf(pTmpBuf2.data(), v664, v675); |
993 | 5080 } |
5081 } | |
5082 else | |
5083 { | |
5084 if (v683.uItemID) | |
5085 { | |
1013 | 5086 const char *_v675 = v683.GetDisplayName(); |
993 | 5087 v664 = "(%s)"; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5088 sprintf(pTmpBuf2.data(), v664, _v675); |
993 | 5089 } |
5090 else | |
5091 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5092 strcpy(pTmpBuf2.data(), "nothing"); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5093 ShowStatusBarString(pTmpBuf2.data(), 2u); |
993 | 5094 } |
5095 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5096 ShowStatusBarString(pTmpBuf2.data(), 2u); |
1013 | 5097 pSpellSprite.stru_24.Reset(); |
5098 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5099 pSpellSprite.spell_level = v2; | |
5100 pSpellSprite.spell_skill = v731; | |
5101 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5102 pSpellSprite.vPosition.x = _v730->vPosition.x; | |
5103 pSpellSprite.vPosition.y = _v730->vPosition.y; | |
5104 v676 = _v730->uActorHeight; | |
5105 v665 = pSpellSprite.vPosition.y; | |
5106 pSpellSprite.vPosition.z = _v730->uActorHeight; | |
5107 v657 = pSpellSprite.vPosition.x; | |
993 | 5108 pSpellSprite.uAttributes = 0; |
5109 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5110 pSpellSprite.uSpriteFrameID = 0; | |
5111 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5112 pSpellSprite.spell_target_pid = a2; | |
5113 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5114 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5115 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5116 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5117 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
889 | 5118 LODWORD(v727) = 1; |
890 | 5119 break; |
5120 } | |
993 | 5121 case SPELL_MIND_BERSERK: |
5122 { | |
1009 | 5123 switch (v731) |
5124 { | |
5125 case 1: amount = 300 * v2; break; | |
5126 case 2: amount = 300 * v2; break; | |
5127 case 3: amount = 600 * v2; break; | |
5128 case 4: amount = 3600; break; | |
5129 default: | |
5130 assert(false); | |
5131 } | |
993 | 5132 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5133 break; | |
5134 v426 = PID_ID(a2); | |
5135 if (PID_TYPE(a2) != OBJECT_Actor) | |
5136 { | |
5137 LODWORD(v727) = 1; | |
5138 break; | |
5139 } | |
5140 v730 = 836 * v426; | |
5141 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
5142 { | |
5143 pActors[v426].pActorBuffs[1].Reset(); | |
5144 pActors[v426].pActorBuffs[12].Reset(); | |
5145 pActors[v426].pActorBuffs[9].Apply( | |
5146 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5147 v731, 0, 0, 0); | |
5148 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5149 } | |
924 | 5150 pSpellSprite.stru_24.Reset(); |
5151 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5152 pSpellSprite.spell_level = v2; | |
5153 pSpellSprite.spell_skill = v731; | |
993 | 5154 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5155 v61 = v426; | |
5156 v600 = pActors[v61].vPosition.y; | |
5157 v601 = pActors[v61].vPosition.x; | |
5158 pSpellSprite.uObjectDescID = v60; | |
5159 pSpellSprite.vPosition.x = v601; | |
5160 v602 = pActors[v61].uActorHeight; | |
5161 v603 = pActors[v61].vPosition.z; | |
5162 pSpellSprite.vPosition.y = v600; | |
5163 v676 = v603 + v602; | |
5164 v665 = v600; | |
5165 pSpellSprite.vPosition.z = v603 + v602; | |
5166 v657 = v601; | |
5167 pSpellSprite.uAttributes = 0; | |
5168 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5169 pSpellSprite.uSpriteFrameID = 0; | |
5170 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5171 pSpellSprite.spell_target_pid = a2; | |
5172 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5173 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5174 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5175 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5176 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5177 LODWORD(v727) = 1; |
5178 break; | |
5179 } | |
5180 case SPELL_MIND_ENSLAVE: | |
993 | 5181 { |
5182 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5183 break; | |
5184 amount = 600 * v2; | |
5185 if (PID_TYPE(a2) != OBJECT_Actor) | |
5186 { | |
5187 LODWORD(v727) = 1; | |
5188 break; | |
5189 } | |
5190 v730 = 836 * PID_ID(a2); | |
5191 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5192 break; | |
5193 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
5194 { | |
5195 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
5196 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
5197 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5198 v731, 0, 0, 0); | |
5199 } | |
5200 pSpellSprite.stru_24.Reset(); | |
5201 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5202 pSpellSprite.spell_level = v2; | |
5203 pSpellSprite.spell_skill = v731; | |
5204 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5205 v61 = PID_ID(a2); | |
5206 v600 = pActors[v61].vPosition.y; | |
5207 v601 = pActors[v61].vPosition.x; | |
5208 pSpellSprite.uObjectDescID = v60; | |
5209 pSpellSprite.vPosition.x = v601; | |
5210 v602 = pActors[v61].uActorHeight; | |
5211 v603 = pActors[v61].vPosition.z; | |
5212 pSpellSprite.vPosition.y = v600; | |
5213 v676 = v603 + v602; | |
5214 v665 = v600; | |
5215 pSpellSprite.vPosition.z = v603 + v602; | |
5216 v657 = v601; | |
5217 pSpellSprite.uAttributes = 0; | |
5218 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
5219 pSpellSprite.uSpriteFrameID = 0; | |
5220 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5221 pSpellSprite.spell_target_pid = a2; | |
5222 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5223 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
5224 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
5225 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5226 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 5227 LODWORD(v727) = 1; |
5228 break; | |
5229 } | |
5230 case SPELL_MIND_MASS_FEAR: | |
5231 { | |
1009 | 5232 if ( v731 == 4 ) |
5233 amount = 300 * v2; | |
5234 else | |
5235 amount = 180 * v2; | |
5236 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5237 break; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5238 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); |
1009 | 5239 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); |
5240 ++pSpellSprite.uType; | |
5241 pSpellSprite.stru_24.Reset(); | |
5242 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5243 pSpellSprite.spell_level = v2; | |
5244 pSpellSprite.spell_skill = v731; | |
5245 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5246 pSpellSprite.uAttributes = 0; | |
5247 pSpellSprite.uSectorID = 0; | |
5248 pSpellSprite.uSpriteFrameID = 0; | |
5249 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5250 pSpellSprite.uFacing = 0; | |
5251 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5252 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5253 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
5254 { | |
5255 v433 = &pActors[dword_50BF30[a2]]; | |
5256 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5257 break; | |
5258 pSpellSprite.vPosition.x = v433->vPosition.x; | |
5259 pSpellSprite.vPosition.y = v433->vPosition.y; | |
5260 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
5261 | |
5262 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5263 pSpellSprite.Create(0, 0, 0, 0); | |
5264 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
5265 { | |
5266 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
5267 v731, 0, 0, 0); | |
5268 } | |
5269 } | |
5270 LODWORD(v727) = 1; | |
890 | 5271 break; |
5272 } | |
1009 | 5273 case SPELL_MIND_CURE_INSANITY: |
890 | 5274 { |
1009 | 5275 v435 = v731 - 2; |
5276 if ( v731 == 4 ) | |
5277 amount = 0; | |
889 | 5278 else |
1009 | 5279 amount = 86400 * v2; |
5280 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5281 break; | |
5282 | |
5283 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5284 v440 = pCastSpell->uPlayerID_2; | |
5285 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
5286 { | |
5287 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
5288 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
5289 if ( v731 == 4 ) | |
890 | 5290 { |
1009 | 5291 v441 = pCastSpell->uPlayerID_2; |
5292 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
5293 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
890 | 5294 } |
5295 else | |
1009 | 5296 { |
5297 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
5298 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
5299 } | |
5300 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5301 v377->SetCondition(1, 0); | |
5302 } | |
889 | 5303 LODWORD(v727) = 1; |
890 | 5304 break; |
5305 } | |
1009 | 5306 case SPELL_EARTH_TELEKINESIS: |
890 | 5307 { |
1009 | 5308 switch (v731) |
5309 { | |
5310 case 1: amount = 2 * v2; break; | |
5311 case 2: amount = 2 * v2; break; | |
5312 case 3: amount = 3 * v2; break; | |
5313 case 4: amount = 4 * v2; break; | |
5314 default: | |
5315 assert(false); | |
5316 } | |
5317 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5318 break; | |
5319 v445 = PID_ID(a2); | |
5320 if (PID_TYPE(a2) == OBJECT_Item) | |
5321 { | |
5322 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
5323 v450 = *(int *)v449; | |
5324 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
5325 { | |
5326 party_finds_gold(*((int *)v449 + 3), 0); | |
5327 viewparams->bRedrawGameUI = 1; | |
5328 } | |
5329 else | |
5330 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5331 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5332 ShowStatusBarString(pTmpBuf2.data(), 2u); |
1009 | 5333 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) |
5334 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
5335 } | |
5336 SpriteObject::OnInteraction(v445); | |
5337 } | |
5338 else | |
5339 { | |
5340 if (PID_TYPE(a2) == OBJECT_Actor) | |
5341 { | |
5342 stru_50C198.LootActor(&pActors[v445]); | |
5343 } | |
5344 else | |
5345 { | |
5346 if (PID_TYPE(a2) != OBJECT_Decoration) | |
5347 { | |
5348 if (PID_TYPE(a2) != OBJECT_BModel) | |
5349 { | |
5350 LODWORD(v727) = 1; | |
5351 break; | |
5352 } | |
5353 dword_507CD8 = 1; | |
5354 v677 = 1; | |
5355 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5356 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
5357 else | |
5358 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
5359 EventProcessor(v446, a2, v677); | |
5360 LODWORD(v727) = 1; | |
5361 break; | |
5362 } | |
5363 v447 = &pLevelDecorations[v445]; | |
5364 dword_507CD8 = 1; | |
5365 v448 = v447->field_16_event_id; | |
5366 if (v448) | |
5367 { | |
5368 v677 = 1; | |
5369 v446 = v448; | |
5370 EventProcessor(v446, a2, v677); | |
5371 LODWORD(v727) = 1; | |
5372 break; | |
5373 } | |
5374 if ( v447->IsInteractive() ) | |
5375 { | |
5376 activeLevelDecoration = v447; | |
5377 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
5378 activeLevelDecoration = NULL; | |
5379 } | |
5380 } | |
5381 } | |
890 | 5382 LODWORD(v727) = 1; |
5383 break; | |
5384 } | |
1009 | 5385 case SPELL_BODY_CURE_WEAKNESS: |
890 | 5386 { |
1009 | 5387 switch (v731) |
5388 { | |
5389 case 1: amount = 180 * v2; break; | |
5390 case 2: amount = 3600 * v2; break; | |
5391 case 3: amount = 86400 * v2; break; | |
5392 case 4: amount = 0; break; | |
5393 default: | |
5394 assert(false); | |
5395 } | |
5396 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5397 break; | |
5398 | |
5399 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5400 v323 = pCastSpell->uPlayerID_2; | |
5401 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
5402 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
5403 { | |
5404 LODWORD(v727) = 1; | |
5405 break; | |
5406 } | |
5407 if ( v731 == 4 ) | |
5408 { | |
5409 *(int *)v324 = 0; | |
5410 *((int *)v324 + 1) = 0; | |
5411 LODWORD(v727) = 1; | |
5412 break; | |
5413 } | |
5414 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5415 v656 = 1; | |
5416 v325 = &pParty->pPlayers[v323]; | |
5417 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
890 | 5418 LODWORD(v727) = 1; |
5419 break; | |
5420 } | |
1009 | 5421 case SPELL_BODY_FIRST_AID: |
890 | 5422 { |
1009 | 5423 switch (v731) |
5424 { | |
5425 case 1: amount = 2 * v2 + 5; break; | |
5426 case 2: amount = 3 * v2 + 5; break; | |
5427 case 3: amount = 4 * v2 + 5; break; | |
5428 case 4: amount = 5 * v2 + 5; break; | |
5429 default: | |
5430 assert(false); | |
5431 } | |
5432 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5433 break; | |
5434 v460 = pCastSpell->spell_target_pid; | |
5435 if (!v460) | |
5436 { | |
5437 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); | |
5438 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5439 } | |
5440 else | |
5441 { | |
5442 if (PID_TYPE(v460) == OBJECT_Actor) | |
5443 { | |
5444 v461 = &pActors[PID_ID(v460)]; | |
5445 v462 = v461->uAIState; | |
5446 v463 = v461->pMonsterInfo.uHP; | |
5447 if ( v462 != 5 ) | |
5448 { | |
5449 if ( v462 != 4 ) | |
5450 { | |
5451 if ( v462 != 19 ) | |
5452 { | |
5453 if ( v462 != 11 ) | |
5454 { | |
5455 v461->sCurrentHP += amount; | |
5456 if ( v461->sCurrentHP > v463 ) | |
5457 v461->sCurrentHP = v463; | |
5458 } | |
5459 } | |
5460 } | |
5461 } | |
5462 } | |
5463 } | |
890 | 5464 LODWORD(v727) = 1; |
5465 break; | |
5466 } | |
1009 | 5467 case SPELL_BODY_CURE_POISON: |
5468 { | |
5469 switch (v731) | |
5470 { | |
5471 case 1: amount = 3600 * v2; break; | |
5472 case 2: amount = 3600 * v2; break; | |
5473 case 3: amount = 86400 * v2; break; | |
5474 case 4: amount = 0; break; | |
5475 default: | |
5476 assert(false); | |
5477 } | |
5478 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5479 break; | |
5480 | |
5481 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5482 v470 = pCastSpell->uPlayerID_2; | |
5483 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
5484 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
5485 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
5486 { | |
5487 LODWORD(v727) = 1; | |
5488 break; | |
5489 } | |
5490 if ( v731 == 4 ) | |
5491 { | |
5492 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5493 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
5494 v471 = pCastSpell->uPlayerID_2; | |
5495 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5496 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
5497 v472 = pCastSpell->uPlayerID_2; | |
5498 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5499 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
5500 LODWORD(v727) = 1; | |
5501 break; | |
5502 } | |
5503 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5504 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
5505 6u, | |
5506 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5507 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5508 8u, | |
5509 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5510 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5511 v656 = 10; | |
5512 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5513 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5514 LODWORD(v727) = 1; | |
5515 break; | |
993 | 5516 } |
890 | 5517 case SPELL_BODY_PROTECTION_FROM_MAGIC: |
5518 { | |
1009 | 5519 amount = v2; |
5520 LODWORD(v733) = 3600 * v2; | |
5521 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5522 break; | |
5523 | |
924 | 5524 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5525 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5526 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5527 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
1009 | 5528 |
5529 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
890 | 5530 LODWORD(v727) = 1; |
5531 break; | |
5532 } | |
1009 | 5533 case SPELL_BODY_HAMMERHANDS: |
890 | 5534 { |
1009 | 5535 LODWORD(v733) = 3600 * v2; |
5536 amount = v2; | |
5537 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5538 break; | |
5539 if ( v731 == 4 ) | |
5540 { | |
5541 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5542 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5543 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5544 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5545 v732 = (int)v733 << 7; | |
5546 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5547 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5548 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5549 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
5550 | |
5551 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
5552 LODWORD(v727) = 1; | |
5553 break; | |
5554 } | |
5555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5556 | |
5557 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | |
890 | 5558 LODWORD(v727) = 1; |
5559 break; | |
5560 } | |
1009 | 5561 case SPELL_BODY_CURE_DISEASE: |
890 | 5562 { |
1009 | 5563 if ( v731 == 4 ) |
5564 amount = 0; | |
5565 else | |
5566 amount = 86400 * v2; | |
5567 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5568 break; | |
5569 | |
5570 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5571 v498 = pCastSpell->uPlayerID_2; | |
5572 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
5573 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
5574 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
5575 { | |
5576 LODWORD(v727) = 1; | |
5577 break; | |
5578 } | |
5579 if ( v731 == 4 ) | |
5580 { | |
5581 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5582 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
5583 v499 = pCastSpell->uPlayerID_2; | |
5584 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5585 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
5586 v500 = pCastSpell->uPlayerID_2; | |
5587 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5588 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
5589 } | |
5590 else | |
5591 { | |
5592 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5593 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
5594 7u, | |
5595 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5596 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5597 9u, | |
5598 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5599 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
5600 v656 = 11; | |
5601 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5602 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
5603 } | |
890 | 5604 LODWORD(v727) = 1; |
5605 break; | |
1009 | 5606 } |
890 | 5607 case SPELL_BODY_POWER_CURE: |
5608 { | |
1009 | 5609 amount = 5 * v2 + 10; |
5610 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5611 break; | |
5612 v501 = pParty->pPlayers; | |
5613 int v1 = 0; | |
5614 do | |
5615 { | |
5616 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); | |
5617 v501->Heal(amount); | |
5618 ++v501; | |
5619 ++v1; | |
5620 } | |
5621 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
890 | 5622 LODWORD(v727) = 1; |
5623 break; | |
5624 } | |
5625 case SPELL_LIGHT_DISPEL_MAGIC: | |
5626 { | |
1009 | 5627 sRecoveryTime -= v2; |
5628 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5629 break; | |
5630 | |
5631 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5632 v505 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); |
1009 | 5633 ++pSpellSprite.uType; |
1102 | 5634 //signed int _v733 = v505; |
1009 | 5635 v688.x = 0; |
5636 v688.y = 0; | |
5637 v688.z = 0; | |
5638 pSpellSprite.stru_24.Reset(); | |
5639 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5640 pSpellSprite.spell_level = v2; | |
5641 pSpellSprite.spell_skill = v731; | |
5642 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5643 pSpellSprite.uAttributes = 0; | |
5644 pSpellSprite.uSectorID = 0; | |
5645 pSpellSprite.uSpriteFrameID = 0; | |
5646 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5647 pSpellSprite.uFacing = 0; | |
5648 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5649 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5650 a2 = 0; | |
1102 | 5651 for ( a2 = 0; a2 < v505; ++a2 ) |
5652 { | |
5653 v507 = dword_50BF30[a2]; | |
5654 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; | |
5655 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
5656 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
5657 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5658 v509 = pSpellSprite.Create(0, 0, 0, 0); | |
5659 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688); | |
5660 } | |
5661 for ( a2 = 0; a2 < v505; ++a2 ) | |
1013 | 5662 { |
5663 pActor = &pActors[dword_50BF30[a2]]; | |
5664 pSpellSprite.vPosition.x = pActor->vPosition.x; | |
5665 pSpellSprite.vPosition.y = pActor->vPosition.y; | |
5666 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548); | |
1009 | 5667 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
5668 pSpellSprite.Create(0, 0, 0, 0); | |
1013 | 5669 for (int i = 0; i < 22; ++i) |
1009 | 5670 { |
1013 | 5671 pActor->pActorBuffs[i].Reset(); |
1009 | 5672 } |
5673 } | |
890 | 5674 LODWORD(v727) = 1; |
5675 break; | |
5676 } | |
1009 | 5677 case SPELL_LIGHT_SUMMON_ELEMENTAL: |
993 | 5678 { |
1009 | 5679 switch (v731) |
5680 { | |
5681 case 1: v733 = 300 * v2; amount = 1; break; | |
5682 case 2: v733 = 300 * v2; amount = 1; break; | |
5683 case 3: v733 = 900 * v2; amount = 3; break; | |
5684 case 4: v733 = 900 * v2; amount = 5; break; | |
5685 default: | |
5686 assert(false); | |
5687 } | |
5688 //v733 = __PAIR__(0, v516); | |
1013 | 5689 signed int _v733 = 0; |
1009 | 5690 if ( (signed int)uNumActors > 0 ) |
5691 { | |
1202 | 5692 v518 = pActors.data();//[0].uAIState; |
1009 | 5693 auto _v726 = uNumActors; |
5694 do | |
5695 { | |
5696 v519 = v518->uAIState; | |
5697 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) | |
1013 | 5698 ++_v733; |
1009 | 5699 ++v518; |
5700 --_v726; | |
5701 } | |
5702 while ( _v726 != 0 ); | |
5703 } | |
1013 | 5704 if ( _v733 >= amount ) |
1009 | 5705 { |
5706 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
5707 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5708 pCastSpell->spellnum = 0; | |
5709 continue; | |
5710 } | |
5711 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5712 break; | |
5713 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); | |
5714 LODWORD(v727) = 1; | |
5715 break; | |
993 | 5716 } |
1009 | 5717 case SPELL_LIGHT_DAY_OF_THE_GODS: |
993 | 5718 { |
1009 | 5719 switch (v731) |
5720 { | |
5721 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5722 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break; | |
5723 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break; | |
5724 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break; | |
5725 default: | |
5726 assert(false); | |
5727 } | |
5728 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5729 break; | |
5730 | |
924 | 5731 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5732 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5733 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5734 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
889 | 5735 |
1009 | 5736 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
5737 LODWORD(v727) = 1; | |
5738 break; | |
890 | 5739 } |
1009 | 5740 case SPELL_LIGHT_PRISMATIC_LIGHT: |
890 | 5741 { |
1009 | 5742 //v67 = 2; |
5743 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
5744 { | |
5745 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
5746 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5747 pCastSpell->spellnum = 0; | |
5748 continue; | |
5749 } | |
5750 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5751 break; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5752 v531 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096); |
1009 | 5753 ++pSpellSprite.uType; |
5754 v694.x = 0; | |
5755 v694.y = 0; | |
5756 v694.z = 0; | |
5757 pSpellSprite.stru_24.Reset(); | |
5758 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5759 pSpellSprite.spell_level = v2; | |
5760 pSpellSprite.spell_skill = v731; | |
5761 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5762 pSpellSprite.uAttributes = 0; | |
5763 pSpellSprite.uSectorID = 0; | |
5764 pSpellSprite.uSpriteFrameID = 0; | |
5765 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5766 pSpellSprite.uFacing = 0; | |
5767 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5768 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5769 a2 = 0; | |
5770 if ( (signed int)v531 > 0 ) | |
5771 { | |
5772 do | |
5773 { | |
5774 v533 = dword_50BF30[a2]; | |
5775 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; | |
5776 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
5777 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
5778 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5779 v535 = pSpellSprite.Create(0, 0, 0, 0); | |
5780 v536 = a2; | |
5781 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
5782 a2 = v536 + 1; | |
5783 } | |
5784 while ( v536 + 1 < (signed int)v531 ); | |
5785 } | |
5786 v537 = pGame->GetStru6(); | |
5787 pGame->GetStru6()->_4A8BFC(); | |
890 | 5788 LODWORD(v727) = 1; |
5789 break; | |
5790 } | |
1009 | 5791 case SPELL_LIGHT_DAY_OF_PROTECTION: |
890 | 5792 { |
1009 | 5793 switch (v731) |
5794 { | |
5795 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5796 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5797 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break; | |
5798 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break; | |
5799 default: | |
5800 assert(false); | |
5801 } | |
5802 v730 = LODWORD(v733); | |
5803 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5804 break; | |
5805 | |
5806 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5807 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5808 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5809 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5810 | |
5811 v732 = v730 << 7; | |
5812 v549 = (double)(v730 << 7) * 0.033333335; | |
5813 *((float *)&v733 + 1) = v549; | |
5814 v712 = (signed __int64)v549; | |
5815 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
5816 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5817 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5818 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5819 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5820 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
5821 v550 = v2 + 5; | |
5822 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
5823 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
5824 v731, | |
5825 v550, 0, 0); | |
5826 | |
5827 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
890 | 5828 LODWORD(v727) = 1; |
5829 break; | |
5830 } | |
1009 | 5831 case SPELL_LIGHT_HOUR_OF_POWER: |
993 | 5832 { |
1009 | 5833 switch (v731) |
5834 { | |
5835 case 1: LODWORD(v733) = 4; amount = 4; break; | |
5836 case 2: LODWORD(v733) = 4; amount = 4; break; | |
5837 case 3: LODWORD(v733) = 12; amount = 12; break; | |
5838 case 4: LODWORD(v733) = 20; amount = 15; break; | |
5839 default: | |
5840 assert(false); | |
5841 } | |
993 | 5842 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5843 break; | |
1013 | 5844 y = (char *)(60 * (v2 * LODWORD(v733) + 60)); |
1009 | 5845 v732 = (300 * amount * v2 + 60) << 7; |
5846 v730 = v2 + 5; | |
5847 int _v726 = 0; | |
5848 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
1013 | 5849 *((float *)&v733) = (double)v732 * 0.033333335; |
1009 | 5850 do |
5851 { | |
5852 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); | |
5853 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); | |
5854 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | |
5855 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | |
5856 | |
5857 //((SpellBuff *)(v553 + 6056))->Apply( | |
1013 | 5858 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
1009 | 5859 if ( *(_QWORD *)v553 ) |
5860 _v726 = 1; | |
5861 ++v553; | |
5862 } | |
5863 while ( v553 <= &pParty->pPlayers[3] ); | |
5864 v562 = v731; | |
1013 | 5865 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0); |
5866 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0); | |
5867 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0); | |
1009 | 5868 if (!_v726) |
5869 { | |
5870 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); | |
5871 } | |
5872 LODWORD(v727) = 1; | |
5873 break; | |
5874 } | |
5875 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
5876 { | |
5877 amount = 3; | |
5878 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
993 | 5879 { |
5880 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5881 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5882 pCastSpell->spellnum = 0; | |
5883 continue; | |
5884 } | |
1009 | 5885 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5886 break; | |
5887 a2 = 0; | |
5888 _this = (ItemGen *)&pPlayers[1]; | |
5889 do | |
5890 { | |
5891 v563 = 0; | |
5892 do | |
5893 { | |
5894 v564 = _this->uItemID; | |
5895 *(int *)(v563 + _this->uItemID) = 0; | |
5896 v563 += 8; | |
5897 *(int *)(v563 + v564 - 4) = 0; | |
5898 } | |
5899 while ( v563 <= 128 ); | |
5900 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
5901 v566 = (Player **)_this; | |
5902 *(int *)(_this->uItemID + 6460) = v565; | |
5903 v567 = (*v566)->GetMaxMana(); | |
5904 *(int *)(_this->uItemID + 6464) = v567; | |
5905 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); | |
5906 ++a2; | |
5907 _this = (ItemGen *)((char *)_this + 4); | |
5908 } | |
5909 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
5910 v571 = pPlayer; | |
5911 v572 = (char *)&pPlayer->sAgeModifier; | |
5912 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
5913 *(short *)v572 = 120; | |
5914 else | |
5915 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
5916 sRecoveryTime += -5 * v2; | |
5917 ++v571->uNumDivineInterventionCastsThisDay; | |
5918 LODWORD(v727) = 1; | |
5919 break; | |
5920 } | |
5921 case SPELL_DARK_REANIMATE: | |
5922 { | |
5923 switch (v731) | |
5924 { | |
5925 case 1: amount = 2 * v2; break; | |
5926 case 2: amount = 3 * v2; break; | |
5927 case 3: amount = 4 * v2; break; | |
5928 case 4: amount = 5 * v2; break; | |
5929 default: | |
5930 assert(false); | |
5931 } | |
5932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5933 break; | |
5934 v576 = pCastSpell->spell_target_pid; | |
5935 if (!v576) | |
5936 { | |
5937 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
5938 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
5939 if ( *((_QWORD *)v585 + 14) ) | |
5940 { | |
5941 ((Player *)v585)->SetCondition(0x11u, 1); | |
5942 v587 = ((Player *)v585)->GetSexByVoice(); | |
5943 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); | |
5944 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
5945 } | |
5946 break; | |
5947 } | |
5948 v577 = (Player *)(PID_ID(v576)); | |
5949 //v726 = v577; | |
5950 if ( v577 == (Player *)-1 ) | |
5951 { | |
5952 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
5953 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5954 pCastSpell->spellnum = 0; | |
5955 continue; | |
5956 } | |
5957 v578 = (int)&pActors[(int)v577]; | |
5958 v721 = v578; | |
5959 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
5960 { | |
5961 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5962 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5963 pCastSpell->spellnum = 0; | |
5964 continue; | |
5965 } | |
5966 ++pSpellSprite.uType; | |
5967 pSpellSprite.stru_24.Reset(); | |
5968 pSpellSprite.spell_id = pCastSpell->spellnum; | |
5969 pSpellSprite.spell_level = v2; | |
5970 pSpellSprite.spell_skill = v731; | |
5971 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
5972 pSpellSprite.uAttributes = 0; | |
5973 pSpellSprite.uSectorID = 0; | |
5974 pSpellSprite.uSpriteFrameID = 0; | |
5975 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
5976 v581 = v721; | |
5977 pSpellSprite.uFacing = 0; | |
5978 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
5979 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
5980 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
5981 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
5982 v732 = *(short *)(v721 + 138); | |
5983 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
5984 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
5985 pSpellSprite.Create(0, 0, 0, 0); | |
5986 if ( *(char *)(v581 + 52) > amount ) | |
5987 break; | |
5988 Actor::Resurrect((unsigned int)v577); | |
5989 *(char *)(v581 + 61) = 0; | |
5990 *(char *)(v581 + 53) = 0; | |
5991 *(char *)(v581 + 54) = 0; | |
5992 *(char *)(v581 + 55) = 0; | |
5993 *(char *)(v581 + 56) = 0; | |
5994 *(char *)(v581 + 57) = 0; | |
5995 *(int *)(v581 + 712) = 9999; | |
5996 *(char *)(v581 + 38) &= 0xF7u; | |
5997 *(int *)(v581 + 708) = 0; | |
5998 ((SpellBuff *)(v581 + 356))->Reset(); | |
5999 ((SpellBuff *)(v581 + 228))->Reset(); | |
6000 ((SpellBuff *)(v581 + 404))->Reset(); | |
6001 if ( *(short *)(v581 + 40) > 10 * amount ) | |
6002 *(short *)(v581 + 40) = 10 * amount; | |
6003 LODWORD(v727) = 1; | |
6004 break; | |
6005 } | |
6006 case SPELL_DARK_VAMPIRIC_WEAPON: | |
6007 { | |
6008 amount = 16; | |
6009 if ( v731 == 4 ) | |
6010 { | |
6011 LODWORD(v733) = 0; | |
6012 } | |
6013 else | |
6014 { | |
6015 LODWORD(v733) = 3600 * v2; | |
6016 } | |
6017 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6018 break; | |
6019 __debugbreak(); | |
1013 | 6020 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
6021 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; | |
6022 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; | |
6023 _v733->UpdateTempBonus(pParty->uTimePlayed); | |
6024 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65 | |
6025 || LOBYTE(_v733->uAttributes) & 2 | |
6026 || _v733->uSpecEnchantmentType != 0 | |
6027 || _v733->uEnchantmentType != 0 | |
6028 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2 | |
6029 || pItemsTable->IsMaterialNonCommon(_v733) ) | |
1009 | 6030 { |
6031 dword_50C9D0 = 113; | |
6032 dword_50C9D4 = 0; | |
6033 dword_50C9D8 = 1; | |
6034 | |
6035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6037 pCastSpell->spellnum = 0; | |
6038 continue; | |
6039 } | |
1013 | 6040 v592 = _v733; |
1009 | 6041 v14 = v731 == 4; |
1013 | 6042 _v733->uSpecEnchantmentType = 16; |
1009 | 6043 if ( !v14 ) |
6044 { | |
6045 v732 = (int)v733 << 7; | |
1013 | 6046 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
6047 v592->uAttributes |= 8u; | |
6048 } | |
6049 LOBYTE(v592->uAttributes) |= 0x80u; | |
1009 | 6050 _50C9A8_item_enchantment_timer = 256; |
6051 LODWORD(v727) = 1; | |
6052 break; | |
6053 } | |
6054 case SPELL_DARK_SHARPMETAL: | |
6055 { | |
6056 switch (v731) | |
6057 { | |
6058 case 1: amount = 5; break; | |
6059 case 2: amount = 5; break; | |
6060 case 3: amount = 7; break; | |
6061 case 4: amount = 9; break; | |
6062 default: | |
6063 assert(false); | |
6064 } | |
6065 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6066 break; | |
6067 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
6068 pSpellSprite.stru_24.Reset(); | |
6069 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6070 pSpellSprite.spell_level = v2; | |
6071 pSpellSprite.spell_skill = v731; | |
6072 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6073 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
6074 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
6075 pSpellSprite.uAttributes = 0; | |
6076 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
6077 pSpellSprite.uSectorID = pIndoor->GetSector( | |
6078 pParty->vPosition.x, | |
6079 pParty->vPosition.y, | |
6080 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
6081 pSpellSprite.uSpriteFrameID = 0; | |
6082 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6083 pSpellSprite.spell_target_pid = a2; | |
6084 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6085 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6086 if ( pParty->bTurnBasedModeOn == 1 ) | |
6087 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
6088 v596 = (signed int)_v726 / -2; | |
6089 y = (char *)((signed int)_v726 / 2); | |
6090 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
6091 { | |
6092 v597 = v715.uYawAngle; | |
6093 do | |
6094 { | |
6095 pSpellSprite.uFacing = v596 + v597; | |
6096 if ( pSpellSprite.Create( | |
6097 v596 + v597, | |
6098 v715.uPitchAngle, | |
6099 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
6100 pCastSpell->uPlayerID + 1) != -1 | |
6101 && pParty->bTurnBasedModeOn == 1 ) | |
6102 ++pTurnEngine->field_1C; | |
6103 v596 += _v726 / (amount - 1); | |
6104 } | |
6105 while ( v596 <= (signed int)y ); | |
6106 } | |
6107 LODWORD(v727) = 1; | |
6108 break; | |
6109 } | |
6110 case SPELL_DARK_CONTROL_UNDEAD: | |
6111 { | |
6112 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6113 break; | |
6114 switch (v731) | |
6115 { | |
6116 case 1: LODWORD(v733) = 180 * v2; break; | |
6117 case 2: LODWORD(v733) = 180 * v2; break; | |
6118 case 3: LODWORD(v733) = 300 * v2; break; | |
6119 case 4: LODWORD(v733) = 29030400; break; | |
6120 default: | |
6121 assert(false); | |
6122 } | |
6123 if (PID_TYPE(a2) != OBJECT_Actor) | |
6124 { | |
6125 LODWORD(v727) = 1; | |
6126 break; | |
6127 } | |
6128 pActor = &pActors[PID_ID(a2)]; | |
6129 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6130 break; | |
6131 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) ) | |
6132 { | |
6133 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6134 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6135 pCastSpell->spellnum = 0; | |
6136 continue; | |
6137 } | |
6138 pActor->pActorBuffs[9].Reset(); | |
6139 pActor->pActorBuffs[1].Reset(); | |
6140 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
993 | 6141 v731, 0, 0, 0); |
6142 pSpellSprite.stru_24.Reset(); | |
6143 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6144 pSpellSprite.spell_level = v2; | |
6145 pSpellSprite.spell_skill = v731; | |
6146 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1009 | 6147 |
6148 v600 = pActor->vPosition.y; | |
6149 v601 = pActor->vPosition.x; | |
993 | 6150 pSpellSprite.uObjectDescID = v60; |
6151 pSpellSprite.vPosition.x = v601; | |
1009 | 6152 v602 = pActor->uActorHeight; |
6153 v603 = pActor->vPosition.z; | |
993 | 6154 pSpellSprite.vPosition.y = v600; |
6155 v676 = v603 + v602; | |
6156 v665 = v600; | |
6157 pSpellSprite.vPosition.z = v603 + v602; | |
6158 v657 = v601; | |
6159 pSpellSprite.uAttributes = 0; | |
6160 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
6161 pSpellSprite.uSpriteFrameID = 0; | |
6162 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6163 pSpellSprite.spell_target_pid = a2; | |
6164 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
6165 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
6166 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
6167 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6168 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
890 | 6169 LODWORD(v727) = 1; |
6170 break; | |
6171 } | |
6172 case SPELL_DARK_SACRIFICE: | |
993 | 6173 { |
6174 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6175 break; | |
1013 | 6176 int _v733 = 0; |
993 | 6177 memset(&achieved_awards, 0, 4000); |
1013 | 6178 int i = 0; |
1009 | 6179 pNPCData = pParty->pHirelings; |
889 | 6180 do |
6181 { | |
1009 | 6182 if ( pNPCData->pName != 0) |
993 | 6183 { |
1013 | 6184 v606 = _v733++; |
6185 achieved_awards[v606] = (AwardType)(i + 1); | |
993 | 6186 } |
1013 | 6187 ++i; |
1009 | 6188 ++pNPCData; |
6189 } | |
6190 while ( pNPCData <= &pParty->pHirelings[1] ); | |
1013 | 6191 i = 0; |
993 | 6192 if ( (signed int)pNPCStats->uNumNewNPCs > 0) |
6193 { | |
1009 | 6194 pNPCData = pNPCStats->pNewNPCData; |
1120 | 6195 //__debugbreak(); // data offset |
1013 | 6196 AwardType *_v734 = &achieved_awards[_v733]; |
993 | 6197 do |
6198 { | |
1009 | 6199 if ( pNPCData->uFlags & 0x80 |
6200 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName)) | |
6201 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) ) | |
993 | 6202 { |
1013 | 6203 v607 = _v734; |
6204 ++_v734; | |
6205 *v607 = (AwardType)(i + 3); | |
993 | 6206 } |
1013 | 6207 ++i; |
1009 | 6208 ++pNPCData; |
993 | 6209 } |
1013 | 6210 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs ); |
993 | 6211 } |
6212 v608 = pCastSpell->uPlayerID_2; | |
6213 if ( v608 != 4 && v608 != 5 | |
1160 | 6214 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) |
993 | 6215 || v609 >= 3 ) |
6216 { | |
6217 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6218 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6219 pCastSpell->spellnum = 0; | |
6220 continue; | |
6221 } | |
1160 | 6222 v610 = 76 * v609; |
1120 | 6223 //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; |
6224 pParty->pHirelings[v609-1].evt_B = 0; | |
993 | 6225 v611 = pIconsFrameTable->FindIcon("spell96"); |
1009 | 6226 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); |
1120 | 6227 pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611); |
1009 | 6228 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; |
1120 | 6229 pParty->pHirelings[v609-1].evt_A = 1; |
1009 | 6230 |
993 | 6231 v612 = pParty->pPlayers; |
6232 do | |
6233 { | |
6234 v612->sHealth = v612->GetMaxHealth(); | |
6235 v612->sMana = v612->GetMaxMana(); | |
6236 ++v612; | |
6237 } | |
6238 while ( v612 <= &pParty->pPlayers[3] ); | |
6239 v613 = &pOutdoor->ddm; | |
6240 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
6241 v613 = &pIndoor->dlv; | |
6242 v613->uReputation += 15; | |
6243 if ( v613->uReputation > 10000 ) | |
6244 v613->uReputation = 10000; | |
890 | 6245 LODWORD(v727) = 1; |
6246 break; | |
6247 } | |
993 | 6248 case SPELL_DARK_PAIN_REFLECTION: |
6249 { | |
1009 | 6250 switch (v731) |
6251 { | |
6252 case 1: LODWORD(v733) = 300 * (v2 + 12); break; | |
6253 case 2: LODWORD(v733) = 300 * (v2 + 12); break; | |
6254 case 3: LODWORD(v733) = 300 * (v2 + 12); break; | |
6255 case 4: LODWORD(v733) = 900 * (v2 + 4); break; | |
6256 default: | |
6257 assert(false); | |
6258 } | |
6259 amount = v2 + 5; | |
993 | 6260 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6261 break; | |
6262 if ( v731 != 3 && v731 != 4 ) | |
6263 { | |
6264 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | |
1013 | 6265 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v716, 0); |
993 | 6266 LODWORD(v727) = 1; |
6267 break; | |
6268 } | |
6269 a2 = 0; | |
6270 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6271 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
889 | 6272 do |
6273 { | |
993 | 6274 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
6275 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
6276 ++a2; | |
6277 ++v619; | |
6278 } | |
6279 while ( v619 <= &pParty->pPlayers[3] ); | |
6280 LODWORD(v727) = 1; | |
6281 break; | |
6282 } | |
6283 case SPELL_DARK_SOULDRINKER: | |
6284 { | |
6285 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6286 break; | |
6287 pGame->GetIndoorCamera(); | |
6288 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6289 signed int _v733 = sub_46A6AC((int)dword_50BF30.data(), 100, v623); |
993 | 6290 v707.x = 0; |
6291 v707.y = 0; | |
6292 v707.z = 0; | |
6293 pSpellSprite.stru_24.Reset(); | |
6294 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6295 pSpellSprite.spell_level = v2; | |
6296 pSpellSprite.spell_skill = v731; | |
6297 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6298 pSpellSprite.uAttributes = 0; | |
6299 pSpellSprite.uSectorID = 0; | |
6300 pSpellSprite.uSpriteFrameID = 0; | |
6301 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
6302 pSpellSprite.uFacing = 0; | |
6303 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
6304 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
6305 a2 = 0; | |
6306 int _v726 = 0; | |
1013 | 6307 if ( _v733 > 0 ) |
6308 { | |
6309 _v726 = (_v733 * (7 * v2 + 25)); | |
993 | 6310 do |
6311 { | |
6312 v625 = dword_50BF30[a2]; | |
6313 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; | |
6314 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
6315 //v732 = pActors[v625].uActorHeight; | |
6316 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
6317 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6318 v627 = pSpellSprite.Create(0, 0, 0, 0); | |
6319 v628 = a2; | |
6320 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
6321 a2 = v628 + 1; | |
6322 } | |
1013 | 6323 while ( v628 + 1 < _v733 ); |
993 | 6324 } |
6325 v730 = 0; | |
6326 v629 = 1; | |
890 | 6327 do |
6328 { | |
993 | 6329 v630 = pPlayers[v629]; |
6330 if ( !v630->pConditions[2] | |
6331 && !v630->pConditions[12] | |
6332 && !v630->pConditions[13] | |
6333 && !v630->pConditions[14] | |
6334 && !v630->pConditions[15] | |
6335 && !v630->pConditions[16] ) | |
6336 { | |
6337 v631 = v730++; | |
6338 v681[v631] = v629; | |
6339 } | |
6340 ++v629; | |
6341 } | |
6342 while ( v629 <= 4 ); | |
6343 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
1013 | 6344 _v733 = 0; |
993 | 6345 if ( v730 > 0 ) |
6346 { | |
6347 do | |
6348 { | |
6349 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
1013 | 6350 v726 = pPlayers[v681[_v733]]; |
993 | 6351 //v633 = pPlayers[v681[HIDWORD(v733)]]; |
6352 v726->sHealth += v732; | |
6353 //v726 = *(Player **)v632; | |
6354 //v634 = v726->GetMaxHealth(); | |
6355 if ( v726->sHealth > v726->GetMaxHealth()) | |
6356 v726->sHealth = v726->GetMaxHealth(); | |
1013 | 6357 v635 = _v733; |
993 | 6358 |
6359 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); | |
1013 | 6360 _v733 = v635 + 1; |
1009 | 6361 } |
6362 while ( v635 + 1 < v730 ); | |
993 | 6363 } |
6364 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
890 | 6365 LODWORD(v727) = 1; |
6366 break; | |
6367 } | |
6368 case SPELL_DARK_ARMAGEDDON: | |
6369 { | |
993 | 6370 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
6371 { | |
6372 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
6373 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6374 pCastSpell->spellnum = 0; | |
6375 continue; | |
6376 } | |
1009 | 6377 if ( v731 == 4) |
6378 amount = 4; | |
6379 else | |
993 | 6380 amount = 3; |
6381 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
6382 { | |
6383 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6384 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6385 pCastSpell->spellnum = 0; | |
6386 continue; | |
6387 } | |
6388 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6389 break; | |
6390 pParty->armageddon_timer = 256; | |
6391 pParty->field_16140 = v2; | |
6392 ++pPlayer->uNumArmageddonCasts; | |
6393 if ( pParty->bTurnBasedModeOn == 1 ) | |
6394 ++pTurnEngine->field_1C; | |
6395 auto _v726 = 50; | |
6396 do | |
6397 { | |
6398 v642 = rand() % 4096 - 2048; | |
6399 v643 = rand(); | |
6400 v721 = v642 + pParty->vPosition.x; | |
6401 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
1119 | 6402 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0); |
993 | 6403 v644 = rand(); |
6404 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
6405 --_v726; | |
6406 } | |
6407 while ( _v726 != 0 ); | |
890 | 6408 LODWORD(v727) = 1; |
6409 break; | |
6410 } | |
6411 | |
6412 default: | |
993 | 6413 break; |
890 | 6414 } |
924 | 6415 if ( pCastSpell->field_8 & 0x20 ) |
890 | 6416 { |
6417 if ( v727 != 0.0 ) | |
924 | 6418 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
890 | 6419 } |
6420 else | |
6421 { | |
6422 if ( sRecoveryTime < 0 ) | |
6423 sRecoveryTime = 0; | |
6424 if ( pParty->bTurnBasedModeOn ) | |
6425 { | |
6426 v645 = sRecoveryTime; | |
924 | 6427 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
890 | 6428 pPlayer->SetRecoveryTime(v645); |
6429 if ( !some_active_character ) | |
6430 pTurnEngine->_40471C(); | |
6431 } | |
6432 else | |
6433 { | |
6434 pPlayer->SetRecoveryTime( | |
6435 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
6436 } | |
6437 if ( v727 != 0.0 ) | |
6438 { | |
6439 pPlayer->PlaySound(SPEECH_49, 0); | |
6440 if ( v727 != 0.0 ) | |
924 | 6441 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
889 | 6442 } |
6443 } | |
924 | 6444 pCastSpell->spellnum = 0; |
890 | 6445 v2 = v723; |
6446 continue; | |
0 | 6447 } |
488 | 6448 |
0 | 6449 } |
6450 //----- (0042EB42) -------------------------------------------------------- | |
6451 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | |
6452 { | |
6453 unsigned int v2; // edx@1 | |
6454 signed int v3; // eax@1 | |
6455 char *v4; // ecx@2 | |
6456 | |
6457 v2 = this->uNumObjects; | |
6458 v3 = 0; | |
6459 if ( (signed int)this->uNumObjects <= 0 ) | |
6460 { | |
6461 LABEL_5: | |
6462 LOWORD(v3) = 0; | |
6463 } | |
6464 else | |
6465 { | |
6466 v4 = (char *)&this->pObjects->uObjectID; | |
6467 while ( uItemID != *(short *)v4 ) | |
6468 { | |
6469 ++v3; | |
6470 v4 += 56; | |
6471 if ( v3 >= (signed int)v2 ) | |
6472 goto LABEL_5; | |
6473 } | |
6474 } | |
6475 return v3; | |
6476 } | |
6477 | |
6478 //----- (0042EB78) -------------------------------------------------------- | |
6479 int IconFrameTable::GetIconAnimLength(unsigned int uIconID) | |
6480 { | |
6481 return 8 * this->pIcons[uIconID].uAnimLength; | |
6482 } | |
6483 | |
437 | 6484 const wchar_t *UIMessage2String(UIMessageType msg) |
6485 { | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
6486 #define CASE(xxx) case xxx: swprintf(b, wcslen(L"%03X/%s"), L"%03X/%s", msg, L#xxx); return b; |
437 | 6487 static wchar_t b[256]; // bad for threads |
6488 switch (msg) | |
6489 { | |
6490 CASE(UIMSG_SelectSpell) | |
6491 CASE(UIMSG_ChangeGameState) | |
6492 CASE(UIMSG_Attack) | |
6493 CASE(UIMSG_PlayArcomage) | |
6494 CASE(UIMSG_MainMenu_ShowPartyCreationWnd) | |
6495 CASE(UIMSG_MainMenu_ShowLoadWindow) | |
6496 CASE(UIMSG_ShowCredits) | |
6497 CASE(UIMSG_ExitToWindows) | |
6498 CASE(UIMSG_PlayerCreationChangeName) | |
6499 CASE(UIMSG_PlayerCreationClickPlus) | |
6500 CASE(UIMSG_PlayerCreationClickMinus) | |
6501 CASE(UIMSG_PlayerCreationSelectActiveSkill) | |
6502 CASE(UIMSG_PlayerCreationSelectClass) | |
6503 CASE(UIMSG_PlayerCreationClickOK) | |
6504 CASE(UIMSG_PlayerCreationClickReset) | |
996 | 6505 CASE(UIMSG_ClickBooksBtn) |
437 | 6506 CASE(UIMSG_PlayerCreationRemoveUpSkill) |
6507 CASE(UIMSG_PlayerCreationRemoveDownSkill) | |
6508 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) | |
6509 CASE(UIMSG_LoadGame) | |
6510 CASE(UIMSG_SaveGame) | |
6511 CASE(UIMSG_ShowStatus_DateTime) | |
6512 CASE(UIMSG_ShowStatus_ManaHP) | |
6513 CASE(UIMSG_ShowStatus_Player) | |
6514 CASE(UIMSG_Wait5Minutes) | |
6515 CASE(UIMSG_Wait1Hour) | |
6516 CASE(UIMSG_ShowStatus_Food) | |
6517 CASE(UIMSG_ShowStatus_Funds) | |
6518 CASE(UIMSG_QuickReference) | |
6519 CASE(UIMSG_GameMenuButton) | |
6520 CASE(UIMSG_AlreadyResting) | |
6521 CASE(UIMSG_SelectCharacter) | |
6522 CASE(UIMSG_ChangeSoundVolume) | |
6523 CASE(UIMSG_ChangeMusicVolume) | |
6524 CASE(UIMSG_Escape) | |
6525 CASE(UIMSG_PlayerCreation_SelectAttribute) | |
6526 CASE(UIMSG_InventoryLeftClick) | |
6527 CASE(UIMSG_SkillUp) | |
6528 CASE(UIMSG_GameMenu_ReturnToGame) | |
6529 CASE(UIMSG_StartNewGame) | |
6530 CASE(UIMSG_Game_OpenLoadGameDialog) | |
6531 CASE(UIMSG_Game_OpenSaveGameDialog) | |
6532 CASE(UIMSG_Game_OpenOptionsDialog) | |
6533 CASE(UIMSG_SetGraphicsMode) | |
6534 CASE(UIMSG_Quit) | |
6535 CASE(UIMSG_StartHireling1Dialogue) | |
6536 CASE(UIMSG_StartHireling2Dialogue) | |
651 | 6537 CASE(UIMSG_SelectNPCDialogueOption) |
437 | 6538 CASE(UIMSG_CastSpellFromBook) |
6539 CASE(UIMSG_PlayerCreation_VoicePrev) | |
6540 CASE(UIMSG_PlayerCreation_VoiceNext) | |
6541 CASE(UIMSG_StartNPCDialogue) | |
6542 CASE(UIMSG_ArrowUp) | |
6543 CASE(UIMSG_DownArrow) | |
961 | 6544 CASE(UIMSG_SaveLoadBtn) |
437 | 6545 CASE(UIMSG_SelectLoadSlot) |
6546 CASE(UIMSG_Cancel) | |
6547 CASE(UIMSG_ExitRest) | |
6548 CASE(UIMSG_PlayerCreation_FacePrev) | |
6549 CASE(UIMSG_PlayerCreation_FaceNext) | |
6550 CASE(UIMSG_CycleCharacters) | |
6551 CASE(UIMSG_SetTurnSpeed) | |
6552 CASE(UIMSG_ToggleWalkSound) | |
6553 CASE(UIMSG_ChangeVoiceVolume) | |
6554 CASE(UIMSG_ToggleShowDamage) | |
6555 CASE(UIMSG_ScrollNPCPanel) | |
6556 CASE(UIMSG_ShowFinalWindow) | |
6557 CASE(UIMSG_OpenQuestBook) | |
6558 CASE(UIMSG_OpenAutonotes) | |
6559 CASE(UIMSG_OpenMapBook) | |
6560 CASE(UIMSG_OpenCalendar) | |
6561 CASE(UIMSG_OpenHistoryBook) | |
6562 CASE(UIMSG_ToggleAlwaysRun) | |
6563 CASE(UIMSG_ToggleFlipOnExit) | |
6564 CASE(UIMSG_Game_Action) | |
907 | 6565 CASE(UIMSG_RentRoom) |
437 | 6566 CASE(UIMSG_TransitionUI_Confirm) |
6567 CASE(UIMSG_OpenKeyMappingOptions) | |
6568 CASE(UIMSG_SelectKeyPage1) | |
6569 CASE(UIMSG_SelectKeyPage2) | |
6570 CASE(UIMSG_ResetKeyMapping) | |
6571 CASE(UIMSG_ChangeKeyButton) | |
6572 CASE(UIMSG_OpenVideoOptions) | |
6573 CASE(UIMSG_ToggleBloodsplats) | |
6574 CASE(UIMSG_ToggleColoredLights) | |
6575 CASE(UIMSG_ToggleTint) | |
6576 default: | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
6577 swprintf(b, wcslen(L"UIMSG_%03X") , L"UIMSG_%03X", msg); return b; |
437 | 6578 }; |
6579 #undef CASE | |
6580 } | |
6581 | |
0 | 6582 //----- (0042EB8D) -------------------------------------------------------- |
437 | 6583 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) |
0 | 6584 { |
482 | 6585 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); |
0 | 6586 if (uNumMessages < 40) |
6587 { | |
437 | 6588 files[uNumMessages] = file; |
6589 lines[uNumMessages] = line; | |
6590 | |
0 | 6591 pMessages[uNumMessages].eType = msg; |
6592 pMessages[uNumMessages].param = param; | |
6593 pMessages[uNumMessages++].field_8 = a4; | |
6594 } | |
6595 } | |
6596 | |
6597 //----- (0042EBBE) -------------------------------------------------------- | |
6598 int __fastcall sub_42EBBE(int a1, int a2) | |
6599 { | |
6600 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16; | |
6601 } | |
6602 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); | |
6603 | |
6604 //----- (0042EBDB) -------------------------------------------------------- | |
323 | 6605 int stru193_math::Sin(int angle) |
0 | 6606 { |
323 | 6607 return Cos(angle - this->uIntegerHalfPi); |
0 | 6608 } |
6609 | |
6610 //----- (0042ECB5) -------------------------------------------------------- | |
271 | 6611 void _42ECB5_PlayerAttacksActor() |
0 | 6612 { |
271 | 6613 //unsigned int v0; // ebx@1 |
6614 //Player *v1; // esi@1 | |
6615 //bool result; // eax@1 | |
295 | 6616 //int v3; // edi@2 |
271 | 6617 //unsigned int v4; // eax@7 |
0 | 6618 char *v5; // eax@8 |
271 | 6619 //int v6; // ecx@9 |
6620 //signed int v7; // eax@16 | |
295 | 6621 //Actor *v8; // edi@20 |
0 | 6622 unsigned int v9; // ecx@21 |
295 | 6623 //char *v10; // eax@26 |
0 | 6624 char *v11; // eax@26 |
6625 unsigned int v12; // eax@47 | |
295 | 6626 //char *v13; // eax@47 |
6627 //char *v14; // eax@47 | |
6628 //unsigned int v15; // ebx@54 | |
6629 //int v16; // [sp-10h] [bp-4Ch]@24 | |
6630 //int v17; // [sp-10h] [bp-4Ch]@44 | |
6631 //unsigned int v18; // [sp-Ch] [bp-48h]@24 | |
6632 //unsigned int v19; // [sp-Ch] [bp-48h]@44 | |
6633 //__int16 v20; // [sp-8h] [bp-44h]@24 | |
6634 //__int16 v21; // [sp-8h] [bp-44h]@44 | |
6635 //int v22; // [sp-4h] [bp-40h]@24 | |
6636 //int v23; // [sp-4h] [bp-40h]@44 | |
0 | 6637 SoundID v24; // [sp-4h] [bp-40h]@58 |
295 | 6638 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 |
271 | 6639 //unsigned int a2; // [sp+18h] [bp-24h]@20 |
6640 //unsigned int v27; // [sp+1Ch] [bp-20h]@1 | |
295 | 6641 //int v28; // [sp+20h] [bp-1Ch]@9 |
271 | 6642 //unsigned int *v28b; |
295 | 6643 //int v29; // [sp+24h] [bp-18h]@16 |
6644 //int v30; // [sp+28h] [bp-14h]@16 | |
271 | 6645 //int v31; // [sp+2Ch] [bp-10h]@4 |
295 | 6646 //int v32; // [sp+30h] [bp-Ch]@7 |
271 | 6647 //int v33; // [sp+34h] [bp-8h]@7 |
295 | 6648 //int v34; // [sp+38h] [bp-4h]@17 |
0 | 6649 |
271 | 6650 //v0 = uActiveCharacter; |
6651 //v27 = 6972 * uActiveCharacter; | |
6652 //v1 = &pParty->pPlayers[uActiveCharacter-1]; | |
6653 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | |
6654 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | |
6655 if (!player->CanAct()) | |
6656 return; | |
6657 | |
1202 | 6658 pCastSpellInfo.data()->_427D48(uActiveCharacter); |
295 | 6659 //v3 = 0; |
271 | 6660 if (pParty->Invisible()) |
6661 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
6662 | |
6663 //v31 = player->pEquipment.uBow; | |
6664 int bow_idx = player->pEquipment.uBow; | |
6665 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) | |
6666 bow_idx = 0; | |
6667 | |
295 | 6668 //v32 = 0; |
6669 int wand_item_id = 0; | |
271 | 6670 //v33 = 0; |
6671 //v4 = v1->pEquipment.uMainHand; | |
6672 int laser_weapon_item_id = 0; | |
6673 | |
6674 int main_hand_idx = player->pEquipment.uMainHand; | |
6675 if (main_hand_idx) | |
0 | 6676 { |
271 | 6677 auto item = &player->pInventoryItems[main_hand_idx - 1]; |
112 | 6678 //v5 = (char *)v1 + 36 * v4; |
271 | 6679 if (!item->Broken()) |
6680 { | |
6681 //v28b = &v1->pInventoryItems[v4].uItemID; | |
6682 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); | |
295 | 6683 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) |
0 | 6684 { |
295 | 6685 if (item->uNumCharges <= 0) |
6686 player->pEquipment.uMainHand = 0; // wand discharged - unequip | |
0 | 6687 else |
295 | 6688 wand_item_id = item->uItemID;//*((int *)v5 + 124); |
0 | 6689 } |
271 | 6690 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) |
6691 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); | |
0 | 6692 } |
271 | 6693 } |
6694 | |
295 | 6695 //v30 = 0; |
6696 //v29 = 0; | |
6697 //v28 = 0; | |
271 | 6698 //v7 = pMouse->uPointingObjectID; |
6699 | |
6700 int target_pid = pMouse->uPointingObjectID; | |
848 | 6701 int target_type = PID_TYPE(target_pid), |
6702 target_id = PID_ID(target_pid); | |
271 | 6703 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) |
6704 { | |
6705 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); | |
848 | 6706 target_type = PID_TYPE(target_pid); |
6707 target_id = PID_ID(target_pid); | |
271 | 6708 } |
295 | 6709 |
6710 auto actor = &pActors[target_id]; | |
6711 int actor_distance = 0; | |
271 | 6712 if (target_type == OBJECT_Actor) |
6713 { | |
295 | 6714 int distance_x = actor->vPosition.x - pParty->vPosition.x, |
6715 distance_y = actor->vPosition.y - pParty->vPosition.y, | |
6716 distance_z = actor->vPosition.z - pParty->vPosition.z; | |
6717 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; | |
6718 if (actor_distance < 0) | |
6719 actor_distance = 0; | |
6720 } | |
6721 | |
6722 bool shooting_bow = false, | |
6723 shotting_laser = false, | |
816 | 6724 shooting_wand = false, |
6725 melee_attack = false; | |
295 | 6726 if (laser_weapon_item_id) |
6727 { | |
6728 shotting_laser = true; | |
490 | 6729 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); |
295 | 6730 } |
6731 else if (wand_item_id) | |
6732 { | |
6733 shooting_wand = true; | |
6734 | |
6735 int main_hand_idx = player->pEquipment.uMainHand; | |
490 | 6736 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); |
295 | 6737 |
6738 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) | |
6739 player->pEquipment.uMainHand = 0; | |
6740 } | |
303 | 6741 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) |
295 | 6742 { |
816 | 6743 melee_attack = true; |
6744 | |
303 | 6745 Vec3_int_ a3; |
6746 a3.x = actor->vPosition.x - pParty->vPosition.x; | |
6747 a3.y = actor->vPosition.y - pParty->vPosition.y; | |
6748 a3.z = actor->vPosition.z - pParty->vPosition.z; | |
6749 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); | |
6750 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6751 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); |
1080 | 6752 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) |
295 | 6753 _42FA66_do_explosive_impact( |
6754 actor->vPosition.x, | |
6755 actor->vPosition.y, | |
6756 actor->vPosition.z + actor->uActorHeight / 2, | |
6757 0, 512, uActiveCharacter); | |
303 | 6758 } |
6759 else if (bow_idx) | |
6760 { | |
6761 shooting_bow = true; | |
490 | 6762 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); |
295 | 6763 } |
6764 else | |
6765 { | |
816 | 6766 melee_attack = true; |
303 | 6767 ; // actor out of range or no actor; no ranged weapon so melee attacking air |
6768 } | |
6769 | |
816 | 6770 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect |
303 | 6771 { |
816 | 6772 int recovery = player->GetAttackRecoveryTime(false); |
303 | 6773 if (recovery < 30 ) |
6774 recovery = 30; | |
816 | 6775 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); |
295 | 6776 } |
6777 | |
6778 | |
6779 int v34 = 0; | |
6780 if (shooting_wand) | |
6781 return; | |
6782 else if (shooting_bow) | |
6783 { | |
6784 v34 = 5; | |
6785 player->PlaySound(SPEECH_50, 0); | |
6786 } | |
6787 if (shotting_laser) | |
6788 v34 = 7; | |
6789 else | |
6790 { | |
6791 int main_hand_idx = player->pEquipment.uMainHand; | |
816 | 6792 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) |
295 | 6793 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; |
6794 pTurnEngine->_40471C(); | |
6795 } | |
6796 | |
6797 switch (v34) | |
6798 { | |
6799 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; | |
6800 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; | |
6801 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; | |
6802 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; | |
6803 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; | |
6804 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; | |
6805 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; | |
6806 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; | |
6807 } | |
0 | 6808 } |
6809 | |
6810 //----- (0042F184) -------------------------------------------------------- | |
295 | 6811 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 6812 { |
6813 int v4; // edi@1 | |
6814 stru319 *v5; // esi@1 | |
6815 int v6; // eax@2 | |
6816 int v7; // eax@4 | |
6817 int result; // eax@5 | |
6818 int *v9; // edx@8 | |
6819 signed int v10; // ebx@10 | |
6820 int v11; // edi@11 | |
6821 Actor *v12; // esi@12 | |
6822 unsigned __int16 v13; // ax@12 | |
6823 int v14; // eax@22 | |
6824 char v15; // zf@30 | |
6825 int v16; // esi@32 | |
6826 int v17; // ecx@34 | |
6827 stru319 *v18; // eax@39 | |
6828 int v19; // edx@39 | |
6829 int v20; // ecx@41 | |
6830 unsigned __int16 v21; // ax@42 | |
6831 unsigned int v22; // [sp+8h] [bp-24h]@11 | |
6832 unsigned int v23; // [sp+Ch] [bp-20h]@7 | |
6833 stru319 *v24; // [sp+10h] [bp-1Ch]@1 | |
6834 unsigned int v25; // [sp+14h] [bp-18h]@8 | |
6835 int *v26; // [sp+18h] [bp-14h]@8 | |
6836 int v27; // [sp+1Ch] [bp-10h]@10 | |
6837 int *v28; // [sp+20h] [bp-Ch]@10 | |
6838 unsigned int v29; // [sp+24h] [bp-8h]@7 | |
6839 int v30; // [sp+28h] [bp-4h]@6 | |
6840 int i; // [sp+38h] [bp+Ch]@33 | |
6841 signed int v32; // [sp+3Ch] [bp+10h]@32 | |
6842 | |
6843 v4 = 0; | |
6844 v5 = this; | |
6845 v24 = this; | |
6846 if ( pRenderer->pRenderD3D ) | |
6847 { | |
6848 v6 = a3 != 0; | |
6849 if ( a4 ) | |
6850 LOBYTE(v6) = v6 | 8; | |
295 | 6851 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 6852 if ( v7 != -1 ) |
6853 return (unsigned __int16)v7; | |
295 | 6854 else return 0; |
0 | 6855 } |
6856 else | |
6857 { | |
6858 v30 = 0; | |
6859 if ( pRenderer->pActiveZBuffer ) | |
6860 { | |
692 | 6861 v29 = viewparams->uScreen_topL_X; |
6862 v23 = viewparams->uScreen_BttmR_X; | |
6863 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
0 | 6864 { |
692 | 6865 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; |
6866 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
6867 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
0 | 6868 do |
6869 { | |
6870 if ( (signed int)v29 < (signed int)v23 ) | |
6871 { | |
6872 v28 = v9; | |
6873 v10 = v4; | |
6874 v27 = v23 - v29; | |
6875 do | |
6876 { | |
6877 v22 = *v28; | |
6878 v11 = *v28 & 0xFFFF; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6879 if (PID_TYPE(v11) == OBJECT_Actor) |
0 | 6880 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6881 v12 = &pActors[PID_ID(v11)]; |
0 | 6882 v13 = v12->uAIState; |
6883 if ( v13 != 5 ) | |
6884 { | |
6885 if ( v13 != 4 | |
6886 && v13 != 11 | |
6887 && v13 != 19 | |
6888 && v13 != 17 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6889 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) ) |
0 | 6890 { |
6891 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) | |
295 | 6892 && v22 <= pick_depth << 16 ) |
0 | 6893 { |
6894 v14 = 0; | |
6895 if ( v10 > 0 ) | |
6896 { | |
6897 do | |
6898 { | |
6899 if ( dword_50BDA0[v14] == v11 ) | |
6900 break; | |
6901 ++v14; | |
6902 } | |
6903 while ( v14 < v30 ); | |
6904 } | |
6905 if ( v14 == v30 && v10 < 100 ) | |
6906 { | |
6907 ++v30; | |
6908 dword_50BC10[v10] = v22; | |
6909 dword_50BDA0[v10] = v11; | |
6910 ++v10; | |
6911 } | |
6912 } | |
6913 } | |
6914 } | |
6915 } | |
6916 ++v28; | |
6917 --v27; | |
6918 } | |
6919 while ( v27 ); | |
6920 v4 = v30; | |
6921 v5 = v24; | |
6922 } | |
6923 v9 = v26 + 640; | |
6924 v15 = v25-- == 1; | |
6925 v26 += 640; | |
6926 } | |
6927 while ( !v15 ); | |
6928 } | |
6929 if ( v4 > 0 ) | |
6930 { | |
6931 v32 = 1; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6932 v16 = (int)dword_50BC10.data(); |
0 | 6933 do |
6934 { | |
6935 for ( i = v32; i < v4; ++i ) | |
6936 { | |
6937 v17 = dword_50BC10[i]; | |
6938 if ( v17 < *(int *)v16 ) | |
6939 { | |
6940 dword_50BC10[i] = *(int *)v16; | |
6941 *(int *)v16 = v17; | |
6942 } | |
6943 } | |
6944 ++v32; | |
6945 v16 += 4; | |
6946 } | |
6947 while ( v32 - 1 < v4 ); | |
6948 v5 = v24; | |
6949 if ( v4 > 0 ) | |
6950 { | |
6951 v18 = v24; | |
6952 v19 = v4; | |
6953 do | |
6954 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6955 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF; |
0 | 6956 v18 += 4; |
6957 --v19; | |
6958 } | |
6959 while ( v19 ); | |
6960 } | |
6961 } | |
6962 v20 = 0; | |
6963 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
6964 { | |
6965 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
6966 if ( v21 != 4 && v21 != 5 ) | |
6967 break; | |
6968 } | |
6969 if ( v20 != v4 ) | |
6970 { | |
6971 result = 8 * *(int *)&v5[4 * v20].field_0; | |
6972 LOBYTE(result) = result | 3; | |
6973 return result; | |
6974 } | |
6975 } | |
6976 } | |
6977 return 0; | |
6978 } | |
6979 | |
6980 //----- (0042F3D6) -------------------------------------------------------- | |
6981 void InitializeTurnBasedAnimations(void *_this) | |
6982 { | |
6983 unsigned int *v1; // edi@1 | |
6984 | |
6985 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0"); | |
6986 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1"); | |
6987 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2"); | |
6988 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3"); | |
6989 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4"); | |
6990 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); | |
6991 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); | |
6992 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); | |
6993 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); | |
6994 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6995 v1 = pIconIDs_Turn.data(); |
0 | 6996 do |
6997 { | |
6998 pIconsFrameTable->InitializeAnimation(*v1); | |
6999 ++v1; | |
7000 } | |
7001 while ( (signed int)v1 < (signed int)&uIconID_TurnStop ); | |
7002 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); | |
7003 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); | |
7004 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); | |
7005 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); | |
7006 } | |
7007 | |
7008 //----- (0042F4DA) -------------------------------------------------------- | |
7009 signed int __cdecl sub_42F4DA() | |
7010 { | |
7011 signed int v0; // edi@1 | |
82 | 7012 Actor *v1; // esi@4 |
0 | 7013 int v2; // ebx@5 |
7014 int v3; // eax@5 | |
7015 int v4; // ebx@5 | |
7016 unsigned int v5; // ecx@5 | |
7017 int v6; // edx@6 | |
7018 unsigned int v7; // edx@8 | |
7019 unsigned int v8; // edx@10 | |
7020 __int16 v9; // ax@12 | |
7021 signed int result; // eax@20 | |
7022 int v11; // [sp+Ch] [bp-10h]@5 | |
7023 int v12; // [sp+10h] [bp-Ch]@5 | |
7024 signed int v13; // [sp+14h] [bp-8h]@3 | |
7025 | |
7026 v0 = 5120; | |
7027 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7028 v0 = 2560; | |
7029 v13 = 0; | |
7030 if ( (signed int)uNumActors <= 0 ) | |
7031 { | |
7032 LABEL_20: | |
7033 result = 0; | |
7034 } | |
7035 else | |
7036 { | |
1202 | 7037 v1 = pActors.data(); |
0 | 7038 while ( 1 ) |
7039 { | |
82 | 7040 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); |
7041 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); | |
7042 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); | |
0 | 7043 v3 = v2; |
7044 v4 = v11; | |
7045 v5 = v12; | |
7046 if ( v3 < v11 ) | |
7047 { | |
7048 v6 = v3; | |
7049 v3 = v11; | |
7050 v4 = v6; | |
7051 } | |
7052 if ( v3 < v12 ) | |
7053 { | |
7054 v7 = v3; | |
7055 v3 = v12; | |
7056 v5 = v7; | |
7057 } | |
7058 if ( v4 < (signed int)v5 ) | |
7059 { | |
7060 v8 = v5; | |
7061 v5 = v4; | |
7062 v4 = v8; | |
7063 } | |
7064 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) | |
7065 { | |
82 | 7066 v9 = v1->uAIState; |
7067 if ( v1->uAIState != 5 ) | |
0 | 7068 { |
7069 if ( v9 != 4 | |
7070 && v9 != 11 | |
7071 && v9 != 19 | |
7072 && v9 != 17 | |
82 | 7073 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) |
0 | 7074 break; |
7075 } | |
7076 } | |
7077 ++v13; | |
82 | 7078 ++v1; |
0 | 7079 if ( v13 >= (signed int)uNumActors ) |
7080 goto LABEL_20; | |
7081 } | |
7082 result = 1; | |
7083 } | |
7084 return result; | |
7085 } | |
7086 | |
7087 //----- (0042F7EB) -------------------------------------------------------- | |
7088 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) | |
7089 { | |
7090 unsigned int v9; // edi@1 | |
7091 signed int v10; // edx@3 | |
7092 char *v11; // ecx@4 | |
7093 unsigned __int16 v12; // ax@7 | |
7094 unsigned int v13; // edx@9 | |
7095 char *v14; // ecx@10 | |
7096 int v15; // esi@17 | |
7097 int v16; // eax@18 | |
7098 int v17; // edi@20 | |
7099 int v18; // esi@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7100 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 |
0 | 7101 int v21; // [sp+7Ch] [bp-8h]@1 |
7102 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
7103 | |
7104 v9 = uSpriteID; | |
7105 v21 = x; | |
7106 v22 = uSpriteID; | |
7107 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7108 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
|
7109 //SpriteObject::SpriteObject(&a1a); |
0 | 7110 a1a.stru_24.Reset(); |
7111 | |
7112 if ( a9 ) | |
7113 { | |
7114 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | |
7115 v9 = v22; | |
7116 } | |
7117 v10 = 0; | |
822 | 7118 a1a.spell_skill = 0; |
7119 a1a.spell_level = 0; | |
7120 a1a.spell_id = 0; | |
0 | 7121 a1a.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7122 a1a.uType = v9; |
0 | 7123 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7124 { | |
7125 LABEL_7: | |
7126 v12 = 0; | |
7127 } | |
7128 else | |
7129 { | |
7130 v11 = (char *)&pObjectList->pObjects->uObjectID; | |
7131 while ( (short)v9 != *(short *)v11 ) | |
7132 { | |
7133 ++v10; | |
7134 v11 += 56; | |
7135 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
7136 goto LABEL_7; | |
7137 } | |
7138 v12 = v10; | |
7139 } | |
7140 a1a.uObjectDescID = v12; | |
7141 a1a.vPosition.z = z; | |
7142 a1a.vPosition.x = v21; | |
7143 a1a.vPosition.y = y; | |
7144 a1a.uSoundID = 0; | |
7145 a1a.uAttributes = attributes; | |
7146 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | |
7147 a1a.uSpriteFrameID = 0; | |
822 | 7148 a1a.spell_caster_pid = 0; |
823 | 7149 a1a.spell_target_pid = 0; |
0 | 7150 if ( !(a1a.uAttributes & 0x10) ) |
7151 { | |
7152 v13 = 0; | |
222 | 7153 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) |
0 | 7154 { |
7155 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | |
7156 while ( *(short *)v14 != v9 ) | |
7157 { | |
7158 ++v13; | |
7159 v14 += 48; | |
222 | 7160 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) |
0 | 7161 goto LABEL_16; |
7162 } | |
7163 a1a.stru_24.uItemID = v13; | |
7164 } | |
7165 } | |
7166 LABEL_16: | |
7167 if ( a7 ) | |
7168 { | |
7169 v15 = count; | |
7170 if ( count > 0 ) | |
7171 { | |
7172 do | |
7173 { | |
7174 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
7175 v16 = rand(); | |
7176 a1a.Create( | |
7177 (signed __int16)a1a.uFacing, | |
7178 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | |
7179 a4, | |
7180 0); | |
7181 --v15; | |
7182 } | |
7183 while ( v15 ); | |
7184 } | |
7185 } | |
7186 else | |
7187 { | |
7188 v17 = count; | |
7189 v18 = stru_5C6E00->uIntegerHalfPi; | |
7190 a1a.uFacing = 0; | |
7191 if ( count > 0 ) | |
7192 { | |
7193 do | |
7194 { | |
7195 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | |
7196 --v17; | |
7197 } | |
7198 while ( v17 ); | |
7199 } | |
7200 } | |
7201 return 1; | |
7202 } | |
7203 | |
7204 //----- (0042F960) -------------------------------------------------------- | |
7205 void __fastcall sub_42F960_create_object(int x, int y, int z) | |
7206 { | |
7207 int v3; // ebx@1 | |
7208 int v4; // edi@1 | |
7209 signed int v5; // edx@1 | |
7210 char *v6; // ecx@2 | |
7211 unsigned __int16 v7; // ax@5 | |
7212 signed int v8; // eax@6 | |
7213 signed int v9; // eax@7 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7214 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 |
0 | 7215 |
7216 v3 = x; | |
7217 v4 = y; | |
7218 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7219 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
|
7220 //SpriteObject::SpriteObject(&a1); |
0 | 7221 a1.stru_24.Reset(); |
7222 | |
7223 v5 = 0; | |
822 | 7224 a1.spell_skill = 0; |
7225 a1.spell_level = 0; | |
7226 a1.spell_id = 0; | |
0 | 7227 a1.field_54 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7228 a1.uType = 800; |
0 | 7229 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
7230 { | |
7231 LABEL_5: | |
7232 v7 = 0; | |
7233 } | |
7234 else | |
7235 { | |
7236 v6 = (char *)&pObjectList->pObjects->uObjectID; | |
7237 while ( *(short *)v6 != 800 ) | |
7238 { | |
7239 ++v5; | |
7240 v6 += 56; | |
7241 if ( v5 >= (signed int)pObjectList->uNumObjects ) | |
7242 goto LABEL_5; | |
7243 } | |
7244 v7 = v5; | |
7245 } | |
7246 a1.uObjectDescID = v7; | |
7247 a1.vPosition.x = v3; | |
7248 a1.vPosition.y = v4; | |
7249 a1.vPosition.z = z; | |
7250 a1.uSoundID = 0; | |
7251 a1.uAttributes = 0; | |
7252 a1.uSectorID = pIndoor->GetSector(v3, v4, z); | |
7253 a1.uSpriteFrameID = 0; | |
822 | 7254 a1.spell_caster_pid = 0; |
823 | 7255 a1.spell_target_pid = 0; |
0 | 7256 v8 = a1.Create(0, 0, 0, 0); |
7257 if ( v8 != -1 ) | |
7258 { | |
7259 v9 = 8 * v8; | |
7260 LOBYTE(v9) = v9 | 2; | |
7261 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); | |
7262 } | |
7263 } | |
7264 | |
810 | 7265 |
0 | 7266 |
7267 //----- (0042FA66) -------------------------------------------------------- | |
7268 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) | |
7269 { | |
7270 int v6; // edi@1 | |
7271 int v7; // esi@1 | |
7272 char *v8; // ecx@2 | |
7273 unsigned __int16 v9; // ax@5 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7274 //int v10; // eax@10 |
0 | 7275 signed int result; // eax@11 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7276 //__int16 v12; // ax@12 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7277 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 |
0 | 7278 int v14; // [sp+7Ch] [bp-4h]@1 |
7279 | |
7280 v6 = a1; | |
7281 v7 = a2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7282 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
|
7283 //SpriteObject::SpriteObject(&a1a); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7284 a1a.uType = 600; |
0 | 7285 a1a.stru_24.Reset(); |
7286 | |
822 | 7287 a1a.spell_id = SPELL_FIRE_FIREBALL; |
7288 a1a.spell_level = 8; | |
7289 a1a.spell_skill = 3; | |
0 | 7290 v14 = 0; |
7291 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
7292 { | |
7293 LABEL_5: | |
7294 v9 = 0; | |
7295 } | |
7296 else | |
7297 { | |
7298 v8 = (char *)&pObjectList->pObjects->uObjectID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
490
diff
changeset
|
7299 while ( (short)a1a.uType != *(short *)v8 ) |
0 | 7300 { |
7301 ++v14; | |
7302 v8 += 56; | |
7303 if ( v14 >= (signed int)pObjectList->uNumObjects ) | |
7304 goto LABEL_5; | |
7305 } | |
7306 v9 = v14; | |
7307 } | |
7308 a1a.uObjectDescID = v9; | |
7309 a1a.vPosition.x = v6; | |
7310 a1a.vPosition.y = v7; | |
7311 a1a.vPosition.z = a3; | |
7312 a1a.uAttributes = 0; | |
7313 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); | |
7314 a1a.uSpriteFrameID = 0; | |
823 | 7315 a1a.spell_target_pid = 0; |
0 | 7316 a1a.field_60_distance_related_prolly_lod = 0; |
7317 a1a.uFacing = 0; | |
7318 a1a.uSoundID = 0; | |
7319 if ( a6 >= 1 || a6 <= 4 ) | |
7320 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7321 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); |
0 | 7322 } |
7323 else | |
7324 { | |
822 | 7325 a1a.spell_caster_pid = 0; |
0 | 7326 } |
7327 result = a1a.Create(0, 0, 0, 0); | |
7328 if ( result != -1 ) | |
7329 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7330 result = stru_50FE08.Add(PID(OBJECT_Item, result), |
0 | 7331 a5, |
7332 SLOWORD(a1a.vPosition.x), | |
7333 SLOWORD(a1a.vPosition.y), | |
7334 SLOWORD(a1a.vPosition.z), | |
7335 0, | |
7336 0); | |
7337 } | |
7338 return result; | |
7339 } | |
7340 | |
7341 //----- (0042FB5C) -------------------------------------------------------- | |
7342 bool __fastcall sub_42FB5C(signed int a1) | |
7343 { | |
7344 int v1; // ecx@3 | |
7345 int v2; // ecx@4 | |
7346 int v3; // ecx@5 | |
7347 int v4; // ecx@6 | |
7348 int v5; // ecx@7 | |
7349 int v6; // ecx@8 | |
7350 char v7; // zf@9 | |
7351 | |
7352 if ( a1 > 39 ) | |
7353 { | |
7354 if ( a1 > 77 ) | |
7355 { | |
7356 if ( a1 == 80 ) | |
7357 return 0; | |
7358 if ( a1 > 84 ) | |
7359 { | |
7360 if ( a1 <= 86 ) | |
7361 return 0; | |
7362 v7 = a1 == 95; | |
7363 goto LABEL_20; | |
7364 } | |
7365 } | |
7366 else | |
7367 { | |
7368 if ( a1 == 77 ) | |
7369 return 0; | |
7370 if ( a1 >= 46 ) | |
7371 { | |
7372 if ( a1 <= 47 || a1 == 51 ) | |
7373 return 0; | |
7374 v7 = a1 == 73; | |
7375 goto LABEL_20; | |
7376 } | |
7377 } | |
7378 return 1; | |
7379 } | |
7380 if ( a1 == 39 || (v1 = a1 - 2) == 0 ) | |
7381 return 1; | |
7382 v2 = v1 - 3; | |
7383 if ( !v2 ) | |
7384 return 0; | |
7385 v3 = v2 - 1; | |
7386 if ( !v3 || (v4 = v3 - 3) == 0 ) | |
7387 return 1; | |
7388 v5 = v4 - 8; | |
7389 if ( !v5 ) | |
7390 return 0; | |
7391 v6 = v5 - 1; | |
7392 if ( !v6 ) | |
7393 return 1; | |
7394 v7 = v6 == 20; | |
7395 LABEL_20: | |
7396 if ( !v7 ) | |
7397 return 1; | |
7398 return 0; | |
7399 } | |
7400 | |
7401 //----- (0042FBDD) -------------------------------------------------------- | |
7402 void __cdecl sub_42FBDD() | |
7403 { | |
388 | 7404 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); |
0 | 7405 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); |
7406 pRenderer->Present(); | |
7407 } | |
7408 | |
7409 //----- (0042FC15) -------------------------------------------------------- | |
11 | 7410 void __cdecl CloseWindowBackground() |
0 | 7411 { |
388 | 7412 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); |
0 | 7413 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); |
7414 pRenderer->Present(); | |
7415 } | |
7416 | |
7417 //----- (0042FC4E) -------------------------------------------------------- | |
7418 void __cdecl ProcessInputActions() | |
7419 { | |
7420 char v4; // al@9 | |
7421 char v8; // bl@100 | |
7422 unsigned __int16 v9; // ax@102 | |
7423 int v10; // eax@103 | |
7424 char v14; // al@159 | |
7425 unsigned int v15; // eax@168 | |
7426 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 | |
7427 InputAction inputAction; // [sp+0h] [bp-8h]@7 | |
7428 int v24; // [sp+4h] [bp-4h]@87 | |
7429 | |
7430 pGame->pKeyboardInstance->EnterCriticalSection(); | |
7431 auto pKeyboard = pGame->pKeyboardInstance; | |
7432 if (!bAlwaysRun) | |
7433 { | |
7434 if (pKeyboard->IsShiftHeld()) | |
7435 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7436 else | |
7437 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7438 } | |
7439 else | |
7440 { | |
7441 if (pKeyboard->IsShiftHeld()) | |
7442 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; | |
7443 else | |
7444 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; | |
7445 } | |
7446 | |
140 | 7447 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; |
1052 | 7448 |
7449 | |
7450 // WUT? double event trigger | |
7451 /*for ( uint i = 0; i < 30; ++i ) | |
998 | 7452 { |
7453 if ( pKeyActionMap->pToggleTypes[i] ) | |
7454 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
7455 else | |
7456 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); | |
1052 | 7457 if ( v14 ) |
998 | 7458 { |
1052 | 7459 if (pCurrentScreen == SCREEN_GAME) |
998 | 7460 { |
7461 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); | |
7462 continue; | |
7463 } | |
7464 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
7465 { | |
7466 v15 = pMessageQueue_50CBD0->uNumMessages; | |
7467 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7468 { | |
7469 v15 = 0; | |
7470 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) | |
7471 { | |
7472 v15 = 1; | |
7473 pMessageQueue_50CBD0->uNumMessages = 0; | |
7474 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; | |
7475 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7476 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7477 ++pMessageQueue_50CBD0->uNumMessages; | |
7478 continue; | |
7479 } | |
7480 pMessageQueue_50CBD0->uNumMessages = 0; | |
7481 } | |
7482 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7483 } | |
7484 } | |
1052 | 7485 }*/ |
0 | 7486 if ( !pEventTimer->bPaused ) |
7487 { | |
998 | 7488 for ( uint i = 0; i < 30; ++i ) |
0 | 7489 { |
998 | 7490 inputAction = (InputAction)i; |
7491 if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) | |
7492 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); | |
0 | 7493 else |
998 | 7494 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); |
0 | 7495 if ( v4 ) |
7496 { | |
7497 switch ( inputAction ) | |
7498 { | |
7499 case INPUT_MoveForward: | |
271 | 7500 if (pCurrentScreen != SCREEN_GAME) |
0 | 7501 break; |
7502 if (!pParty->bTurnBasedModeOn) | |
7503 { | |
140 | 7504 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) |
0 | 7505 partyAction = PARTY_RunForward; |
7506 else | |
7507 partyAction = PARTY_WalkForward; | |
998 | 7508 pPartyActionQueue->Add(partyAction); |
163 | 7509 break; |
7510 } | |
7511 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) | |
7512 { | |
7513 pTurnEngine->uActionPointsLeft -= 26; | |
7514 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) | |
7515 partyAction = PARTY_RunForward; | |
7516 else | |
7517 partyAction = PARTY_WalkForward; | |
998 | 7518 pPartyActionQueue->Add(partyAction); |
163 | 7519 break; |
0 | 7520 } |
7521 break; | |
7522 case INPUT_MoveBackwards: | |
271 | 7523 if (pCurrentScreen != SCREEN_GAME) |
0 | 7524 break; |
7525 if (!pParty->bTurnBasedModeOn) | |
17 | 7526 { |
7527 if ( pParty->uFlags2 & 2 ) | |
7528 partyAction = PARTY_RunBackward; | |
7529 else | |
7530 partyAction = PARTY_WalkBackward; | |
998 | 7531 pPartyActionQueue->Add(partyAction); |
163 | 7532 break; |
17 | 7533 } |
0 | 7534 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) |
7535 { | |
7536 pTurnEngine->uActionPointsLeft -= 26; | |
7537 if ( pParty->uFlags2 & 2 ) | |
7538 partyAction = PARTY_RunBackward; | |
7539 else | |
7540 partyAction = PARTY_WalkBackward; | |
998 | 7541 pPartyActionQueue->Add(partyAction); |
163 | 7542 break; |
0 | 7543 } |
7544 break; | |
7545 case INPUT_StrafeLeft: | |
271 | 7546 if (pCurrentScreen != SCREEN_GAME) |
0 | 7547 break; |
7548 if (!pParty->bTurnBasedModeOn) | |
17 | 7549 { |
7550 partyAction = PARTY_StrafeLeft; | |
998 | 7551 pPartyActionQueue->Add(partyAction); |
163 | 7552 break; |
17 | 7553 } |
0 | 7554 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7555 break; | |
7556 pTurnEngine->uActionPointsLeft -= 26; | |
7557 partyAction = PARTY_StrafeLeft; | |
998 | 7558 pPartyActionQueue->Add(partyAction); |
7559 break; | |
0 | 7560 case INPUT_StrafeRight: |
271 | 7561 if (pCurrentScreen != SCREEN_GAME) |
0 | 7562 break; |
7563 if (!pParty->bTurnBasedModeOn) | |
17 | 7564 { |
7565 partyAction = PARTY_StrafeRight; | |
998 | 7566 pPartyActionQueue->Add(partyAction); |
163 | 7567 break; |
17 | 7568 } |
0 | 7569 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) |
7570 break; | |
7571 pTurnEngine->uActionPointsLeft -= 26; | |
7572 partyAction = PARTY_StrafeRight; | |
998 | 7573 pPartyActionQueue->Add(partyAction); |
163 | 7574 break; |
0 | 7575 case INPUT_TurnLeft: |
271 | 7576 if (pCurrentScreen != SCREEN_GAME) |
0 | 7577 break; |
7578 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing | |
7579 { | |
7580 if (pParty->bTurnBasedModeOn) | |
7581 { | |
7582 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7583 break; | |
7584 pTurnEngine->uActionPointsLeft -= 26; | |
7585 } | |
998 | 7586 partyAction = PARTY_StrafeLeft; |
0 | 7587 } |
7588 else | |
7589 { | |
7590 if ( pParty->uFlags2 & 2 ) | |
998 | 7591 partyAction = PARTY_FastTurnLeft; |
0 | 7592 else |
998 | 7593 partyAction = PARTY_TurnLeft; |
0 | 7594 } |
998 | 7595 pPartyActionQueue->Add(partyAction); |
0 | 7596 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7597 { | |
271 | 7598 pWeather->OnPlayerTurn(10); |
0 | 7599 } |
7600 break; | |
7601 case INPUT_TurnRight: | |
271 | 7602 if (pCurrentScreen != SCREEN_GAME) |
0 | 7603 break; |
7604 if ( GetAsyncKeyState(17) ) // strafing | |
7605 { | |
7606 if (pParty->bTurnBasedModeOn) | |
7607 { | |
7608 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) | |
7609 break; | |
7610 pTurnEngine->uActionPointsLeft -= 26; | |
7611 } | |
998 | 7612 partyAction = PARTY_StrafeRight; |
0 | 7613 } |
7614 else | |
7615 { | |
7616 if ( pParty->uFlags2 & 2 ) | |
998 | 7617 partyAction = PARTY_FastTurnRight; |
0 | 7618 else |
998 | 7619 partyAction = PARTY_TurnRight; |
0 | 7620 } |
998 | 7621 pPartyActionQueue->Add(partyAction); |
0 | 7622 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) |
7623 { | |
271 | 7624 pWeather->OnPlayerTurn(-10); |
0 | 7625 } |
7626 break; | |
7627 case INPUT_Jump: | |
271 | 7628 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) |
0 | 7629 break; |
7630 partyAction = (PartyAction)12; | |
998 | 7631 pPartyActionQueue->Add(partyAction); |
163 | 7632 break; |
0 | 7633 case INPUT_Yell: |
187 | 7634 if (!pCurrentScreen && uActiveCharacter) |
0 | 7635 { |
7636 pParty->Yell(); | |
187 | 7637 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); |
0 | 7638 } |
187 | 7639 break; |
0 | 7640 case INPUT_Pass: |
7641 if ( pCurrentScreen ) | |
7642 break; | |
7643 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7644 { |
7645 pTurnEngine->field_18 |= 8u; | |
7646 break; | |
7647 } | |
0 | 7648 if ( uActiveCharacter ) |
7649 { | |
998 | 7650 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) |
0 | 7651 { |
998 | 7652 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); |
0 | 7653 if ( !pParty->bTurnBasedModeOn ) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7654 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
1202 | 7655 pCastSpellInfo.data()->_427D48(uActiveCharacter); |
0 | 7656 pTurnEngine->_40471C(); |
7657 } | |
7658 } | |
7659 break; | |
998 | 7660 case INPUT_Combat://if press ENTER |
271 | 7661 if (pCurrentScreen == SCREEN_GAME) |
0 | 7662 { |
7663 if (pParty->bTurnBasedModeOn) | |
7664 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7665 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 7666 { |
7667 pParty->bTurnBasedModeOn = 0; | |
7668 pTurnEngine->End(true); | |
7669 } | |
7670 } | |
7671 else | |
7672 { | |
7673 pTurnEngine->Start(); | |
7674 pParty->bTurnBasedModeOn = true; | |
7675 } | |
7676 } | |
7677 break; | |
7678 case INPUT_CastReady: | |
271 | 7679 if (pCurrentScreen != SCREEN_GAME) |
0 | 7680 break; |
7681 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) | |
17 | 7682 { |
7683 pTurnEngine->field_18 |= 8u; | |
7684 break; | |
7685 } | |
0 | 7686 if ( !uActiveCharacter ) |
7687 break; | |
998 | 7688 v8 = pPlayers[uActiveCharacter]->uQuickSpell; |
0 | 7689 if ( !v8 |
7690 || bUnderwater | |
998 | 7691 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? |
7692 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : | |
7693 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : | |
7694 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : | |
7695 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), | |
7696 v10 > pPlayers[uActiveCharacter]->sMana) ) | |
0 | 7697 { |
998 | 7698 pPartyActionQueue = pPartyActionQueue; |
437 | 7699 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); |
7700 break; | |
0 | 7701 } |
7702 else | |
7703 { | |
1012 | 7704 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); |
0 | 7705 } |
7706 break; | |
7707 case INPUT_Attack: | |
271 | 7708 if (pCurrentScreen != SCREEN_GAME) |
0 | 7709 break; |
998 | 7710 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) |
7711 { | |
7712 pTurnEngine->field_18 |= 8u; | |
7713 break; | |
7714 } | |
7715 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 7716 break; |
7717 case INPUT_EventTrigger: | |
271 | 7718 if (pCurrentScreen == SCREEN_GAME) |
0 | 7719 { |
437 | 7720 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); |
163 | 7721 break; |
0 | 7722 } |
151 | 7723 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) |
0 | 7724 { |
7725 if ( pMessageQueue_50CBD0->uNumMessages ) | |
7726 { | |
437 | 7727 pMessageQueue_50CBD0->uNumMessages = 0; |
0 | 7728 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
7729 { | |
7730 pMessageQueue_50CBD0->uNumMessages = 1; | |
998 | 7731 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 7732 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7733 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7734 ++pMessageQueue_50CBD0->uNumMessages; | |
7735 break; | |
7736 } | |
437 | 7737 break; |
0 | 7738 } |
437 | 7739 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
0 | 7740 } |
7741 break; | |
7742 case INPUT_CharCycle: | |
1012 | 7743 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 7744 break; |
1012 | 7745 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40 |
437 | 7746 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7747 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7748 ++dword_50C9E8;*/ |
7749 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); | |
163 | 7750 break; |
0 | 7751 case INPUT_LookUp: |
7752 if ( pEventTimer->bPaused ) | |
7753 break; | |
7754 partyAction = (PartyAction)7; | |
998 | 7755 pPartyActionQueue->Add(partyAction); |
163 | 7756 break; |
0 | 7757 case INPUT_CenterView: |
7758 if ( pEventTimer->bPaused ) | |
7759 break; | |
7760 partyAction = (PartyAction)9; | |
998 | 7761 pPartyActionQueue->Add(partyAction); |
163 | 7762 break; |
0 | 7763 case INPUT_LookDown: |
7764 if ( pEventTimer->bPaused ) | |
7765 break; | |
7766 partyAction = (PartyAction)8; | |
998 | 7767 pPartyActionQueue->Add(partyAction); |
163 | 7768 break; |
0 | 7769 case INPUT_FlyUp: |
998 | 7770 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7771 break; |
7772 partyAction = (PartyAction)13; | |
998 | 7773 pPartyActionQueue->Add(partyAction); |
163 | 7774 break; |
0 | 7775 case INPUT_Land: |
998 | 7776 if ( pCurrentScreen || pEventTimer->bPaused ) |
0 | 7777 break; |
7778 partyAction = (PartyAction)15; | |
998 | 7779 pPartyActionQueue->Add(partyAction); |
163 | 7780 break; |
0 | 7781 case INPUT_FlyDown: |
7782 if ( !pCurrentScreen | |
7783 && !pEventTimer->bPaused ) | |
7784 { | |
7785 partyAction = (PartyAction)14; | |
998 | 7786 pPartyActionQueue->Add(partyAction); |
0 | 7787 } |
7788 break; | |
7789 case INPUT_ZoomIn: | |
1012 | 7790 /*if ( dword_50C9E8 >= 40 ) |
0 | 7791 break; |
7792 dword_50C9EC[3 * dword_50C9E8] = 367; | |
437 | 7793 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7794 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
1012 | 7795 ++dword_50C9E8;*/ |
7796 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); | |
163 | 7797 break; |
0 | 7798 case INPUT_ZoomOut: |
1012 | 7799 /*if ( dword_50C9E8 < 40 ) |
0 | 7800 { |
7801 dword_50C9EC[3 * dword_50C9E8] = 368; | |
437 | 7802 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; |
7803 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; | |
0 | 7804 ++dword_50C9E8; |
1012 | 7805 }*/ |
7806 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); | |
0 | 7807 break; |
7808 case INPUT_AlwaysRun: | |
7809 bAlwaysRun = bAlwaysRun == 0; | |
7810 break; | |
17 | 7811 default: |
7812 break; | |
0 | 7813 } |
7814 } | |
7815 } | |
7816 } | |
7817 } |