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