annotate mm7_6.cpp @ 1216:de876af42e0d

removing ArcomageCard array
author Grumpy7
date Sun, 09 Jun 2013 16:30:07 +0200
parents 96a81634669e
children 1803172dffd9
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4
0
Ritor1
parents:
diff changeset
5 #include "MM7.h"
Ritor1
parents:
diff changeset
6
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
7
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
8
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
9 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
10 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
11 #include "OutdoorCamera.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
12 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
13 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
14 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
15
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
16 #include "Vis.h"
0
Ritor1
parents:
diff changeset
17 #include "Game.h"
Ritor1
parents:
diff changeset
18 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
19 #include "GUIFont.h"
Ritor1
parents:
diff changeset
20 #include "Party.h"
Ritor1
parents:
diff changeset
21 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
22 #include "Outdoor.h"
Ritor1
parents:
diff changeset
23 #include "Overlays.h"
Ritor1
parents:
diff changeset
24 #include "LOD.h"
Ritor1
parents:
diff changeset
25 #include "Actor.h"
Ritor1
parents:
diff changeset
26 #include "Events.h"
Ritor1
parents:
diff changeset
27 #include "Viewport.h"
Ritor1
parents:
diff changeset
28 #include "Math.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
29 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
30 #include "ObjectList.h"
Ritor1
parents:
diff changeset
31 #include "stru123.h"
Ritor1
parents:
diff changeset
32 #include "Time.h"
Ritor1
parents:
diff changeset
33 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
34 #include "Awards.h"
Ritor1
parents:
diff changeset
35 #include "TurnEngine.h"
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
36 #include "CastSpellInfo.h"
0
Ritor1
parents:
diff changeset
37 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 169
diff changeset
38 #include "texts.h"
0
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40 #include "mm7_data.h"
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 //----- (00424EE0) --------------------------------------------------------
Ritor1
parents:
diff changeset
45 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID)
Ritor1
parents:
diff changeset
46 {
Ritor1
parents:
diff changeset
47 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
48 double v2; // st7@1
Ritor1
parents:
diff changeset
49 signed int v3; // edi@1
Ritor1
parents:
diff changeset
50 char *v4; // esi@4
Ritor1
parents:
diff changeset
51 char *v5; // ecx@4
Ritor1
parents:
diff changeset
52 unsigned int v6; // eax@4
Ritor1
parents:
diff changeset
53 char *v7; // edx@4
Ritor1
parents:
diff changeset
54 double v8; // st6@10
Ritor1
parents:
diff changeset
55 double v9; // st5@10
Ritor1
parents:
diff changeset
56 double v10; // st6@11
Ritor1
parents:
diff changeset
57 unsigned __int8 v11; // c2@15
Ritor1
parents:
diff changeset
58 unsigned __int8 v12; // c3@15
Ritor1
parents:
diff changeset
59 void *v13; // edi@22
Ritor1
parents:
diff changeset
60 char *v14; // eax@22
Ritor1
parents:
diff changeset
61 double v15; // st6@22
Ritor1
parents:
diff changeset
62 char *v16; // ecx@22
Ritor1
parents:
diff changeset
63 signed int result; // eax@24
Ritor1
parents:
diff changeset
64 unsigned int v18; // [sp+8h] [bp-2Ch]@4
Ritor1
parents:
diff changeset
65 bool v19; // [sp+Ch] [bp-28h]@6
Ritor1
parents:
diff changeset
66 char *v20; // [sp+10h] [bp-24h]@4
Ritor1
parents:
diff changeset
67 char *v21; // [sp+14h] [bp-20h]@4
Ritor1
parents:
diff changeset
68 signed int v22; // [sp+18h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
69 char *v23; // [sp+1Ch] [bp-18h]@4
Ritor1
parents:
diff changeset
70 RenderVertexSoft *v24; // [sp+20h] [bp-14h]@4
Ritor1
parents:
diff changeset
71 char *v25; // [sp+24h] [bp-10h]@4
Ritor1
parents:
diff changeset
72 char *v26; // [sp+28h] [bp-Ch]@4
Ritor1
parents:
diff changeset
73 char *v27; // [sp+2Ch] [bp-8h]@4
Ritor1
parents:
diff changeset
74 char *v28; // [sp+30h] [bp-4h]@4
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76 v1 = uVertexID;
Ritor1
parents:
diff changeset
77 v2 = (double)pOutdoorCamera->shading_dist_mist;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
78 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
79 v3 = 0;
Ritor1
parents:
diff changeset
80 v22 = 0;
Ritor1
parents:
diff changeset
81 if ( array_50AC10[0].vWorldViewPosition.x <= v2 )
Ritor1
parents:
diff changeset
82 v3 = 1;
Ritor1
parents:
diff changeset
83 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
84 return 0;
Ritor1
parents:
diff changeset
85 v4 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
86 v5 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
87 v6 = v1;
Ritor1
parents:
diff changeset
88 v23 = (char *)&array_507D30[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
89 v26 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
90 v24 = array_507D30;
0
Ritor1
parents:
diff changeset
91 v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
92 v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
93 v25 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
94 v27 = (char *)&array_507D30[0].v;
Ritor1
parents:
diff changeset
95 v28 = (char *)&array_507D30[0].u;
Ritor1
parents:
diff changeset
96 v7 = (char *)&array_50AC10[0].v;
Ritor1
parents:
diff changeset
97 v18 = v6;
Ritor1
parents:
diff changeset
98 do
Ritor1
parents:
diff changeset
99 {
Ritor1
parents:
diff changeset
100 v19 = v2 >= *((float *)v7 + 5);
Ritor1
parents:
diff changeset
101 if ( v3 != v19 )
Ritor1
parents:
diff changeset
102 {
Ritor1
parents:
diff changeset
103 if ( v19 )
Ritor1
parents:
diff changeset
104 {
Ritor1
parents:
diff changeset
105 v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7));
Ritor1
parents:
diff changeset
106 *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6);
Ritor1
parents:
diff changeset
107 *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5);
Ritor1
parents:
diff changeset
108 *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1);
Ritor1
parents:
diff changeset
109 v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7;
Ritor1
parents:
diff changeset
110 }
Ritor1
parents:
diff changeset
111 else
Ritor1
parents:
diff changeset
112 {
Ritor1
parents:
diff changeset
113 v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5));
Ritor1
parents:
diff changeset
114 *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6);
Ritor1
parents:
diff changeset
115 *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7);
Ritor1
parents:
diff changeset
116 *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11);
Ritor1
parents:
diff changeset
117 v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12);
Ritor1
parents:
diff changeset
118 }
Ritor1
parents:
diff changeset
119 *(float *)v27 = v9;
Ritor1
parents:
diff changeset
120 *(float *)v25 = v2;
Ritor1
parents:
diff changeset
121 *(float *)v26 = 1.0 / v2;
Ritor1
parents:
diff changeset
122 if ( v3 )
Ritor1
parents:
diff changeset
123 {
Ritor1
parents:
diff changeset
124 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) )
Ritor1
parents:
diff changeset
125 {
Ritor1
parents:
diff changeset
126 v11 = 0;
Ritor1
parents:
diff changeset
127 v12 = *(float *)v4 == *((float *)v7 - 5);
Ritor1
parents:
diff changeset
128 goto LABEL_19;
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 }
Ritor1
parents:
diff changeset
131 else
Ritor1
parents:
diff changeset
132 {
Ritor1
parents:
diff changeset
133 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) )
Ritor1
parents:
diff changeset
134 {
Ritor1
parents:
diff changeset
135 v11 = 0;
Ritor1
parents:
diff changeset
136 v12 = *(float *)v4 == *((float *)v7 + 7);
Ritor1
parents:
diff changeset
137 LABEL_19:
Ritor1
parents:
diff changeset
138 if ( v12 | v11 )
Ritor1
parents:
diff changeset
139 goto LABEL_21;
Ritor1
parents:
diff changeset
140 goto LABEL_20;
Ritor1
parents:
diff changeset
141 }
Ritor1
parents:
diff changeset
142 }
Ritor1
parents:
diff changeset
143 LABEL_20:
Ritor1
parents:
diff changeset
144 v26 += 48;
Ritor1
parents:
diff changeset
145 ++v24;
Ritor1
parents:
diff changeset
146 v25 += 48;
Ritor1
parents:
diff changeset
147 v27 += 48;
Ritor1
parents:
diff changeset
148 v28 += 48;
Ritor1
parents:
diff changeset
149 v5 += 48;
Ritor1
parents:
diff changeset
150 v4 += 48;
Ritor1
parents:
diff changeset
151 ++v22;
Ritor1
parents:
diff changeset
152 v23 += 48;
Ritor1
parents:
diff changeset
153 v21 = v5;
Ritor1
parents:
diff changeset
154 v20 = v4;
Ritor1
parents:
diff changeset
155 }
Ritor1
parents:
diff changeset
156 LABEL_21:
Ritor1
parents:
diff changeset
157 if ( v19 )
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 v13 = v24;
Ritor1
parents:
diff changeset
160 v14 = v26;
Ritor1
parents:
diff changeset
161 v21 += 48;
Ritor1
parents:
diff changeset
162 v15 = 1.0 / (*((float *)v7 + 5) + 0.0000001);
Ritor1
parents:
diff changeset
163 v20 += 48;
Ritor1
parents:
diff changeset
164 ++v22;
Ritor1
parents:
diff changeset
165 v28 += 48;
Ritor1
parents:
diff changeset
166 v27 += 48;
Ritor1
parents:
diff changeset
167 v25 += 48;
Ritor1
parents:
diff changeset
168 ++v24;
Ritor1
parents:
diff changeset
169 v26 += 48;
Ritor1
parents:
diff changeset
170 memcpy(v13, v7 + 8, 0x30u);
Ritor1
parents:
diff changeset
171 v16 = v23;
Ritor1
parents:
diff changeset
172 v23 += 48;
Ritor1
parents:
diff changeset
173 v4 = v20;
Ritor1
parents:
diff changeset
174 *(float *)v14 = v15;
Ritor1
parents:
diff changeset
175 *(int *)v16 = *((int *)v7 + 13);
Ritor1
parents:
diff changeset
176 v5 = v21;
Ritor1
parents:
diff changeset
177 }
Ritor1
parents:
diff changeset
178 v3 = v19;
Ritor1
parents:
diff changeset
179 v7 += 48;
Ritor1
parents:
diff changeset
180 --v18;
Ritor1
parents:
diff changeset
181 }
Ritor1
parents:
diff changeset
182 while ( v18 );
Ritor1
parents:
diff changeset
183 result = v22;
Ritor1
parents:
diff changeset
184 if ( v22 < 3 )
Ritor1
parents:
diff changeset
185 return 0;
Ritor1
parents:
diff changeset
186 return result;
Ritor1
parents:
diff changeset
187 }
Ritor1
parents:
diff changeset
188
Ritor1
parents:
diff changeset
189 //----- (004250FE) --------------------------------------------------------
Ritor1
parents:
diff changeset
190 signed int __fastcall sr_4250FE(unsigned int uVertexID)
Ritor1
parents:
diff changeset
191 {
Ritor1
parents:
diff changeset
192 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
193 char *v2; // edi@5
Ritor1
parents:
diff changeset
194 char *v3; // esi@5
Ritor1
parents:
diff changeset
195 char *v4; // ecx@5
Ritor1
parents:
diff changeset
196 int v5; // ebx@6
Ritor1
parents:
diff changeset
197 double v6; // st6@11
Ritor1
parents:
diff changeset
198 double v7; // st5@11
Ritor1
parents:
diff changeset
199 double v8; // st6@12
Ritor1
parents:
diff changeset
200 unsigned __int8 v9; // c2@16
Ritor1
parents:
diff changeset
201 unsigned __int8 v10; // c3@16
Ritor1
parents:
diff changeset
202 void *v11; // edi@23
Ritor1
parents:
diff changeset
203 double v12; // st6@23
Ritor1
parents:
diff changeset
204 char *v13; // ecx@23
Ritor1
parents:
diff changeset
205 char v14; // zf@24
Ritor1
parents:
diff changeset
206 signed int result; // eax@25
Ritor1
parents:
diff changeset
207 unsigned int v16; // [sp+8h] [bp-28h]@5
Ritor1
parents:
diff changeset
208 bool v17; // [sp+Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
209 bool v18; // [sp+10h] [bp-20h]@7
Ritor1
parents:
diff changeset
210 char *v19; // [sp+14h] [bp-1Ch]@5
Ritor1
parents:
diff changeset
211 char *v20; // [sp+18h] [bp-18h]@5
Ritor1
parents:
diff changeset
212 signed int v21; // [sp+1Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
213 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5
Ritor1
parents:
diff changeset
214 char *v23; // [sp+24h] [bp-Ch]@5
Ritor1
parents:
diff changeset
215 char *v24; // [sp+28h] [bp-8h]@5
Ritor1
parents:
diff changeset
216 char *v25; // [sp+2Ch] [bp-4h]@5
Ritor1
parents:
diff changeset
217
Ritor1
parents:
diff changeset
218 v1 = uVertexID;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
219 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
220 v21 = 0;
Ritor1
parents:
diff changeset
221 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0;
Ritor1
parents:
diff changeset
222 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
223 return 0;
Ritor1
parents:
diff changeset
224 v2 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
225 v3 = (char *)&array_507D30[0].vWorldViewPosition.y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
226 v24 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
227 v22 = array_507D30;
0
Ritor1
parents:
diff changeset
228 v19 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
229 v20 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
230 v23 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
231 v25 = (char *)&array_507D30[0].flt_2C;
Ritor1
parents:
diff changeset
232 v4 = (char *)&array_50AC10[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
233 v16 = v1;
Ritor1
parents:
diff changeset
234 do
Ritor1
parents:
diff changeset
235 {
Ritor1
parents:
diff changeset
236 v5 = (int)(v4 + 48);
Ritor1
parents:
diff changeset
237 v18 = *((float *)v4 + 12) >= 8.0;
Ritor1
parents:
diff changeset
238 if ( v17 != v18 )
Ritor1
parents:
diff changeset
239 {
Ritor1
parents:
diff changeset
240 if ( v18 )
Ritor1
parents:
diff changeset
241 {
Ritor1
parents:
diff changeset
242 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4);
Ritor1
parents:
diff changeset
243 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1);
Ritor1
parents:
diff changeset
244 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2);
Ritor1
parents:
diff changeset
245 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8);
Ritor1
parents:
diff changeset
246 }
Ritor1
parents:
diff changeset
247 else
Ritor1
parents:
diff changeset
248 {
Ritor1
parents:
diff changeset
249 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5);
Ritor1
parents:
diff changeset
250 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13);
Ritor1
parents:
diff changeset
251 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14);
Ritor1
parents:
diff changeset
252 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20);
Ritor1
parents:
diff changeset
253 }
Ritor1
parents:
diff changeset
254 *(float *)v25 = v7;
Ritor1
parents:
diff changeset
255 *(float *)v23 = 8.0;
Ritor1
parents:
diff changeset
256 *(int *)v24 = 0x3E000000u;
Ritor1
parents:
diff changeset
257 if ( v17 )
Ritor1
parents:
diff changeset
258 {
Ritor1
parents:
diff changeset
259 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) )
Ritor1
parents:
diff changeset
260 {
Ritor1
parents:
diff changeset
261 v9 = 0;
Ritor1
parents:
diff changeset
262 v10 = *(float *)v2 == *((float *)v4 + 2);
Ritor1
parents:
diff changeset
263 goto LABEL_20;
Ritor1
parents:
diff changeset
264 }
Ritor1
parents:
diff changeset
265 }
Ritor1
parents:
diff changeset
266 else
Ritor1
parents:
diff changeset
267 {
Ritor1
parents:
diff changeset
268 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) )
Ritor1
parents:
diff changeset
269 {
Ritor1
parents:
diff changeset
270 v9 = 0;
Ritor1
parents:
diff changeset
271 v10 = *(float *)v2 == *((float *)v4 + 14);
Ritor1
parents:
diff changeset
272 LABEL_20:
Ritor1
parents:
diff changeset
273 if ( v10 | v9 )
Ritor1
parents:
diff changeset
274 goto LABEL_22;
Ritor1
parents:
diff changeset
275 goto LABEL_21;
Ritor1
parents:
diff changeset
276 }
Ritor1
parents:
diff changeset
277 }
Ritor1
parents:
diff changeset
278 LABEL_21:
Ritor1
parents:
diff changeset
279 ++v22;
Ritor1
parents:
diff changeset
280 v23 += 48;
Ritor1
parents:
diff changeset
281 v25 += 48;
Ritor1
parents:
diff changeset
282 v3 += 48;
Ritor1
parents:
diff changeset
283 v2 += 48;
Ritor1
parents:
diff changeset
284 ++v21;
Ritor1
parents:
diff changeset
285 v24 += 48;
Ritor1
parents:
diff changeset
286 v20 = v3;
Ritor1
parents:
diff changeset
287 v19 = v2;
Ritor1
parents:
diff changeset
288 }
Ritor1
parents:
diff changeset
289 LABEL_22:
Ritor1
parents:
diff changeset
290 if ( v18 )
Ritor1
parents:
diff changeset
291 {
Ritor1
parents:
diff changeset
292 v11 = v22;
Ritor1
parents:
diff changeset
293 v20 += 48;
Ritor1
parents:
diff changeset
294 v19 += 48;
Ritor1
parents:
diff changeset
295 v12 = 1.0 / (*(float *)v5 + 0.0000001);
Ritor1
parents:
diff changeset
296 ++v21;
Ritor1
parents:
diff changeset
297 v25 += 48;
Ritor1
parents:
diff changeset
298 v23 += 48;
Ritor1
parents:
diff changeset
299 ++v22;
Ritor1
parents:
diff changeset
300 memcpy(v11, v4 + 36, 0x30u);
Ritor1
parents:
diff changeset
301 v13 = v24;
Ritor1
parents:
diff changeset
302 v24 += 48;
Ritor1
parents:
diff changeset
303 v3 = v20;
Ritor1
parents:
diff changeset
304 v2 = v19;
Ritor1
parents:
diff changeset
305 *(float *)v13 = v12;
Ritor1
parents:
diff changeset
306 }
Ritor1
parents:
diff changeset
307 v14 = v16-- == 1;
Ritor1
parents:
diff changeset
308 v17 = v18;
Ritor1
parents:
diff changeset
309 v4 = (char *)v5;
Ritor1
parents:
diff changeset
310 }
Ritor1
parents:
diff changeset
311 while ( !v14 );
Ritor1
parents:
diff changeset
312 result = v21;
Ritor1
parents:
diff changeset
313 if ( v21 < 3 )
Ritor1
parents:
diff changeset
314 return 0;
Ritor1
parents:
diff changeset
315 return result;
Ritor1
parents:
diff changeset
316 }
Ritor1
parents:
diff changeset
317
Ritor1
parents:
diff changeset
318 //----- (004252E8) --------------------------------------------------------
Ritor1
parents:
diff changeset
319 signed int __fastcall sr_4252E8(unsigned int uVertexID)
Ritor1
parents:
diff changeset
320 {
Ritor1
parents:
diff changeset
321 unsigned int v1; // edx@1
Ritor1
parents:
diff changeset
322 double v2; // st7@1
Ritor1
parents:
diff changeset
323 char *v3; // edi@5
Ritor1
parents:
diff changeset
324 char *v4; // esi@5
Ritor1
parents:
diff changeset
325 char *v5; // ecx@5
Ritor1
parents:
diff changeset
326 int v6; // ebx@6
Ritor1
parents:
diff changeset
327 double v7; // st6@11
Ritor1
parents:
diff changeset
328 double v8; // st5@11
Ritor1
parents:
diff changeset
329 double v9; // st6@12
Ritor1
parents:
diff changeset
330 unsigned __int8 v10; // c2@16
Ritor1
parents:
diff changeset
331 unsigned __int8 v11; // c3@16
Ritor1
parents:
diff changeset
332 void *v12; // edi@23
Ritor1
parents:
diff changeset
333 double v13; // st6@23
Ritor1
parents:
diff changeset
334 char *v14; // ecx@23
Ritor1
parents:
diff changeset
335 char v15; // zf@24
Ritor1
parents:
diff changeset
336 signed int result; // eax@25
Ritor1
parents:
diff changeset
337 unsigned int v17; // [sp+8h] [bp-28h]@5
Ritor1
parents:
diff changeset
338 bool v18; // [sp+Ch] [bp-24h]@2
Ritor1
parents:
diff changeset
339 bool v19; // [sp+10h] [bp-20h]@7
Ritor1
parents:
diff changeset
340 char *v20; // [sp+14h] [bp-1Ch]@5
Ritor1
parents:
diff changeset
341 char *v21; // [sp+18h] [bp-18h]@5
Ritor1
parents:
diff changeset
342 signed int v22; // [sp+1Ch] [bp-14h]@1
Ritor1
parents:
diff changeset
343 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5
Ritor1
parents:
diff changeset
344 char *v24; // [sp+24h] [bp-Ch]@5
Ritor1
parents:
diff changeset
345 char *v25; // [sp+28h] [bp-8h]@5
Ritor1
parents:
diff changeset
346 char *v26; // [sp+2Ch] [bp-4h]@5
Ritor1
parents:
diff changeset
347
Ritor1
parents:
diff changeset
348 v1 = uVertexID;
Ritor1
parents:
diff changeset
349 v2 = (double)pOutdoorCamera->shading_dist_mist;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
350 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
0
Ritor1
parents:
diff changeset
351 v22 = 0;
Ritor1
parents:
diff changeset
352 v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
Ritor1
parents:
diff changeset
353 if ( (signed int)(uVertexID + 1) <= 1 )
Ritor1
parents:
diff changeset
354 return 0;
Ritor1
parents:
diff changeset
355 v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
356 v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
357 v25 = (char *)&array_507D30[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
358 v23 = array_507D30;
0
Ritor1
parents:
diff changeset
359 v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
360 v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
361 v24 = (char *)&array_507D30[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
362 v26 = (char *)&array_507D30[0].flt_2C;
Ritor1
parents:
diff changeset
363 v5 = (char *)&array_50AC10[0].vWorldViewPosition;
Ritor1
parents:
diff changeset
364 v17 = v1;
Ritor1
parents:
diff changeset
365 do
Ritor1
parents:
diff changeset
366 {
Ritor1
parents:
diff changeset
367 v6 = (int)(v5 + 48);
Ritor1
parents:
diff changeset
368 v19 = v2 >= *((float *)v5 + 12);
Ritor1
parents:
diff changeset
369 if ( v18 != v19 )
Ritor1
parents:
diff changeset
370 {
Ritor1
parents:
diff changeset
371 if ( v19 )
Ritor1
parents:
diff changeset
372 {
Ritor1
parents:
diff changeset
373 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5);
Ritor1
parents:
diff changeset
374 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1);
Ritor1
parents:
diff changeset
375 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2);
Ritor1
parents:
diff changeset
376 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8);
Ritor1
parents:
diff changeset
377 }
Ritor1
parents:
diff changeset
378 else
Ritor1
parents:
diff changeset
379 {
Ritor1
parents:
diff changeset
380 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6);
Ritor1
parents:
diff changeset
381 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13);
Ritor1
parents:
diff changeset
382 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14);
Ritor1
parents:
diff changeset
383 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20);
Ritor1
parents:
diff changeset
384 }
Ritor1
parents:
diff changeset
385 *(float *)v26 = v8;
Ritor1
parents:
diff changeset
386 *(float *)v24 = v2;
Ritor1
parents:
diff changeset
387 *(float *)v25 = 1.0 / v2;
Ritor1
parents:
diff changeset
388 if ( v18 )
Ritor1
parents:
diff changeset
389 {
Ritor1
parents:
diff changeset
390 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) )
Ritor1
parents:
diff changeset
391 {
Ritor1
parents:
diff changeset
392 v10 = 0;
Ritor1
parents:
diff changeset
393 v11 = *(float *)v3 == *((float *)v5 + 2);
Ritor1
parents:
diff changeset
394 goto LABEL_20;
Ritor1
parents:
diff changeset
395 }
Ritor1
parents:
diff changeset
396 }
Ritor1
parents:
diff changeset
397 else
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) )
Ritor1
parents:
diff changeset
400 {
Ritor1
parents:
diff changeset
401 v10 = 0;
Ritor1
parents:
diff changeset
402 v11 = *(float *)v3 == *((float *)v5 + 14);
Ritor1
parents:
diff changeset
403 LABEL_20:
Ritor1
parents:
diff changeset
404 if ( v11 | v10 )
Ritor1
parents:
diff changeset
405 goto LABEL_22;
Ritor1
parents:
diff changeset
406 goto LABEL_21;
Ritor1
parents:
diff changeset
407 }
Ritor1
parents:
diff changeset
408 }
Ritor1
parents:
diff changeset
409 LABEL_21:
Ritor1
parents:
diff changeset
410 ++v23;
Ritor1
parents:
diff changeset
411 v24 += 48;
Ritor1
parents:
diff changeset
412 v26 += 48;
Ritor1
parents:
diff changeset
413 v4 += 48;
Ritor1
parents:
diff changeset
414 v3 += 48;
Ritor1
parents:
diff changeset
415 ++v22;
Ritor1
parents:
diff changeset
416 v25 += 48;
Ritor1
parents:
diff changeset
417 v21 = v4;
Ritor1
parents:
diff changeset
418 v20 = v3;
Ritor1
parents:
diff changeset
419 }
Ritor1
parents:
diff changeset
420 LABEL_22:
Ritor1
parents:
diff changeset
421 if ( v19 )
Ritor1
parents:
diff changeset
422 {
Ritor1
parents:
diff changeset
423 v12 = v23;
Ritor1
parents:
diff changeset
424 v21 += 48;
Ritor1
parents:
diff changeset
425 v20 += 48;
Ritor1
parents:
diff changeset
426 v13 = 1.0 / (*(float *)v6 + 0.0000001);
Ritor1
parents:
diff changeset
427 ++v22;
Ritor1
parents:
diff changeset
428 v26 += 48;
Ritor1
parents:
diff changeset
429 v24 += 48;
Ritor1
parents:
diff changeset
430 ++v23;
Ritor1
parents:
diff changeset
431 memcpy(v12, v5 + 36, 0x30u);
Ritor1
parents:
diff changeset
432 v14 = v25;
Ritor1
parents:
diff changeset
433 v25 += 48;
Ritor1
parents:
diff changeset
434 v4 = v21;
Ritor1
parents:
diff changeset
435 v3 = v20;
Ritor1
parents:
diff changeset
436 *(float *)v14 = v13;
Ritor1
parents:
diff changeset
437 }
Ritor1
parents:
diff changeset
438 v15 = v17-- == 1;
Ritor1
parents:
diff changeset
439 v18 = v19;
Ritor1
parents:
diff changeset
440 v5 = (char *)v6;
Ritor1
parents:
diff changeset
441 }
Ritor1
parents:
diff changeset
442 while ( !v15 );
Ritor1
parents:
diff changeset
443 result = v22;
Ritor1
parents:
diff changeset
444 if ( v22 < 3 )
Ritor1
parents:
diff changeset
445 return 0;
Ritor1
parents:
diff changeset
446 return result;
Ritor1
parents:
diff changeset
447 }
Ritor1
parents:
diff changeset
448
Ritor1
parents:
diff changeset
449 //----- (004254D2) --------------------------------------------------------
Ritor1
parents:
diff changeset
450 int __fastcall sr_4254D2(signed int a1)
Ritor1
parents:
diff changeset
451 {
Ritor1
parents:
diff changeset
452 signed int v1; // ebx@2
Ritor1
parents:
diff changeset
453 int v2; // ecx@2
Ritor1
parents:
diff changeset
454 int result; // eax@11
Ritor1
parents:
diff changeset
455 double v4; // ST74_8@12
Ritor1
parents:
diff changeset
456 bool v5; // edi@12
Ritor1
parents:
diff changeset
457 char *v6; // esi@13
Ritor1
parents:
diff changeset
458 char *v7; // ebx@13
Ritor1
parents:
diff changeset
459 double v8; // st7@15
Ritor1
parents:
diff changeset
460 double v9; // st7@16
Ritor1
parents:
diff changeset
461 double v10; // st6@16
Ritor1
parents:
diff changeset
462 double v11; // st7@17
Ritor1
parents:
diff changeset
463 float v12; // eax@18
Ritor1
parents:
diff changeset
464 double v13; // ST4C_8@19
Ritor1
parents:
diff changeset
465 double v14; // ST10_8@19
Ritor1
parents:
diff changeset
466 double v15; // ST28_8@20
Ritor1
parents:
diff changeset
467 double v16; // ST34_8@20
Ritor1
parents:
diff changeset
468 char v17; // zf@20
Ritor1
parents:
diff changeset
469 double v18; // ST18_8@21
Ritor1
parents:
diff changeset
470 double v19; // ST3C_8@21
Ritor1
parents:
diff changeset
471 double v20; // ST44_8@22
Ritor1
parents:
diff changeset
472 double v21; // ST54_8@22
Ritor1
parents:
diff changeset
473 void *v22; // edi@26
Ritor1
parents:
diff changeset
474 double v23; // ST54_8@29
Ritor1
parents:
diff changeset
475 bool v24; // esi@29
Ritor1
parents:
diff changeset
476 char *v25; // edi@30
Ritor1
parents:
diff changeset
477 char *v26; // ebx@30
Ritor1
parents:
diff changeset
478 bool v27; // ecx@32
Ritor1
parents:
diff changeset
479 double v28; // st7@33
Ritor1
parents:
diff changeset
480 double v29; // st7@34
Ritor1
parents:
diff changeset
481 double v30; // st6@34
Ritor1
parents:
diff changeset
482 double v31; // st7@35
Ritor1
parents:
diff changeset
483 double v32; // ST44_8@37
Ritor1
parents:
diff changeset
484 double v33; // ST3C_8@37
Ritor1
parents:
diff changeset
485 double v34; // ST18_8@38
Ritor1
parents:
diff changeset
486 double v35; // ST34_8@38
Ritor1
parents:
diff changeset
487 char v36; // zf@38
Ritor1
parents:
diff changeset
488 double v37; // ST28_8@39
Ritor1
parents:
diff changeset
489 double v38; // ST10_8@39
Ritor1
parents:
diff changeset
490 double v39; // ST20_8@40
Ritor1
parents:
diff changeset
491 double v40; // ST5C_8@40
Ritor1
parents:
diff changeset
492 void *v41; // edi@44
Ritor1
parents:
diff changeset
493 double v42; // ST5C_8@47
Ritor1
parents:
diff changeset
494 bool v43; // edi@47
Ritor1
parents:
diff changeset
495 char *v44; // esi@48
Ritor1
parents:
diff changeset
496 char *v45; // ebx@48
Ritor1
parents:
diff changeset
497 bool v46; // ecx@49
Ritor1
parents:
diff changeset
498 double v47; // st6@50
Ritor1
parents:
diff changeset
499 double v48; // st6@51
Ritor1
parents:
diff changeset
500 double v49; // st5@51
Ritor1
parents:
diff changeset
501 double v50; // st6@52
Ritor1
parents:
diff changeset
502 double v51; // ST20_8@54
Ritor1
parents:
diff changeset
503 double v52; // ST54_8@54
Ritor1
parents:
diff changeset
504 double v53; // ST44_8@55
Ritor1
parents:
diff changeset
505 double v54; // ST3C_8@55
Ritor1
parents:
diff changeset
506 char v55; // zf@55
Ritor1
parents:
diff changeset
507 double v56; // ST18_8@56
Ritor1
parents:
diff changeset
508 double v57; // ST34_8@56
Ritor1
parents:
diff changeset
509 double v58; // ST28_8@57
Ritor1
parents:
diff changeset
510 double v59; // ST10_8@57
Ritor1
parents:
diff changeset
511 void *v60; // edi@61
Ritor1
parents:
diff changeset
512 double v61; // ST5C_8@64
Ritor1
parents:
diff changeset
513 bool v62; // edi@64
Ritor1
parents:
diff changeset
514 char *v63; // esi@65
Ritor1
parents:
diff changeset
515 char *v64; // ebx@65
Ritor1
parents:
diff changeset
516 bool v65; // ecx@66
Ritor1
parents:
diff changeset
517 double v66; // st6@67
Ritor1
parents:
diff changeset
518 double v67; // st6@68
Ritor1
parents:
diff changeset
519 double v68; // st5@68
Ritor1
parents:
diff changeset
520 double v69; // st6@69
Ritor1
parents:
diff changeset
521 double v70; // ST20_8@71
Ritor1
parents:
diff changeset
522 double v71; // ST54_8@71
Ritor1
parents:
diff changeset
523 double v72; // ST44_8@72
Ritor1
parents:
diff changeset
524 double v73; // ST3C_8@72
Ritor1
parents:
diff changeset
525 char v74; // zf@72
Ritor1
parents:
diff changeset
526 double v75; // ST18_8@73
Ritor1
parents:
diff changeset
527 double v76; // ST34_8@73
Ritor1
parents:
diff changeset
528 double v77; // ST28_8@74
Ritor1
parents:
diff changeset
529 double v78; // ST10_8@74
Ritor1
parents:
diff changeset
530 void *v79; // edi@78
Ritor1
parents:
diff changeset
531 int v80; // ebx@81
Ritor1
parents:
diff changeset
532 char *v81; // ecx@82
Ritor1
parents:
diff changeset
533 signed int v82; // esi@82
Ritor1
parents:
diff changeset
534 float v83; // ST78_4@83
Ritor1
parents:
diff changeset
535 double v84; // ST5C_8@83
Ritor1
parents:
diff changeset
536 float v85; // eax@84
Ritor1
parents:
diff changeset
537 double v86; // ST20_8@85
Ritor1
parents:
diff changeset
538 double v87; // ST54_8@88
Ritor1
parents:
diff changeset
539 float v88; // eax@89
Ritor1
parents:
diff changeset
540 double v89; // ST44_8@90
Ritor1
parents:
diff changeset
541 unsigned __int8 v90; // sf@94
Ritor1
parents:
diff changeset
542 unsigned __int8 v91; // of@94
Ritor1
parents:
diff changeset
543 int v92; // edx@97
Ritor1
parents:
diff changeset
544 int v93; // esi@97
Ritor1
parents:
diff changeset
545 int v94; // edi@97
Ritor1
parents:
diff changeset
546 int v95; // eax@97
Ritor1
parents:
diff changeset
547 int v96; // eax@104
Ritor1
parents:
diff changeset
548 double v97; // [sp+4Ch] [bp-8Ch]@32
Ritor1
parents:
diff changeset
549 double v98; // [sp+54h] [bp-84h]@49
Ritor1
parents:
diff changeset
550 double v99; // [sp+54h] [bp-84h]@66
Ritor1
parents:
diff changeset
551 float v100; // [sp+5Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
552 float v101; // [sp+60h] [bp-78h]@1
Ritor1
parents:
diff changeset
553 float v102; // [sp+64h] [bp-74h]@1
Ritor1
parents:
diff changeset
554 double v103; // [sp+6Ch] [bp-6Ch]@14
Ritor1
parents:
diff changeset
555 float v104; // [sp+A8h] [bp-30h]@1
Ritor1
parents:
diff changeset
556 signed int v105; // [sp+A8h] [bp-30h]@96
Ritor1
parents:
diff changeset
557 bool v106; // [sp+ACh] [bp-2Ch]@14
Ritor1
parents:
diff changeset
558 bool v107; // [sp+ACh] [bp-2Ch]@32
Ritor1
parents:
diff changeset
559 bool v108; // [sp+ACh] [bp-2Ch]@49
Ritor1
parents:
diff changeset
560 bool v109; // [sp+ACh] [bp-2Ch]@66
Ritor1
parents:
diff changeset
561 signed int v110; // [sp+B0h] [bp-28h]@12
Ritor1
parents:
diff changeset
562 char *v111; // [sp+B8h] [bp-20h]@30
Ritor1
parents:
diff changeset
563 signed int v112; // [sp+B8h] [bp-20h]@48
Ritor1
parents:
diff changeset
564 signed int v113; // [sp+B8h] [bp-20h]@65
Ritor1
parents:
diff changeset
565 char *v114; // [sp+BCh] [bp-1Ch]@13
Ritor1
parents:
diff changeset
566 signed int v115; // [sp+BCh] [bp-1Ch]@29
Ritor1
parents:
diff changeset
567 signed int v116; // [sp+BCh] [bp-1Ch]@64
Ritor1
parents:
diff changeset
568 signed int v117; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
569 char *v118; // [sp+C0h] [bp-18h]@30
Ritor1
parents:
diff changeset
570 char *v119; // [sp+C0h] [bp-18h]@48
Ritor1
parents:
diff changeset
571 char *v120; // [sp+C0h] [bp-18h]@65
Ritor1
parents:
diff changeset
572 char *v121; // [sp+C4h] [bp-14h]@13
Ritor1
parents:
diff changeset
573 char *v122; // [sp+C4h] [bp-14h]@30
Ritor1
parents:
diff changeset
574 signed int v123; // [sp+C4h] [bp-14h]@47
Ritor1
parents:
diff changeset
575 char *v124; // [sp+C8h] [bp-10h]@30
Ritor1
parents:
diff changeset
576 char *v125; // [sp+C8h] [bp-10h]@48
Ritor1
parents:
diff changeset
577 char *v126; // [sp+C8h] [bp-10h]@65
Ritor1
parents:
diff changeset
578 signed int v127; // [sp+CCh] [bp-Ch]@2
Ritor1
parents:
diff changeset
579 char *v128; // [sp+CCh] [bp-Ch]@13
Ritor1
parents:
diff changeset
580 char *v129; // [sp+CCh] [bp-Ch]@30
Ritor1
parents:
diff changeset
581 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48
Ritor1
parents:
diff changeset
582 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65
Ritor1
parents:
diff changeset
583 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13
Ritor1
parents:
diff changeset
584 char *v133; // [sp+D0h] [bp-8h]@30
Ritor1
parents:
diff changeset
585 char *v134; // [sp+D0h] [bp-8h]@48
Ritor1
parents:
diff changeset
586 char *v135; // [sp+D0h] [bp-8h]@65
Ritor1
parents:
diff changeset
587 signed int v136; // [sp+D4h] [bp-4h]@1
Ritor1
parents:
diff changeset
588 char *v137; // [sp+D4h] [bp-4h]@13
Ritor1
parents:
diff changeset
589 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30
Ritor1
parents:
diff changeset
590 char *v139; // [sp+D4h] [bp-4h]@48
Ritor1
parents:
diff changeset
591 char *v140; // [sp+D4h] [bp-4h]@65
Ritor1
parents:
diff changeset
592
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
593 v101 = (double)(signed int)pViewport->uViewportTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
594 v100 = (double)(signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
595 v117 = a1;
Ritor1
parents:
diff changeset
596 v136 = 1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
597 v104 = (double)(signed int)pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
598 v102 = (double)(pViewport->uViewportBR_Y + 1);
0
Ritor1
parents:
diff changeset
599 if ( a1 <= 0 )
Ritor1
parents:
diff changeset
600 return v117;
Ritor1
parents:
diff changeset
601 v127 = a1;
Ritor1
parents:
diff changeset
602 v1 = a1;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
603 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2));
0
Ritor1
parents:
diff changeset
604 v2 = 0;
Ritor1
parents:
diff changeset
605 do
Ritor1
parents:
diff changeset
606 {
Ritor1
parents:
diff changeset
607 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 )
Ritor1
parents:
diff changeset
608 v136 = 0;
Ritor1
parents:
diff changeset
609 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 )
Ritor1
parents:
diff changeset
610 v136 = 0;
Ritor1
parents:
diff changeset
611 ++v2;
Ritor1
parents:
diff changeset
612 --v127;
Ritor1
parents:
diff changeset
613 }
Ritor1
parents:
diff changeset
614 while ( v127 );
Ritor1
parents:
diff changeset
615 if ( v136 )
Ritor1
parents:
diff changeset
616 return v117;
Ritor1
parents:
diff changeset
617 v110 = 0;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
618 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1]));
0
Ritor1
parents:
diff changeset
619 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
620 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
621 if ( v117 < 1 )
Ritor1
parents:
diff changeset
622 goto LABEL_112;
Ritor1
parents:
diff changeset
623 v6 = (char *)&array_50A2B0[0].vWorldViewProjY;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
624 v132 = array_50A2B0;
0
Ritor1
parents:
diff changeset
625 v137 = (char *)&array_50A2B0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
626 v128 = (char *)&array_50A2B0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
627 v121 = (char *)&array_50A2B0[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
628 v114 = (char *)&array_50A2B0[0]._rhw;
0
Ritor1
parents:
diff changeset
629 v7 = (char *)&array_50AC10[0].flt_2C;
Ritor1
parents:
diff changeset
630 do
Ritor1
parents:
diff changeset
631 {
Ritor1
parents:
diff changeset
632 v103 = *((float *)v7 + 7) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
633 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X;
0
Ritor1
parents:
diff changeset
634 if ( !(v5 ^ v106) )
Ritor1
parents:
diff changeset
635 goto LABEL_25;
Ritor1
parents:
diff changeset
636 v8 = v101;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
637 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X )
0
Ritor1
parents:
diff changeset
638 {
Ritor1
parents:
diff changeset
639 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5));
Ritor1
parents:
diff changeset
640 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4);
Ritor1
parents:
diff changeset
641 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3);
Ritor1
parents:
diff changeset
642 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7;
Ritor1
parents:
diff changeset
643 }
Ritor1
parents:
diff changeset
644 else
Ritor1
parents:
diff changeset
645 {
Ritor1
parents:
diff changeset
646 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7));
Ritor1
parents:
diff changeset
647 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8);
Ritor1
parents:
diff changeset
648 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9);
Ritor1
parents:
diff changeset
649 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12);
Ritor1
parents:
diff changeset
650 }
Ritor1
parents:
diff changeset
651 *(float *)v121 = v10;
Ritor1
parents:
diff changeset
652 *(int *)v137 = LODWORD(v101);
Ritor1
parents:
diff changeset
653 LODWORD(v12) = *(int *)v6;
Ritor1
parents:
diff changeset
654 if ( v5 )
Ritor1
parents:
diff changeset
655 {
Ritor1
parents:
diff changeset
656 v13 = v12 + 6.7553994e15;
Ritor1
parents:
diff changeset
657 v14 = *((float *)v7 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
658 if ( LODWORD(v13) == LODWORD(v14) )
Ritor1
parents:
diff changeset
659 {
Ritor1
parents:
diff changeset
660 v15 = *(float *)v137 + 6.7553994e15;
Ritor1
parents:
diff changeset
661 v16 = *((float *)v7 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
662 v17 = LODWORD(v15) == LODWORD(v16);
Ritor1
parents:
diff changeset
663 goto LABEL_23;
Ritor1
parents:
diff changeset
664 }
Ritor1
parents:
diff changeset
665 }
Ritor1
parents:
diff changeset
666 else
Ritor1
parents:
diff changeset
667 {
Ritor1
parents:
diff changeset
668 v18 = v12 + 6.7553994e15;
Ritor1
parents:
diff changeset
669 v19 = *((float *)v7 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
670 if ( LODWORD(v18) == LODWORD(v19) )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 v20 = *(float *)v137 + 6.7553994e15;
Ritor1
parents:
diff changeset
673 v21 = *((float *)v7 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
674 v17 = LODWORD(v20) == LODWORD(v21);
Ritor1
parents:
diff changeset
675 LABEL_23:
Ritor1
parents:
diff changeset
676 if ( v17 )
Ritor1
parents:
diff changeset
677 goto LABEL_25;
Ritor1
parents:
diff changeset
678 goto LABEL_24;
Ritor1
parents:
diff changeset
679 }
Ritor1
parents:
diff changeset
680 }
Ritor1
parents:
diff changeset
681 LABEL_24:
Ritor1
parents:
diff changeset
682 v121 += 48;
Ritor1
parents:
diff changeset
683 v114 += 48;
Ritor1
parents:
diff changeset
684 v6 += 48;
Ritor1
parents:
diff changeset
685 ++v110;
Ritor1
parents:
diff changeset
686 ++v132;
Ritor1
parents:
diff changeset
687 v128 = v6;
Ritor1
parents:
diff changeset
688 v137 += 48;
Ritor1
parents:
diff changeset
689 LABEL_25:
Ritor1
parents:
diff changeset
690 if ( v106 )
Ritor1
parents:
diff changeset
691 {
Ritor1
parents:
diff changeset
692 v22 = v132;
Ritor1
parents:
diff changeset
693 v128 += 48;
Ritor1
parents:
diff changeset
694 ++v110;
Ritor1
parents:
diff changeset
695 v114 += 48;
Ritor1
parents:
diff changeset
696 v121 += 48;
Ritor1
parents:
diff changeset
697 v137 += 48;
Ritor1
parents:
diff changeset
698 ++v132;
Ritor1
parents:
diff changeset
699 memcpy(v22, v7 + 4, 0x30u);
Ritor1
parents:
diff changeset
700 v6 = v128;
Ritor1
parents:
diff changeset
701 }
Ritor1
parents:
diff changeset
702 v5 = v106;
Ritor1
parents:
diff changeset
703 v7 += 48;
Ritor1
parents:
diff changeset
704 --v117;
Ritor1
parents:
diff changeset
705 }
Ritor1
parents:
diff changeset
706 while ( v117 );
Ritor1
parents:
diff changeset
707 if ( v110 < 3
Ritor1
parents:
diff changeset
708 || (v115 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
709 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])),
0
Ritor1
parents:
diff changeset
710 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
711 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X,
0
Ritor1
parents:
diff changeset
712 v110 < 1) )
Ritor1
parents:
diff changeset
713 goto LABEL_112;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
714 v25 = (char *)&array_509950[0]._rhw;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
715 v138 = array_509950;
0
Ritor1
parents:
diff changeset
716 v129 = (char *)&array_50A2B0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
717 v118 = (char *)&array_50A2B0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
718 v133 = (char *)&array_509950[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
719 v122 = (char *)&array_509950[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
720 v124 = (char *)&array_509950[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
721 v111 = (char *)&array_509950[0]._rhw;
0
Ritor1
parents:
diff changeset
722 v26 = (char *)&array_50A2B0[0].flt_2C;
Ritor1
parents:
diff changeset
723 while ( 2 )
Ritor1
parents:
diff changeset
724 {
Ritor1
parents:
diff changeset
725 v97 = *((float *)v26 + 7) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
726 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
727 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
0
Ritor1
parents:
diff changeset
728 if ( v24 != v27 )
Ritor1
parents:
diff changeset
729 {
Ritor1
parents:
diff changeset
730 v28 = v100;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
731 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X )
0
Ritor1
parents:
diff changeset
732 {
Ritor1
parents:
diff changeset
733 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5));
Ritor1
parents:
diff changeset
734 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4);
Ritor1
parents:
diff changeset
735 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3);
Ritor1
parents:
diff changeset
736 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26;
Ritor1
parents:
diff changeset
737 }
Ritor1
parents:
diff changeset
738 else
Ritor1
parents:
diff changeset
739 {
Ritor1
parents:
diff changeset
740 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7));
Ritor1
parents:
diff changeset
741 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8);
Ritor1
parents:
diff changeset
742 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9);
Ritor1
parents:
diff changeset
743 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12);
Ritor1
parents:
diff changeset
744 }
Ritor1
parents:
diff changeset
745 *(float *)v124 = v30;
Ritor1
parents:
diff changeset
746 *(int *)v133 = LODWORD(v100);
Ritor1
parents:
diff changeset
747 if ( v24 )
Ritor1
parents:
diff changeset
748 {
Ritor1
parents:
diff changeset
749 v32 = *(float *)v122 + 6.7553994e15;
Ritor1
parents:
diff changeset
750 v33 = *((float *)v26 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
751 if ( LODWORD(v32) == LODWORD(v33) )
Ritor1
parents:
diff changeset
752 {
Ritor1
parents:
diff changeset
753 v34 = *(float *)v133 + 6.7553994e15;
Ritor1
parents:
diff changeset
754 v35 = *((float *)v26 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
755 v36 = LODWORD(v34) == LODWORD(v35);
Ritor1
parents:
diff changeset
756 goto LABEL_41;
Ritor1
parents:
diff changeset
757 }
Ritor1
parents:
diff changeset
758 goto LABEL_42;
Ritor1
parents:
diff changeset
759 }
Ritor1
parents:
diff changeset
760 v37 = *(float *)v118 + 6.7553994e15;
Ritor1
parents:
diff changeset
761 v38 = *((float *)v26 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
762 if ( LODWORD(v37) != LODWORD(v38) )
Ritor1
parents:
diff changeset
763 goto LABEL_42;
Ritor1
parents:
diff changeset
764 v39 = *(float *)v129 + 6.7553994e15;
Ritor1
parents:
diff changeset
765 v40 = *((float *)v26 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
766 v36 = LODWORD(v39) == LODWORD(v40);
Ritor1
parents:
diff changeset
767 LABEL_41:
Ritor1
parents:
diff changeset
768 if ( !v36 )
Ritor1
parents:
diff changeset
769 {
Ritor1
parents:
diff changeset
770 LABEL_42:
Ritor1
parents:
diff changeset
771 v129 += 48;
Ritor1
parents:
diff changeset
772 v118 += 48;
Ritor1
parents:
diff changeset
773 v133 += 48;
Ritor1
parents:
diff changeset
774 v122 += 48;
Ritor1
parents:
diff changeset
775 v124 += 48;
Ritor1
parents:
diff changeset
776 v111 += 48;
Ritor1
parents:
diff changeset
777 ++v115;
Ritor1
parents:
diff changeset
778 ++v138;
Ritor1
parents:
diff changeset
779 }
Ritor1
parents:
diff changeset
780 }
Ritor1
parents:
diff changeset
781 if ( v27 )
Ritor1
parents:
diff changeset
782 {
Ritor1
parents:
diff changeset
783 v41 = v138;
Ritor1
parents:
diff changeset
784 ++v115;
Ritor1
parents:
diff changeset
785 v111 += 48;
Ritor1
parents:
diff changeset
786 v124 += 48;
Ritor1
parents:
diff changeset
787 v122 += 48;
Ritor1
parents:
diff changeset
788 v133 += 48;
Ritor1
parents:
diff changeset
789 v118 += 48;
Ritor1
parents:
diff changeset
790 v129 += 48;
Ritor1
parents:
diff changeset
791 ++v138;
Ritor1
parents:
diff changeset
792 memcpy(v41, v26 + 4, 0x30u);
Ritor1
parents:
diff changeset
793 }
Ritor1
parents:
diff changeset
794 v24 = v107;
Ritor1
parents:
diff changeset
795 v26 += 48;
Ritor1
parents:
diff changeset
796 --v110;
Ritor1
parents:
diff changeset
797 if ( v110 )
Ritor1
parents:
diff changeset
798 {
Ritor1
parents:
diff changeset
799 v25 = v111;
Ritor1
parents:
diff changeset
800 continue;
Ritor1
parents:
diff changeset
801 }
Ritor1
parents:
diff changeset
802 break;
Ritor1
parents:
diff changeset
803 }
Ritor1
parents:
diff changeset
804 if ( v115 < 3
Ritor1
parents:
diff changeset
805 || (v123 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
806 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])),
0
Ritor1
parents:
diff changeset
807 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
808 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y,
0
Ritor1
parents:
diff changeset
809 v115 < 1) )
Ritor1
parents:
diff changeset
810 goto LABEL_112;
Ritor1
parents:
diff changeset
811 v44 = (char *)&array_508FF0[0].vWorldViewProjX;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
812 v130 = array_508FF0;
0
Ritor1
parents:
diff changeset
813 v119 = (char *)&array_508FF0[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
814 v139 = (char *)&array_508FF0[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
815 v125 = (char *)&array_508FF0[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
816 v134 = (char *)&array_508FF0[0]._rhw;
0
Ritor1
parents:
diff changeset
817 v45 = (char *)&array_509950[0].flt_2C;
Ritor1
parents:
diff changeset
818 v112 = v115;
Ritor1
parents:
diff changeset
819 while ( 2 )
Ritor1
parents:
diff changeset
820 {
Ritor1
parents:
diff changeset
821 v98 = *((float *)v45 + 8) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
822 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
823 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
0
Ritor1
parents:
diff changeset
824 if ( v43 != v46 )
Ritor1
parents:
diff changeset
825 {
Ritor1
parents:
diff changeset
826 v47 = v104;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
827 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y )
0
Ritor1
parents:
diff changeset
828 {
Ritor1
parents:
diff changeset
829 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4));
Ritor1
parents:
diff changeset
830 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5);
Ritor1
parents:
diff changeset
831 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3);
Ritor1
parents:
diff changeset
832 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834 else
Ritor1
parents:
diff changeset
835 {
Ritor1
parents:
diff changeset
836 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8));
Ritor1
parents:
diff changeset
837 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7);
Ritor1
parents:
diff changeset
838 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9);
Ritor1
parents:
diff changeset
839 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12);
Ritor1
parents:
diff changeset
840 }
Ritor1
parents:
diff changeset
841 *(float *)v125 = v49;
Ritor1
parents:
diff changeset
842 *(float *)v139 = v104;
Ritor1
parents:
diff changeset
843 if ( v43 )
Ritor1
parents:
diff changeset
844 {
Ritor1
parents:
diff changeset
845 v51 = v104 + 6.7553994e15;
Ritor1
parents:
diff changeset
846 v52 = *((float *)v45 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
847 if ( LODWORD(v51) == LODWORD(v52) )
Ritor1
parents:
diff changeset
848 {
Ritor1
parents:
diff changeset
849 v53 = *(float *)v44 + 6.7553994e15;
Ritor1
parents:
diff changeset
850 v54 = *((float *)v45 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
851 v55 = LODWORD(v53) == LODWORD(v54);
Ritor1
parents:
diff changeset
852 goto LABEL_58;
Ritor1
parents:
diff changeset
853 }
Ritor1
parents:
diff changeset
854 goto LABEL_59;
Ritor1
parents:
diff changeset
855 }
Ritor1
parents:
diff changeset
856 v56 = v104 + 6.7553994e15;
Ritor1
parents:
diff changeset
857 v57 = *((float *)v45 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
858 if ( LODWORD(v56) != LODWORD(v57) )
Ritor1
parents:
diff changeset
859 goto LABEL_59;
Ritor1
parents:
diff changeset
860 v58 = *(float *)v44 + 6.7553994e15;
Ritor1
parents:
diff changeset
861 v59 = *((float *)v45 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
862 v55 = LODWORD(v58) == LODWORD(v59);
Ritor1
parents:
diff changeset
863 LABEL_58:
Ritor1
parents:
diff changeset
864 if ( !v55 )
Ritor1
parents:
diff changeset
865 {
Ritor1
parents:
diff changeset
866 LABEL_59:
Ritor1
parents:
diff changeset
867 v139 += 48;
Ritor1
parents:
diff changeset
868 v125 += 48;
Ritor1
parents:
diff changeset
869 v134 += 48;
Ritor1
parents:
diff changeset
870 v44 += 48;
Ritor1
parents:
diff changeset
871 ++v123;
Ritor1
parents:
diff changeset
872 ++v130;
Ritor1
parents:
diff changeset
873 v119 = v44;
Ritor1
parents:
diff changeset
874 }
Ritor1
parents:
diff changeset
875 }
Ritor1
parents:
diff changeset
876 if ( v46 )
Ritor1
parents:
diff changeset
877 {
Ritor1
parents:
diff changeset
878 v60 = v130;
Ritor1
parents:
diff changeset
879 v119 += 48;
Ritor1
parents:
diff changeset
880 ++v123;
Ritor1
parents:
diff changeset
881 v134 += 48;
Ritor1
parents:
diff changeset
882 v125 += 48;
Ritor1
parents:
diff changeset
883 v139 += 48;
Ritor1
parents:
diff changeset
884 ++v130;
Ritor1
parents:
diff changeset
885 memcpy(v60, v45 + 4, 0x30u);
Ritor1
parents:
diff changeset
886 v44 = v119;
Ritor1
parents:
diff changeset
887 }
Ritor1
parents:
diff changeset
888 v43 = v108;
Ritor1
parents:
diff changeset
889 v45 += 48;
Ritor1
parents:
diff changeset
890 --v112;
Ritor1
parents:
diff changeset
891 if ( v112 )
Ritor1
parents:
diff changeset
892 continue;
Ritor1
parents:
diff changeset
893 break;
Ritor1
parents:
diff changeset
894 }
Ritor1
parents:
diff changeset
895 if ( v123 < 3
Ritor1
parents:
diff changeset
896 || (v116 = 0,
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
897 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])),
0
Ritor1
parents:
diff changeset
898 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15,
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
899 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y,
0
Ritor1
parents:
diff changeset
900 v123 < 1) )
Ritor1
parents:
diff changeset
901 goto LABEL_112;
Ritor1
parents:
diff changeset
902 v63 = (char *)&array_508690[0].vWorldViewProjX;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
903 v131 = array_508690;
0
Ritor1
parents:
diff changeset
904 v120 = (char *)&array_508690[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
905 v140 = (char *)&array_508690[0].vWorldViewProjY;
Ritor1
parents:
diff changeset
906 v126 = (char *)&array_508690[0].flt_2C;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 141
diff changeset
907 v135 = (char *)&array_508690[0]._rhw;
0
Ritor1
parents:
diff changeset
908 v64 = (char *)&array_508FF0[0].flt_2C;
Ritor1
parents:
diff changeset
909 v113 = v123;
Ritor1
parents:
diff changeset
910 while ( 2 )
Ritor1
parents:
diff changeset
911 {
Ritor1
parents:
diff changeset
912 v99 = *((float *)v64 + 8) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
913 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
914 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
0
Ritor1
parents:
diff changeset
915 if ( v62 != v65 )
Ritor1
parents:
diff changeset
916 {
Ritor1
parents:
diff changeset
917 v66 = v102;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
918 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
919 {
Ritor1
parents:
diff changeset
920 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4));
Ritor1
parents:
diff changeset
921 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5);
Ritor1
parents:
diff changeset
922 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3);
Ritor1
parents:
diff changeset
923 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64;
Ritor1
parents:
diff changeset
924 }
Ritor1
parents:
diff changeset
925 else
Ritor1
parents:
diff changeset
926 {
Ritor1
parents:
diff changeset
927 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8));
Ritor1
parents:
diff changeset
928 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7);
Ritor1
parents:
diff changeset
929 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9);
Ritor1
parents:
diff changeset
930 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12);
Ritor1
parents:
diff changeset
931 }
Ritor1
parents:
diff changeset
932 *(float *)v126 = v68;
Ritor1
parents:
diff changeset
933 *(float *)v140 = v102;
Ritor1
parents:
diff changeset
934 if ( v62 )
Ritor1
parents:
diff changeset
935 {
Ritor1
parents:
diff changeset
936 v70 = v102 + 6.7553994e15;
Ritor1
parents:
diff changeset
937 v71 = *((float *)v64 - 4) + 6.7553994e15;
Ritor1
parents:
diff changeset
938 if ( LODWORD(v70) == LODWORD(v71) )
Ritor1
parents:
diff changeset
939 {
Ritor1
parents:
diff changeset
940 v72 = *(float *)v63 + 6.7553994e15;
Ritor1
parents:
diff changeset
941 v73 = *((float *)v64 - 5) + 6.7553994e15;
Ritor1
parents:
diff changeset
942 v74 = LODWORD(v72) == LODWORD(v73);
Ritor1
parents:
diff changeset
943 goto LABEL_75;
Ritor1
parents:
diff changeset
944 }
Ritor1
parents:
diff changeset
945 goto LABEL_76;
Ritor1
parents:
diff changeset
946 }
Ritor1
parents:
diff changeset
947 v75 = v102 + 6.7553994e15;
Ritor1
parents:
diff changeset
948 v76 = *((float *)v64 + 8) + 6.7553994e15;
Ritor1
parents:
diff changeset
949 if ( LODWORD(v75) != LODWORD(v76) )
Ritor1
parents:
diff changeset
950 goto LABEL_76;
Ritor1
parents:
diff changeset
951 v77 = *(float *)v63 + 6.7553994e15;
Ritor1
parents:
diff changeset
952 v78 = *((float *)v64 + 7) + 6.7553994e15;
Ritor1
parents:
diff changeset
953 v74 = LODWORD(v77) == LODWORD(v78);
Ritor1
parents:
diff changeset
954 LABEL_75:
Ritor1
parents:
diff changeset
955 if ( !v74 )
Ritor1
parents:
diff changeset
956 {
Ritor1
parents:
diff changeset
957 LABEL_76:
Ritor1
parents:
diff changeset
958 v140 += 48;
Ritor1
parents:
diff changeset
959 v126 += 48;
Ritor1
parents:
diff changeset
960 v135 += 48;
Ritor1
parents:
diff changeset
961 v63 += 48;
Ritor1
parents:
diff changeset
962 ++v116;
Ritor1
parents:
diff changeset
963 ++v131;
Ritor1
parents:
diff changeset
964 v120 = v63;
Ritor1
parents:
diff changeset
965 }
Ritor1
parents:
diff changeset
966 }
Ritor1
parents:
diff changeset
967 if ( v65 )
Ritor1
parents:
diff changeset
968 {
Ritor1
parents:
diff changeset
969 v79 = v131;
Ritor1
parents:
diff changeset
970 v120 += 48;
Ritor1
parents:
diff changeset
971 ++v116;
Ritor1
parents:
diff changeset
972 v135 += 48;
Ritor1
parents:
diff changeset
973 v126 += 48;
Ritor1
parents:
diff changeset
974 v140 += 48;
Ritor1
parents:
diff changeset
975 ++v131;
Ritor1
parents:
diff changeset
976 memcpy(v79, v64 + 4, 0x30u);
Ritor1
parents:
diff changeset
977 v63 = v120;
Ritor1
parents:
diff changeset
978 }
Ritor1
parents:
diff changeset
979 v62 = v109;
Ritor1
parents:
diff changeset
980 v64 += 48;
Ritor1
parents:
diff changeset
981 --v113;
Ritor1
parents:
diff changeset
982 if ( v113 )
Ritor1
parents:
diff changeset
983 continue;
Ritor1
parents:
diff changeset
984 break;
Ritor1
parents:
diff changeset
985 }
Ritor1
parents:
diff changeset
986 if ( v116 < 3 )
Ritor1
parents:
diff changeset
987 goto LABEL_112;
Ritor1
parents:
diff changeset
988 v80 = v116;
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
989 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116]));
0
Ritor1
parents:
diff changeset
990 if ( v116 > 0 )
Ritor1
parents:
diff changeset
991 {
Ritor1
parents:
diff changeset
992 v81 = (char *)&array_508690[0].vWorldViewProjX;
Ritor1
parents:
diff changeset
993 v82 = v116;
Ritor1
parents:
diff changeset
994 do
Ritor1
parents:
diff changeset
995 {
Ritor1
parents:
diff changeset
996 LODWORD(v83) = *(int *)v81;
Ritor1
parents:
diff changeset
997 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2);
Ritor1
parents:
diff changeset
998 v84 = v83 + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
999 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X )
0
Ritor1
parents:
diff changeset
1000 {
Ritor1
parents:
diff changeset
1001 v86 = *(float *)v81 + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1002 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X )
0
Ritor1
parents:
diff changeset
1003 goto LABEL_88;
Ritor1
parents:
diff changeset
1004 v85 = v101;
Ritor1
parents:
diff changeset
1005 }
Ritor1
parents:
diff changeset
1006 else
Ritor1
parents:
diff changeset
1007 {
Ritor1
parents:
diff changeset
1008 v85 = v100;
Ritor1
parents:
diff changeset
1009 }
Ritor1
parents:
diff changeset
1010 *(int *)v81 = LODWORD(v85);
Ritor1
parents:
diff changeset
1011 LABEL_88:
Ritor1
parents:
diff changeset
1012 v87 = *((float *)v81 + 1) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1013 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y )
0
Ritor1
parents:
diff changeset
1014 {
Ritor1
parents:
diff changeset
1015 v88 = v102;
Ritor1
parents:
diff changeset
1016 LABEL_92:
Ritor1
parents:
diff changeset
1017 *((int *)v81 + 1) = LODWORD(v88);
Ritor1
parents:
diff changeset
1018 goto LABEL_93;
Ritor1
parents:
diff changeset
1019 }
Ritor1
parents:
diff changeset
1020 v89 = *((float *)v81 + 1) + 6.7553994e15;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
1021 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y )
0
Ritor1
parents:
diff changeset
1022 {
Ritor1
parents:
diff changeset
1023 v88 = v104;
Ritor1
parents:
diff changeset
1024 goto LABEL_92;
Ritor1
parents:
diff changeset
1025 }
Ritor1
parents:
diff changeset
1026 LABEL_93:
Ritor1
parents:
diff changeset
1027 v81 += 48;
Ritor1
parents:
diff changeset
1028 --v82;
Ritor1
parents:
diff changeset
1029 }
Ritor1
parents:
diff changeset
1030 while ( v82 );
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032 v91 = __OFSUB__(v116, 3);
Ritor1
parents:
diff changeset
1033 v90 = v116 - 3 < 0;
Ritor1
parents:
diff changeset
1034 if ( v116 > 3 )
Ritor1
parents:
diff changeset
1035 {
Ritor1
parents:
diff changeset
1036 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1]));
Ritor1
parents:
diff changeset
1037 if ( v116 > 0 )
Ritor1
parents:
diff changeset
1038 {
Ritor1
parents:
diff changeset
1039 v105 = 1;
Ritor1
parents:
diff changeset
1040 do
Ritor1
parents:
diff changeset
1041 {
Ritor1
parents:
diff changeset
1042 v92 = v105;
Ritor1
parents:
diff changeset
1043 v93 = v105 - 1;
Ritor1
parents:
diff changeset
1044 v94 = v105 + 1;
Ritor1
parents:
diff changeset
1045 v95 = v105 + 1;
Ritor1
parents:
diff changeset
1046 if ( v105 - 1 >= v80 )
Ritor1
parents:
diff changeset
1047 v93 -= v80;
Ritor1
parents:
diff changeset
1048 if ( v105 >= v80 )
Ritor1
parents:
diff changeset
1049 v92 = v105 - v80;
Ritor1
parents:
diff changeset
1050 if ( v94 >= v80 )
Ritor1
parents:
diff changeset
1051 v95 = v94 - v80;
Ritor1
parents:
diff changeset
1052 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
Ritor1
parents:
diff changeset
1053 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY)
Ritor1
parents:
diff changeset
1054 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
Ritor1
parents:
diff changeset
1055 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 )
Ritor1
parents:
diff changeset
1056 {
Ritor1
parents:
diff changeset
1057 ++v105;
Ritor1
parents:
diff changeset
1058 }
Ritor1
parents:
diff changeset
1059 else
Ritor1
parents:
diff changeset
1060 {
Ritor1
parents:
diff changeset
1061 v96 = v105;
Ritor1
parents:
diff changeset
1062 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) )
Ritor1
parents:
diff changeset
1063 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2));
Ritor1
parents:
diff changeset
1064 --v80;
Ritor1
parents:
diff changeset
1065 }
Ritor1
parents:
diff changeset
1066 }
Ritor1
parents:
diff changeset
1067 while ( v105 - 1 < v80 );
Ritor1
parents:
diff changeset
1068 }
Ritor1
parents:
diff changeset
1069 v91 = __OFSUB__(v80, 3);
Ritor1
parents:
diff changeset
1070 v90 = v80 - 3 < 0;
Ritor1
parents:
diff changeset
1071 }
Ritor1
parents:
diff changeset
1072 if ( v90 ^ v91 )
Ritor1
parents:
diff changeset
1073 LABEL_112:
Ritor1
parents:
diff changeset
1074 result = 0;
Ritor1
parents:
diff changeset
1075 else
Ritor1
parents:
diff changeset
1076 result = v80;
Ritor1
parents:
diff changeset
1077 return result;
Ritor1
parents:
diff changeset
1078 }
Ritor1
parents:
diff changeset
1079
Ritor1
parents:
diff changeset
1080 //----- (0042620A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1081 bool __thiscall sr_42620A(RenderVertexSoft *p)
Ritor1
parents:
diff changeset
1082 {
Ritor1
parents:
diff changeset
1083 __int16 v1; // fps@1
Ritor1
parents:
diff changeset
1084 unsigned __int8 v2; // c0@2
Ritor1
parents:
diff changeset
1085 char v3; // c2@2
Ritor1
parents:
diff changeset
1086 unsigned __int8 v4; // c3@2
Ritor1
parents:
diff changeset
1087 bool result; // eax@2
Ritor1
parents:
diff changeset
1088 unsigned __int8 v6; // c0@4
Ritor1
parents:
diff changeset
1089 char v7; // c2@4
Ritor1
parents:
diff changeset
1090 unsigned __int8 v8; // c3@4
Ritor1
parents:
diff changeset
1091 unsigned __int8 v9; // c0@6
Ritor1
parents:
diff changeset
1092 char v10; // c2@6
Ritor1
parents:
diff changeset
1093 unsigned __int8 v11; // c3@6
Ritor1
parents:
diff changeset
1094 double v12; // st6@7
Ritor1
parents:
diff changeset
1095 float v13; // ST04_4@7
Ritor1
parents:
diff changeset
1096 float v14; // ST00_4@7
Ritor1
parents:
diff changeset
1097 double v15; // st7@7
Ritor1
parents:
diff changeset
1098 double v16; // st6@8
Ritor1
parents:
diff changeset
1099 float v17; // ST04_4@8
Ritor1
parents:
diff changeset
1100 float v18; // ST00_4@8
Ritor1
parents:
diff changeset
1101 double v19; // st7@8
Ritor1
parents:
diff changeset
1102
Ritor1
parents:
diff changeset
1103 //UNDEF(v1);
Ritor1
parents:
diff changeset
1104 if ( p->vWorldViewPosition.x < 300.0
Ritor1
parents:
diff changeset
1105 || (v2 = 300.0 < p[1].vWorldViewPosition.x,
Ritor1
parents:
diff changeset
1106 v3 = 0,
Ritor1
parents:
diff changeset
1107 v4 = 300.0 == p[1].vWorldViewPosition.x,
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1108 //BYTE1(result) = HIBYTE(v1),
0
Ritor1
parents:
diff changeset
1109 !(v2 | v4)) )
Ritor1
parents:
diff changeset
1110 {
Ritor1
parents:
diff changeset
1111 if ( p->vWorldViewPosition.x < 300.0 )
Ritor1
parents:
diff changeset
1112 {
Ritor1
parents:
diff changeset
1113 v6 = 300.0 < p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1114 v7 = 0;
Ritor1
parents:
diff changeset
1115 v8 = 300.0 == p[1].vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1116 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
1117 if ( !(v6 | v8) )
Ritor1
parents:
diff changeset
1118 {
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1119 //LOBYTE(result) = 0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1120 return false;
0
Ritor1
parents:
diff changeset
1121 }
Ritor1
parents:
diff changeset
1122 }
Ritor1
parents:
diff changeset
1123 v9 = 300.0 < p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1124 v10 = 0;
Ritor1
parents:
diff changeset
1125 v11 = 300.0 == p->vWorldViewPosition.x;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1126 //BYTE1(result) = HIBYTE(v1);
0
Ritor1
parents:
diff changeset
1127 if ( v9 | v11 )
Ritor1
parents:
diff changeset
1128 {
Ritor1
parents:
diff changeset
1129 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x);
Ritor1
parents:
diff changeset
1130 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16;
Ritor1
parents:
diff changeset
1131 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16;
Ritor1
parents:
diff changeset
1132 v19 = 300.0 - p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1133 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1134 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y;
Ritor1
parents:
diff changeset
1135 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z;
Ritor1
parents:
diff changeset
1136 }
Ritor1
parents:
diff changeset
1137 else
Ritor1
parents:
diff changeset
1138 {
Ritor1
parents:
diff changeset
1139 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x);
Ritor1
parents:
diff changeset
1140 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12;
Ritor1
parents:
diff changeset
1141 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12;
Ritor1
parents:
diff changeset
1142 v15 = 300.0 - p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1143 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x;
Ritor1
parents:
diff changeset
1144 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
1145 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
1146 }
Ritor1
parents:
diff changeset
1147 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1148 //LOBYTE(result) = 1;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 907
diff changeset
1149 return true;
0
Ritor1
parents:
diff changeset
1150 }
Ritor1
parents:
diff changeset
1151
Ritor1
parents:
diff changeset
1152 //----- (004268E3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1153 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor)
Ritor1
parents:
diff changeset
1154 {
Ritor1
parents:
diff changeset
1155 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
1156 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
1157 int v3; // eax@1
Ritor1
parents:
diff changeset
1158 int v4; // edx@1
Ritor1
parents:
diff changeset
1159 unsigned int v5; // ecx@1
Ritor1
parents:
diff changeset
1160
Ritor1
parents:
diff changeset
1161 v1 = uColor >> 9;
Ritor1
parents:
diff changeset
1162 v2 = uColor >> 6;
Ritor1
parents:
diff changeset
1163 LOWORD(v1) = (uColor >> 9) & 0x7C00;
Ritor1
parents:
diff changeset
1164 LOWORD(v2) = (uColor >> 6) & 0x3E0;
Ritor1
parents:
diff changeset
1165 v3 = v2 | v1;
Ritor1
parents:
diff changeset
1166 v4 = (unsigned __int8)uColor >> 3;
Ritor1
parents:
diff changeset
1167 v5 = uColor >> 16;
Ritor1
parents:
diff changeset
1168 LOWORD(v5) = v5 & 0x8000;
Ritor1
parents:
diff changeset
1169 return v5 | v4 | v3;
Ritor1
parents:
diff changeset
1170 }
Ritor1
parents:
diff changeset
1171
Ritor1
parents:
diff changeset
1172 //----- (0042690D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1173 int __fastcall _42690D_colors_cvt(unsigned int a1)
Ritor1
parents:
diff changeset
1174 {
Ritor1
parents:
diff changeset
1175 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
1176 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
1177
Ritor1
parents:
diff changeset
1178 v1 = a1 >> 8;
Ritor1
parents:
diff changeset
1179 v2 = a1 >> 5;
Ritor1
parents:
diff changeset
1180 LOWORD(v1) = (a1 >> 8) & 0xF800;
Ritor1
parents:
diff changeset
1181 LOWORD(v2) = (a1 >> 5) & 0x7E0;
Ritor1
parents:
diff changeset
1182 return ((unsigned __int8)a1 >> 3) | v2 | v1;
Ritor1
parents:
diff changeset
1183 }
Ritor1
parents:
diff changeset
1184 //----- (00426947) --------------------------------------------------------
Ritor1
parents:
diff changeset
1185 void __cdecl sub_426947()
Ritor1
parents:
diff changeset
1186 {
893
4676774b225c GuildDialogue fix
Ritor1
parents: 890
diff changeset
1187 stru_50C198.field_0 = 0;
0
Ritor1
parents:
diff changeset
1188 dword_50C994 = 0;
Ritor1
parents:
diff changeset
1189 dword_50C998_turnbased_icon_1A = 0;
Ritor1
parents:
diff changeset
1190 }
Ritor1
parents:
diff changeset
1191 // 50C968: using guessed type int dword_50C968;
Ritor1
parents:
diff changeset
1192 // 50C994: using guessed type int dword_50C994;
Ritor1
parents:
diff changeset
1193 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
Ritor1
parents:
diff changeset
1194
Ritor1
parents:
diff changeset
1195 //----- (004269A2) --------------------------------------------------------
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1196 void __fastcall GivePartyExp(unsigned int pEXPNum)
0
Ritor1
parents:
diff changeset
1197 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1198 signed int pActivePlayerCount; // ecx@1
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1199 int pLearningPercent; // eax@13
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1200
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1201 pActivePlayerCount = 0;
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1202 for ( uint i = 0; i < 4; ++i )
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1203 {
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1204 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] )
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1205 pActivePlayerCount ++;
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1206 }
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1207 if ( pActivePlayerCount )
0
Ritor1
parents:
diff changeset
1208 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1209 pEXPNum = pEXPNum / pActivePlayerCount;
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1210 for ( uint i = 0; i < 4; ++i )
0
Ritor1
parents:
diff changeset
1211 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1212 if ( !pParty->pPlayers[i].pConditions[13] && !pParty->pPlayers[i].pConditions[14] && !pParty->pPlayers[i].pConditions[15] && !pParty->pPlayers[i].pConditions[16] )
0
Ritor1
parents:
diff changeset
1213 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1214 if ( pEXPNum )
0
Ritor1
parents:
diff changeset
1215 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1216 pLearningPercent = pParty->pPlayers[i].GetLearningPercent();
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1217 pEXPNum = pEXPNum + pEXPNum * pLearningPercent / 100;
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1218 pParty->pPlayers[i].uExperience += pEXPNum;
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1219 if ( pParty->pPlayers[i].uExperience > 4000000000i64 )
0
Ritor1
parents:
diff changeset
1220 {
958
9c2d08e42ed3 GivePartyExp
Ritor1
parents: 951
diff changeset
1221 pParty->pPlayers[i].uExperience = 0;
0
Ritor1
parents:
diff changeset
1222 }
Ritor1
parents:
diff changeset
1223 }
Ritor1
parents:
diff changeset
1224 }
Ritor1
parents:
diff changeset
1225 }
Ritor1
parents:
diff changeset
1226 }
Ritor1
parents:
diff changeset
1227 }
Ritor1
parents:
diff changeset
1228
Ritor1
parents:
diff changeset
1229 //----- (00426A5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1230 void stru319::LootActor(Actor *pActor)
Ritor1
parents:
diff changeset
1231 {
Ritor1
parents:
diff changeset
1232 signed int v2; // edi@1
Ritor1
parents:
diff changeset
1233 char v3; // zf@1
Ritor1
parents:
diff changeset
1234 unsigned int v4; // eax@13
Ritor1
parents:
diff changeset
1235 unsigned int v5; // esi@13
Ritor1
parents:
diff changeset
1236 int v6; // eax@14
Ritor1
parents:
diff changeset
1237 unsigned __int8 v7; // al@30
Ritor1
parents:
diff changeset
1238 Party *v8; // esi@34
Ritor1
parents:
diff changeset
1239 char *v9; // [sp-4h] [bp-3Ch]@10
Ritor1
parents:
diff changeset
1240 char *v10; // [sp-4h] [bp-3Ch]@31
Ritor1
parents:
diff changeset
1241 char *v11; // [sp-4h] [bp-3Ch]@38
Ritor1
parents:
diff changeset
1242 ItemGen Dst; // [sp+Ch] [bp-2Ch]@1
Ritor1
parents:
diff changeset
1243 int v13; // [sp+30h] [bp-8h]@1
Ritor1
parents:
diff changeset
1244 int v14; // [sp+34h] [bp-4h]@1
Ritor1
parents:
diff changeset
1245
Ritor1
parents:
diff changeset
1246 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1247 Dst.Reset();
Ritor1
parents:
diff changeset
1248 v2 = 0;
Ritor1
parents:
diff changeset
1249 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0;
Ritor1
parents:
diff changeset
1250 v13 = 0;
Ritor1
parents:
diff changeset
1251 v14 = 0;
Ritor1
parents:
diff changeset
1252 if ( v3 )
Ritor1
parents:
diff changeset
1253 {
Ritor1
parents:
diff changeset
1254 if ( !pActor->pMonsterInfo.uTreasureDiceRolls )
Ritor1
parents:
diff changeset
1255 goto LABEL_9;
Ritor1
parents:
diff changeset
1256 do
Ritor1
parents:
diff changeset
1257 {
Ritor1
parents:
diff changeset
1258 ++v2;
Ritor1
parents:
diff changeset
1259 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1;
Ritor1
parents:
diff changeset
1260 }
Ritor1
parents:
diff changeset
1261 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls );
Ritor1
parents:
diff changeset
1262 }
Ritor1
parents:
diff changeset
1263 else
Ritor1
parents:
diff changeset
1264 {
Ritor1
parents:
diff changeset
1265 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 )
Ritor1
parents:
diff changeset
1266 goto LABEL_9;
377
243418228760 GetIdentifiedName
Gloval
parents: 370
diff changeset
1267 v14 = pActor->array_000234[3].uSpecEnchantmentType;
0
Ritor1
parents:
diff changeset
1268 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
1269 }
Ritor1
parents:
diff changeset
1270 if ( v14 )
Ritor1
parents:
diff changeset
1271 {
Ritor1
parents:
diff changeset
1272 party_finds_gold(v14, 0);
Ritor1
parents:
diff changeset
1273 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
1274 }
Ritor1
parents:
diff changeset
1275 LABEL_9:
Ritor1
parents:
diff changeset
1276 if ( pActor->uCarriedItemID )
Ritor1
parents:
diff changeset
1277 {
Ritor1
parents:
diff changeset
1278 Dst.Reset();
Ritor1
parents:
diff changeset
1279 Dst.uItemID = pActor->uCarriedItemID;
Ritor1
parents:
diff changeset
1280 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1281 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1282 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
0
Ritor1
parents:
diff changeset
1283 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1284 sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1285 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1286 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
1287 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
1288 if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 )
Ritor1
parents:
diff changeset
1289 {
Ritor1
parents:
diff changeset
1290 v5 = Dst.uItemID;
Ritor1
parents:
diff changeset
1291 v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1;
Ritor1
parents:
diff changeset
1292 Dst.uNumCharges = v6;
Ritor1
parents:
diff changeset
1293 Dst.uMaxCharges = v6;
Ritor1
parents:
diff changeset
1294 v4 = Dst.uItemID;
Ritor1
parents:
diff changeset
1295 }
Ritor1
parents:
diff changeset
1296 if ( pItemsTable->pItems[v5].uEquipType == 14 && v4 != 220 )
570
f54481c85df8 itemgen working, i hope
Gloval
parents: 569
diff changeset
1297 Dst.uEnchantmentType = 2 * rand() % 4 + 2;
0
Ritor1
parents:
diff changeset
1298 pItemsTable->SetSpecialBonus(&Dst);
Ritor1
parents:
diff changeset
1299 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1300 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1301 pActor->uCarriedItemID = 0;
Ritor1
parents:
diff changeset
1302 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
1303 {
Ritor1
parents:
diff changeset
1304 if ( !pParty->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
1305 {
Ritor1
parents:
diff changeset
1306 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1307 pParty->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
1308 }
Ritor1
parents:
diff changeset
1309 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
1310 }
Ritor1
parents:
diff changeset
1311 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
1312 {
Ritor1
parents:
diff changeset
1313 if ( !pParty->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
1314 {
Ritor1
parents:
diff changeset
1315 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1316 pParty->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
1317 }
Ritor1
parents:
diff changeset
1318 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
1319 }
Ritor1
parents:
diff changeset
1320 LABEL_55:
Ritor1
parents:
diff changeset
1321 pActor->Remove();
Ritor1
parents:
diff changeset
1322 return;
Ritor1
parents:
diff changeset
1323 }
Ritor1
parents:
diff changeset
1324 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes )
Ritor1
parents:
diff changeset
1325 {
Ritor1
parents:
diff changeset
1326 if ( pActor->array_000234[3].uItemID )
Ritor1
parents:
diff changeset
1327 {
Ritor1
parents:
diff changeset
1328 memcpy(&Dst, &pActor->array_000234[3], sizeof(Dst));
Ritor1
parents:
diff changeset
1329 pActor->array_000234[3].Reset();
Ritor1
parents:
diff changeset
1330 v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1331 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1332 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
0
Ritor1
parents:
diff changeset
1333 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1334 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1335 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1336 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1337 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1338 v13 = 1;
Ritor1
parents:
diff changeset
1339 }
Ritor1
parents:
diff changeset
1340 goto LABEL_44;
Ritor1
parents:
diff changeset
1341 }
Ritor1
parents:
diff changeset
1342 if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 )
Ritor1
parents:
diff changeset
1343 {
Ritor1
parents:
diff changeset
1344 LABEL_44:
Ritor1
parents:
diff changeset
1345 v8 = pParty;
Ritor1
parents:
diff changeset
1346 goto LABEL_45;
Ritor1
parents:
diff changeset
1347 }
Ritor1
parents:
diff changeset
1348 pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
Ritor1
parents:
diff changeset
1349 v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1350 if ( v14 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1351 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);
0
Ritor1
parents:
diff changeset
1352 else
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1353 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1354 ShowStatusBarString(pTmpBuf2.data(), 2u);
0
Ritor1
parents:
diff changeset
1355 v8 = pParty;
Ritor1
parents:
diff changeset
1356 if ( !pParty->AddItem(&Dst) )
Ritor1
parents:
diff changeset
1357 pParty->SetHoldingItem(&Dst);
Ritor1
parents:
diff changeset
1358 v13 = 1;
Ritor1
parents:
diff changeset
1359 LABEL_45:
Ritor1
parents:
diff changeset
1360 if ( pActor->array_000234[0].uItemID )
Ritor1
parents:
diff changeset
1361 {
Ritor1
parents:
diff changeset
1362 if ( !v8->AddItem(pActor->array_000234) )
Ritor1
parents:
diff changeset
1363 {
Ritor1
parents:
diff changeset
1364 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1365 v8->SetHoldingItem(pActor->array_000234);
Ritor1
parents:
diff changeset
1366 v13 = 1;
Ritor1
parents:
diff changeset
1367 }
Ritor1
parents:
diff changeset
1368 pActor->array_000234[0].Reset();
Ritor1
parents:
diff changeset
1369 }
Ritor1
parents:
diff changeset
1370 if ( pActor->array_000234[1].uItemID )
Ritor1
parents:
diff changeset
1371 {
Ritor1
parents:
diff changeset
1372 if ( !v8->AddItem(&pActor->array_000234[1]) )
Ritor1
parents:
diff changeset
1373 {
Ritor1
parents:
diff changeset
1374 sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
1375 v8->SetHoldingItem(&pActor->array_000234[1]);
Ritor1
parents:
diff changeset
1376 v13 = 1;
Ritor1
parents:
diff changeset
1377 }
Ritor1
parents:
diff changeset
1378 pActor->array_000234[1].Reset();
Ritor1
parents:
diff changeset
1379 }
Ritor1
parents:
diff changeset
1380 if ( !v13 || rand() % 100 < 90 )
Ritor1
parents:
diff changeset
1381 goto LABEL_55;
Ritor1
parents:
diff changeset
1382 }
Ritor1
parents:
diff changeset
1383
Ritor1
parents:
diff changeset
1384 //----- (00426E10) --------------------------------------------------------
Ritor1
parents:
diff changeset
1385 int stru319::which_player_would_attack(Actor *pActor)
Ritor1
parents:
diff changeset
1386 {
Ritor1
parents:
diff changeset
1387 signed int v2; // ebx@1
Ritor1
parents:
diff changeset
1388 int v3; // ecx@2
Ritor1
parents:
diff changeset
1389 signed int v4; // edx@3
Ritor1
parents:
diff changeset
1390 char v5; // zf@3
Ritor1
parents:
diff changeset
1391 unsigned int v6; // eax@3
Ritor1
parents:
diff changeset
1392 int v7; // eax@6
Ritor1
parents:
diff changeset
1393 int v8; // eax@7
Ritor1
parents:
diff changeset
1394 int v9; // eax@8
Ritor1
parents:
diff changeset
1395 int v10; // eax@9
Ritor1
parents:
diff changeset
1396 int v11; // eax@10
Ritor1
parents:
diff changeset
1397 int v12; // eax@11
Ritor1
parents:
diff changeset
1398 int v13; // esi@35
Ritor1
parents:
diff changeset
1399 signed int v14; // edi@37
Ritor1
parents:
diff changeset
1400 enum CHARACTER_RACE v15; // eax@44
Ritor1
parents:
diff changeset
1401 Player *v16; // ecx@47
Ritor1
parents:
diff changeset
1402 unsigned __int8 v17; // sf@50
Ritor1
parents:
diff changeset
1403 unsigned __int8 v18; // of@50
Ritor1
parents:
diff changeset
1404 int v19; // esi@52
Ritor1
parents:
diff changeset
1405 Player *v20; // ecx@53
Ritor1
parents:
diff changeset
1406 int result; // eax@57
Ritor1
parents:
diff changeset
1407 int v22[16]; // [sp+8h] [bp-140h]@3
Ritor1
parents:
diff changeset
1408 int v23[60]; // [sp+48h] [bp-100h]@48
Ritor1
parents:
diff changeset
1409 int v24; // [sp+138h] [bp-10h]@2
Ritor1
parents:
diff changeset
1410 int v25; // [sp+13Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
1411 int v26; // [sp+140h] [bp-8h]@1
Ritor1
parents:
diff changeset
1412 int v27; // [sp+144h] [bp-4h]@1
Ritor1
parents:
diff changeset
1413
Ritor1
parents:
diff changeset
1414 v27 = -1;
Ritor1
parents:
diff changeset
1415 v26 = -1;
Ritor1
parents:
diff changeset
1416 v25 = -1;
Ritor1
parents:
diff changeset
1417 v2 = 0;
Ritor1
parents:
diff changeset
1418 if ( pActor->pMonsterInfo.uAttackPreference )
Ritor1
parents:
diff changeset
1419 {
Ritor1
parents:
diff changeset
1420 v3 = 0;
Ritor1
parents:
diff changeset
1421 v24 = 0;
Ritor1
parents:
diff changeset
1422 do
Ritor1
parents:
diff changeset
1423 {
Ritor1
parents:
diff changeset
1424 v4 = 1;
Ritor1
parents:
diff changeset
1425 v6 = pActor->pMonsterInfo.uAttackPreference & (1 << v3);
Ritor1
parents:
diff changeset
1426 v5 = (pActor->pMonsterInfo.uAttackPreference & (1 << v3)) == 0;
Ritor1
parents:
diff changeset
1427 v22[v3] = v6;
Ritor1
parents:
diff changeset
1428 if ( !v5 )
Ritor1
parents:
diff changeset
1429 {
Ritor1
parents:
diff changeset
1430 if ( (signed int)v6 > 128 )
Ritor1
parents:
diff changeset
1431 {
Ritor1
parents:
diff changeset
1432 switch ( v6 )
Ritor1
parents:
diff changeset
1433 {
Ritor1
parents:
diff changeset
1434 case 0x100u:
Ritor1
parents:
diff changeset
1435 v27 = 8;
Ritor1
parents:
diff changeset
1436 break;
Ritor1
parents:
diff changeset
1437 case 0x200u:
Ritor1
parents:
diff changeset
1438 v25 = 0;
Ritor1
parents:
diff changeset
1439 break;
Ritor1
parents:
diff changeset
1440 case 0x400u:
Ritor1
parents:
diff changeset
1441 v25 = 1;
Ritor1
parents:
diff changeset
1442 break;
Ritor1
parents:
diff changeset
1443 case 0x800u:
Ritor1
parents:
diff changeset
1444 v26 = 0;
Ritor1
parents:
diff changeset
1445 break;
Ritor1
parents:
diff changeset
1446 case 0x1000u:
Ritor1
parents:
diff changeset
1447 v26 = 1;
Ritor1
parents:
diff changeset
1448 break;
Ritor1
parents:
diff changeset
1449 case 0x2000u:
Ritor1
parents:
diff changeset
1450 v26 = 3;
Ritor1
parents:
diff changeset
1451 break;
Ritor1
parents:
diff changeset
1452 case 0x4000u:
Ritor1
parents:
diff changeset
1453 v26 = 2;
Ritor1
parents:
diff changeset
1454 break;
Ritor1
parents:
diff changeset
1455 }
Ritor1
parents:
diff changeset
1456 }
Ritor1
parents:
diff changeset
1457 else
Ritor1
parents:
diff changeset
1458 {
Ritor1
parents:
diff changeset
1459 if ( v6 == 128 )
Ritor1
parents:
diff changeset
1460 {
Ritor1
parents:
diff changeset
1461 v27 = 4;
Ritor1
parents:
diff changeset
1462 }
Ritor1
parents:
diff changeset
1463 else
Ritor1
parents:
diff changeset
1464 {
Ritor1
parents:
diff changeset
1465 v7 = v6 - 1;
Ritor1
parents:
diff changeset
1466 if ( v7 )
Ritor1
parents:
diff changeset
1467 {
Ritor1
parents:
diff changeset
1468 v8 = v7 - 1;
Ritor1
parents:
diff changeset
1469 if ( v8 )
Ritor1
parents:
diff changeset
1470 {
Ritor1
parents:
diff changeset
1471 v9 = v8 - 2;
Ritor1
parents:
diff changeset
1472 if ( v9 )
Ritor1
parents:
diff changeset
1473 {
Ritor1
parents:
diff changeset
1474 v10 = v9 - 4;
Ritor1
parents:
diff changeset
1475 if ( v10 )
Ritor1
parents:
diff changeset
1476 {
Ritor1
parents:
diff changeset
1477 v11 = v10 - 8;
Ritor1
parents:
diff changeset
1478 if ( v11 )
Ritor1
parents:
diff changeset
1479 {
Ritor1
parents:
diff changeset
1480 v12 = v11 - 16;
Ritor1
parents:
diff changeset
1481 if ( v12 )
Ritor1
parents:
diff changeset
1482 {
Ritor1
parents:
diff changeset
1483 if ( v12 == 32 )
Ritor1
parents:
diff changeset
1484 v27 = 20;
Ritor1
parents:
diff changeset
1485 }
Ritor1
parents:
diff changeset
1486 else
Ritor1
parents:
diff changeset
1487 {
Ritor1
parents:
diff changeset
1488 v27 = 32;
Ritor1
parents:
diff changeset
1489 }
Ritor1
parents:
diff changeset
1490 }
Ritor1
parents:
diff changeset
1491 else
Ritor1
parents:
diff changeset
1492 {
Ritor1
parents:
diff changeset
1493 v27 = 24;
Ritor1
parents:
diff changeset
1494 }
Ritor1
parents:
diff changeset
1495 }
Ritor1
parents:
diff changeset
1496 else
Ritor1
parents:
diff changeset
1497 {
Ritor1
parents:
diff changeset
1498 v27 = 28;
Ritor1
parents:
diff changeset
1499 }
Ritor1
parents:
diff changeset
1500 }
Ritor1
parents:
diff changeset
1501 else
Ritor1
parents:
diff changeset
1502 {
Ritor1
parents:
diff changeset
1503 v27 = 16;
Ritor1
parents:
diff changeset
1504 }
Ritor1
parents:
diff changeset
1505 }
Ritor1
parents:
diff changeset
1506 else
Ritor1
parents:
diff changeset
1507 {
Ritor1
parents:
diff changeset
1508 v27 = 12;
Ritor1
parents:
diff changeset
1509 }
Ritor1
parents:
diff changeset
1510 }
Ritor1
parents:
diff changeset
1511 else
Ritor1
parents:
diff changeset
1512 {
Ritor1
parents:
diff changeset
1513 v27 = 0;
Ritor1
parents:
diff changeset
1514 }
Ritor1
parents:
diff changeset
1515 }
Ritor1
parents:
diff changeset
1516 }
Ritor1
parents:
diff changeset
1517 v2 = 0;
Ritor1
parents:
diff changeset
1518 v13 = 0;
Ritor1
parents:
diff changeset
1519 while ( 1 )
Ritor1
parents:
diff changeset
1520 {
Ritor1
parents:
diff changeset
1521 v14 = 0;
135
9b0d651821f1 Party creation screen: sorcerer class icon fixed
Nomad
parents: 112
diff changeset
1522 if ( v27 != -1 && v27 == pPlayers[v13 + 1]->classType )
0
Ritor1
parents:
diff changeset
1523 v14 = v4;
Ritor1
parents:
diff changeset
1524 if ( v25 != -1 && v25 == pPlayers[v13 + 1]->uSex )
Ritor1
parents:
diff changeset
1525 v14 = v4;
Ritor1
parents:
diff changeset
1526 if ( v26 != -1 )
Ritor1
parents:
diff changeset
1527 {
Ritor1
parents:
diff changeset
1528 v15 = pPlayers[v13 + 1]->GetRace();
Ritor1
parents:
diff changeset
1529 if ( v26 == v15 )
Ritor1
parents:
diff changeset
1530 v14 = 1;
Ritor1
parents:
diff changeset
1531 }
Ritor1
parents:
diff changeset
1532 if ( v14 == 1 )
Ritor1
parents:
diff changeset
1533 {
Ritor1
parents:
diff changeset
1534 v16 = pPlayers[v13 + 1];
Ritor1
parents:
diff changeset
1535 if ( !(v16->pConditions[12] | v16->pConditions[13] | v16->pConditions[14] | v16->pConditions[15] | v16->pConditions[16]) )
Ritor1
parents:
diff changeset
1536 v23[v2++] = v13;
Ritor1
parents:
diff changeset
1537 }
Ritor1
parents:
diff changeset
1538 ++v13;
Ritor1
parents:
diff changeset
1539 if ( v13 >= 4 )
Ritor1
parents:
diff changeset
1540 break;
Ritor1
parents:
diff changeset
1541 v4 = 1;
Ritor1
parents:
diff changeset
1542 }
Ritor1
parents:
diff changeset
1543 }
Ritor1
parents:
diff changeset
1544 v3 = v24 + 1;
Ritor1
parents:
diff changeset
1545 v18 = __OFSUB__(v24 + 1, 15);
Ritor1
parents:
diff changeset
1546 v17 = v24++ - 14 < 0;
Ritor1
parents:
diff changeset
1547 }
Ritor1
parents:
diff changeset
1548 while ( v17 ^ v18 );
Ritor1
parents:
diff changeset
1549 if ( v2 )
Ritor1
parents:
diff changeset
1550 goto LABEL_61;
Ritor1
parents:
diff changeset
1551 }
Ritor1
parents:
diff changeset
1552 v19 = 0;
Ritor1
parents:
diff changeset
1553 do
Ritor1
parents:
diff changeset
1554 {
Ritor1
parents:
diff changeset
1555 v20 = pPlayers[v19 + 1];
Ritor1
parents:
diff changeset
1556 if ( !(v20->pConditions[12] | v20->pConditions[13] | v20->pConditions[14] | v20->pConditions[15] | v20->pConditions[16]) )
Ritor1
parents:
diff changeset
1557 v23[v2++] = v19;
Ritor1
parents:
diff changeset
1558 ++v19;
Ritor1
parents:
diff changeset
1559 }
Ritor1
parents:
diff changeset
1560 while ( v19 < 4 );
Ritor1
parents:
diff changeset
1561 if ( v2 )
Ritor1
parents:
diff changeset
1562 LABEL_61:
Ritor1
parents:
diff changeset
1563 result = v23[rand() % v2];
Ritor1
parents:
diff changeset
1564 else
Ritor1
parents:
diff changeset
1565 result = 0;
Ritor1
parents:
diff changeset
1566 return result;
Ritor1
parents:
diff changeset
1567 }
Ritor1
parents:
diff changeset
1568
Ritor1
parents:
diff changeset
1569 //----- (0042704B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1570 bool stru319::special_ability_use_check(Actor *pActor, int a2)
Ritor1
parents:
diff changeset
1571 {
Ritor1
parents:
diff changeset
1572 stru319 *v3; // edi@1
Ritor1
parents:
diff changeset
1573 signed int v4; // ebx@5
Ritor1
parents:
diff changeset
1574 signed int v5; // edi@5
Ritor1
parents:
diff changeset
1575
Ritor1
parents:
diff changeset
1576 v3 = this;
Ritor1
parents:
diff changeset
1577 if ( pActor->pMonsterInfo.uSpecialAbilityType == 2
Ritor1
parents:
diff changeset
1578 && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
Ritor1
parents:
diff changeset
1579 && rand() % 100 < 5 )
Ritor1
parents:
diff changeset
1580 pActor->_44FD29(a2);
Ritor1
parents:
diff changeset
1581 v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID);
Ritor1
parents:
diff changeset
1582 v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID);
Ritor1
parents:
diff changeset
1583 if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance )
Ritor1
parents:
diff changeset
1584 return 2;
Ritor1
parents:
diff changeset
1585 if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance )
Ritor1
parents:
diff changeset
1586 return 3;
Ritor1
parents:
diff changeset
1587 return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance;
Ritor1
parents:
diff changeset
1588 }
Ritor1
parents:
diff changeset
1589
Ritor1
parents:
diff changeset
1590 //----- (00427102) --------------------------------------------------------
Ritor1
parents:
diff changeset
1591 int stru319::_427102(Actor *pActor, signed int a2)
Ritor1
parents:
diff changeset
1592 {
Ritor1
parents:
diff changeset
1593 unsigned __int8 v3; // cf@11
Ritor1
parents:
diff changeset
1594 unsigned __int8 v4; // zf@11
Ritor1
parents:
diff changeset
1595 SpellBuff *v6; // ecx@46
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1596 Player *v7; // esi@49
0
Ritor1
parents:
diff changeset
1597 signed int v8; // edx@50
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1598 SpellBuff *v9; // ecx@50
0
Ritor1
parents:
diff changeset
1599
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1600 switch(a2)
0
Ritor1
parents:
diff changeset
1601 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1602 case 77:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1603 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1604 if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1605 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1606 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1607 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1608 case 80:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1609 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1610 v6 = pParty->pPartyBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1611 while ( (signed __int64)v6->uExpireTime <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1612 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1613 ++v6;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
1614 if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1615 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1616 v7 = pParty->pPlayers;//[0].pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1617 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1618 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1619 while ( v9->uExpireTime <= 0i64 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1620 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1621 ++v8;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1622 ++v9;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1623 if ( v8 >= 24 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1624 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1625 ++v7;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1626 if ( v7 <= &pParty->pPlayers[3] )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1627 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1628 v8 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1629 v9 = v7->pPlayerBuffs;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1630 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1631 else
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1632 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1633 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1634 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1635 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1636 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1637 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1638 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1639 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1640 case 85:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1641 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1642 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1643 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1644 if ( SHIDWORD(pActor->pActorBuffs[13].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1645 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1646 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1647 v4 = LODWORD(pActor->pActorBuffs[13].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1648 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1649 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1650 case 86:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1651 {
0
Ritor1
parents:
diff changeset
1652 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) < 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1653 return 1;
0
Ritor1
parents:
diff changeset
1654 if ( SHIDWORD(pActor->pActorBuffs[14].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1655 return 0;
0
Ritor1
parents:
diff changeset
1656 v3 = 0;
Ritor1
parents:
diff changeset
1657 v4 = LODWORD(pActor->pActorBuffs[14].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1658 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1659 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1660 case 95:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1661 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1662 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1663 return 1;
0
Ritor1
parents:
diff changeset
1664 if ( SHIDWORD(pActor->pActorBuffs[20].uExpireTime) > 0 )
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1665 return 0;
0
Ritor1
parents:
diff changeset
1666 v3 = 0;
Ritor1
parents:
diff changeset
1667 v4 = LODWORD(pActor->pActorBuffs[20].uExpireTime) == 0;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1668 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1669 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1670 case 73:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1671 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1672 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1673 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1674 if ( SHIDWORD(pActor->pActorBuffs[21].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1675 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1676 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1677 v4 = LODWORD(pActor->pActorBuffs[21].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1678 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1679 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1680 case 5:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1681 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1682 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1683 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1684 if ( SHIDWORD(pActor->pActorBuffs[19].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1685 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1686 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1687 v4 = LODWORD(pActor->pActorBuffs[19].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1688 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1689 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1690 case 17:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1691 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1692 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1693 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1694 if ( SHIDWORD(pActor->pActorBuffs[15].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1695 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1696 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1697 v4 = LODWORD(pActor->pActorBuffs[15].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1698 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1699 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1700 case 38:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1701 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1702 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1703 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1704 if ( SHIDWORD(pActor->pActorBuffs[16].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1705 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1706 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1707 v4 = LODWORD(pActor->pActorBuffs[16].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1708 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1709 case 46:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1710 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1711 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) < 0 )
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1712 return 1;
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1713 if ( SHIDWORD(pActor->pActorBuffs[17].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1714 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1715 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1716 v4 = LODWORD(pActor->pActorBuffs[17].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1717 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1718 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1719 case 47:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1720 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1721 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1722 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1723 if ( SHIDWORD(pActor->pActorBuffs[11].uExpireTime) > 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1724 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1725 v3 = 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1726 v4 = LODWORD(pActor->pActorBuffs[11].uExpireTime) == 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1727 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1728 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1729 case 51:
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1730 {
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1731 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) < 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1732 return 1;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1733 if ( SHIDWORD(pActor->pActorBuffs[18].uExpireTime) <= 0 )
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1734 {
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1735 v3 = 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1736 v4 = LODWORD(pActor->pActorBuffs[18].uExpireTime) == 0;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1737 }
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1738 else
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1739 return 0;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1740 break;
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1741 }
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1742 default:
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1743 {
597
c03428cb4119 stru319::_427102 clean
zipi
parents: 574
diff changeset
1744 return 1;
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
1745 }
0
Ritor1
parents:
diff changeset
1746 }
Ritor1
parents:
diff changeset
1747 if ( !(v3 | v4) )
Ritor1
parents:
diff changeset
1748 return 0;
Ritor1
parents:
diff changeset
1749 return 1;
Ritor1
parents:
diff changeset
1750 }
Ritor1
parents:
diff changeset
1751
Ritor1
parents:
diff changeset
1752 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1753 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
1754 {
Ritor1
parents:
diff changeset
1755 signed int v5; // esi@1
Ritor1
parents:
diff changeset
1756 signed int v6; // edi@1
Ritor1
parents:
diff changeset
1757 int v7; // esi@8
Ritor1
parents:
diff changeset
1758 int v8; // eax@9
Ritor1
parents:
diff changeset
1759 int v9; // edx@11
Ritor1
parents:
diff changeset
1760 int v10; // edx@13
Ritor1
parents:
diff changeset
1761 int v11; // esi@13
Ritor1
parents:
diff changeset
1762 unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
1763 unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
1764 int v14; // edx@14
Ritor1
parents:
diff changeset
1765 int v15; // eax@14
Ritor1
parents:
diff changeset
1766 signed int result; // eax@17
Ritor1
parents:
diff changeset
1767
Ritor1
parents:
diff changeset
1768 v5 = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
1769 v6 = 0;
Ritor1
parents:
diff changeset
1770 if ( (signed __int64)pActor->pActorBuffs[8].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1771 v5 /= 2;
Ritor1
parents:
diff changeset
1772 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1773 v6 = pActor->pActorBuffs[15].uPower;
Ritor1
parents:
diff changeset
1774 if ( (signed __int64)pActor->pActorBuffs[16].uExpireTime > 0 && pActor->pActorBuffs[16].uPower > v6 )
Ritor1
parents:
diff changeset
1775 v6 = pActor->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
1776 v7 = v6 + v5;
Ritor1
parents:
diff changeset
1777 if ( a3 )
Ritor1
parents:
diff changeset
1778 v8 = pPlayer->GetRangedAttack();
Ritor1
parents:
diff changeset
1779 else
Ritor1
parents:
diff changeset
1780 v8 = pPlayer->GetActualAttack(0);
Ritor1
parents:
diff changeset
1781 v9 = rand() % (v7 + 2 * v8 + 30);
Ritor1
parents:
diff changeset
1782 if ( a3 == 2 )
Ritor1
parents:
diff changeset
1783 {
Ritor1
parents:
diff changeset
1784 v14 = a4 + v9;
Ritor1
parents:
diff changeset
1785 v15 = ((v7 + 15) >> 1) + v7 + 15;
Ritor1
parents:
diff changeset
1786 }
Ritor1
parents:
diff changeset
1787 else
Ritor1
parents:
diff changeset
1788 {
Ritor1
parents:
diff changeset
1789 if ( a3 != 3 )
Ritor1
parents:
diff changeset
1790 {
Ritor1
parents:
diff changeset
1791 v10 = a4 + v9;
Ritor1
parents:
diff changeset
1792 v11 = v7 + 15;
Ritor1
parents:
diff changeset
1793 v13 = __OFSUB__(v10, v11);
Ritor1
parents:
diff changeset
1794 v12 = v10 - v11 < 0;
Ritor1
parents:
diff changeset
1795 goto LABEL_16;
Ritor1
parents:
diff changeset
1796 }
Ritor1
parents:
diff changeset
1797 v14 = a4 + v9;
Ritor1
parents:
diff changeset
1798 v15 = 2 * v7 + 30;
Ritor1
parents:
diff changeset
1799 }
Ritor1
parents:
diff changeset
1800 v13 = __OFSUB__(v14, v15);
Ritor1
parents:
diff changeset
1801 v12 = v14 - v15 < 0;
Ritor1
parents:
diff changeset
1802 LABEL_16:
Ritor1
parents:
diff changeset
1803 if ( v12 ^ v13 )
Ritor1
parents:
diff changeset
1804 result = 0;
Ritor1
parents:
diff changeset
1805 else
Ritor1
parents:
diff changeset
1806 result = 1;
Ritor1
parents:
diff changeset
1807 return result;
Ritor1
parents:
diff changeset
1808 }
Ritor1
parents:
diff changeset
1809
Ritor1
parents:
diff changeset
1810 //----- (004273BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1811 bool stru319::_4273BB(Actor *pActor, Actor *a2, int a3, int a4)
Ritor1
parents:
diff changeset
1812 {
Ritor1
parents:
diff changeset
1813 Actor *v5; // ecx@1
Ritor1
parents:
diff changeset
1814 signed int v6; // ebx@1
Ritor1
parents:
diff changeset
1815 signed int v7; // esi@1
Ritor1
parents:
diff changeset
1816 unsigned __int8 v8; // zf@1
Ritor1
parents:
diff changeset
1817 unsigned __int8 v9; // sf@1
Ritor1
parents:
diff changeset
1818 int v10; // ebx@10
Ritor1
parents:
diff changeset
1819 signed int a2a; // [sp+18h] [bp+Ch]@1
Ritor1
parents:
diff changeset
1820
Ritor1
parents:
diff changeset
1821 v5 = a2;
Ritor1
parents:
diff changeset
1822 v6 = a2->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
1823 v7 = 0;
Ritor1
parents:
diff changeset
1824 v8 = HIDWORD(a2->pActorBuffs[8].uExpireTime) == 0;
Ritor1
parents:
diff changeset
1825 v9 = SHIDWORD(a2->pActorBuffs[8].uExpireTime) < 0;
Ritor1
parents:
diff changeset
1826 a2a = 0;
Ritor1
parents:
diff changeset
1827 if ( !v9 && (!(v9 | v8) || LODWORD(v5->pActorBuffs[8].uExpireTime) > 0) )
Ritor1
parents:
diff changeset
1828 v6 /= 2;
Ritor1
parents:
diff changeset
1829 if ( (signed __int64)v5->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1830 v7 = v5->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1831 if ( (signed __int64)v5->pActorBuffs[16].uExpireTime > 0 && v5->pActorBuffs[16].uPower > v7 )
Ritor1
parents:
diff changeset
1832 v7 = v5->pActorBuffs[16].uPower;
Ritor1
parents:
diff changeset
1833 v10 = v7 + v6;
Ritor1
parents:
diff changeset
1834 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1835 a2a = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1836 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > a2a )
Ritor1
parents:
diff changeset
1837 a2a = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
1838 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1839 {
Ritor1
parents:
diff changeset
1840 a2a += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
1841 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
1842 }
Ritor1
parents:
diff changeset
1843 return rand() % (v10 + 2 * pActor->pMonsterInfo.uLevel + 10) + a2a + 1 > v10 + 5;
Ritor1
parents:
diff changeset
1844 }
Ritor1
parents:
diff changeset
1845
Ritor1
parents:
diff changeset
1846 //----- (004274AD) --------------------------------------------------------
Ritor1
parents:
diff changeset
1847 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
Ritor1
parents:
diff changeset
1848 {
Ritor1
parents:
diff changeset
1849 signed int v3; // edi@1
Ritor1
parents:
diff changeset
1850 signed int v4; // esi@8
Ritor1
parents:
diff changeset
1851 int v5; // esi@8
Ritor1
parents:
diff changeset
1852
Ritor1
parents:
diff changeset
1853 v3 = 0;
Ritor1
parents:
diff changeset
1854 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1855 v3 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1856 if ( (signed __int64)pActor->pActorBuffs[17].uExpireTime > 0 && pActor->pActorBuffs[17].uPower > v3 )
Ritor1
parents:
diff changeset
1857 v3 = pActor->pActorBuffs[17].uPower;
Ritor1
parents:
diff changeset
1858 if ( (signed __int64)pActor->pActorBuffs[11].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1859 {
Ritor1
parents:
diff changeset
1860 v3 += pActor->pActorBuffs[11].uPower;
Ritor1
parents:
diff changeset
1861 pActor->pActorBuffs[11].Reset();
Ritor1
parents:
diff changeset
1862 }
Ritor1
parents:
diff changeset
1863 v4 = pPlayer->GetActualAC() + 2 * pActor->pMonsterInfo.uLevel + 10;
Ritor1
parents:
diff changeset
1864 v5 = rand() % v4 + 1;
Ritor1
parents:
diff changeset
1865 return v3 + v5 > pPlayer->GetActualAC() + 5;
Ritor1
parents:
diff changeset
1866 }
Ritor1
parents:
diff changeset
1867
Ritor1
parents:
diff changeset
1868 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
1869 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
1870 {
Ritor1
parents:
diff changeset
1871 int result; // eax@2
Ritor1
parents:
diff changeset
1872
Ritor1
parents:
diff changeset
1873 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
1874 {
Ritor1
parents:
diff changeset
1875 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
1876 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
1877 else
Ritor1
parents:
diff changeset
1878 result = 1;
Ritor1
parents:
diff changeset
1879 }
Ritor1
parents:
diff changeset
1880 else
Ritor1
parents:
diff changeset
1881 {
Ritor1
parents:
diff changeset
1882 result = 0;
Ritor1
parents:
diff changeset
1883 }
Ritor1
parents:
diff changeset
1884 return result;
Ritor1
parents:
diff changeset
1885 }
Ritor1
parents:
diff changeset
1886
Ritor1
parents:
diff changeset
1887 //----- (0042756B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1888 int stru319::CalcMagicalDamageToActor(Actor *pActor, int a2, signed int a3)
Ritor1
parents:
diff changeset
1889 {
Ritor1
parents:
diff changeset
1890 int v4; // edx@1
Ritor1
parents:
diff changeset
1891 int v5; // ecx@1
Ritor1
parents:
diff changeset
1892 signed int v6; // eax@4
Ritor1
parents:
diff changeset
1893 signed int result; // eax@17
Ritor1
parents:
diff changeset
1894 signed int v8; // esi@18
Ritor1
parents:
diff changeset
1895
Ritor1
parents:
diff changeset
1896 v4 = 0;
Ritor1
parents:
diff changeset
1897 v5 = 0;
Ritor1
parents:
diff changeset
1898 if ( (signed __int64)pActor->pActorBuffs[14].uExpireTime > 0 )
Ritor1
parents:
diff changeset
1899 v5 = pActor->pActorBuffs[14].uPower;
Ritor1
parents:
diff changeset
1900 switch ( a2 )
Ritor1
parents:
diff changeset
1901 {
Ritor1
parents:
diff changeset
1902 case 4:
Ritor1
parents:
diff changeset
1903 v6 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
1904 break;
Ritor1
parents:
diff changeset
1905 case 0:
Ritor1
parents:
diff changeset
1906 v6 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
1907 goto LABEL_12;
Ritor1
parents:
diff changeset
1908 case 1:
Ritor1
parents:
diff changeset
1909 v6 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
1910 goto LABEL_12;
Ritor1
parents:
diff changeset
1911 case 2:
Ritor1
parents:
diff changeset
1912 v6 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
1913 goto LABEL_12;
Ritor1
parents:
diff changeset
1914 case 3:
Ritor1
parents:
diff changeset
1915 v6 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
1916 goto LABEL_12;
Ritor1
parents:
diff changeset
1917 case 6:
Ritor1
parents:
diff changeset
1918 v6 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
1919 break;
Ritor1
parents:
diff changeset
1920 case 7:
Ritor1
parents:
diff changeset
1921 v6 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
1922 goto LABEL_12;
Ritor1
parents:
diff changeset
1923 case 8:
Ritor1
parents:
diff changeset
1924 v6 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
1925 LABEL_12:
Ritor1
parents:
diff changeset
1926 v4 = v5;
Ritor1
parents:
diff changeset
1927 break;
Ritor1
parents:
diff changeset
1928 case 9:
Ritor1
parents:
diff changeset
1929 v6 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
1930 break;
Ritor1
parents:
diff changeset
1931 case 10:
Ritor1
parents:
diff changeset
1932 v6 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
1933 break;
Ritor1
parents:
diff changeset
1934 default:
Ritor1
parents:
diff changeset
1935 v6 = 0;
Ritor1
parents:
diff changeset
1936 break;
Ritor1
parents:
diff changeset
1937 }
Ritor1
parents:
diff changeset
1938 if ( v6 < 200 )
Ritor1
parents:
diff changeset
1939 {
Ritor1
parents:
diff changeset
1940 v8 = v4 + v6 + 30;
Ritor1
parents:
diff changeset
1941 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1942 {
Ritor1
parents:
diff changeset
1943 a3 >>= 1;
Ritor1
parents:
diff changeset
1944 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1945 {
Ritor1
parents:
diff changeset
1946 a3 >>= 1;
Ritor1
parents:
diff changeset
1947 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1948 {
Ritor1
parents:
diff changeset
1949 a3 >>= 1;
Ritor1
parents:
diff changeset
1950 if ( rand() % v8 >= 30 )
Ritor1
parents:
diff changeset
1951 a3 >>= 1;
Ritor1
parents:
diff changeset
1952 }
Ritor1
parents:
diff changeset
1953 }
Ritor1
parents:
diff changeset
1954 }
Ritor1
parents:
diff changeset
1955 result = a3;
Ritor1
parents:
diff changeset
1956 }
Ritor1
parents:
diff changeset
1957 else
Ritor1
parents:
diff changeset
1958 {
Ritor1
parents:
diff changeset
1959 result = 0;
Ritor1
parents:
diff changeset
1960 }
Ritor1
parents:
diff changeset
1961 return result;
Ritor1
parents:
diff changeset
1962 }
Ritor1
parents:
diff changeset
1963
Ritor1
parents:
diff changeset
1964 //----- (00427662) --------------------------------------------------------
Ritor1
parents:
diff changeset
1965 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
Ritor1
parents:
diff changeset
1966 {
Ritor1
parents:
diff changeset
1967 Actor *v3; // edi@2
Ritor1
parents:
diff changeset
1968 signed int v4; // esi@2
Ritor1
parents:
diff changeset
1969 bool result; // eax@13
Ritor1
parents:
diff changeset
1970
Ritor1
parents:
diff changeset
1971 switch ( uType )
Ritor1
parents:
diff changeset
1972 {
Ritor1
parents:
diff changeset
1973 case 0u:
Ritor1
parents:
diff changeset
1974 v3 = pActor;
Ritor1
parents:
diff changeset
1975 v4 = pActor->pMonsterInfo.uResFire;
Ritor1
parents:
diff changeset
1976 goto LABEL_12;
Ritor1
parents:
diff changeset
1977 case 1u:
Ritor1
parents:
diff changeset
1978 v3 = pActor;
Ritor1
parents:
diff changeset
1979 v4 = pActor->pMonsterInfo.uResAir;
Ritor1
parents:
diff changeset
1980 goto LABEL_12;
Ritor1
parents:
diff changeset
1981 case 2u:
Ritor1
parents:
diff changeset
1982 v3 = pActor;
Ritor1
parents:
diff changeset
1983 v4 = pActor->pMonsterInfo.uResWater;
Ritor1
parents:
diff changeset
1984 goto LABEL_12;
Ritor1
parents:
diff changeset
1985 case 3u:
Ritor1
parents:
diff changeset
1986 v3 = pActor;
Ritor1
parents:
diff changeset
1987 v4 = pActor->pMonsterInfo.uResEarth;
Ritor1
parents:
diff changeset
1988 goto LABEL_12;
Ritor1
parents:
diff changeset
1989 case 7u:
Ritor1
parents:
diff changeset
1990 v3 = pActor;
Ritor1
parents:
diff changeset
1991 v4 = pActor->pMonsterInfo.uResMind;
Ritor1
parents:
diff changeset
1992 goto LABEL_12;
Ritor1
parents:
diff changeset
1993 case 6u:
Ritor1
parents:
diff changeset
1994 v3 = pActor;
Ritor1
parents:
diff changeset
1995 v4 = pActor->pMonsterInfo.uResSpirit;
Ritor1
parents:
diff changeset
1996 goto LABEL_12;
Ritor1
parents:
diff changeset
1997 case 8u:
Ritor1
parents:
diff changeset
1998 v3 = pActor;
Ritor1
parents:
diff changeset
1999 v4 = pActor->pMonsterInfo.uResBody;
Ritor1
parents:
diff changeset
2000 goto LABEL_12;
Ritor1
parents:
diff changeset
2001 case 9u:
Ritor1
parents:
diff changeset
2002 v3 = pActor;
Ritor1
parents:
diff changeset
2003 v4 = pActor->pMonsterInfo.uResLight;
Ritor1
parents:
diff changeset
2004 goto LABEL_12;
Ritor1
parents:
diff changeset
2005 case 0xAu:
Ritor1
parents:
diff changeset
2006 v3 = pActor;
Ritor1
parents:
diff changeset
2007 v4 = pActor->pMonsterInfo.uResDark;
Ritor1
parents:
diff changeset
2008 goto LABEL_12;
Ritor1
parents:
diff changeset
2009 case 4u:
Ritor1
parents:
diff changeset
2010 v3 = pActor;
Ritor1
parents:
diff changeset
2011 v4 = pActor->pMonsterInfo.uResPhysical;
Ritor1
parents:
diff changeset
2012 LABEL_12:
Ritor1
parents:
diff changeset
2013 if ( v4 < 200 )
Ritor1
parents:
diff changeset
2014 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
Ritor1
parents:
diff changeset
2015 else
Ritor1
parents:
diff changeset
2016 result = 0;
Ritor1
parents:
diff changeset
2017 break;
Ritor1
parents:
diff changeset
2018 default:
Ritor1
parents:
diff changeset
2019 result = 1;
Ritor1
parents:
diff changeset
2020 break;
Ritor1
parents:
diff changeset
2021 }
Ritor1
parents:
diff changeset
2022 return result;
Ritor1
parents:
diff changeset
2023 }
Ritor1
parents:
diff changeset
2024
Ritor1
parents:
diff changeset
2025 //----- (00427769) --------------------------------------------------------
Ritor1
parents:
diff changeset
2026 bool __fastcall sub_427769_spell(unsigned int uSpellID)
Ritor1
parents:
diff changeset
2027 {
Ritor1
parents:
diff changeset
2028 bool result; // eax@2
Ritor1
parents:
diff changeset
2029
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 693
diff changeset
2030 __debugbreak(); // refactor
0
Ritor1
parents:
diff changeset
2031 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC )
Ritor1
parents:
diff changeset
2032 result = 1;
Ritor1
parents:
diff changeset
2033 else
Ritor1
parents:
diff changeset
2034 result = 0;
Ritor1
parents:
diff changeset
2035 return result;
Ritor1
parents:
diff changeset
2036 }
Ritor1
parents:
diff changeset
2037
Ritor1
parents:
diff changeset
2038 //----- (0042777D) --------------------------------------------------------
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2039 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6)
0
Ritor1
parents:
diff changeset
2040 {
370
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2041 //bool result; // eax@2
486
Nomad
parents: 482
diff changeset
2042 //__int16 v6; // bx@4
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2043 //Player *v7; // eax@4
486
Nomad
parents: 482
diff changeset
2044 //char v8; // zf@12
0
Ritor1
parents:
diff changeset
2045 unsigned __int16 v9; // cx@16
Ritor1
parents:
diff changeset
2046 unsigned int v10; // eax@18
Ritor1
parents:
diff changeset
2047 unsigned __int8 v11; // sf@18
Ritor1
parents:
diff changeset
2048 unsigned __int8 v12; // of@18
Ritor1
parents:
diff changeset
2049 unsigned __int16 v13; // cx@21
Ritor1
parents:
diff changeset
2050 unsigned int v14; // eax@23
486
Nomad
parents: 482
diff changeset
2051 //stru277 *v15; // esi@27
Nomad
parents: 482
diff changeset
2052 //stru277 *v16; // eax@28
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2053 //GUIWindow *v17; // eax@43
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2054 //GUIWindow *v18; // [sp-30h] [bp-48h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2055 //unsigned int v19; // [sp-2Ch] [bp-44h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2056 //unsigned int v20; // [sp-28h] [bp-40h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2057 //unsigned int v21; // [sp-24h] [bp-3Ch]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2058 //unsigned int v22; // [sp-20h] [bp-38h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2059 //int v23; // [sp-1Ch] [bp-34h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2060 //int v24; // [sp-18h] [bp-30h]@44
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2061 //unsigned int v25; // [sp-14h] [bp-2Ch]@43
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2062 //unsigned int v26; // [sp-10h] [bp-28h]@43
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2063 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2064 //char *v28; // [sp-8h] [bp-20h]@43
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2065 //Texture *v29; // [sp-4h] [bp-1Ch]@43
486
Nomad
parents: 482
diff changeset
2066 //__int16 a3a; // [sp+10h] [bp-8h]@1
Nomad
parents: 482
diff changeset
2067 //__int16 a2a; // [sp+14h] [bp-4h]@1
Nomad
parents: 482
diff changeset
2068
Nomad
parents: 482
diff changeset
2069 //a3a = uPlayerID;
Nomad
parents: 482
diff changeset
2070 //a2a = a1;
370
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2071
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2072 //if ( pParty->bTurnBasedModeOn != 1
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2073 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 )
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2074 if (pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
2075 {
370
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2076 if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3)
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2077 return;
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2078 }
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2079
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2080
486
Nomad
parents: 482
diff changeset
2081 //v6 = a5;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2082 //v7 = &pParty->pPlayers[uPlayerID];
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2083 assert(uPlayerID < 4);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2084 auto player = &pParty->pPlayers[uPlayerID];
0
Ritor1
parents:
diff changeset
2085 if ( !(a5 & 0x10) )
Ritor1
parents:
diff changeset
2086 {
Ritor1
parents:
diff changeset
2087 switch ( a1 )
Ritor1
parents:
diff changeset
2088 {
486
Nomad
parents: 482
diff changeset
2089 case SPELL_SPIRIT_FATE:
Nomad
parents: 482
diff changeset
2090 case SPELL_BODY_FIRST_AID:
Nomad
parents: 482
diff changeset
2091 case SPELL_DARK_REANIMATE:
Nomad
parents: 482
diff changeset
2092 //HIBYTE(v6) = HIBYTE(a5) | 1;
Nomad
parents: 482
diff changeset
2093 a5 |= 0x0100;
0
Ritor1
parents:
diff changeset
2094 break;
486
Nomad
parents: 482
diff changeset
2095
Nomad
parents: 482
diff changeset
2096 case SPELL_FIRE_FIRE_AURA:
Nomad
parents: 482
diff changeset
2097 case SPELL_WATER_RECHARGE_ITEM:
Nomad
parents: 482
diff changeset
2098 case SPELL_WATER_ENCHANT_ITEM:
Nomad
parents: 482
diff changeset
2099 case SPELL_DARK_VAMPIRIC_WEAPON:
Nomad
parents: 482
diff changeset
2100 //LOBYTE(v6) = a5 | 0x80;
Nomad
parents: 482
diff changeset
2101 a5 |= 0x0080;
0
Ritor1
parents:
diff changeset
2102 break;
486
Nomad
parents: 482
diff changeset
2103
Nomad
parents: 482
diff changeset
2104 case SPELL_FIRE_FIRE_BOLT:
Nomad
parents: 482
diff changeset
2105 case SPELL_FIRE_FIREBALL:
Nomad
parents: 482
diff changeset
2106 case SPELL_FIRE_INCINERATE:
Nomad
parents: 482
diff changeset
2107 case SPELL_AIR_LIGHNING_BOLT:
Nomad
parents: 482
diff changeset
2108 case SPELL_AIR_IMPLOSION:
Nomad
parents: 482
diff changeset
2109 case SPELL_WATER_POISON_SPRAY:
Nomad
parents: 482
diff changeset
2110 case SPELL_WATER_ICE_BOLT:
Nomad
parents: 482
diff changeset
2111 case SPELL_WATER_ACID_BURST:
Nomad
parents: 482
diff changeset
2112 case SPELL_WATER_ICE_BLAST:
Nomad
parents: 482
diff changeset
2113 case SPELL_EARTH_STUN:
Nomad
parents: 482
diff changeset
2114 case SPELL_EARTH_SLOW:
Nomad
parents: 482
diff changeset
2115 case SPELL_EARTH_DEADLY_SWARM:
Nomad
parents: 482
diff changeset
2116 case SPELL_EARTH_BLADES:
Nomad
parents: 482
diff changeset
2117 case SPELL_EARTH_MASS_DISTORTION:
Nomad
parents: 482
diff changeset
2118 case SPELL_SPIRIT_SPIRIT_LASH:
Nomad
parents: 482
diff changeset
2119 case SPELL_MIND_MIND_BLAST:
Nomad
parents: 482
diff changeset
2120 case SPELL_MIND_CHARM:
Nomad
parents: 482
diff changeset
2121 case SPELL_MIND_PSYCHIC_SHOCK:
Nomad
parents: 482
diff changeset
2122 case SPELL_BODY_HARM:
Nomad
parents: 482
diff changeset
2123 case SPELL_BODY_FLYING_FIST:
Nomad
parents: 482
diff changeset
2124 case SPELL_LIGHT_LIGHT_BOLT:
Nomad
parents: 482
diff changeset
2125 case SPELL_LIGHT_DESTROY_UNDEAD:
Nomad
parents: 482
diff changeset
2126 case SPELL_LIGHT_SUNRAY:
Nomad
parents: 482
diff changeset
2127 case SPELL_DARK_TOXIC_CLOUD:
Nomad
parents: 482
diff changeset
2128 case SPELL_DARK_SHRINKING_RAY:
Nomad
parents: 482
diff changeset
2129 case SPELL_DARK_SHARPMETAL:
Nomad
parents: 482
diff changeset
2130 case SPELL_DARK_DRAGON_BREATH:
0
Ritor1
parents:
diff changeset
2131 if ( !a6 )
486
Nomad
parents: 482
diff changeset
2132 a5 |= 0x0008;
0
Ritor1
parents:
diff changeset
2133 break;
486
Nomad
parents: 482
diff changeset
2134 case SPELL_MIND_TELEPATHY:
Nomad
parents: 482
diff changeset
2135 case SPELL_MIND_BERSERK:
Nomad
parents: 482
diff changeset
2136 case SPELL_MIND_ENSLAVE:
Nomad
parents: 482
diff changeset
2137 case SPELL_LIGHT_PARALYZE:
Nomad
parents: 482
diff changeset
2138 case SPELL_DARK_CONTROL_UNDEAD:
Nomad
parents: 482
diff changeset
2139 //LABEL_9:
Nomad
parents: 482
diff changeset
2140 //v6 = a5 | 8;
Nomad
parents: 482
diff changeset
2141 a5 |= 0x0008;
0
Ritor1
parents:
diff changeset
2142 break;
486
Nomad
parents: 482
diff changeset
2143
Nomad
parents: 482
diff changeset
2144 case SPELL_EARTH_TELEKINESIS:
Nomad
parents: 482
diff changeset
2145 a5 |= 0x0040;
Nomad
parents: 482
diff changeset
2146 break;
Nomad
parents: 482
diff changeset
2147
Nomad
parents: 482
diff changeset
2148 case SPELL_SPIRIT_BLESS:
Nomad
parents: 482
diff changeset
2149 if (a4 && ~a4 & 0x01C0)
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2150 //goto LABEL_25;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2151 {
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2152 a5 |= 0x0002;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2153 break;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2154 }
1108
a1fd8045ffb1 probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents: 1106
diff changeset
2155 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0)
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2156 //goto LABEL_25;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2157 {
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2158 a5 |= 0x0002;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2159 break;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2160 }
0
Ritor1
parents:
diff changeset
2161 break;
486
Nomad
parents: 482
diff changeset
2162
Nomad
parents: 482
diff changeset
2163 case SPELL_SPIRIT_PRESERVATION:
0
Ritor1
parents:
diff changeset
2164 v9 = a4;
Ritor1
parents:
diff changeset
2165 if ( !a4 )
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2166 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT];
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2167 //goto LABEL_18;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2168 v10 = SkillToMastery(v9);
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2169 v12 = __OFSUB__(v10, 3);
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2170 v11 = ((v10 - 3) & 0x80000000u) != 0;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2171 //goto LABEL_24;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2172 if ( v11 ^ v12 )
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2173 {
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2174 a5 |= 0x0002;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2175 break;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2176 }
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2177 break;
486
Nomad
parents: 482
diff changeset
2178
Nomad
parents: 482
diff changeset
2179 case SPELL_DARK_PAIN_REFLECTION:
0
Ritor1
parents:
diff changeset
2180 v9 = a4;
Ritor1
parents:
diff changeset
2181 if ( !a4 )
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2182 v9 = player->pActiveSkills[PLAYER_SKILL_DARK];
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2183 //LABEL_18:
0
Ritor1
parents:
diff changeset
2184 v10 = SkillToMastery(v9);
Ritor1
parents:
diff changeset
2185 v12 = __OFSUB__(v10, 3);
Ritor1
parents:
diff changeset
2186 v11 = ((v10 - 3) & 0x80000000u) != 0;
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2187 //goto LABEL_24;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2188 if ( v11 ^ v12 )
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2189 {
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2190 a5 |= 0x0002;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2191 break;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2192 }
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2193 break;
486
Nomad
parents: 482
diff changeset
2194
Nomad
parents: 482
diff changeset
2195 case SPELL_BODY_HAMMERHANDS:
0
Ritor1
parents:
diff changeset
2196 v13 = a4;
Ritor1
parents:
diff changeset
2197 if ( !a4 )
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
2198 v13 = player->pActiveSkills[PLAYER_SKILL_BODY];
0
Ritor1
parents:
diff changeset
2199 v14 = SkillToMastery(v13);
Ritor1
parents:
diff changeset
2200 v12 = __OFSUB__(v14, 4);
Ritor1
parents:
diff changeset
2201 v11 = ((v14 - 4) & 0x80000000u) != 0;
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2202 //LABEL_24:
0
Ritor1
parents:
diff changeset
2203 if ( v11 ^ v12 )
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2204 //goto LABEL_25;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2205 {
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2206 a5 |= 0x0002;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2207 break;
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2208 }
0
Ritor1
parents:
diff changeset
2209 break;
486
Nomad
parents: 482
diff changeset
2210
Nomad
parents: 482
diff changeset
2211 case SPELL_EARTH_STONE_TO_FLESH:
Nomad
parents: 482
diff changeset
2212 case SPELL_SPIRIT_REMOVE_CURSE:
Nomad
parents: 482
diff changeset
2213 case SPELL_SPIRIT_RAISE_DEAD:
Nomad
parents: 482
diff changeset
2214 case SPELL_SPIRIT_RESSURECTION:
Nomad
parents: 482
diff changeset
2215 case SPELL_MIND_REMOVE_FEAR:
Nomad
parents: 482
diff changeset
2216 case SPELL_MIND_CURE_PARALYSIS:
Nomad
parents: 482
diff changeset
2217 case SPELL_MIND_CURE_INSANITY:
Nomad
parents: 482
diff changeset
2218 case SPELL_BODY_CURE_WEAKNESS:
Nomad
parents: 482
diff changeset
2219 case SPELL_BODY_REGENERATION:
Nomad
parents: 482
diff changeset
2220 case SPELL_BODY_CURE_POISON:
Nomad
parents: 482
diff changeset
2221 case SPELL_BODY_CURE_DISEASE:
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2222 //LABEL_25:
486
Nomad
parents: 482
diff changeset
2223 //v6 = a5 | 2;
Nomad
parents: 482
diff changeset
2224 a5 |= 0x0002;
0
Ritor1
parents:
diff changeset
2225 break;
486
Nomad
parents: 482
diff changeset
2226
Nomad
parents: 482
diff changeset
2227 case SPELL_DARK_SACRIFICE:
Nomad
parents: 482
diff changeset
2228 //HIBYTE(v6) = HIBYTE(a5) | 2;
Nomad
parents: 482
diff changeset
2229 a5 |= 0x0200;
0
Ritor1
parents:
diff changeset
2230 break;
Ritor1
parents:
diff changeset
2231 default:
Ritor1
parents:
diff changeset
2232 break;
Ritor1
parents:
diff changeset
2233 }
Ritor1
parents:
diff changeset
2234 }
370
7f817679b60e _42777D_CastSpell_UseWand_ShootArrow
Nomad
parents: 349
diff changeset
2235
486
Nomad
parents: 482
diff changeset
2236
Nomad
parents: 482
diff changeset
2237 if (a5 & 0x3CA)
0
Ritor1
parents:
diff changeset
2238 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2239 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10);
486
Nomad
parents: 482
diff changeset
2240 for (uint i = 0; i < 10; ++i)
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2241 if (pCastSpellInfo[i].field_8 & 0x3CA)
486
Nomad
parents: 482
diff changeset
2242 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2243 pCastSpellInfo[i].spellnum = 0;
486
Nomad
parents: 482
diff changeset
2244 break;
Nomad
parents: 482
diff changeset
2245 }
0
Ritor1
parents:
diff changeset
2246 }
486
Nomad
parents: 482
diff changeset
2247
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2248 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10);
486
Nomad
parents: 482
diff changeset
2249 for (uint i = 0; i < 10; ++i)
0
Ritor1
parents:
diff changeset
2250 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2251 auto spell = &pCastSpellInfo[i];
486
Nomad
parents: 482
diff changeset
2252 if (!spell->spellnum)
Nomad
parents: 482
diff changeset
2253 continue;
Nomad
parents: 482
diff changeset
2254
Nomad
parents: 482
diff changeset
2255 spell->spellnum = 0;
Nomad
parents: 482
diff changeset
2256 if (spell->field_8 & 0x3CA)
0
Ritor1
parents:
diff changeset
2257 {
486
Nomad
parents: 482
diff changeset
2258 pGUIWindow_Settings->Release();
Nomad
parents: 482
diff changeset
2259 pGUIWindow_Settings = nullptr;
Nomad
parents: 482
diff changeset
2260 pMouse->SetCursorBitmap("MICON1");
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 735
diff changeset
2261 GameUI_Footer_TimeLeft = 0;
486
Nomad
parents: 482
diff changeset
2262 unk_50C9A0 = 0;
Nomad
parents: 482
diff changeset
2263 back_to_game();
0
Ritor1
parents:
diff changeset
2264 }
Ritor1
parents:
diff changeset
2265 }
486
Nomad
parents: 482
diff changeset
2266
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
2267 int result = pCastSpellInfo.data()->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6);
0
Ritor1
parents:
diff changeset
2268 if ( result != -1 )
Ritor1
parents:
diff changeset
2269 {
486
Nomad
parents: 482
diff changeset
2270 if ( a5 & 2 )
0
Ritor1
parents:
diff changeset
2271 {
Ritor1
parents:
diff changeset
2272 if ( pGUIWindow_Settings )
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2273 return;
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2274 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2275 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2276 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2277 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2278 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0);
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2279 sub_421B2C_PlaceInInventory_or_DropPickedItem();
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2280 return;
0
Ritor1
parents:
diff changeset
2281 }
486
Nomad
parents: 482
diff changeset
2282 if ( a5 & 8 )
0
Ritor1
parents:
diff changeset
2283 {
Ritor1
parents:
diff changeset
2284 if ( pGUIWindow_Settings )
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2285 return;
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2286
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2287 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2288 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0);
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2289 sub_421B2C_PlaceInInventory_or_DropPickedItem();
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2290 return;
0
Ritor1
parents:
diff changeset
2291 }
486
Nomad
parents: 482
diff changeset
2292 if ( a5 & 0x40 )
0
Ritor1
parents:
diff changeset
2293 {
Ritor1
parents:
diff changeset
2294 if ( pGUIWindow_Settings )
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2295 return;
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2296
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2297 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2298 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2299 sub_421B2C_PlaceInInventory_or_DropPickedItem();
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2300 return;
0
Ritor1
parents:
diff changeset
2301 }
486
Nomad
parents: 482
diff changeset
2302 if ( (char)a5 < 0 )
0
Ritor1
parents:
diff changeset
2303 {
Ritor1
parents:
diff changeset
2304 if ( pGUIWindow_Settings )
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2305 return;
0
Ritor1
parents:
diff changeset
2306 ++pIcons_LOD->uTexturePacksCount;
Ritor1
parents:
diff changeset
2307 if ( !pIcons_LOD->uNumPrevLoadedFiles )
Ritor1
parents:
diff changeset
2308 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2309 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE();
0
Ritor1
parents:
diff changeset
2310 unk_50C9A0 = 1;
Ritor1
parents:
diff changeset
2311 some_active_character = uActiveCharacter;
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2312 sub_421B2C_PlaceInInventory_or_DropPickedItem();
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2313 return;
0
Ritor1
parents:
diff changeset
2314 }
486
Nomad
parents: 482
diff changeset
2315 if ( HIBYTE(a5) & 1 )
0
Ritor1
parents:
diff changeset
2316 {
Ritor1
parents:
diff changeset
2317 if ( pGUIWindow_Settings )
319
5a66be213cff Actor::Die
Nomad
parents: 315
diff changeset
2318 return;
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2319 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2320 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2321 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2322 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2323 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2324 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL);
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2325 sub_421B2C_PlaceInInventory_or_DropPickedItem();
0
Ritor1
parents:
diff changeset
2326 }
486
Nomad
parents: 482
diff changeset
2327 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
0
Ritor1
parents:
diff changeset
2328 {
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
2329 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2330 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178,
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2331 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2332 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
960
9a5db2cf999a UIMSG and WINDOW_Type
Ritor1
parents: 958
diff changeset
2333 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "",
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2334 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2335 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178,
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2336 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth,
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2337 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
960
9a5db2cf999a UIMSG and WINDOW_Type
Ritor1
parents: 958
diff changeset
2338 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "",
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2339 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2340 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
2341 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0);
0
Ritor1
parents:
diff changeset
2342 }
Ritor1
parents:
diff changeset
2343 }
Ritor1
parents:
diff changeset
2344 }
Ritor1
parents:
diff changeset
2345
Ritor1
parents:
diff changeset
2346 //----- (00427D48) --------------------------------------------------------
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2347 void CastSpellInfo::_427D48(unsigned int uPlayerID)
0
Ritor1
parents:
diff changeset
2348 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2349 CastSpellInfo *v2; // esi@1
0
Ritor1
parents:
diff changeset
2350 signed int v3; // ebx@1
Ritor1
parents:
diff changeset
2351
Ritor1
parents:
diff changeset
2352 v2 = this;
Ritor1
parents:
diff changeset
2353 v3 = 10;
Ritor1
parents:
diff changeset
2354 do
Ritor1
parents:
diff changeset
2355 {
Ritor1
parents:
diff changeset
2356 if ( v2->spellnum )
Ritor1
parents:
diff changeset
2357 {
Ritor1
parents:
diff changeset
2358 if ( v2->field_8 & 0x3CA )
Ritor1
parents:
diff changeset
2359 {
Ritor1
parents:
diff changeset
2360 v2->spellnum = 0;
Ritor1
parents:
diff changeset
2361 pGUIWindow_Settings->Release();
Ritor1
parents:
diff changeset
2362 pGUIWindow_Settings = 0;
Ritor1
parents:
diff changeset
2363 pMouse->SetCursorBitmap("MICON1");
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 735
diff changeset
2364 GameUI_Footer_TimeLeft = 0;
0
Ritor1
parents:
diff changeset
2365 unk_50C9A0 = 0;
Ritor1
parents:
diff changeset
2366 back_to_game();
Ritor1
parents:
diff changeset
2367 }
Ritor1
parents:
diff changeset
2368 }
Ritor1
parents:
diff changeset
2369 ++v2;
Ritor1
parents:
diff changeset
2370 --v3;
Ritor1
parents:
diff changeset
2371 }
Ritor1
parents:
diff changeset
2372 while ( v3 );
Ritor1
parents:
diff changeset
2373 }
Ritor1
parents:
diff changeset
2374
Ritor1
parents:
diff changeset
2375 //----- (00427DA0) --------------------------------------------------------
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2376 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id)
0
Ritor1
parents:
diff changeset
2377 {
Ritor1
parents:
diff changeset
2378 unsigned int result; // eax@1
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2379 CastSpellInfo *v7; // edx@1
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2380 CastSpellInfo *v8; // ecx@5
0
Ritor1
parents:
diff changeset
2381
Ritor1
parents:
diff changeset
2382 result = 0;
Ritor1
parents:
diff changeset
2383 v7 = this;
Ritor1
parents:
diff changeset
2384 while ( v7->spellnum )
Ritor1
parents:
diff changeset
2385 {
Ritor1
parents:
diff changeset
2386 ++result;
Ritor1
parents:
diff changeset
2387 ++v7;
Ritor1
parents:
diff changeset
2388 if ( (signed int)result >= 10 )
Ritor1
parents:
diff changeset
2389 goto LABEL_8;
Ritor1
parents:
diff changeset
2390 }
Ritor1
parents:
diff changeset
2391 v8 = &this[result];
Ritor1
parents:
diff changeset
2392 v8->spellnum = a2;
Ritor1
parents:
diff changeset
2393 v8->uPlayerID = uPlayerID;
Ritor1
parents:
diff changeset
2394 if ( a5 & 0x10 )
Ritor1
parents:
diff changeset
2395 v8->uPlayerID_2 = uPlayerID;
Ritor1
parents:
diff changeset
2396 v8->field_6 = 0;
488
Nomad
parents: 486
diff changeset
2397 v8->spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
2398 v8->field_8 = a5;
488
Nomad
parents: 486
diff changeset
2399 v8->forced_spell_skill_level = skill_level;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
2400 v8->sound_id = spell_sound_id;
0
Ritor1
parents:
diff changeset
2401 LABEL_8:
Ritor1
parents:
diff changeset
2402 if ( result == 10 )
Ritor1
parents:
diff changeset
2403 result = -1;
Ritor1
parents:
diff changeset
2404 return result;
Ritor1
parents:
diff changeset
2405 }
Ritor1
parents:
diff changeset
2406
Ritor1
parents:
diff changeset
2407 //----- (00427E01) --------------------------------------------------------
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2408 void CastSpellInfo::_427E01_cast_spell()
0
Ritor1
parents:
diff changeset
2409 {
Ritor1
parents:
diff changeset
2410 int v2; // edi@1
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2411 CastSpellInfo *pCastSpell; // ebx@2
0
Ritor1
parents:
diff changeset
2412 signed int v6; // eax@14
Ritor1
parents:
diff changeset
2413 unsigned __int16 v11; // cx@45
Ritor1
parents:
diff changeset
2414 unsigned __int8 v14; // zf@53
Ritor1
parents:
diff changeset
2415 signed int i; // esi@76
Ritor1
parents:
diff changeset
2416 __int16 v23; // ax@88
Ritor1
parents:
diff changeset
2417 int v51; // eax@146
Ritor1
parents:
diff changeset
2418 __int16 v52; // ax@153
Ritor1
parents:
diff changeset
2419 signed __int64 v54; // qax@164
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2420 Actor *v55; // edi@164
0
Ritor1
parents:
diff changeset
2421 signed __int64 v58; // qax@177
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2422 Actor *pActor; // edi@177
0
Ritor1
parents:
diff changeset
2423 unsigned __int16 v60; // ax@184
Ritor1
parents:
diff changeset
2424 int v61; // ecx@184
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2425 ItemGen *v69; // esi@211
0
Ritor1
parents:
diff changeset
2426 double v90; // st7@245
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2427 Player *v92; // eax@255
0
Ritor1
parents:
diff changeset
2428 int v105; // edi@271
Ritor1
parents:
diff changeset
2429 __int16 v108; // ST1C_2@274
Ritor1
parents:
diff changeset
2430 __int16 v109; // ST18_2@274
Ritor1
parents:
diff changeset
2431 stru6 *v110; // eax@274
Ritor1
parents:
diff changeset
2432 int v111; // eax@274
Ritor1
parents:
diff changeset
2433 Actor *v112; // esi@278
Ritor1
parents:
diff changeset
2434 int v113; // eax@278
Ritor1
parents:
diff changeset
2435 int v114; // ebx@278
Ritor1
parents:
diff changeset
2436 unsigned int v115; // ecx@278
Ritor1
parents:
diff changeset
2437 int v116; // edx@279
Ritor1
parents:
diff changeset
2438 int v117; // edx@281
Ritor1
parents:
diff changeset
2439 int v118; // edx@283
Ritor1
parents:
diff changeset
2440 signed int v122; // eax@286
Ritor1
parents:
diff changeset
2441 int v127; // eax@296
Ritor1
parents:
diff changeset
2442 int v153; // ecx@322
Ritor1
parents:
diff changeset
2443 int v154; // eax@322
Ritor1
parents:
diff changeset
2444 int v155; // eax@323
Ritor1
parents:
diff changeset
2445 int v156; // eax@323
Ritor1
parents:
diff changeset
2446 int v162; // edi@340
Ritor1
parents:
diff changeset
2447 signed int v164; // eax@340
Ritor1
parents:
diff changeset
2448 signed int v165; // edi@340
Ritor1
parents:
diff changeset
2449 signed int v168; // edi@343
Ritor1
parents:
diff changeset
2450 int v169; // eax@344
Ritor1
parents:
diff changeset
2451 signed int v174; // edi@355
Ritor1
parents:
diff changeset
2452 int v188; // esi@369
Ritor1
parents:
diff changeset
2453 int v189; // edi@369
Ritor1
parents:
diff changeset
2454 signed int v191; // edi@379
Ritor1
parents:
diff changeset
2455 signed int v205; // edi@405
Ritor1
parents:
diff changeset
2456 int v206; // eax@407
Ritor1
parents:
diff changeset
2457 __int16 v207; // cx@407
Ritor1
parents:
diff changeset
2458 int v208; // eax@411
Ritor1
parents:
diff changeset
2459 signed int v209; // ecx@412
Ritor1
parents:
diff changeset
2460 int v210; // edx@412
Ritor1
parents:
diff changeset
2461 signed int v211; // ecx@412
Ritor1
parents:
diff changeset
2462 int v212; // eax@413
Ritor1
parents:
diff changeset
2463 int v213; // eax@413
Ritor1
parents:
diff changeset
2464 int v214; // eax@413
Ritor1
parents:
diff changeset
2465 int v215; // eax@415
Ritor1
parents:
diff changeset
2466 double v216; // st7@415
Ritor1
parents:
diff changeset
2467 double v217; // st6@415
Ritor1
parents:
diff changeset
2468 signed __int64 v218; // qtt@423
Ritor1
parents:
diff changeset
2469 char v223; // al@438
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
2470
0
Ritor1
parents:
diff changeset
2471 int v227; // esi@453
Ritor1
parents:
diff changeset
2472 unsigned int v228; // edi@454
Ritor1
parents:
diff changeset
2473 int v229; // edi@466
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
2474
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2475 ItemGen *v240; // ecx@472
0
Ritor1
parents:
diff changeset
2476 double v241; // st7@478
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2477 ItemGen *v245; // edi@492
0
Ritor1
parents:
diff changeset
2478 int v254; // eax@513
Ritor1
parents:
diff changeset
2479 int v255; // esi@513
Ritor1
parents:
diff changeset
2480 int v256; // ecx@513
Ritor1
parents:
diff changeset
2481 int v257; // edx@514
Ritor1
parents:
diff changeset
2482 int v258; // ecx@514
Ritor1
parents:
diff changeset
2483 char v259; // al@516
Ritor1
parents:
diff changeset
2484 int v260; // eax@518
Ritor1
parents:
diff changeset
2485 int v261; // esi@519
Ritor1
parents:
diff changeset
2486 int v262; // edx@521
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2487 int *v263; // ecx@521
0
Ritor1
parents:
diff changeset
2488 int v264; // esi@521
Ritor1
parents:
diff changeset
2489 int v265; // edx@521
Ritor1
parents:
diff changeset
2490 int *ii; // eax@522
Ritor1
parents:
diff changeset
2491 int v267; // eax@524
Ritor1
parents:
diff changeset
2492 int v268; // eax@524
Ritor1
parents:
diff changeset
2493 char v271; // al@531
Ritor1
parents:
diff changeset
2494 int v277; // edx@548
Ritor1
parents:
diff changeset
2495 int v278; // ecx@548
Ritor1
parents:
diff changeset
2496 char v279; // al@550
Ritor1
parents:
diff changeset
2497 int v280; // eax@552
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2498 int *v281; // esi@553
0
Ritor1
parents:
diff changeset
2499 int v282; // edx@555
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2500 int *v283; // ecx@555
0
Ritor1
parents:
diff changeset
2501 int v284; // esi@555
Ritor1
parents:
diff changeset
2502 int v285; // edx@555
Ritor1
parents:
diff changeset
2503 int *l; // eax@556
Ritor1
parents:
diff changeset
2504 ItemGen *v294; // esi@575
Ritor1
parents:
diff changeset
2505 int v295; // edx@575
Ritor1
parents:
diff changeset
2506 int kk; // edi@575
488
Nomad
parents: 486
diff changeset
2507 char v313; // al@606pGame->GetStru6()
0
Ritor1
parents:
diff changeset
2508 const char *v317; // ecx@617
Ritor1
parents:
diff changeset
2509 Player *v318; // ecx@619
Ritor1
parents:
diff changeset
2510 unsigned int v319; // edi@627
Ritor1
parents:
diff changeset
2511 int v323; // edi@635
Ritor1
parents:
diff changeset
2512 char *v324; // eax@635
Ritor1
parents:
diff changeset
2513 Player *v325; // ecx@640
Ritor1
parents:
diff changeset
2514 int v328; // ecx@651
Ritor1
parents:
diff changeset
2515 int v329; // ecx@652
Ritor1
parents:
diff changeset
2516 int v330; // edi@654
Ritor1
parents:
diff changeset
2517 signed int v342; // edi@668
Ritor1
parents:
diff changeset
2518 signed int v343; // edi@670
Ritor1
parents:
diff changeset
2519 unsigned __int64 v344; // ST08_8@670
Ritor1
parents:
diff changeset
2520 Player *v351; // edi@680
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
2521 Player *v357; // edi@694
0
Ritor1
parents:
diff changeset
2522 Actor *v369; // edi@705
Ritor1
parents:
diff changeset
2523 int v373; // eax@715
Ritor1
parents:
diff changeset
2524 int v374; // eax@717
Ritor1
parents:
diff changeset
2525 int v376; // eax@717
Ritor1
parents:
diff changeset
2526 Player *v377; // ecx@719
Ritor1
parents:
diff changeset
2527 int v381; // edi@727
Ritor1
parents:
diff changeset
2528 int v382; // ecx@727
Ritor1
parents:
diff changeset
2529 Player *v383; // eax@728
Ritor1
parents:
diff changeset
2530 int v384; // eax@733
Ritor1
parents:
diff changeset
2531 int v388; // edi@740
Ritor1
parents:
diff changeset
2532 int v396; // eax@752
Ritor1
parents:
diff changeset
2533 int v397; // eax@757
Ritor1
parents:
diff changeset
2534 int v398; // eax@757
Ritor1
parents:
diff changeset
2535 int v399; // eax@757
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2536 Actor *v417; // eax@787
0
Ritor1
parents:
diff changeset
2537 int v418; // ecx@789
Ritor1
parents:
diff changeset
2538 __int16 v419; // ax@791
Ritor1
parents:
diff changeset
2539 signed int v420; // eax@793
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2540 ItemGen *v421; // edx@793
0
Ritor1
parents:
diff changeset
2541 const char *v422; // eax@801
Ritor1
parents:
diff changeset
2542 signed int v426; // eax@815
Ritor1
parents:
diff changeset
2543 Actor *v433; // edi@832
Ritor1
parents:
diff changeset
2544 int v435; // ecx@837
Ritor1
parents:
diff changeset
2545 int v440; // eax@843
Ritor1
parents:
diff changeset
2546 int v441; // eax@847
Ritor1
parents:
diff changeset
2547 signed int v445; // edi@857
Ritor1
parents:
diff changeset
2548 int v446; // ecx@862
Ritor1
parents:
diff changeset
2549 LevelDecoration *v447; // edi@864
Ritor1
parents:
diff changeset
2550 __int16 v448; // ax@864
Ritor1
parents:
diff changeset
2551 char *v449; // esi@870
Ritor1
parents:
diff changeset
2552 int v450; // eax@870
Ritor1
parents:
diff changeset
2553 signed int v460; // eax@895
Ritor1
parents:
diff changeset
2554 Actor *v461; // eax@897
Ritor1
parents:
diff changeset
2555 unsigned __int16 v462; // cx@897
Ritor1
parents:
diff changeset
2556 signed int v463; // edx@897
Ritor1
parents:
diff changeset
2557 int v470; // edi@913
Ritor1
parents:
diff changeset
2558 int v471; // eax@917
Ritor1
parents:
diff changeset
2559 int v472; // eax@917
Ritor1
parents:
diff changeset
2560 int v498; // edi@931
Ritor1
parents:
diff changeset
2561 int v499; // eax@935
Ritor1
parents:
diff changeset
2562 int v500; // eax@935
Ritor1
parents:
diff changeset
2563 Player *v501; // edi@939
Ritor1
parents:
diff changeset
2564 int v505; // eax@943
Ritor1
parents:
diff changeset
2565 int v507; // edi@944
Ritor1
parents:
diff changeset
2566 signed int v509; // eax@944
1102
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
2567 //signed int v510; // edi@944
90
d61f6bc04bf2 more pointer fixes
zipi
parents: 89
diff changeset
2568 Actor *v518; // edx@957
0
Ritor1
parents:
diff changeset
2569 __int16 v519; // cx@958
Ritor1
parents:
diff changeset
2570 int v531; // eax@982
Ritor1
parents:
diff changeset
2571 int v533; // edi@983
Ritor1
parents:
diff changeset
2572 signed int v535; // eax@983
Ritor1
parents:
diff changeset
2573 signed int v536; // edi@983
Ritor1
parents:
diff changeset
2574 stru6 *v537; // eax@984
Ritor1
parents:
diff changeset
2575 double v549; // st7@991
Ritor1
parents:
diff changeset
2576 unsigned __int16 v550; // di@991
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2577 Player *v553; // edi@1001
0
Ritor1
parents:
diff changeset
2578 unsigned __int16 v562; // di@1005
Ritor1
parents:
diff changeset
2579 signed int v563; // eax@1010
Ritor1
parents:
diff changeset
2580 unsigned int v564; // ecx@1011
Ritor1
parents:
diff changeset
2581 signed int v565; // eax@1012
Ritor1
parents:
diff changeset
2582 Player **v566; // ecx@1012
Ritor1
parents:
diff changeset
2583 int v567; // eax@1012
Ritor1
parents:
diff changeset
2584 Player *v571; // eax@1013
Ritor1
parents:
diff changeset
2585 char *v572; // ecx@1013
Ritor1
parents:
diff changeset
2586 signed int v576; // eax@1025
Ritor1
parents:
diff changeset
2587 Player *v577; // eax@1026
Ritor1
parents:
diff changeset
2588 int v578; // eax@1028
Ritor1
parents:
diff changeset
2589 __int16 v579; // ax@1029
Ritor1
parents:
diff changeset
2590 int v581; // edi@1031
Ritor1
parents:
diff changeset
2591 char *v585; // esi@1034
Ritor1
parents:
diff changeset
2592 signed int v587; // eax@1035
Ritor1
parents:
diff changeset
2593 char v591; // al@1048
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2594 ItemGen *v592; // esi@1052
0
Ritor1
parents:
diff changeset
2595 int v596; // esi@1066
Ritor1
parents:
diff changeset
2596 unsigned int v597; // edi@1067
Ritor1
parents:
diff changeset
2597 int v600; // edi@1086
Ritor1
parents:
diff changeset
2598 int v601; // edx@1086
Ritor1
parents:
diff changeset
2599 int v602; // eax@1086
Ritor1
parents:
diff changeset
2600 int v603; // ecx@1086
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
2601 NPCData *pNPCData; // eax@1089
0
Ritor1
parents:
diff changeset
2602 int v606; // edx@1091
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2603 AwardType *v607; // ecx@1100
0
Ritor1
parents:
diff changeset
2604 __int16 v608; // ax@1102
Ritor1
parents:
diff changeset
2605 signed int v609; // eax@1104
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1122
diff changeset
2606 int v610; // edi@1106
0
Ritor1
parents:
diff changeset
2607 unsigned int v611; // eax@1106
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2608 Player *v612; // edi@1106
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2609 DDM_DLV_Header *v613; // eax@1108
0
Ritor1
parents:
diff changeset
2610 int v615; // edi@1119
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
2611 Player *v619; // edi@1123
0
Ritor1
parents:
diff changeset
2612 signed __int64 v623; // qax@1127
Ritor1
parents:
diff changeset
2613 int v625; // edi@1129
Ritor1
parents:
diff changeset
2614 signed int v627; // eax@1129
Ritor1
parents:
diff changeset
2615 signed int v628; // edi@1129
Ritor1
parents:
diff changeset
2616 int v629; // ecx@1130
Ritor1
parents:
diff changeset
2617 Player *v630; // eax@1131
Ritor1
parents:
diff changeset
2618 int v631; // eax@1137
Ritor1
parents:
diff changeset
2619 int v635; // edi@1142
Ritor1
parents:
diff changeset
2620 int v642; // edi@1156
Ritor1
parents:
diff changeset
2621 int v643; // eax@1156
Ritor1
parents:
diff changeset
2622 int v644; // eax@1156
Ritor1
parents:
diff changeset
2623 signed int v645; // eax@1158
Ritor1
parents:
diff changeset
2624 unsigned int v656; // [sp-4h] [bp-E88h]@639
Ritor1
parents:
diff changeset
2625 int v657; // [sp-4h] [bp-E88h]@807
Ritor1
parents:
diff changeset
2626 int v659; // [sp+0h] [bp-E84h]@123
Ritor1
parents:
diff changeset
2627 int v660; // [sp+0h] [bp-E84h]@146
Ritor1
parents:
diff changeset
2628 Actor *v661; // [sp+0h] [bp-E84h]@164
Ritor1
parents:
diff changeset
2629 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639
Ritor1
parents:
diff changeset
2630 const char *v664; // [sp+0h] [bp-E84h]@802
Ritor1
parents:
diff changeset
2631 int v665; // [sp+0h] [bp-E84h]@807
Ritor1
parents:
diff changeset
2632 int v666; // [sp+4h] [bp-E80h]@12
821
5e3f4bf3b8e6 * UpdateActorAI clean
zipi
parents: 819
diff changeset
2633 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25
0
Ritor1
parents:
diff changeset
2634 int v671; // [sp+4h] [bp-E80h]@146
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2635 int v675; // [sp+4h] [bp-E80h]@800
0
Ritor1
parents:
diff changeset
2636 int v676; // [sp+4h] [bp-E80h]@807
Ritor1
parents:
diff changeset
2637 int v677; // [sp+4h] [bp-E80h]@861
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
2638 int v679[800]; // [sp+14h] [bp-E70h]@515
0
Ritor1
parents:
diff changeset
2639 AIDirection a3; // [sp+C94h] [bp-1F0h]@21
Ritor1
parents:
diff changeset
2640 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
Ritor1
parents:
diff changeset
2641 int v682[4]; // [sp+CC0h] [bp-1C4h]@731
Ritor1
parents:
diff changeset
2642 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791
Ritor1
parents:
diff changeset
2643 int v684; // [sp+D04h] [bp-180h]@416
Ritor1
parents:
diff changeset
2644 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416
Ritor1
parents:
diff changeset
2645 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2646 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2647 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2648 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2649 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129
0
Ritor1
parents:
diff changeset
2650 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2651 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2652 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2653 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
1119
aa706cde7fda * dark spells working
zipi
parents: 1108
diff changeset
2654 int v710; // [sp+D8Ch] [bp-F8h]@1156
0
Ritor1
parents:
diff changeset
2655 __int64 v712; // [sp+D94h] [bp-F0h]@991
Ritor1
parents:
diff changeset
2656 int v713; // [sp+D9Ch] [bp-E8h]@324
Ritor1
parents:
diff changeset
2657 int n; // [sp+DA0h] [bp-E4h]@1
Ritor1
parents:
diff changeset
2658 AIDirection v715; // [sp+DA4h] [bp-E0h]@21
Ritor1
parents:
diff changeset
2659 int v716; // [sp+DC0h] [bp-C4h]@272
Ritor1
parents:
diff changeset
2660 __int64 v717; // [sp+DC4h] [bp-C0h]@271
Ritor1
parents:
diff changeset
2661 float v718; // [sp+DCCh] [bp-B8h]@176
Ritor1
parents:
diff changeset
2662 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
Ritor1
parents:
diff changeset
2663 char *y; // [sp+DD4h] [bp-B0h]@325
Ritor1
parents:
diff changeset
2664 int v721; // [sp+DD8h] [bp-ACh]@163
Ritor1
parents:
diff changeset
2665 int v723; // [sp+E4Ch] [bp-38h]@1
Ritor1
parents:
diff changeset
2666 ItemGen *_this; // [sp+E50h] [bp-34h]@23
Ritor1
parents:
diff changeset
2667 float v725; // [sp+E54h] [bp-30h]@23
Ritor1
parents:
diff changeset
2668 Player *v726; // [sp+E58h] [bp-2Ch]@131
Ritor1
parents:
diff changeset
2669 float v727; // [sp+E5Ch] [bp-28h]@1
Ritor1
parents:
diff changeset
2670 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53
Ritor1
parents:
diff changeset
2671 Player *pPlayer; // [sp+E64h] [bp-20h]@8
Ritor1
parents:
diff changeset
2672 int v730; // [sp+E68h] [bp-1Ch]@53
89
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2673 Player *v730b;
98cd93e14777 pointer fixes
zipi
parents: 82
diff changeset
2674 ItemGen *v730c;
0
Ritor1
parents:
diff changeset
2675 int v731; // [sp+E6Ch] [bp-18h]@48
Ritor1
parents:
diff changeset
2676 signed int v732; // [sp+E70h] [bp-14h]@325
Ritor1
parents:
diff changeset
2677 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1
Ritor1
parents:
diff changeset
2678 signed int a2; // [sp+E7Ch] [bp-8h]@14
Ritor1
parents:
diff changeset
2679 int amount; // [sp+E80h] [bp-4h]@1
Ritor1
parents:
diff changeset
2680
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2681 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
2682
0
Ritor1
parents:
diff changeset
2683 v2 = 0;
Ritor1
parents:
diff changeset
2684 amount = 0;
Ritor1
parents:
diff changeset
2685 LODWORD(v733) = 0;
Ritor1
parents:
diff changeset
2686 v723 = 0;
Ritor1
parents:
diff changeset
2687 v727 = 0.0;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2688 for(n = 0; n < 10; ++n)
0
Ritor1
parents:
diff changeset
2689 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2690 pCastSpell = &this[n];
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2691 HIDWORD(v733) = (int)pCastSpell;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2692 if ( pCastSpell->spellnum == 0 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2693 continue;
486
Nomad
parents: 482
diff changeset
2694
Nomad
parents: 482
diff changeset
2695 if (pParty->Invisible())
Nomad
parents: 482
diff changeset
2696 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
Nomad
parents: 482
diff changeset
2697
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2698 if ( pCastSpell->field_8 & 0x3CA )
0
Ritor1
parents:
diff changeset
2699 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2700 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() )
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2701 this->_427D48(1);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2702 continue;
0
Ritor1
parents:
diff changeset
2703 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2704 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2705
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2706 a2 = pCastSpell->spell_target_pid;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2707 if (!pCastSpell->spell_target_pid)
0
Ritor1
parents:
diff changeset
2708 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2709 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD ||
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2710 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD ||
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2711 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD )
488
Nomad
parents: 486
diff changeset
2712 v666 = 1;
Nomad
parents: 486
diff changeset
2713 else
Nomad
parents: 486
diff changeset
2714 v666 = 0;
Nomad
parents: 486
diff changeset
2715
Nomad
parents: 486
diff changeset
2716 a2 = stru_50C198.FindClosestActor(5120, 1, v666);
Nomad
parents: 486
diff changeset
2717 v6 = pMouse->uPointingObjectID;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2718 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() )
488
Nomad
parents: 486
diff changeset
2719 a2 = pMouse->uPointingObjectID;
0
Ritor1
parents:
diff changeset
2720 }
488
Nomad
parents: 486
diff changeset
2721
Nomad
parents: 486
diff changeset
2722
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2723 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2724 if (pSpellSprite.uType)
0
Ritor1
parents:
diff changeset
2725 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
2726 if (PID_TYPE(a2) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
2727 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2728 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715));
0
Ritor1
parents:
diff changeset
2729 v2 = v723;
Ritor1
parents:
diff changeset
2730 }
Ritor1
parents:
diff changeset
2731 else
Ritor1
parents:
diff changeset
2732 {
Ritor1
parents:
diff changeset
2733 v715.uYawAngle = pParty->sRotationY;
Ritor1
parents:
diff changeset
2734 v715.uPitchAngle = pParty->sRotationX;
Ritor1
parents:
diff changeset
2735 }
Ritor1
parents:
diff changeset
2736 }
488
Nomad
parents: 486
diff changeset
2737
486
Nomad
parents: 482
diff changeset
2738 LODWORD(v725) = 0;
Nomad
parents: 482
diff changeset
2739 _this = 0;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2740 if (pCastSpell->forced_spell_skill_level)
488
Nomad
parents: 486
diff changeset
2741 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2742 v11 = pCastSpell->forced_spell_skill_level;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
2743 v723 = v11 & 0x3F; // 6 bytes
488
Nomad
parents: 486
diff changeset
2744 v2 = v723;
Nomad
parents: 486
diff changeset
2745 }
Nomad
parents: 486
diff changeset
2746 else
0
Ritor1
parents:
diff changeset
2747 {
488
Nomad
parents: 486
diff changeset
2748 //v667 = PLAYER_SKILL_STAFF;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2749 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE)
488
Nomad
parents: 486
diff changeset
2750 v667 = PLAYER_SKILL_FIRE;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2751 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN)
488
Nomad
parents: 486
diff changeset
2752 v667 = PLAYER_SKILL_AIR;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2753 else if (pCastSpell->spellnum < SPELL_EARTH_STUN)
488
Nomad
parents: 486
diff changeset
2754 v667 = PLAYER_SKILL_WATER;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2755 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE)
488
Nomad
parents: 486
diff changeset
2756 v667 = PLAYER_SKILL_EARTH;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2757 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR)
488
Nomad
parents: 486
diff changeset
2758 v667 = PLAYER_SKILL_SPIRIT;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2759 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS)
488
Nomad
parents: 486
diff changeset
2760 v667 = PLAYER_SKILL_MIND;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2761 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT)
488
Nomad
parents: 486
diff changeset
2762 v667 = PLAYER_SKILL_BODY;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2763 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE)
488
Nomad
parents: 486
diff changeset
2764 v667 = PLAYER_SKILL_LIGHT;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2765 else if (pCastSpell->spellnum < SPELL_BOW_ARROW)
488
Nomad
parents: 486
diff changeset
2766 v667 = PLAYER_SKILL_DARK;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2767 else if (pCastSpell->spellnum == SPELL_BOW_ARROW)
488
Nomad
parents: 486
diff changeset
2768 v667 = PLAYER_SKILL_BOW;
Nomad
parents: 486
diff changeset
2769 else assert(false && "Unknown spell");
Nomad
parents: 486
diff changeset
2770
0
Ritor1
parents:
diff changeset
2771 LODWORD(v725) = v667;
488
Nomad
parents: 486
diff changeset
2772 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F;
Nomad
parents: 486
diff changeset
2773 v2 = v723;
Nomad
parents: 486
diff changeset
2774 v11 = pPlayer->pActiveSkills[LODWORD(v725)];
0
Ritor1
parents:
diff changeset
2775 }
488
Nomad
parents: 486
diff changeset
2776
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
2777 v731 = SkillToMastery(v11);
488
Nomad
parents: 486
diff changeset
2778
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2779 if (pCastSpell->forced_spell_skill_level)
486
Nomad
parents: 482
diff changeset
2780 uRequiredMana = 0;
488
Nomad
parents: 486
diff changeset
2781 else
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2782 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1];
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2783 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1];
488
Nomad
parents: 486
diff changeset
2784
Nomad
parents: 486
diff changeset
2785 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 ||
490
Nomad
parents: 488
diff changeset
2786 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0)
486
Nomad
parents: 482
diff changeset
2787 uRequiredMana = 0;
488
Nomad
parents: 486
diff changeset
2788
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2789 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana)
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2790 {
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2791 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points"
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2792 pCastSpell->spellnum = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2793 continue;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2794 }
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2795 v730 = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2796 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50)
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2797 {
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2798 if (!pParty->bTurnBasedModeOn)
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2799 {
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2800 //v646 = pPlayer;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2801 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2802 //v647 = n;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2803 }
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2804 else
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2805 {
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2806 //v647 = n;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2807 //v646 = pPlayer;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2808 //v648 = sRecoveryTime;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2809 //v649 = pPlayer;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2810 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2811 pPlayer->SetRecoveryTime(sRecoveryTime);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2812 pTurnEngine->_40471C();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2813 }
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2814 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed"
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2815 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2816 this[n].spellnum = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2817 pPlayer->sMana -= uRequiredMana;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2818 return;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2819 }
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2820
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2821 switch ( pCastSpell->spellnum )
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2822 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2823 case SPELL_101:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2824 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow");
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2825 case SPELL_BOW_ARROW:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2826 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2827 amount = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2828 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2829 amount = 2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2830 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2831 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2832 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2833 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2834 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2835 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1052
diff changeset
2836 if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) )
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2837 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2838 pSpellSprite.vPosition.x = pParty->vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2839 pSpellSprite.vPosition.y = pParty->vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2840 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2841 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2842 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2843 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2844 pSpellSprite.spell_target_pid = a2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2845 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2846 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2847 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2848 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
1100
b82375804b5d arrow damage fixed
zipi
parents: 1090
diff changeset
2849 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24));
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2850 pSpellSprite.uAttributes = 256;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2851 if ( pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2852 pSpellSprite.uAttributes = 260;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2853 for ( i = 0; i < amount; ++i )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2854 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2855 if ( i )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2856 pSpellSprite.vPosition.z += 32;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2857 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2858 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2859 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2860 ++pTurnEngine->field_1C;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2861 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2862 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2863 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2864 case SPELL_LASER_PROJECTILE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2865 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2866 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2867 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2868 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2869 pSpellSprite.spell_level = v723;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2870 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2871 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2872 pSpellSprite.vPosition.x = pParty->vPosition.x;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2873 pSpellSprite.vPosition.y = pParty->vPosition.y;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2874 pSpellSprite.uAttributes = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2875 pSpellSprite.uSpriteFrameID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2876 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2877 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2878 pSpellSprite.spell_target_pid = a2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2879 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2880 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2881 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2882 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2883 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24));
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2884 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2885 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], );
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2886 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2887 HIBYTE(pSpellSprite.uAttributes) |= 1u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2888 pSpellSprite.uSectorID = v23;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2889 if ( pParty->bTurnBasedModeOn == 1 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2890 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2891 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2892 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2893 ++pTurnEngine->field_1C;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
2894 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2895 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2896 case SPELL_FIRE_TORCH_LIGHT:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2897 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2898 switch (v731)
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2899 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2900 case 1: amount = 2; break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2901 case 2: amount = 3; break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2902 case 3:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2903 case 4: amount = 4; break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2904 default:
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2905 assert(false);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2906 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2907 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2908 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2909 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2910 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2911 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2912 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2913 case SPELL_FIRE_FIRE_SPIKE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2914 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2915 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2916 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2917 case 1: amount = 3; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2918 case 2: amount = 5; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2919 case 3: amount = 7; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2920 case 4: amount = 9; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2921 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2922 assert(false);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2923 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2924
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2925 //v31 = v3->uPlayerID;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2926 //v32 = 8 * v31;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2927 //LOBYTE(v32) = v32 | OBJECT_Player;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2928
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2929 //if ( (signed int)uNumSpriteObjects > 0 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2930 int _v733 = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2931 for (uint i = 0; i < uNumSpriteObjects; ++i)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2932 {
1207
96a81634669e arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents: 1206
diff changeset
2933 auto object = &pSpriteObjects[i];
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2934 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID))
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2935 ++_v733;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2936 /*v33 = (char *)&pSpriteObjects[0].field_48;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2937 v730 = uNumSpriteObjects;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2938 do
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2939 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2940 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2941 ++HIDWORD(v733);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2942 v33 += 112;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2943 --v730;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2944 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2945 while ( v730 );*/
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2946 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2947 if (_v733 > amount)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2948 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2949 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2950 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2951 pCastSpell->spellnum = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2952 continue;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2953 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2954 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2955 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2956 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2957 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2958 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2959 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2960 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2961 pSpellSprite.vPosition.y = pParty->vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2962 pSpellSprite.vPosition.x = pParty->vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2963 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2964 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2965 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2966 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2967 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2968 pSpellSprite.spell_target_pid = a2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2969 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2970 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2971 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2972 if ( pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2973 LOBYTE(pSpellSprite.uAttributes) |= 4u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2974 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2975 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2976 ++pTurnEngine->field_1C;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
2977 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2978 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
2979 }
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2980 case SPELL_AIR_IMPLOSION:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2981 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2982 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2983 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2984 if (!a2)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2985 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2986 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2987 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2988 pCastSpell->spellnum = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2989 continue;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2990 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2991 if (PID_TYPE(a2) != OBJECT_Actor)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2992 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2993 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2994 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2995 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2996 v697.x = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2997 v697.y = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2998 v697.z = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
2999 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3000 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3001 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3002 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3003 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3004 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3005 pSpellSprite.uSectorID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3006 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3007 pSpellSprite.field_60_distance_related_prolly_lod = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3008 pSpellSprite.uFacing = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3009 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3010 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3011 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3012 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3013 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3014 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3015 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3016 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3017 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3018 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3019 }
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3020 case SPELL_EARTH_MASS_DISTORTION:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3021 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3022 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3023 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3024 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3025 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3026 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3027 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3028 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3029 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3030 v704.x = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3031 v704.y = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3032 v704.z = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3033 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3034 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3035 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3036 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3037 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3038 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3039 pSpellSprite.uSectorID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3040 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3041 pSpellSprite.field_60_distance_related_prolly_lod = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3042 pSpellSprite.uFacing = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3043 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3044 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3045 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3046 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3047 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1088
diff changeset
3048 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3049 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3050 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3051 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3052 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3053 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3054 case SPELL_LIGHT_DESTROY_UNDEAD:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3055 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3056 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3057 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3058 //v730 = a2 >> 3;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3059 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)];
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3060 v691.x = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3061 v691.y = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3062 v691.z = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3063 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3064 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3065 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3066 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3067 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3068 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3069 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3070 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3071 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3072 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3073 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3074 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3075 pSpellSprite.spell_target_pid = a2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3076 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3077 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3078 pSpellSprite.uAttributes |= 0x80u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3079 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3080 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3081 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3082 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3083 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3084 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3085 pCastSpell->spellnum = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3086 continue;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3087 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3088 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3089 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3090 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3091 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3092 case SPELL_FIRE_FIRE_BOLT:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3093 case SPELL_FIRE_FIREBALL:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3094 case SPELL_FIRE_INCINERATE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3095 case SPELL_AIR_LIGHNING_BOLT:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3096 case SPELL_WATER_ICE_BOLT:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3097 case SPELL_WATER_ICE_BLAST:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3098 case SPELL_EARTH_STUN:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3099 case SPELL_EARTH_DEADLY_SWARM:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3100 case SPELL_MIND_MIND_BLAST:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3101 case SPELL_MIND_PSYCHIC_SHOCK:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3102 case SPELL_BODY_HARM:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3103 case SPELL_LIGHT_LIGHT_BOLT:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3104 case SPELL_DARK_DRAGON_BREATH:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3105 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3106 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3107 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3108 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3109 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3110 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3111 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3112 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3113 pSpellSprite.vPosition.y = pParty->vPosition.y;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3114 pSpellSprite.vPosition.x = pParty->vPosition.x;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3115 pSpellSprite.uAttributes = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3116 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3117 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3118 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3119 else
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3120 pSpellSprite.uSectorID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3121 pSpellSprite.uSpriteFrameID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3122 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3123 pSpellSprite.spell_target_pid = a2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3124 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3125 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3126 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3127 if ( pParty->bTurnBasedModeOn == 1 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3128 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3129 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT )
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3130 LOBYTE(pSpellSprite.uAttributes) |= 0x40u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3131 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3132 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3133 ++pTurnEngine->field_1C;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3134 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3135 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3136 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3137 case SPELL_WATER_ACID_BURST:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3138 case SPELL_EARTH_BLADES:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3139 case SPELL_BODY_FLYING_FIST:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3140 case SPELL_DARK_TOXIC_CLOUD:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3141 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3142 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3143 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3144 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3145 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3146 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3147 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3148 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3149 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3150 pSpellSprite.vPosition.y = pParty->vPosition.y;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3151 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3152 v660 = pParty->vPosition.y;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3153 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3154 pSpellSprite.vPosition.x = pParty->vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3155 pSpellSprite.vPosition.z = v51;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3156 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3157 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3158 pSpellSprite.uSectorID = v52;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3159 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3160 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3161 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3162 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3163 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3164 if ( pParty->bTurnBasedModeOn == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3165 LOBYTE(pSpellSprite.uAttributes) |= 4u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3166 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3167 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3168 ++pTurnEngine->field_1C;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3169 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3170 break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3171 }
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3172 case SPELL_LIGHT_SUNRAY:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3173 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3174 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3175 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3176 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3177 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3178 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3179 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3180 continue;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3181 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3182 if ( pPlayer->CanCastSpell(uRequiredMana) )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3183 {
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3184 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3185 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3186 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3187 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3188 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3189 pSpellSprite.vPosition.y = pParty->vPosition.y;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3190 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3191 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3192 v660 = pParty->vPosition.y;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3193 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3194 pSpellSprite.vPosition.x = pParty->vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3195 pSpellSprite.vPosition.z = v51;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3196 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3197 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3198 pSpellSprite.uSectorID = v52;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3199 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3200 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3201 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3202 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3203 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3204 if ( pParty->bTurnBasedModeOn == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3205 LOBYTE(pSpellSprite.uAttributes) |= 4u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3206 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3207 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3208 ++pTurnEngine->field_1C;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3209 LODWORD(v727) = 1;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3210 }
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3211 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3212 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3213 case SPELL_LIGHT_PARALYZE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3214 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3215 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3216 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3217 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)],
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3218 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3219 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3220 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3221 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3222 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3223 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3224 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3225 v55 = &pActors[PID_ID(a2)];
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3226 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3227 BYTE2(v55->uAttributes) |= 8u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3228 v55->vVelocity.x = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3229 //v672 = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3230 v55->vVelocity.y = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3231 v661 = v55;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3232 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3233 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3234 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3235 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3236 case SPELL_EARTH_SLOW:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3237 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3238 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3239 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3240 case 1: LODWORD(v733) = 180 * v2; amount = 2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3241 case 2: LODWORD(v733) = 300 * v2; amount = 2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3242 case 3: LODWORD(v733) = 300 * v2; amount = 4; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3243 case 4: LODWORD(v733) = 300 * v2; amount = 8; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3244 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3245 assert(false);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3246 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3247 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3248 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3249 if (PID_TYPE(a2) != OBJECT_Actor
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3250 || (v721 = 836 * PID_ID(a2),
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3251 LODWORD(v718) = (int)&pActors[PID_ID(a2)],
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3252 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3253 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3254 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3255 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3256 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3257 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335);
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3258 //v59 = v721;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3259 pActor = &pActors[PID_ID(a2)];
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3260 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3261 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3262 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3263 BYTE2(pActor->uAttributes) |= 8u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3264 //v672 = 0;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3265 v661 = (Actor *)LODWORD(v718);
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3266 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3267 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3268 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3269 }
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3270 case SPELL_MIND_CHARM:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3271 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3272 if ( !pPlayer->CanCastSpell(uRequiredMana) )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3273 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3274
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3275 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3276 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3277 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3278 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3279 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3280
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3281 uint power = 300 * v2;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3282 if ( v731 == 2 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3283 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3284 power = 600 * v2;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3285 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3286 else if ( v731 == 3 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3287 power = 29030400;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3288
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3289 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3290 pActors[PID_ID(a2)].pActorBuffs[9].Reset();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3291 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3292 pActors[PID_ID(a2)].pActorBuffs[12].Reset();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3293 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply(
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3294 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335),
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3295 v731, 0, 0, 0);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3296 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3297 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3298 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3299 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3300 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3301 v61 = PID_ID(a2);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3302 v600 = pActors[v61].vPosition.y;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3303 v601 = pActors[v61].vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3304 pSpellSprite.uObjectDescID = v60;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3305 pSpellSprite.vPosition.x = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3306 v602 = pActors[v61].uActorHeight;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3307 v603 = pActors[v61].vPosition.z;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3308 pSpellSprite.vPosition.y = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3309 v676 = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3310 v665 = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3311 pSpellSprite.vPosition.z = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3312 v657 = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3313 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3314 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3315 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3316 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3317 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3318 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3319 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3320 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3321 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3322 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3323 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3324 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3325 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3326 case SPELL_DARK_SHRINKING_RAY:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3327 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3328 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3329 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3330 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3331 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3332 pSpellSprite.vPosition.x = pParty->vPosition.x;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3333 pSpellSprite.vPosition.y = pParty->vPosition.y;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3334 pSpellSprite.uAttributes = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3335 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3336 pSpellSprite.uSectorID = pIndoor->GetSector(
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3337 pParty->vPosition.x,
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3338 pParty->vPosition.y,
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3339 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3340 pSpellSprite.uSpriteFrameID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3341 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3342 pSpellSprite.spell_target_pid = a2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3343 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3344 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3345 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3346 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3347 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3348 pSpellSprite.spell_level = 300 * v2;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3349 if ( pParty->bTurnBasedModeOn == 1 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3350 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3351
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3352 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3353
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3354 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3355 ++pTurnEngine->field_1C;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3356 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3357 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3358 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3359 case SPELL_FIRE_FIRE_AURA:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3360 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3361 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3362 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3363 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3364 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3365 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3366 case 4: LODWORD(v733) = 0; amount = 12; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3367 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3368 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3369 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3370
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3371 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3372 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3373 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3374 auto _itm = &pItemsTable->pItems[v730c->uItemID];
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3375 v730c->UpdateTempBonus(pParty->uTimePlayed);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3376 if ( v730c->uItemID < 64 || v730c->uItemID > 65
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3377 && !v730c->Broken()
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3378 && !v730c->uSpecEnchantmentType
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3379 && !v730c->uEnchantmentType
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3380 && ( _itm->uEquipType == 0 || _itm->uEquipType == 1 || _itm->uEquipType == 2)
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3381 && !pItemsTable->IsMaterialNonCommon(v730c) )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3382 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3383 v69 = v730c;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3384 v14 = v731 == 4;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3385 v730c->uSpecEnchantmentType = amount;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3386 if ( !v14 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3387 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3388 v69->uExpireTime = pParty->uTimePlayed
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3389 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7)
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3390 * 0.033333335);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3391 v69->uAttributes |= 8u;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3392 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3393 v69->uAttributes |= 0x10u;
984
d982fffb8b96 CharacterUI_InventoryTab_Draw cleaned.
Nomad
parents: 961
diff changeset
3394 _50C9A8_item_enchantment_timer = 256;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3395 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3396 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3397 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3398
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3399 dword_50C9D0 = 113;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3400 dword_50C9D4 = 0;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3401 dword_50C9D8 = 1;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3402
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3403 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3404 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3405 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3406 continue;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3407 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3408 case SPELL_BODY_REGENERATION:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3409 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3410 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3411 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3412 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3413 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3414 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3415 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3416 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3417 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3418 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3419 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3420 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3421
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3422 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3423
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3424 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3425 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3426 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3427 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3428 case SPELL_FIRE_PROTECTION_FROM_FIRE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3429 case SPELL_AIR_PROTECTION_FROM_AIR:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3430 case SPELL_WATER_PROTECTION_FROM_WATER:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3431 case SPELL_EARTH_PROTECTION_FROM_EARTH:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3432 case SPELL_MIND_PROTECTION_FROM_MIND:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3433 case SPELL_BODY_PROTECTION_FROM_BODY:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3434 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3435 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3436 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3437 case 1:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3438 case 2:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3439 case 3:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3440 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3441 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3442 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3443 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3444
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3445 switch (pCastSpell->spellnum)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3446 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3447 case SPELL_FIRE_PROTECTION_FROM_FIRE:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3448 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3449 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3450 case SPELL_AIR_PROTECTION_FROM_AIR:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3451 LODWORD(v725) = PARTY_BUFF_RESIST_AIR;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3452 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3453 case SPELL_WATER_PROTECTION_FROM_WATER:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3454 LODWORD(v725) = PARTY_BUFF_RESIST_WATER;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3455 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3456 case SPELL_EARTH_PROTECTION_FROM_EARTH:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3457 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3458 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3459 case SPELL_MIND_PROTECTION_FROM_MIND:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3460 LODWORD(v725) = PARTY_BUFF_RESIST_MIND;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3461 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3462 case SPELL_BODY_PROTECTION_FROM_BODY:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3463 LODWORD(v725) = PARTY_BUFF_RESIST_BODY;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3464 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3465 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3466 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3467 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3468 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3469 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3470 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3471 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3472 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3473 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3474 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3475 v90 = (double)(signed int)v733 * 4.2666669;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3476 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3477 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3478 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3479 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3480 case SPELL_FIRE_HASTE:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3481 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3482 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3483 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3484 case 1: LODWORD(v733) = 60 * (v2 + 60); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3485 case 2: LODWORD(v733) = 60 * (v2 + 60); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3486 case 3: LODWORD(v733) = 180 * (v2 + 20); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3487 case 4: LODWORD(v733) = 240 * (v2 + 15); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3488 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3489 assert(false);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3490 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3491 if ( pPlayer->CanCastSpell(uRequiredMana) )
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3492 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3493 v92 = pParty->pPlayers;//[0].pConditions[1];
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3494 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3495 do
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3496 {
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1088
diff changeset
3497 if ( v92->pConditions[1] )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3498 LODWORD(v727) = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3499 ++v92;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3500 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3501 while ( v92 <= &pParty->pPlayers[3] );
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3502 if (LODWORD(v727))
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3503 {
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3504 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3505
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3506 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3507 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3508 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3509 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3510 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3511 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3512 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3513 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3514 case SPELL_SPIRIT_BLESS:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3515 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3516 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3517 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3518 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3519 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3520 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3521 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3522 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3523 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3524 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3525 amount = v2 + 5;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3526 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3527 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3528 if ( v731 == 1 )
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3529 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3530 v108 = pCastSpell->uPlayerID_2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3531 v109 = pCastSpell->spellnum;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3532 v110 = pGame->GetStru6();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3533 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3534 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3535 //v668 = 0;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3536 v716 = v111;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3537 //v658 = v111;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3538 //v653 = amount;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3539 //v651 = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3540 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3541 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS];
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3542 //LABEL_103:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3543 //HIDWORD(v650) = HIDWORD(v28);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3544 //LABEL_104:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3545 //LODWORD(v650) = v28;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3546 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3547 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3548 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3549 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3550 v105 = 0;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3551 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3552 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1];
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3553 do
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3554 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3556 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3557 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3558 ++v730b;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3559 ++v105;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3560 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3561 while ( v730b <= &pParty->pPlayers[3] );
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3562 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3563 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3564 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3565 case SPELL_SPIRIT_SPIRIT_LASH:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3566 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3567 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor)
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3568 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3569 //v730 = a2 >> 3;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3570 v112 = &pActors[PID_ID(a2)];
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3571 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3572 v721 = abs(v112->vPosition.y - pParty->vPosition.y);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3573 v113 = abs(v112->vPosition.x - pParty->vPosition.x);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3574 _this = (ItemGen *)v113;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3575 v114 = v721;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3576 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3577 if ( v113 < v721 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3578 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3579 v116 = v113;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3580 v113 = v721;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3581 v114 = v116;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3582 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3583 if ( v113 < (signed int)v115 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3584 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3585 v117 = v113;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3586 v113 = (int)v115;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3587 v115 = v117;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3588 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3589 if ( v114 < (signed int)v115 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3590 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3591 v118 = v115;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3592 v115 = v114;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3593 v114 = v118;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3594 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3595 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3596 if ( (double)(signed int)this <= 307.2 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3597 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3598 v701.x = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3599 v701.y = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3600 v701.z = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3601 pSpellSprite.stru_24.Reset();
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3602 pSpellSprite.spell_id = pCastSpell->spellnum;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3603 pSpellSprite.spell_level = v723;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3604 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3605 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3606 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3607 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3608 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3609 pSpellSprite.field_60_distance_related_prolly_lod = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3610 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3611 pSpellSprite.uFacing = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3612 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3613 pSpellSprite.vPosition.x = v112->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3614 pSpellSprite.vPosition.y = v112->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3615 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3616 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3617 v122 = pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3618 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3619 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3620 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3621 else
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3622 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3623 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3624 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3625 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3626 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3627 //pCastSpell = (CastSpellInfo *)HIDWORD(v733);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3628 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3629 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3630 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3631 case SPELL_AIR_SHIELD:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3632 case SPELL_EARTH_STONESKIN:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3633 case SPELL_SPIRIT_HEROISM:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3634 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3635 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3636 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3637 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3638 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3639 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3640 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3641 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3642 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3643 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3644 v127 = pCastSpell->spellnum;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3645 if ( v127 == 17 )
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3646 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3647 amount = 0;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3648 LODWORD(v725) = 14;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3649 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3650 else
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3651 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3652 if ( v127 == 38 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3653 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3654 LODWORD(v725) = 15;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3655 amount = v2 + 5;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3656 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3657 else
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3658 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3659 if ( v127 != 51 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3660 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3661 LODWORD(v725) = 9;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3662 amount = v2 + 5;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3663 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3664 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3665 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3666 break;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3667 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3668 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3669 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3670 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3671 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3672 //LABEL_304:
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3673 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3674 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3675 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3676 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3677 case SPELL_FIRE_IMMOLATION:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3678 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3679 if ( v731 == 4 )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3680 LODWORD(v733) = 600 * v2;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3681 else
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
3682 LODWORD(v733) = 60 * v2;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3683 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3684 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3685
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3686 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3687 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3688 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3689 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3690
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3691 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3692 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3693 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3694 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3695 case SPELL_FIRE_METEOR_SHOWER:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3696 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3697 //v149 = v731 - 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3698 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 )
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3699 int i;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3700 if ( v731 == 4 )
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3701 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3702 i = 20;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3703 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3704 else
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3705 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3706 i = 16;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3707 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3708 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3709 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3710 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors!
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3711 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3712 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3713 continue;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3714 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3715 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3716 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3717 LODWORD(v725) = PID_TYPE(a2);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3718 if (PID_TYPE(a2) == OBJECT_Actor)
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3719 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3720 uRequiredMana = pActors[PID_ID(a2)].vPosition.x;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3721 v153 = pActors[PID_ID(a2)].vPosition.y;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3722 v154 = pActors[PID_ID(a2)].vPosition.z;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3723 LODWORD(v727) = v153;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3724 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3725 else
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3726 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3727 v155 = stru_5C6E00->Cos(pParty->sRotationY);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3728 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3729 v156 = stru_5C6E00->Sin(pParty->sRotationY);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3730 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3731 v154 = pParty->vPosition.z;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3732 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3733 unsigned __int64 k = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3734 int j = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3735 if ( (signed int)i > 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3736 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3737 v730 = LODWORD(v725) == 3 ? a2 : 0;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3738 do
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3739 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3740 a2 = rand() % 1000;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3741 if ( sqrt((double)(rand() % 1000) - 2500 *
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3742 (double)(rand() % 1000) - 2500 +
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3743 j * j + k * k) <= 1.0 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3744 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3745 LODWORD(v687) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3746 HIDWORD(v687) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3747 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3748 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3749 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3750 v687 = __PAIR__(
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3751 stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)),
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3752 (double)(rand() % 1000) - 2500),
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3753 stru_5C6E00->Atan2(j, k));
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3754 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3755 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3756 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3757 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3758 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3759 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3760 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3761 pSpellSprite.vPosition.x = uRequiredMana;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3762 pSpellSprite.vPosition.y = LODWORD(v727);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3763 pSpellSprite.uSectorID = 0;
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1088
diff changeset
3764 pSpellSprite.vPosition.z = a2 + v154;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3765 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3766 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3767 pSpellSprite.spell_target_pid = v730;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3768 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3769 pSpellSprite.uFacing = v687;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3770 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3771 if ( pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3772 pSpellSprite.uAttributes = 4;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3773 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3774 && pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3775 ++pTurnEngine->field_1C;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3776 j = rand() % 1024 - 512;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3777 k = rand() % 1024 - 512;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3778 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
3779 while ( i-- != 1 );
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3780 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3781 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3782 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3783 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3784 case SPELL_FIRE_INFERNO:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3785 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3786 //v67 = 2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3787 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3788 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3789 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3790 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3791 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3792 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3793 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3794 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3795 break;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
3796 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3797 v700.z = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3798 v700.y = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3799 v700.x = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3800 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3801 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3802 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3803 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3804 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3805 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3806 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3807 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3808 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3809 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3810 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3811 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3812 a2 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3813 if ( (signed int)_v726 > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3814 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3815 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3816 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3817 v162 = dword_50BF30[a2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3818 pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3819 pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3820 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3821 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3822 v164 = pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3823 v165 = a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3824 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3825 pGame->GetStru6()->_4A81CA(&pSpellSprite);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3826 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3827 a2 = v165 + 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3828 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3829 while ( v165 + 1 < (signed int)_v726 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3830 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3831 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3832 break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3833 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3834 case SPELL_AIR_WIZARD_EYE:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3835 {
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3836 LODWORD(v733) = 3600 * v2;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3837 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3838 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3839 v168 = 0;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3840 do
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3841 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3842 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3843 v716 = v169;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3844 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3845 while ( v168 < 4 );
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3846
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3847 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3848 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3849 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3850 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3851 case SPELL_AIR_FEATHER_FALL:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3852 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3853 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3854 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3855 case 1: LODWORD(v733) = 300 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3856 case 2: LODWORD(v733) = 600 * v2; break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3857 case 3: LODWORD(v733) = 3600 * v2; break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3858 case 4: LODWORD(v733) = 3600 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3859 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3860 assert(false);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3861 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3862 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3863 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3864 v174 = 0;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3865 do
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3866 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3867 while ( v174 < 4 );
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3868 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3869 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3870 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3871 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3872
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3873 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3874 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3875 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3876 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3877 case SPELL_AIR_SPARKS:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3878 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3879 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3880 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3881 case 1: amount = 3; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3882 case 2: amount = 5; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3883 case 3: amount = 7; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3884 case 4: amount = 9; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3885 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3886 assert(false);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3887 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3888 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3889 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3890 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3891 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3892 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3893 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3894 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3895 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3896 pSpellSprite.vPosition.y = pParty->vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3897 pSpellSprite.vPosition.x = pParty->vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3898 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3899 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3900 pSpellSprite.uSectorID = pIndoor->GetSector(
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3901 pParty->vPosition.x,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3902 pParty->vPosition.y,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3903 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3904 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3905 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3906 pSpellSprite.spell_target_pid = a2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3907 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3908 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3909 if ( pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3910 LOBYTE(pSpellSprite.uAttributes) |= 4u;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3911 v188 = (signed int)_v726 / -2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3912 v189 = (signed int)_v726 / 2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3913 while ( v188 <= v189 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3914 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3915 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3916 if ( pSpellSprite.Create(
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3917 (signed __int16)(v188 + LOWORD(v715.uYawAngle)),
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3918 v715.uPitchAngle,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3919 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3920 pCastSpell->uPlayerID + 1) != -1
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3921 && pParty->bTurnBasedModeOn == 1 )
1106
3395579f6c4d stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents: 1104
diff changeset
3922 ++pTurnEngine->field_1C;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3923 v188 += _v726 / (amount - 1);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3924 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3925 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3926 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3927 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3928 case SPELL_AIR_JUMP:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3929 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3930 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING)
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3931 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3932 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne!
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3933 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3934 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3935 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3936 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3937 break;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3938 v191 = 0;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3939 do
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3940 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3941 while ( v191 < 4 );
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3942 BYTE1(pParty->uFlags) |= 1u;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3943 pParty->uFallSpeed = 1000;
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3944 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3945 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3946 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3947 case SPELL_AIR_INVISIBILITY:
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3948 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3949 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3950 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3951 case 1: LODWORD(v733) = 600 * v2; amount = v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3952 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3953 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3954 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3955 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3956 assert(false);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3957 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3958 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW))
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3959 {
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3960 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby!
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3961 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3962 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3963 continue;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3964 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3965 if ( pPlayer->CanCastSpell(uRequiredMana) )
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
3966 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3967 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3968 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3969 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
3970 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3971
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3972 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3973 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3974 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3975 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3976 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3977 case SPELL_AIR_FLY:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
3978 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3979 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3980 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3981 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors!
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3982 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3983 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3984 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3985 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3986 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3987 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3988 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3989 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3990 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3991 LODWORD(v733) = 3600 * v2;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3992 if ( v731 == 1 || v731 == 2 || v731 == 3 )
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3993 amount = 1;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3994 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
3995 amount = 0;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3996 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3997 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3998 v205 = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
3999 do
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4000 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4001 while ( v205 < 4 );
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4002 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4003 v207 = pCastSpell->uPlayerID + 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4004 v716 = v206;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4006 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4007 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4008 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4009 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4010 case SPELL_AIR_STARBURST:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4011 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4012 //v67 = 2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4013 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4014 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4015 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors!
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4016 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4017 pCastSpell->spellnum = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4018 continue;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4019 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4020 if ( !pPlayer->CanCastSpell(uRequiredMana) )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4021 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4022 v208 = PID_TYPE(a2);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4023 LODWORD(v725) = PID_TYPE(a2);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4024 if ( v208 == 3 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4025 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4026 v209 = PID_ID(a2);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4027 LODWORD(v718) = pActors[v209].vPosition.x;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4028 v210 = pActors[v209].vPosition.y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4029 v211 = pActors[v209].vPosition.z;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4030 v713 = v210;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4031 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4032 else
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4033 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4034 v212 = stru_5C6E00->Cos(pParty->sRotationY);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4035 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4036 v213 = stru_5C6E00->Sin(pParty->sRotationY);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4037 v214 = sub_42EBBE(2048, v213);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4038 v211 = pParty->vPosition.z;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4039 v713 = pParty->vPosition.y + v214;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4040 v208 = LODWORD(v725);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4041 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4042 signed int _v733 = 0;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4043 *(float *)&v732 = (double)v211;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4044 LODWORD(v725) = v211 + 2500;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4045 v721 = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4046 *(float *)&y = (double)(v211 + 2500);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4047 v730 = v208 == 3 ? a2 : 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4048 a2 = 20;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4049 do
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4050 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4051 v215 = rand();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4052 v216 = (double)v721;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4053 v217 = (double)_v733;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4054 *(float *)&uRequiredMana = v217;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4055 _this = (ItemGen *)(v215 % 1000);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4056 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4057 *(float *)&v721 = v217 * v217;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4058 //*(float *)&v726 = v216 * v216;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4059 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4060 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4061 LODWORD(v685) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4062 HIDWORD(v685) = 0;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4063 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4064 else
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4065 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4066 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4067 v685 = __PAIR__(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4068 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)),
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4069 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana));
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4070 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4071 pSpellSprite.stru_24.Reset();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4072 pSpellSprite.spell_id = pCastSpell->spellnum;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4073 pSpellSprite.spell_level = v2;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4074 pSpellSprite.spell_skill = v731;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4075 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4076 pSpellSprite.uAttributes = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4077 pSpellSprite.vPosition.x = LODWORD(v718);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4078 pSpellSprite.vPosition.y = v713;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4079 pSpellSprite.uSectorID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4080 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725));
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4081 pSpellSprite.uSpriteFrameID = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4082 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4083 pSpellSprite.spell_target_pid = v730;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4084 //__debugbreak();//çâåçäîïàä
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4085 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4086 pSpellSprite.uFacing = v685;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4087 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4088 if ( pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4089 pSpellSprite.uAttributes = 4;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4090 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4091 && pParty->bTurnBasedModeOn == 1 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4092 ++pTurnEngine->field_1C;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4093 v721 = rand() % 1024 - 512;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4094 v218 = rand();
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4095 v14 = a2-- == 1;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4096 _v733 = (unsigned __int64)(v218 % 1024) - 512;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4097 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4098 while ( !v14 );
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4099 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4100 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4101 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4102 case SPELL_WATER_AWAKEN:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4103 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4104 switch (v731)
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4105 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4106 case 1: amount = 180 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4107 case 2: amount = 3600 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4108 case 3: amount = 86400 * v2; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4109 case 4: amount = 0; break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4110 default:
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4111 assert(false);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4112 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4113 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4114 break;
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4115 for( int i=0; i < 4; i++ )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4116 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4117 pPlayer = &pParty->pPlayers[i];
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4118 if ( v731 == 4 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4119 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4120 if ( pPlayer->pConditions[2] )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4121 {
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4122 //*((int *)v222 + 4) = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4123 //*((int *)v222 + 5) = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4124 pPlayer->pConditions[2] = 0;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4125 pPlayer->PlaySound(SPEECH_103, 0);
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4126 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4127 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4128 else
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4129 {
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4130 v223 = pPlayer->DiscardConditionIfLastsLongerThan(
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4131 2u,
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4132 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335));
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4133 if ( v223 )
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4134 pPlayer->PlaySound(SPEECH_103, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4135 }
1005
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4136 }
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4137 LODWORD(v727) = 1;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4138 break;
8073f9a70e8b CastSpellInfo::_427E01_cast_spell() more clean
zipi
parents: 1003
diff changeset
4139 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4140 case SPELL_WATER_POISON_SPRAY:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4141 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4142 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4143 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4144 case 1: amount = 1; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4145 case 2: amount = 3; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4146 case 3: amount = 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4147 case 4: amount = 7; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4148 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4149 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4150 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4151 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4152 break;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4153 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4154 if ( amount == 1 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4155 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4156 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4157 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4158 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4159 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4160 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4161 pSpellSprite.vPosition.y = pParty->vPosition.y;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4162 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4163 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4164 v660 = pParty->vPosition.y;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4165 // LABEL_153:
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4166 pSpellSprite.uAttributes = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4167 pSpellSprite.vPosition.x = pParty->vPosition.x;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4168 pSpellSprite.vPosition.z = v51;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4169 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671);
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4170 pSpellSprite.uSpriteFrameID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4171 pSpellSprite.uSectorID = v52;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4172 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4173 pSpellSprite.spell_target_pid = a2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4174 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4175 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4176 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4177 if ( pParty->bTurnBasedModeOn == 1 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4178 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4179 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4180 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4181 ++pTurnEngine->field_1C;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4182 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4183 else
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4184 {
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4185 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4186 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4187 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4188 pSpellSprite.spell_skill = v731;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4189 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4190 pSpellSprite.vPosition.y = pParty->vPosition.y;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4191 pSpellSprite.vPosition.x = pParty->vPosition.x;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4192 pSpellSprite.uAttributes = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4193 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4194 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4195 pSpellSprite.uSpriteFrameID = 0;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4196 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4197 pSpellSprite.spell_target_pid = a2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4198 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4199 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4200 if ( pParty->bTurnBasedModeOn == 1 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4201 LOBYTE(pSpellSprite.uAttributes) |= 4u;
1088
8439c5df37cc small mistakes
zipi
parents: 1080
diff changeset
4202 v227 = _v733 / -2;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4203 signed int _y = _v733 / 2;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4204 if ( _v733 / -2 <= _v733 / 2 )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4205 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4206 v228 = v715.uYawAngle;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4207 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4208 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4209 pSpellSprite.uFacing = v227 + v228;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4210 if ( pSpellSprite.Create(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4211 v227 + v228,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4212 v715.uPitchAngle,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4213 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4214 pCastSpell->uPlayerID + 1) != -1
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4215 && pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4216 ++pTurnEngine->field_1C;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4217 v227 += _v733 / (amount - 1);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4218 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4219 while ( v227 <= _y );
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4220 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4221 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4222 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4223 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4224 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4225 case SPELL_WATER_WATER_WALK:
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4226 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4227 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4228 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4229 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4231 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4232 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4233 if ( v731 == 2 || v731 != 3 && v731 != 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4234 v229 = 600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4235 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4236 v229 = 3600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4237 LODWORD(v733) = v229;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4238 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4239 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4240 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4241 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4242 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4243 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4244 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4245
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4246 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4247 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4248 v731,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4249 amount,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4250 v716,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4251 pCastSpell->uPlayerID + 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4252 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4253 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4254 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4255 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4256 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4257 case SPELL_WATER_RECHARGE_ITEM:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4258 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4259 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4260 break;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4261 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4262
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4263 if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4264 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4265 dword_50C9D0 = 113;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4266 dword_50C9D4 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4267 dword_50C9D8 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4268
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4269 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4270 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4271 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4272 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4273 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4274 if ( v731 == 1 || v731 == 2 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4275 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4276 v241 = (double)v723 * 0.0099999998 + 0.5;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4277 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4278 else if ( v731 == 3 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4279 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4280 v241 = (double)v723 * 0.0099999998 + 0.69999999;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4281 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4282 else if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4283 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4284 v241 = (double)v723 * 0.0099999998 + 0.80000001;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4285 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4286 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4287 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4288 v241 = 0.0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4289 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4290 if ( v241 > 1.0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4291 v241 = 1.0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4292 int uNewCharges = v240->uMaxCharges * v241;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4293 v240->uMaxCharges = uNewCharges;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4294 v240->uNumCharges = uNewCharges;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4295 if ( uNewCharges <= 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4296 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4297 v240 = 0;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4298 dword_50C9D0 = 113;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4299 dword_50C9D4 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4300 dword_50C9D8 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4301 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4302 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4303 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4304 v2 = v723;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4305 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4306 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4307 v240->uAttributes |= 0x40u;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4308 _50C9A8_item_enchantment_timer = 256;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4309 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4310 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4311 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4312 case SPELL_WATER_ENCHANT_ITEM:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4313 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4314 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4315 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4316 uRequiredMana = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4317 amount = 10 * v2;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4318 v730 = 1;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4319 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4320 v245 = &pPlayer->pInventoryItems[a2];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4321 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4322 if (
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4323 v731 == 1 || v731 == 2 && _v725->uEquipType > 2 ||
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4324 v731 == 3 || v731 == 4 &&
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4325 v245->uItemID <= 134 &&
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4326 v245->uSpecEnchantmentType == 0 &&
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4327 v245->uEnchantmentType == 0 &&
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4328 v245->_bonus_strength== 0 &&
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4329 !v245->Broken() )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4330 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4331 if ( v245->GetValue() < 450 ||
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4332 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2)
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4333 )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4334 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4335 v730 = 0;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4336 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4337 if ( rand() % 100 < 10 * v2 ||
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4338 (rand() % 100 < 80 && (v731 == 3 || v731 == 4 )) ||
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4339 v245->GetValue() < 450 ||
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4340 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && v271 >= 0 && v271 <= 2)
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4341 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4342 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4343 v313 = _v725->uEquipType;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4344 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4345 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4346 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4347 v245->uEnchantmentType = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4348 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4349 ;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4350 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4351 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4352 ++v245->uEnchantmentType;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4353 if ( kk >= v295 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4354 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4355 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4356 v255 = 10;//pItemsTable->field_116D8[17];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4357 v256 = 10;//pItemsTable->field_116D8[16];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4358 v245->_bonus_strength = v256 + rand() % (v255 - v256 + 1);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4359 v245->uAttributes |= 0x20u;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4360 _50C9A8_item_enchantment_timer = 256;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4361 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4362 break;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4363 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4364 else if ( v731 == 3 || v731 == 4)
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4365 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4366 v257 = pItemsTable->pSpecialEnchantments_count;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4367 v258 = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4368 v725 = 0.0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4369 int _v733 = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4370 if ( pItemsTable->pSpecialEnchantments_count > 0 )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4371 {
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4372 v730 = (int)&v679;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4373 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4374 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4375 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4376 if ( !v259 || v259 == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4377 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4378 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4379 + 4]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4380 + v258 * 28);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4381 LODWORD(v725) += v260;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4382 if ( v260 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4383 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4384 v261 = v730;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4385 v730 += 4;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4386 *(int *)v261 = _v733;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4387 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4388 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4389 ++_v733;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4390 ++v258;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4391 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4392 while ( _v733 < v257 );
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4393 }
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4394 v262 = rand() % SLODWORD(v725);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4395 v263 = v679;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4396 v245->uSpecEnchantmentType = v679[0];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4397 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4398 v265 = v262 + 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4399 if ( v264 < v265 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4400 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4401 for ( ii = v679; ; ii = (int *)v732 )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4402 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4403 v267 = (int)(ii + 1);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4404 v732 = v267;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4405 v268 = *(int *)v267;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4406 *(int *)(v245 + 12) = v268;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4407 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4408 + 4];
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4409 if ( v264 >= v265 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4410 break;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4411 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4412 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4413
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4414 v277 = pItemsTable->pSpecialEnchantments_count;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4415 v278 = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4416 v725 = 0.0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4417 _v733 = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4418 if ( pItemsTable->pSpecialEnchantments_count > 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4419 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4420 int *_v730 = v679;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4421 do
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4422 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4423 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4424 if ( !v279 || v279 == 1 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4425 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4426 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4427 _v733 += v280;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4428 if ( v280 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4429 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4430 v281 = _v730;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4431 ++_v730;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4432 *v281 = _v733;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4433 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4434 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4435 ++_v733;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4436 ++v278;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4437 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4438 while ( _v733 < v277 );
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4439 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4440 v282 = rand() % _v733;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4441 v283 = v679;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4442 v245->uSpecEnchantmentType = v679[0];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4443 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4444 v285 = v282 + 1;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4445 for ( l = v679; v284 < v285; ++l )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4446 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4447 v245->uSpecEnchantmentType = *(l+1);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4448 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4449 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4450 ++v245->uSpecEnchantmentType;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4451 v245->uAttributes |= 0x20u;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4452 _50C9A8_item_enchantment_timer = 256;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4453 LODWORD(v727) = 1;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4454 break;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4455 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4456 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4457 else
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4458 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4459 if ( !(BYTE1(v245->uAttributes) & 2) )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4460 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4461 v245->uAttributes |= 2;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4462 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4463 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4464
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4465 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4466
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4467 if ( LODWORD(v727) == 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4468 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4469 v317 = pGlobalTXT_LocalizationStrings[428];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4470 if ( v730 == 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4471 v317 = pGlobalTXT_LocalizationStrings[585];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4472 ShowStatusBarString(v317, 2u);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4474 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4475 pCastSpell->spellnum = 0;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4476 v318->PlaySound(SPEECH_43, 0);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4477 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4478
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4479 break;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4480 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4481 case SPELL_WATER_TOWN_PORTAL:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4482 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4483 amount = 10 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4484 if ( pPlayer->sMana < (signed int)uRequiredMana )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4485 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4486 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4487 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4488 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4489 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4490 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4491 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4492 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4493 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4494 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4495 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4496 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4497 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4498 case SPELL_WATER_LLOYDS_BEACON:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4499 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4500 LODWORD(v733) = 604800 * v2;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
4501 if ( !_stricmp(pCurrentMapName.data(), "d05.blv") )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4502 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4503 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4504 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4505 pCastSpell->spellnum = 0;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4506 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4507 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4508 v319 = uRequiredMana;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4509 if ( pPlayer->sMana >= (signed int)uRequiredMana )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4510 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4511 pEventTimer->Pause();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4512 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4513 qword_506350 = (signed int)v733;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4514 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4515 ::uRequiredMana = v319;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4516 ::sRecoveryTime = sRecoveryTime;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4517 dword_50633C = pCastSpell->sound_id;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4518 dword_506338 = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4519 LOBYTE(pCastSpell->field_8) |= 0x20u;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4520 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4521 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4522 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4523 case SPELL_EARTH_STONE_TO_FLESH:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4524 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4525 __debugbreak(); // missing GM ?
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4526 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4527 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4528 case 1: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4529 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4530 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4531 case 4: break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4532 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4533 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4534 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4535 //LABEL_634:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4536 if ( !pPlayer->CanCastSpell(uRequiredMana) )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4537 break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4538 v323 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4539 v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4540 if ( !pParty->pPlayers[v323].pConditions[15] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4541 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4542 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4543 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4544 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4545 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4546 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4547 *(int *)v324 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4548 *((int *)v324 + 1) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4549 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4550 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4551 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4552 v732 = amount << 7;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4553 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4554 v656 = 15;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4555 v325 = &pParty->pPlayers[v323];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4556 v325->DiscardConditionIfLastsLongerThan(v656, v663);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4557 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4558 break;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4559 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4560 case SPELL_EARTH_ROCK_BLAST:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4561 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4562 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4563 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4564 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4565 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4566 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4567 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4568 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4569 pSpellSprite.vPosition.y = pParty->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4570 pSpellSprite.vPosition.x = pParty->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4571 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4572 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4573 pSpellSprite.uSectorID = pIndoor->GetSector(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4574 pParty->vPosition.x,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4575 pParty->vPosition.y,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4576 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4577 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4578 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4579 pSpellSprite.spell_target_pid = a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4580 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4581 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4582 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4583 if ( pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4584 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4585
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4586 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4587 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4588 ++pTurnEngine->field_1C;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4589 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4590 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4591 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4592 case SPELL_EARTH_DEATH_BLOSSOM:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4593 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4594 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4595 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4596 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4597 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4598 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4599 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4600 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4601 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4602 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4603 pSpellSprite.uType = 4090;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4604 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4605 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4606 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4607 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4608 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4609 pSpellSprite.vPosition.x = pParty->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4610 pSpellSprite.vPosition.y = pParty->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4611 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4612 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4613 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4614 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4615 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4616 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4617 pSpellSprite.spell_target_pid = a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4618 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4619 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4620 if ( pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4621 pSpellSprite.uAttributes = 4;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4622
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4623 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4624 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4625 ++pTurnEngine->field_1C;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4626 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4627 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4628 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4629 case SPELL_SPIRIT_DETECT_LIFE:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4630 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4631 v328 = v731 - 2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4632 if ( v328 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4633 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4634 v329 = v328 - 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4635 if ( v329 && v329 != 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4636 v330 = 600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4637 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4638 v330 = 3600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4639 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4640 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4641 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4642 v330 = 1800 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4643 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4644 LODWORD(v733) = v330;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4645 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4646 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4647 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4648 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4649 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4650 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4651
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4652 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4653 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4654 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4655 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4656 case SPELL_SPIRIT_FATE:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4657 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4658 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4659 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4660 case 1: amount = 1 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4661 case 2: amount = 2 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4662 case 3: amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4663 case 4: amount = 6 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4664 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4665 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4666 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4667 LODWORD(v733) = 300;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4668 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4669 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4670 v342 = pCastSpell->spell_target_pid;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4671 if ( v342 == 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4672 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4673 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4674
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4675 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4676 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4677 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4678 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4679 if (PID_TYPE(v342) == OBJECT_Actor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4680 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4681 v343 = PID_ID(v342);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4682 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4683 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4684 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4685 BYTE2(pActors[v343].uAttributes) |= 8u;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4686 //v672 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4687 v661 = &pActors[v343];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4688 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4689 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4690 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4691 break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4692 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4693 case SPELL_SPIRIT_REMOVE_CURSE:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4694 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4695 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4696 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4697 case 1: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4698 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4699 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4700 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4701 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4702 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4703 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4704 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4705 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4706 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4707 if ( !v351->pConditions[0] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4708 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4709 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4710 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4711 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4712 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4713 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4714 LODWORD(v351->pConditions[0]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4715 HIDWORD(v351->pConditions[0]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4716 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4717 else
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4718 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4719 v732 = amount << 7;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4720 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4721 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4722 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4723 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4724 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4725 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4726 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
4727 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4728 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4729 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4730 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4731 case SPELL_SPIRIT_PRESERVATION:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4732 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4733 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4734 LODWORD(v733) = 900 * (v2 + 4);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4735 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4736 LODWORD(v733) = 300 * (v2 + 12);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4737 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4738 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4739 if ( v731 == 1 || v731 == 2 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4740 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4741 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4742 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4743 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4744 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4745 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4746 a2 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4747 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4748 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4749 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4750 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4751 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4752 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4753 ++a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4754 ++v357;// = (SpellBuff *)((char *)v357 + 6972);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4755 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4756 while ( v357 <= &pParty->pPlayers[3] );
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4757 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4758 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4759 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4760 case SPELL_SPIRIT_TURN_UNDEAD:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4761 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4762 if ( v731 == 1 || v731 == 2)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4763 LODWORD(v733) = 60 * (v2 + 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4764 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4765 LODWORD(v733) = 300 * v2 + 180;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4766 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4767 break;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
4768 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4769 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4770 ++pSpellSprite.uType;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4771 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4772 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4773 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4774 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4775 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4776 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4777 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4778 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4779 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4780 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4781 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4782 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4783 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4784 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4785 v369 = &pActors[dword_50BF30[a2]];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4786 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4787 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4788 pSpellSprite.vPosition.x = v369->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4789 pSpellSprite.vPosition.y = v369->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4790 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4791
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4792 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4793 pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4794 v369->pActorBuffs[4].Apply(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4795 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4796 v731, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4797 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4798 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4799 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4800 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4801 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4802 case SPELL_SPIRIT_RAISE_DEAD:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4803 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4804 if ( v731 == 4 )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4805 amount = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4806 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4807 amount = 86400 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4808 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4809 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4810 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4811 v373 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4812 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4813 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4814 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4815 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4816 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4817 v14 = v731 == 4;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4818 pParty->pPlayers[v373].sHealth = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4819 if ( v14 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4820 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4821 v374 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4822 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4823 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4824 v376 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4825 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4826 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4827 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4828 else
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4829 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4830 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4831 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4832 0xEu,
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4833 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4834 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4835 0xDu,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4836 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4837 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4838 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4839 v377->SetCondition(1, 0);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
4840 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4841 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4842 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4843 case SPELL_SPIRIT_SHARED_LIFE:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
4844 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4845 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4846 amount = 4 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4847 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4848 amount = 3 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4849 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4850 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4851 v381 = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4852 signed int _v733 = amount;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4853 v730 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4854 v382 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4855 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4856 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4857 v383 = pPlayers[v382];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4858 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4859 v682[v381++] = v382;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4860 ++v382;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4861 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4862 while ( v382 <= 4 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4863 v384 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4864 v730 = v381;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4865 if ( v381 > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4866 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4867 do
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4868 _v733 += pPlayers[v682[v384++]]->sHealth;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4869 while ( v384 < v381 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4870 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4871 v732 = (signed __int64)((double)_v733 / (double)v730);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4872 _v733 = 0;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4873 if ( v381 > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4874 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4875 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4876 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4877 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4878 v726 = pPlayers[v682[_v733]];
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4879 v726->sHealth = v732;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4880 //v386 = v726->GetMaxHealth();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4881 if ( v726->sHealth > v726->GetMaxHealth())
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4882 v726->sHealth = v726->GetMaxHealth();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4883 if ( v726->sHealth > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4884 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4885 v726->pConditions[Player::Condition_Unconcious] = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4886 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4887 v388 = _v733;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4888
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4889 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[_v733]) - 1);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
4890 _v733 = v388 + 1;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4891 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4892 while ( v388 + 1 < v730 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4893 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4894 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4895 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
4896 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4897 case SPELL_SPIRIT_RESSURECTION:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4898 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4899 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4900 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4901 case 1: amount = 180 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4902 case 2: amount = 10800 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4903 case 3: amount = 259200 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4904 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4905 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4906 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4907 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4908 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4909 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4910 v396 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4911 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4912 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4913 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4914 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4915 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4916 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4917 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4918 v397 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4919 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4920 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4921 v398 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4922 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4923 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4924 v399 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4925 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4926 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4927 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4928 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4929 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4930 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4931 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4932 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4933 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4934 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4935 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4936 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4937 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4938 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4939 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4940 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4941 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4942 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4943 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4944 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4945 case SPELL_MIND_CURE_PARALYSIS:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4946 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4947 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4948 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4949 case 1: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4950 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4951 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4952 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4953 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4954 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4955 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4956 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4957 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4958
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4959 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4960 v323 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4961 v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4962 if ( !pParty->pPlayers[v323].pConditions[12] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4963 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4964 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4965 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4966 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4967 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4968 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4969 *(int *)v324 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4970 *((int *)v324 + 1) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4971 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4972 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4973 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4974 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4975 v656 = 12;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4976 v325 = &pParty->pPlayers[v323];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4977 v325->DiscardConditionIfLastsLongerThan(v656, v663);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4978 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4979 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4980 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4981 case SPELL_MIND_REMOVE_FEAR:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4982 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4983 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4984 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4985 case 1: amount = 180 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4986 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4987 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4988 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4989 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4990 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4991 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4992
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4993 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4994 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4995
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4997 v323 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4998 v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
4999 if ( !pParty->pPlayers[v323].pConditions[3] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5000 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5001 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5002 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5003 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5004 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5005 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5006 *(int *)v324 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5007 *((int *)v324 + 1) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5008 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5009 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5010 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5011 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5012 v656 = 3;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5013 v325 = &pParty->pPlayers[v323];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5014 v325->DiscardConditionIfLastsLongerThan(v656, v663);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5015 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5016 break;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5017 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5018 case SPELL_MIND_TELEPATHY:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5019 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5020 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5021 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5022 if (PID_TYPE(a2) != OBJECT_Actor)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5023 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5024 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5025 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5026 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5027 v417 = &pActors[PID_ID(a2)];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5028 Actor * _v730 = v417;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5029 if ( !(BYTE2(v417->uAttributes) & 0x80) )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5030 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5031 v417->SetRandomGoldIfTheresNoItem();
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5032 v417 = _v730;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5033 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5034 v418 = v417->array_000234[3].uItemID;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5035 signed int _v733 = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5036 if ( pItemsTable->pItems[v418].uEquipType == 18 )
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5037 _v733 = v417->array_000234[3].uSpecEnchantmentType;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5038
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5039 //ItemGen::ItemGen(&v683);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5040 v683.Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5041
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5042 v419 = _v730->uCarriedItemID;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5043 if (v419)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5044 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5045 v683.uItemID = v419;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5046 //goto LABEL_799;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5047 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5048 else
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5049 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5050 v420 = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5051 v421 = _v730->array_000234;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5052 while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5053 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5054 ++v420;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5055 ++v421;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5056 if ( v420 >= 4 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5057 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5058 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5059 if ( v420 < 4 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5060 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5061 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683));
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5062 v2 = v723;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5063 //v1 = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5064 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5065 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5066 // LABEL_799:
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5067 if ( _v733 != 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5068 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5069 v675 = _v733;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5070 if (v683.uItemID)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5071 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5072 v422 = v683.GetDisplayName();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5073 sprintf(pTmpBuf2.data(), "(%s), and %d gold", v422, v675);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5074
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5075 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5076 else
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5077 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5078 v664 = "%d gold";
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5079 sprintf(pTmpBuf2.data(), v664, v675);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5080 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5081 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5082 else
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5083 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5084 if (v683.uItemID)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5085 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5086 const char *_v675 = v683.GetDisplayName();
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5087 v664 = "(%s)";
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5088 sprintf(pTmpBuf2.data(), v664, _v675);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5089 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5090 else
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5091 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5092 strcpy(pTmpBuf2.data(), "nothing");
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5093 ShowStatusBarString(pTmpBuf2.data(), 2u);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5094 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5095 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5096 ShowStatusBarString(pTmpBuf2.data(), 2u);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5097 pSpellSprite.stru_24.Reset();
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5098 pSpellSprite.spell_id = pCastSpell->spellnum;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5099 pSpellSprite.spell_level = v2;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5100 pSpellSprite.spell_skill = v731;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5101 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5102 pSpellSprite.vPosition.x = _v730->vPosition.x;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5103 pSpellSprite.vPosition.y = _v730->vPosition.y;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5104 v676 = _v730->uActorHeight;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5105 v665 = pSpellSprite.vPosition.y;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5106 pSpellSprite.vPosition.z = _v730->uActorHeight;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5107 v657 = pSpellSprite.vPosition.x;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5108 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5109 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5110 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5111 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5112 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5113 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5114 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5115 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5116 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5117 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
5118 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5119 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5120 }
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5121 case SPELL_MIND_BERSERK:
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5122 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5123 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5124 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5125 case 1: amount = 300 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5126 case 2: amount = 300 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5127 case 3: amount = 600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5128 case 4: amount = 3600; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5129 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5130 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5131 }
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5132 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5133 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5134 v426 = PID_ID(a2);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5135 if (PID_TYPE(a2) != OBJECT_Actor)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5136 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5137 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5138 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5139 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5140 v730 = 836 * v426;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5141 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5142 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5143 pActors[v426].pActorBuffs[1].Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5144 pActors[v426].pActorBuffs[12].Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5145 pActors[v426].pActorBuffs[9].Apply(
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5146 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5147 v731, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5148 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5149 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5150 pSpellSprite.stru_24.Reset();
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5151 pSpellSprite.spell_id = pCastSpell->spellnum;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5152 pSpellSprite.spell_level = v2;
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5153 pSpellSprite.spell_skill = v731;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5154 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5155 v61 = v426;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5156 v600 = pActors[v61].vPosition.y;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5157 v601 = pActors[v61].vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5158 pSpellSprite.uObjectDescID = v60;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5159 pSpellSprite.vPosition.x = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5160 v602 = pActors[v61].uActorHeight;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5161 v603 = pActors[v61].vPosition.z;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5162 pSpellSprite.vPosition.y = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5163 v676 = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5164 v665 = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5165 pSpellSprite.vPosition.z = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5166 v657 = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5167 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5168 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5169 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5170 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5171 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5172 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5173 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5174 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5175 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5176 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5177 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5178 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5179 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5180 case SPELL_MIND_ENSLAVE:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5181 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5182 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5183 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5184 amount = 600 * v2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5185 if (PID_TYPE(a2) != OBJECT_Actor)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5186 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5187 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5188 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5189 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5190 v730 = 836 * PID_ID(a2);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5191 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5192 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5193 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5194 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5195 pActors[PID_ID(a2)].pActorBuffs[9].Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5196 pActors[PID_ID(a2)].pActorBuffs[1].Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5197 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5198 v731, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5199 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5200 pSpellSprite.stru_24.Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5201 pSpellSprite.spell_id = pCastSpell->spellnum;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5202 pSpellSprite.spell_level = v2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5203 pSpellSprite.spell_skill = v731;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5204 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5205 v61 = PID_ID(a2);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5206 v600 = pActors[v61].vPosition.y;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5207 v601 = pActors[v61].vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5208 pSpellSprite.uObjectDescID = v60;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5209 pSpellSprite.vPosition.x = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5210 v602 = pActors[v61].uActorHeight;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5211 v603 = pActors[v61].vPosition.z;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5212 pSpellSprite.vPosition.y = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5213 v676 = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5214 v665 = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5215 pSpellSprite.vPosition.z = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5216 v657 = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5217 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5218 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5219 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5220 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5221 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5222 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5223 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5224 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5225 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5226 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5227 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5228 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5229 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5230 case SPELL_MIND_MASS_FEAR:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5231 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5232 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5233 amount = 300 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5234 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5235 amount = 180 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5236 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5237 break;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5238 auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5239 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5240 ++pSpellSprite.uType;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5241 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5242 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5243 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5244 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5245 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5246 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5247 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5248 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5249 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5250 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5251 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5252 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5253 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5254 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5255 v433 = &pActors[dword_50BF30[a2]];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5256 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5257 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5258 pSpellSprite.vPosition.x = v433->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5259 pSpellSprite.vPosition.y = v433->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5260 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5261
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5262 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5263 pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5264 if ( stru_50C198.GetMagicalResistance(v433, 7u) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5265 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5266 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5267 v731, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5268 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5269 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5270 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5271 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5272 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5273 case SPELL_MIND_CURE_INSANITY:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5274 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5275 v435 = v731 - 2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5276 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5277 amount = 0;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
5278 else
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5279 amount = 86400 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5280 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5281 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5282
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5283 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5284 v440 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5285 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5286 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5287 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5288 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5289 if ( v731 == 4 )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5290 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5291 v441 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5292 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5293 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5294 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5295 else
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5296 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5297 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5298 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5299 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5300 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5301 v377->SetCondition(1, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5302 }
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
5303 LODWORD(v727) = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5304 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5305 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5306 case SPELL_EARTH_TELEKINESIS:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5307 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5308 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5309 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5310 case 1: amount = 2 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5311 case 2: amount = 2 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5312 case 3: amount = 3 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5313 case 4: amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5314 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5315 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5316 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5317 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5318 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5319 v445 = PID_ID(a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5320 if (PID_TYPE(a2) == OBJECT_Item)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5321 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5322 v449 = (char *)&pSpriteObjects[v445].stru_24;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5323 v450 = *(int *)v449;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5324 if ( pItemsTable->pItems[v450].uEquipType == 18 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5325 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5326 party_finds_gold(*((int *)v449 + 3), 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5327 viewparams->bRedrawGameUI = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5328 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5329 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5330 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5331 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5332 ShowStatusBarString(pTmpBuf2.data(), 2u);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5333 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5334 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5335 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5336 SpriteObject::OnInteraction(v445);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5337 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5338 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5339 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5340 if (PID_TYPE(a2) == OBJECT_Actor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5341 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5342 stru_50C198.LootActor(&pActors[v445]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5343 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5344 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5345 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5346 if (PID_TYPE(a2) != OBJECT_Decoration)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5347 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5348 if (PID_TYPE(a2) != OBJECT_BModel)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5349 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5350 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5351 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5352 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5353 dword_507CD8 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5354 v677 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5355 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5356 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5357 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5358 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5359 EventProcessor(v446, a2, v677);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5360 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5361 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5362 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5363 v447 = &pLevelDecorations[v445];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5364 dword_507CD8 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5365 v448 = v447->field_16_event_id;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5366 if (v448)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5367 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5368 v677 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5369 v446 = v448;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5370 EventProcessor(v446, a2, v677);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5371 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5372 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5373 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5374 if ( v447->IsInteractive() )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5375 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5376 activeLevelDecoration = v447;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5377 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5378 activeLevelDecoration = NULL;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5379 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5380 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5381 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5382 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5383 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5384 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5385 case SPELL_BODY_CURE_WEAKNESS:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5386 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5387 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5388 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5389 case 1: amount = 180 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5390 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5391 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5392 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5393 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5394 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5395 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5396 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5397 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5398
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5399 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5400 v323 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5401 v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5402 if ( !pParty->pPlayers[v323].pConditions[1] )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5403 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5404 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5405 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5406 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5407 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5408 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5409 *(int *)v324 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5410 *((int *)v324 + 1) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5411 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5412 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5413 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5414 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5415 v656 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5416 v325 = &pParty->pPlayers[v323];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5417 v325->DiscardConditionIfLastsLongerThan(v656, v663);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5418 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5419 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5420 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5421 case SPELL_BODY_FIRST_AID:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5422 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5423 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5424 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5425 case 1: amount = 2 * v2 + 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5426 case 2: amount = 3 * v2 + 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5427 case 3: amount = 4 * v2 + 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5428 case 4: amount = 5 * v2 + 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5429 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5430 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5431 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5432 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5433 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5434 v460 = pCastSpell->spell_target_pid;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5435 if (!v460)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5436 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5437 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5438 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5439 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5440 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5441 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5442 if (PID_TYPE(v460) == OBJECT_Actor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5443 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5444 v461 = &pActors[PID_ID(v460)];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5445 v462 = v461->uAIState;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5446 v463 = v461->pMonsterInfo.uHP;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5447 if ( v462 != 5 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5448 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5449 if ( v462 != 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5450 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5451 if ( v462 != 19 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5452 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5453 if ( v462 != 11 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5454 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5455 v461->sCurrentHP += amount;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5456 if ( v461->sCurrentHP > v463 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5457 v461->sCurrentHP = v463;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5458 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5459 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5460 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5461 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5462 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5463 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5464 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5465 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5466 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5467 case SPELL_BODY_CURE_POISON:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5468 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5469 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5470 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5471 case 1: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5472 case 2: amount = 3600 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5473 case 3: amount = 86400 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5474 case 4: amount = 0; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5475 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5476 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5477 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5478 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5479 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5480
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5481 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5482 v470 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5483 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5484 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5485 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5486 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5487 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5488 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5489 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5490 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5491 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5492 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5493 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5494 v471 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5495 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5496 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5497 v472 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5498 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5499 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5500 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5501 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5502 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5503 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5504 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5505 6u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5506 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5507 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5508 8u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5509 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5510 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5511 v656 = 10;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5512 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5513 v325->DiscardConditionIfLastsLongerThan(v656, v663);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5514 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5515 break;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5516 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5517 case SPELL_BODY_PROTECTION_FROM_MAGIC:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5518 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5519 amount = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5520 LODWORD(v733) = 3600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5521 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5522 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5523
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5524 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5525 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5526 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5527 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5528
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5529 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5530 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5531 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5532 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5533 case SPELL_BODY_HAMMERHANDS:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5534 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5535 LODWORD(v733) = 3600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5536 amount = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5537 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5538 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5539 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5540 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5541 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5542 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5543 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5544 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5545 v732 = (int)v733 << 7;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5546 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5547 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5548 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5549 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5550
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5551 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5552 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5553 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5554 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5555 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5556
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5557 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5558 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5559 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5560 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5561 case SPELL_BODY_CURE_DISEASE:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5562 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5563 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5564 amount = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5565 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5566 amount = 86400 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5567 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5568 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5569
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5570 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5571 v498 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5572 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7]))
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5573 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9]))
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5574 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5575 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5576 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5577 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5578 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5579 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5580 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5581 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5582 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5583 v499 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5584 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5585 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5586 v500 = pCastSpell->uPlayerID_2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5587 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5588 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5589 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5590 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5591 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5592 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5593 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5594 7u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5595 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5596 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5597 9u,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5598 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5599 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5600 v656 = 11;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5601 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5602 v325->DiscardConditionIfLastsLongerThan(v656, v663);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5603 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5604 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5605 break;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5606 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5607 case SPELL_BODY_POWER_CURE:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5608 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5609 amount = 5 * v2 + 10;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5610 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5611 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5612 v501 = pParty->pPlayers;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5613 int v1 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5614 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5615 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5616 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5617 v501->Heal(amount);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5618 ++v501;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5619 ++v1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5620 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5621 while ( (signed int)v501 < (signed int)pParty->pHirelings );
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5622 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5623 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5624 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5625 case SPELL_LIGHT_DISPEL_MAGIC:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5626 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5627 sRecoveryTime -= v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5628 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5629 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5630
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5631 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5632 v505 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5633 ++pSpellSprite.uType;
1102
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5634 //signed int _v733 = v505;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5635 v688.x = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5636 v688.y = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5637 v688.z = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5638 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5639 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5640 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5641 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5642 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5643 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5644 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5645 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5646 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5647 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5648 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5649 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5650 a2 = 0;
1102
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5651 for ( a2 = 0; a2 < v505; ++a2 )
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5652 {
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5653 v507 = dword_50BF30[a2];
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5654 pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5655 pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5656 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5657 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5658 v509 = pSpellSprite.Create(0, 0, 0, 0);
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5659 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688);
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5660 }
79010db96ade some spell fixes
zipi
parents: 1100
diff changeset
5661 for ( a2 = 0; a2 < v505; ++a2 )
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5662 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5663 pActor = &pActors[dword_50BF30[a2]];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5664 pSpellSprite.vPosition.x = pActor->vPosition.x;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5665 pSpellSprite.vPosition.y = pActor->vPosition.y;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5666 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5667 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5668 pSpellSprite.Create(0, 0, 0, 0);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5669 for (int i = 0; i < 22; ++i)
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5670 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5671 pActor->pActorBuffs[i].Reset();
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5672 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5673 }
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5674 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5675 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5676 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5677 case SPELL_LIGHT_SUMMON_ELEMENTAL:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5678 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5679 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5680 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5681 case 1: v733 = 300 * v2; amount = 1; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5682 case 2: v733 = 300 * v2; amount = 1; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5683 case 3: v733 = 900 * v2; amount = 3; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5684 case 4: v733 = 900 * v2; amount = 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5685 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5686 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5687 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5688 //v733 = __PAIR__(0, v516);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5689 signed int _v733 = 0;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5690 if ( (signed int)uNumActors > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5691 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
5692 v518 = pActors.data();//[0].uAIState;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5693 auto _v726 = uNumActors;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5694 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5695 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5696 v519 = v518->uAIState;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5697 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5698 ++_v733;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5699 ++v518;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5700 --_v726;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5701 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5702 while ( _v726 != 0 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5703 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5704 if ( _v733 >= amount )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5705 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5706 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5707 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5708 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5709 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5710 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5711 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5712 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5713 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5714 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5715 break;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5716 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5717 case SPELL_LIGHT_DAY_OF_THE_GODS:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5718 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5719 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5720 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5721 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5722 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5723 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5724 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5725 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5726 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5727 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5728 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5729 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5730
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5731 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5732 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5733 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
5734 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
5735
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5736 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5737 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5738 break;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5739 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5740 case SPELL_LIGHT_PRISMATIC_LIGHT:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5741 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5742 //v67 = 2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5743 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5744 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5745 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5746 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5747 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5748 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5749 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5750 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5751 break;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
5752 v531 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5753 ++pSpellSprite.uType;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5754 v694.x = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5755 v694.y = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5756 v694.z = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5757 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5758 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5759 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5760 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5761 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5762 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5763 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5764 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5765 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5766 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5767 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5768 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5769 a2 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5770 if ( (signed int)v531 > 0 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5771 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5772 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5773 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5774 v533 = dword_50BF30[a2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5775 pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5776 pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5777 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5778 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5779 v535 = pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5780 v536 = a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5781 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5782 a2 = v536 + 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5783 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5784 while ( v536 + 1 < (signed int)v531 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5785 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5786 v537 = pGame->GetStru6();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5787 pGame->GetStru6()->_4A8BFC();
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5788 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5789 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5790 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5791 case SPELL_LIGHT_DAY_OF_PROTECTION:
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5792 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5793 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5794 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5795 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5796 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5797 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5798 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5799 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5800 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5801 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5802 v730 = LODWORD(v733);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5803 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5804 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5805
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5806 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5807 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5808 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5809 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5810
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5811 v732 = v730 << 7;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5812 v549 = (double)(v730 << 7) * 0.033333335;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5813 *((float *)&v733 + 1) = v549;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5814 v712 = (signed __int64)v549;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5815 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5816 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5817 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5818 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5819 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5820 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5821 v550 = v2 + 5;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5822 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5823 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5824 v731,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5825 v550, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5826
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5827 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5828 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5829 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
5830 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5831 case SPELL_LIGHT_HOUR_OF_POWER:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5832 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5833 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5834 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5835 case 1: LODWORD(v733) = 4; amount = 4; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5836 case 2: LODWORD(v733) = 4; amount = 4; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5837 case 3: LODWORD(v733) = 12; amount = 12; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5838 case 4: LODWORD(v733) = 20; amount = 15; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5839 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5840 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5841 }
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5842 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5843 break;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5844 y = (char *)(60 * (v2 * LODWORD(v733) + 60));
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5845 v732 = (300 * amount * v2 + 60) << 7;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5846 v730 = v2 + 5;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5847 int _v726 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5848 v553 = pParty->pPlayers;//[0].pConditions[1];
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5849 *((float *)&v733) = (double)v732 * 0.033333335;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5850 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5851 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5852 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5853 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5854 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5855 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5856
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5857 //((SpellBuff *)(v553 + 6056))->Apply(
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5858 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5859 if ( *(_QWORD *)v553 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5860 _v726 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5861 ++v553;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5862 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5863 while ( v553 <= &pParty->pPlayers[3] );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5864 v562 = v731;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5865 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5866 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
5867 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5868 if (!_v726)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5869 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5870 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5871 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5872 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5873 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5874 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5875 case SPELL_LIGHT_DIVINE_INTERVENTION:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5876 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5877 amount = 3;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5878 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5879 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5880 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5881 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5882 pCastSpell->spellnum = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5883 continue;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
5884 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5885 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5886 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5887 a2 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5888 _this = (ItemGen *)&pPlayers[1];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5889 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5890 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5891 v563 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5892 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5893 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5894 v564 = _this->uItemID;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5895 *(int *)(v563 + _this->uItemID) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5896 v563 += 8;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5897 *(int *)(v563 + v564 - 4) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5898 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5899 while ( v563 <= 128 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5900 v565 = ((Player *)_this->uItemID)->GetMaxHealth();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5901 v566 = (Player **)_this;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5902 *(int *)(_this->uItemID + 6460) = v565;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5903 v567 = (*v566)->GetMaxMana();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5904 *(int *)(_this->uItemID + 6464) = v567;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5905 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5906 ++a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5907 _this = (ItemGen *)((char *)_this + 4);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5908 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5909 while ( (signed int)this < (signed int)&qword_A750D8 );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5910 v571 = pPlayer;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5911 v572 = (char *)&pPlayer->sAgeModifier;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5912 if ( pPlayer->sAgeModifier + 10 >= 120 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5913 *(short *)v572 = 120;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5914 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5915 *(short *)v572 = pPlayer->sAgeModifier + 10;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5916 sRecoveryTime += -5 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5917 ++v571->uNumDivineInterventionCastsThisDay;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5918 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5919 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5920 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5921 case SPELL_DARK_REANIMATE:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5922 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5923 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5924 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5925 case 1: amount = 2 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5926 case 2: amount = 3 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5927 case 3: amount = 4 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5928 case 4: amount = 5 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5929 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5930 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5931 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5932 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5933 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5934 v576 = pCastSpell->spell_target_pid;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5935 if (!v576)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5936 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5937 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5938 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5939 if ( *((_QWORD *)v585 + 14) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5940 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5941 ((Player *)v585)->SetCondition(0x11u, 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5942 v587 = ((Player *)v585)->GetSexByVoice();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5943 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5944 *((_QWORD *)v585 + 17) = pParty->uTimePlayed;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5945 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5946 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5947 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5948 v577 = (Player *)(PID_ID(v576));
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5949 //v726 = v577;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5950 if ( v577 == (Player *)-1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5951 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5952 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5953 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5954 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5955 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5956 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5957 v578 = (int)&pActors[(int)v577];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5958 v721 = v578;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5959 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5960 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5961 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5962 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5963 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5964 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5965 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5966 ++pSpellSprite.uType;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5967 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5968 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5969 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5970 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5971 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5972 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5973 pSpellSprite.uSectorID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5974 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5975 pSpellSprite.field_60_distance_related_prolly_lod = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5976 v581 = v721;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5977 pSpellSprite.uFacing = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5978 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5979 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5980 pSpellSprite.vPosition.x = *(short *)(v721 + 142);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5981 pSpellSprite.vPosition.y = *(short *)(v721 + 144);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5982 v732 = *(short *)(v721 + 138);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5983 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5984 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5985 pSpellSprite.Create(0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5986 if ( *(char *)(v581 + 52) > amount )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5987 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5988 Actor::Resurrect((unsigned int)v577);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5989 *(char *)(v581 + 61) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5990 *(char *)(v581 + 53) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5991 *(char *)(v581 + 54) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5992 *(char *)(v581 + 55) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5993 *(char *)(v581 + 56) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5994 *(char *)(v581 + 57) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5995 *(int *)(v581 + 712) = 9999;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5996 *(char *)(v581 + 38) &= 0xF7u;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5997 *(int *)(v581 + 708) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5998 ((SpellBuff *)(v581 + 356))->Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
5999 ((SpellBuff *)(v581 + 228))->Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6000 ((SpellBuff *)(v581 + 404))->Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6001 if ( *(short *)(v581 + 40) > 10 * amount )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6002 *(short *)(v581 + 40) = 10 * amount;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6003 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6004 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6005 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6006 case SPELL_DARK_VAMPIRIC_WEAPON:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6007 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6008 amount = 16;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6009 if ( v731 == 4 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6010 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6011 LODWORD(v733) = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6012 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6013 else
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6014 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6015 LODWORD(v733) = 3600 * v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6016 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6017 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6018 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6019 __debugbreak();
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6020 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6021 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6022 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID];
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6023 _v733->UpdateTempBonus(pParty->uTimePlayed);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6024 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6025 || LOBYTE(_v733->uAttributes) & 2
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6026 || _v733->uSpecEnchantmentType != 0
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6027 || _v733->uEnchantmentType != 0
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6028 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6029 || pItemsTable->IsMaterialNonCommon(_v733) )
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6030 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6031 dword_50C9D0 = 113;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6032 dword_50C9D4 = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6033 dword_50C9D8 = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6034
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6037 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6038 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6039 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6040 v592 = _v733;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6041 v14 = v731 == 4;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6042 _v733->uSpecEnchantmentType = 16;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6043 if ( !v14 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6044 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6045 v732 = (int)v733 << 7;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6046 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6047 v592->uAttributes |= 8u;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6048 }
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6049 LOBYTE(v592->uAttributes) |= 0x80u;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6050 _50C9A8_item_enchantment_timer = 256;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6051 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6052 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6053 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6054 case SPELL_DARK_SHARPMETAL:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6055 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6056 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6057 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6058 case 1: amount = 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6059 case 2: amount = 5; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6060 case 3: amount = 7; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6061 case 4: amount = 9; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6062 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6063 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6064 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6065 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6066 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6067 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6068 pSpellSprite.stru_24.Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6069 pSpellSprite.spell_id = pCastSpell->spellnum;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6070 pSpellSprite.spell_level = v2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6071 pSpellSprite.spell_skill = v731;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6072 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6073 pSpellSprite.vPosition.x = pParty->vPosition.x;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6074 pSpellSprite.vPosition.y = pParty->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6075 pSpellSprite.uAttributes = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6076 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6077 pSpellSprite.uSectorID = pIndoor->GetSector(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6078 pParty->vPosition.x,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6079 pParty->vPosition.y,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6080 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6081 pSpellSprite.uSpriteFrameID = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6082 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6083 pSpellSprite.spell_target_pid = a2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6084 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6085 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6086 if ( pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6087 LOBYTE(pSpellSprite.uAttributes) |= 4u;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6088 v596 = (signed int)_v726 / -2;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6089 y = (char *)((signed int)_v726 / 2);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6090 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6091 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6092 v597 = v715.uYawAngle;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6093 do
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6094 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6095 pSpellSprite.uFacing = v596 + v597;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6096 if ( pSpellSprite.Create(
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6097 v596 + v597,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6098 v715.uPitchAngle,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6099 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6100 pCastSpell->uPlayerID + 1) != -1
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6101 && pParty->bTurnBasedModeOn == 1 )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6102 ++pTurnEngine->field_1C;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6103 v596 += _v726 / (amount - 1);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6104 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6105 while ( v596 <= (signed int)y );
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6106 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6107 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6108 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6109 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6110 case SPELL_DARK_CONTROL_UNDEAD:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6111 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6112 if ( !pPlayer->CanCastSpell(uRequiredMana) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6113 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6114 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6115 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6116 case 1: LODWORD(v733) = 180 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6117 case 2: LODWORD(v733) = 180 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6118 case 3: LODWORD(v733) = 300 * v2; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6119 case 4: LODWORD(v733) = 29030400; break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6120 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6121 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6122 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6123 if (PID_TYPE(a2) != OBJECT_Actor)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6124 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6125 LODWORD(v727) = 1;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6126 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6127 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6128 pActor = &pActors[PID_ID(a2)];
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6129 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6130 break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6131 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) )
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6132 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6133 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6134 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6135 pCastSpell->spellnum = 0;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6136 continue;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6137 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6138 pActor->pActorBuffs[9].Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6139 pActor->pActorBuffs[1].Reset();
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6140 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6141 v731, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6142 pSpellSprite.stru_24.Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6143 pSpellSprite.spell_id = pCastSpell->spellnum;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6144 pSpellSprite.spell_level = v2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6145 pSpellSprite.spell_skill = v731;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6146 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6147
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6148 v600 = pActor->vPosition.y;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6149 v601 = pActor->vPosition.x;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6150 pSpellSprite.uObjectDescID = v60;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6151 pSpellSprite.vPosition.x = v601;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6152 v602 = pActor->uActorHeight;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6153 v603 = pActor->vPosition.z;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6154 pSpellSprite.vPosition.y = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6155 v676 = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6156 v665 = v600;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6157 pSpellSprite.vPosition.z = v603 + v602;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6158 v657 = v601;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6159 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6160 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6161 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6162 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6163 pSpellSprite.spell_target_pid = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6164 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6165 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6166 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6167 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6168 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6169 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6170 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6171 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6172 case SPELL_DARK_SACRIFICE:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6173 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6174 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6175 break;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6176 int _v733 = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6177 memset(&achieved_awards, 0, 4000);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6178 int i = 0;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6179 pNPCData = pParty->pHirelings;
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6180 do
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6181 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6182 if ( pNPCData->pName != 0)
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6183 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6184 v606 = _v733++;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6185 achieved_awards[v606] = (AwardType)(i + 1);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6186 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6187 ++i;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6188 ++pNPCData;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6189 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6190 while ( pNPCData <= &pParty->pHirelings[1] );
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6191 i = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6192 if ( (signed int)pNPCStats->uNumNewNPCs > 0)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6193 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6194 pNPCData = pNPCStats->pNewNPCData;
1120
17a01695926b trying to get dark sacrifice to work
zipi
parents: 1119
diff changeset
6195 //__debugbreak(); // data offset
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6196 AwardType *_v734 = &achieved_awards[_v733];
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6197 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6198 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6199 if ( pNPCData->uFlags & 0x80
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6200 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName))
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6201 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) )
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6202 {
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6203 v607 = _v734;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6204 ++_v734;
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6205 *v607 = (AwardType)(i + 3);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6206 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6207 ++i;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6208 ++pNPCData;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6209 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6210 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs );
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6211 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6212 v608 = pCastSpell->uPlayerID_2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6213 if ( v608 != 4 && v608 != 5
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1122
diff changeset
6214 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6215 || v609 >= 3 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6216 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6217 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6218 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6219 pCastSpell->spellnum = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6220 continue;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6221 }
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1122
diff changeset
6222 v610 = 76 * v609;
1120
17a01695926b trying to get dark sacrifice to work
zipi
parents: 1119
diff changeset
6223 //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
17a01695926b trying to get dark sacrifice to work
zipi
parents: 1119
diff changeset
6224 pParty->pHirelings[v609-1].evt_B = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6225 v611 = pIconsFrameTable->FindIcon("spell96");
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6226 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
1120
17a01695926b trying to get dark sacrifice to work
zipi
parents: 1119
diff changeset
6227 pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611);
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6228 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
1120
17a01695926b trying to get dark sacrifice to work
zipi
parents: 1119
diff changeset
6229 pParty->pHirelings[v609-1].evt_A = 1;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6230
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6231 v612 = pParty->pPlayers;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6232 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6233 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6234 v612->sHealth = v612->GetMaxHealth();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6235 v612->sMana = v612->GetMaxMana();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6236 ++v612;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6237 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6238 while ( v612 <= &pParty->pPlayers[3] );
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6239 v613 = &pOutdoor->ddm;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6240 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6241 v613 = &pIndoor->dlv;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6242 v613->uReputation += 15;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6243 if ( v613->uReputation > 10000 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6244 v613->uReputation = 10000;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6245 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6246 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6247 }
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6248 case SPELL_DARK_PAIN_REFLECTION:
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6249 {
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6250 switch (v731)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6251 {
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6252 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6253 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6254 case 3: LODWORD(v733) = 300 * (v2 + 12); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6255 case 4: LODWORD(v733) = 900 * (v2 + 4); break;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6256 default:
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6257 assert(false);
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6258 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6259 amount = v2 + 5;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6260 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6261 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6262 if ( v731 != 3 && v731 != 4 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6263 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6264 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6265 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v716, 0);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6266 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6267 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6268 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6269 a2 = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6270 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6271 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10];
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6272 do
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6273 {
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6274 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6275 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6276 ++a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6277 ++v619;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6278 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6279 while ( v619 <= &pParty->pPlayers[3] );
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6280 LODWORD(v727) = 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6281 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6282 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6283 case SPELL_DARK_SOULDRINKER:
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6284 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6285 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6286 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6287 pGame->GetIndoorCamera();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6288 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
6289 signed int _v733 = sub_46A6AC((int)dword_50BF30.data(), 100, v623);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6290 v707.x = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6291 v707.y = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6292 v707.z = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6293 pSpellSprite.stru_24.Reset();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6294 pSpellSprite.spell_id = pCastSpell->spellnum;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6295 pSpellSprite.spell_level = v2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6296 pSpellSprite.spell_skill = v731;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6297 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6298 pSpellSprite.uAttributes = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6299 pSpellSprite.uSectorID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6300 pSpellSprite.uSpriteFrameID = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6301 pSpellSprite.field_60_distance_related_prolly_lod = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6302 pSpellSprite.uFacing = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6303 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6304 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6305 a2 = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6306 int _v726 = 0;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6307 if ( _v733 > 0 )
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6308 {
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6309 _v726 = (_v733 * (7 * v2 + 25));
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6310 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6311 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6312 v625 = dword_50BF30[a2];
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6313 pSpellSprite.vPosition.x = pActors[v625].vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6314 pSpellSprite.vPosition.y = pActors[v625].vPosition.y;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6315 //v732 = pActors[v625].uActorHeight;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6316 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6317 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6318 v627 = pSpellSprite.Create(0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6319 v628 = a2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6320 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6321 a2 = v628 + 1;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6322 }
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6323 while ( v628 + 1 < _v733 );
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6324 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6325 v730 = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6326 v629 = 1;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6327 do
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6328 {
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6329 v630 = pPlayers[v629];
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6330 if ( !v630->pConditions[2]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6331 && !v630->pConditions[12]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6332 && !v630->pConditions[13]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6333 && !v630->pConditions[14]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6334 && !v630->pConditions[15]
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6335 && !v630->pConditions[16] )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6336 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6337 v631 = v730++;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6338 v681[v631] = v629;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6339 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6340 ++v629;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6341 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6342 while ( v629 <= 4 );
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6343 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730);
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6344 _v733 = 0;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6345 if ( v730 > 0 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6346 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6347 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6348 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6349 //v632 = 4 * v681[HIDWORD(v733)] + 10965188;
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6350 v726 = pPlayers[v681[_v733]];
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6351 //v633 = pPlayers[v681[HIDWORD(v733)]];
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6352 v726->sHealth += v732;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6353 //v726 = *(Player **)v632;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6354 //v634 = v726->GetMaxHealth();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6355 if ( v726->sHealth > v726->GetMaxHealth())
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6356 v726->sHealth = v726->GetMaxHealth();
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6357 v635 = _v733;
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6358
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6359 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
1013
0cef8c6aa893 case SPELL_WATER_ENCHANT_ITEM refactor
zipi
parents: 1012
diff changeset
6360 _v733 = v635 + 1;
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6361 }
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6362 while ( v635 + 1 < v730 );
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6363 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6364 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6365 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6366 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6367 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6368 case SPELL_DARK_ARMAGEDDON:
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6369 {
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6370 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6371 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6372 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors!
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6373 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6374 pCastSpell->spellnum = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6375 continue;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6376 }
1009
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6377 if ( v731 == 4)
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6378 amount = 4;
a32318b557c7 CastSpellInfo::_427E01_cast_spell() more clean 2
zipi
parents: 1005
diff changeset
6379 else
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6380 amount = 3;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6381 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6382 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6383 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6384 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6385 pCastSpell->spellnum = 0;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6386 continue;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6387 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6388 if ( !pPlayer->CanCastSpell(uRequiredMana) )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6389 break;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6390 pParty->armageddon_timer = 256;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6391 pParty->field_16140 = v2;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6392 ++pPlayer->uNumArmageddonCasts;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6393 if ( pParty->bTurnBasedModeOn == 1 )
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6394 ++pTurnEngine->field_1C;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6395 auto _v726 = 50;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6396 do
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6397 {
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6398 v642 = rand() % 4096 - 2048;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6399 v643 = rand();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6400 v721 = v642 + pParty->vPosition.x;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6401 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048);
1119
aa706cde7fda * dark spells working
zipi
parents: 1108
diff changeset
6402 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0);
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6403 v644 = rand();
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6404 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0);
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6405 --_v726;
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6406 }
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6407 while ( _v726 != 0 );
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6408 LODWORD(v727) = 1;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6409 break;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6410 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6411
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6412 default:
993
ada1ed5f44a1 CastSpellInfo::_427E01_cast_spell cleaned from gotos
zipi
parents: 990
diff changeset
6413 break;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6414 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
6415 if ( pCastSpell->field_8 & 0x20 )
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6416 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6417 if ( v727 != 0.0 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
6418 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0);
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6419 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6420 else
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6421 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6422 if ( sRecoveryTime < 0 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6423 sRecoveryTime = 0;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6424 if ( pParty->bTurnBasedModeOn )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6425 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6426 v645 = sRecoveryTime;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
6427 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6428 pPlayer->SetRecoveryTime(v645);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6429 if ( !some_active_character )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6430 pTurnEngine->_40471C();
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6431 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6432 else
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6433 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6434 pPlayer->SetRecoveryTime(
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6435 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333));
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6436 }
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6437 if ( v727 != 0.0 )
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6438 {
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6439 pPlayer->PlaySound(SPEECH_49, 0);
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6440 if ( v727 != 0.0 )
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
6441 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0);
889
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6442 }
279a315ff122 * first cast_spell clean
zipi
parents: 888
diff changeset
6443 }
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 921
diff changeset
6444 pCastSpell->spellnum = 0;
890
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6445 v2 = v723;
dba25247e74f massive cast spell clean
zipi
parents: 889
diff changeset
6446 continue;
0
Ritor1
parents:
diff changeset
6447 }
488
Nomad
parents: 486
diff changeset
6448
0
Ritor1
parents:
diff changeset
6449 }
Ritor1
parents:
diff changeset
6450 //----- (0042EB42) --------------------------------------------------------
Ritor1
parents:
diff changeset
6451 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID)
Ritor1
parents:
diff changeset
6452 {
Ritor1
parents:
diff changeset
6453 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
6454 signed int v3; // eax@1
Ritor1
parents:
diff changeset
6455 char *v4; // ecx@2
Ritor1
parents:
diff changeset
6456
Ritor1
parents:
diff changeset
6457 v2 = this->uNumObjects;
Ritor1
parents:
diff changeset
6458 v3 = 0;
Ritor1
parents:
diff changeset
6459 if ( (signed int)this->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
6460 {
Ritor1
parents:
diff changeset
6461 LABEL_5:
Ritor1
parents:
diff changeset
6462 LOWORD(v3) = 0;
Ritor1
parents:
diff changeset
6463 }
Ritor1
parents:
diff changeset
6464 else
Ritor1
parents:
diff changeset
6465 {
Ritor1
parents:
diff changeset
6466 v4 = (char *)&this->pObjects->uObjectID;
Ritor1
parents:
diff changeset
6467 while ( uItemID != *(short *)v4 )
Ritor1
parents:
diff changeset
6468 {
Ritor1
parents:
diff changeset
6469 ++v3;
Ritor1
parents:
diff changeset
6470 v4 += 56;
Ritor1
parents:
diff changeset
6471 if ( v3 >= (signed int)v2 )
Ritor1
parents:
diff changeset
6472 goto LABEL_5;
Ritor1
parents:
diff changeset
6473 }
Ritor1
parents:
diff changeset
6474 }
Ritor1
parents:
diff changeset
6475 return v3;
Ritor1
parents:
diff changeset
6476 }
Ritor1
parents:
diff changeset
6477
Ritor1
parents:
diff changeset
6478 //----- (0042EB78) --------------------------------------------------------
Ritor1
parents:
diff changeset
6479 int IconFrameTable::GetIconAnimLength(unsigned int uIconID)
Ritor1
parents:
diff changeset
6480 {
Ritor1
parents:
diff changeset
6481 return 8 * this->pIcons[uIconID].uAnimLength;
Ritor1
parents:
diff changeset
6482 }
Ritor1
parents:
diff changeset
6483
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6484 const wchar_t *UIMessage2String(UIMessageType msg)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6485 {
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
6486 #define CASE(xxx) case xxx: swprintf(b, wcslen(L"%03X/%s"), L"%03X/%s", msg, L#xxx); return b;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6487 static wchar_t b[256]; // bad for threads
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6488 switch (msg)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6489 {
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6490 CASE(UIMSG_SelectSpell)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6491 CASE(UIMSG_ChangeGameState)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6492 CASE(UIMSG_Attack)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6493 CASE(UIMSG_PlayArcomage)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6494 CASE(UIMSG_MainMenu_ShowPartyCreationWnd)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6495 CASE(UIMSG_MainMenu_ShowLoadWindow)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6496 CASE(UIMSG_ShowCredits)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6497 CASE(UIMSG_ExitToWindows)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6498 CASE(UIMSG_PlayerCreationChangeName)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6499 CASE(UIMSG_PlayerCreationClickPlus)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6500 CASE(UIMSG_PlayerCreationClickMinus)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6501 CASE(UIMSG_PlayerCreationSelectActiveSkill)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6502 CASE(UIMSG_PlayerCreationSelectClass)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6503 CASE(UIMSG_PlayerCreationClickOK)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6504 CASE(UIMSG_PlayerCreationClickReset)
996
bdbbdfa77ea6 UIMSG_ClickBooksBtn
Ritor1
parents: 990
diff changeset
6505 CASE(UIMSG_ClickBooksBtn)
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6506 CASE(UIMSG_PlayerCreationRemoveUpSkill)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6507 CASE(UIMSG_PlayerCreationRemoveDownSkill)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6508 CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6509 CASE(UIMSG_LoadGame)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6510 CASE(UIMSG_SaveGame)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6511 CASE(UIMSG_ShowStatus_DateTime)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6512 CASE(UIMSG_ShowStatus_ManaHP)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6513 CASE(UIMSG_ShowStatus_Player)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6514 CASE(UIMSG_Wait5Minutes)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6515 CASE(UIMSG_Wait1Hour)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6516 CASE(UIMSG_ShowStatus_Food)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6517 CASE(UIMSG_ShowStatus_Funds)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6518 CASE(UIMSG_QuickReference)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6519 CASE(UIMSG_GameMenuButton)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6520 CASE(UIMSG_AlreadyResting)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6521 CASE(UIMSG_SelectCharacter)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6522 CASE(UIMSG_ChangeSoundVolume)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6523 CASE(UIMSG_ChangeMusicVolume)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6524 CASE(UIMSG_Escape)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6525 CASE(UIMSG_PlayerCreation_SelectAttribute)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6526 CASE(UIMSG_InventoryLeftClick)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6527 CASE(UIMSG_SkillUp)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6528 CASE(UIMSG_GameMenu_ReturnToGame)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6529 CASE(UIMSG_StartNewGame)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6530 CASE(UIMSG_Game_OpenLoadGameDialog)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6531 CASE(UIMSG_Game_OpenSaveGameDialog)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6532 CASE(UIMSG_Game_OpenOptionsDialog)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6533 CASE(UIMSG_SetGraphicsMode)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6534 CASE(UIMSG_Quit)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6535 CASE(UIMSG_StartHireling1Dialogue)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6536 CASE(UIMSG_StartHireling2Dialogue)
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 597
diff changeset
6537 CASE(UIMSG_SelectNPCDialogueOption)
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6538 CASE(UIMSG_CastSpellFromBook)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6539 CASE(UIMSG_PlayerCreation_VoicePrev)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6540 CASE(UIMSG_PlayerCreation_VoiceNext)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6541 CASE(UIMSG_StartNPCDialogue)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6542 CASE(UIMSG_ArrowUp)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6543 CASE(UIMSG_DownArrow)
961
5a12082c803d UIMSG and WINDOW_Type(continue)
Ritor1
parents: 960
diff changeset
6544 CASE(UIMSG_SaveLoadBtn)
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6545 CASE(UIMSG_SelectLoadSlot)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6546 CASE(UIMSG_Cancel)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6547 CASE(UIMSG_ExitRest)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6548 CASE(UIMSG_PlayerCreation_FacePrev)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6549 CASE(UIMSG_PlayerCreation_FaceNext)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6550 CASE(UIMSG_CycleCharacters)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6551 CASE(UIMSG_SetTurnSpeed)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6552 CASE(UIMSG_ToggleWalkSound)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6553 CASE(UIMSG_ChangeVoiceVolume)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6554 CASE(UIMSG_ToggleShowDamage)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6555 CASE(UIMSG_ScrollNPCPanel)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6556 CASE(UIMSG_ShowFinalWindow)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6557 CASE(UIMSG_OpenQuestBook)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6558 CASE(UIMSG_OpenAutonotes)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6559 CASE(UIMSG_OpenMapBook)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6560 CASE(UIMSG_OpenCalendar)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6561 CASE(UIMSG_OpenHistoryBook)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6562 CASE(UIMSG_ToggleAlwaysRun)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6563 CASE(UIMSG_ToggleFlipOnExit)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6564 CASE(UIMSG_Game_Action)
907
f3ccfc765502 RentRoom
Ritor1
parents: 893
diff changeset
6565 CASE(UIMSG_RentRoom)
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6566 CASE(UIMSG_TransitionUI_Confirm)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6567 CASE(UIMSG_OpenKeyMappingOptions)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6568 CASE(UIMSG_SelectKeyPage1)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6569 CASE(UIMSG_SelectKeyPage2)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6570 CASE(UIMSG_ResetKeyMapping)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6571 CASE(UIMSG_ChangeKeyButton)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6572 CASE(UIMSG_OpenVideoOptions)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6573 CASE(UIMSG_ToggleBloodsplats)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6574 CASE(UIMSG_ToggleColoredLights)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6575 CASE(UIMSG_ToggleTint)
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6576 default:
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
6577 swprintf(b, wcslen(L"UIMSG_%03X") , L"UIMSG_%03X", msg); return b;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6578 };
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6579 #undef CASE
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6580 }
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6581
0
Ritor1
parents:
diff changeset
6582 //----- (0042EB8D) --------------------------------------------------------
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6583 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
0
Ritor1
parents:
diff changeset
6584 {
482
9898e6b413d8 some debug stuff commented
Nomad
parents: 469
diff changeset
6585 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
0
Ritor1
parents:
diff changeset
6586 if (uNumMessages < 40)
Ritor1
parents:
diff changeset
6587 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6588 files[uNumMessages] = file;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6589 lines[uNumMessages] = line;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
6590
0
Ritor1
parents:
diff changeset
6591 pMessages[uNumMessages].eType = msg;
Ritor1
parents:
diff changeset
6592 pMessages[uNumMessages].param = param;
Ritor1
parents:
diff changeset
6593 pMessages[uNumMessages++].field_8 = a4;
Ritor1
parents:
diff changeset
6594 }
Ritor1
parents:
diff changeset
6595 }
Ritor1
parents:
diff changeset
6596
Ritor1
parents:
diff changeset
6597 //----- (0042EBBE) --------------------------------------------------------
Ritor1
parents:
diff changeset
6598 int __fastcall sub_42EBBE(int a1, int a2)
Ritor1
parents:
diff changeset
6599 {
Ritor1
parents:
diff changeset
6600 return (unsigned __int64)(a2 * (signed __int64)a1) >> 16;
Ritor1
parents:
diff changeset
6601 }
Ritor1
parents:
diff changeset
6602 // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int);
Ritor1
parents:
diff changeset
6603
Ritor1
parents:
diff changeset
6604 //----- (0042EBDB) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
6605 int stru193_math::Sin(int angle)
0
Ritor1
parents:
diff changeset
6606 {
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 319
diff changeset
6607 return Cos(angle - this->uIntegerHalfPi);
0
Ritor1
parents:
diff changeset
6608 }
Ritor1
parents:
diff changeset
6609
Ritor1
parents:
diff changeset
6610 //----- (0042ECB5) --------------------------------------------------------
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6611 void _42ECB5_PlayerAttacksActor()
0
Ritor1
parents:
diff changeset
6612 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6613 //unsigned int v0; // ebx@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6614 //Player *v1; // esi@1
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6615 //bool result; // eax@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6616 //int v3; // edi@2
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6617 //unsigned int v4; // eax@7
0
Ritor1
parents:
diff changeset
6618 char *v5; // eax@8
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6619 //int v6; // ecx@9
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6620 //signed int v7; // eax@16
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6621 //Actor *v8; // edi@20
0
Ritor1
parents:
diff changeset
6622 unsigned int v9; // ecx@21
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6623 //char *v10; // eax@26
0
Ritor1
parents:
diff changeset
6624 char *v11; // eax@26
Ritor1
parents:
diff changeset
6625 unsigned int v12; // eax@47
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6626 //char *v13; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6627 //char *v14; // eax@47
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6628 //unsigned int v15; // ebx@54
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6629 //int v16; // [sp-10h] [bp-4Ch]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6630 //int v17; // [sp-10h] [bp-4Ch]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6631 //unsigned int v18; // [sp-Ch] [bp-48h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6632 //unsigned int v19; // [sp-Ch] [bp-48h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6633 //__int16 v20; // [sp-8h] [bp-44h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6634 //__int16 v21; // [sp-8h] [bp-44h]@44
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6635 //int v22; // [sp-4h] [bp-40h]@24
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6636 //int v23; // [sp-4h] [bp-40h]@44
0
Ritor1
parents:
diff changeset
6637 SoundID v24; // [sp-4h] [bp-40h]@58
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6638 //Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6639 //unsigned int a2; // [sp+18h] [bp-24h]@20
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6640 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6641 //int v28; // [sp+20h] [bp-1Ch]@9
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6642 //unsigned int *v28b;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6643 //int v29; // [sp+24h] [bp-18h]@16
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6644 //int v30; // [sp+28h] [bp-14h]@16
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6645 //int v31; // [sp+2Ch] [bp-10h]@4
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6646 //int v32; // [sp+30h] [bp-Ch]@7
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6647 //int v33; // [sp+34h] [bp-8h]@7
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6648 //int v34; // [sp+38h] [bp-4h]@17
0
Ritor1
parents:
diff changeset
6649
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6650 //v0 = uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6651 //v27 = 6972 * uActiveCharacter;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6652 //v1 = &pParty->pPlayers[uActiveCharacter-1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6653 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6654 auto player = &pParty->pPlayers[uActiveCharacter - 1];
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6655 if (!player->CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6656 return;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6657
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
6658 pCastSpellInfo.data()->_427D48(uActiveCharacter);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6659 //v3 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6660 if (pParty->Invisible())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6661 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6662
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6663 //v31 = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6664 int bow_idx = player->pEquipment.uBow;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6665 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6666 bow_idx = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6667
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6668 //v32 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6669 int wand_item_id = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6670 //v33 = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6671 //v4 = v1->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6672 int laser_weapon_item_id = 0;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6673
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6674 int main_hand_idx = player->pEquipment.uMainHand;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6675 if (main_hand_idx)
0
Ritor1
parents:
diff changeset
6676 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6677 auto item = &player->pInventoryItems[main_hand_idx - 1];
112
909822c91d47 pointer fixes
zipi
parents: 90
diff changeset
6678 //v5 = (char *)v1 + 36 * v4;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6679 if (!item->Broken())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6680 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6681 //v28b = &v1->pInventoryItems[v4].uItemID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6682 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6683 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND)
0
Ritor1
parents:
diff changeset
6684 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6685 if (item->uNumCharges <= 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6686 player->pEquipment.uMainHand = 0; // wand discharged - unequip
0
Ritor1
parents:
diff changeset
6687 else
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6688 wand_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
6689 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6690 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6691 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
0
Ritor1
parents:
diff changeset
6692 }
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6693 }
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6694
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6695 //v30 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6696 //v29 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6697 //v28 = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6698 //v7 = pMouse->uPointingObjectID;
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6699
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6700 int target_pid = pMouse->uPointingObjectID;
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
6701 int target_type = PID_TYPE(target_pid),
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
6702 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6703 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6704 {
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6705 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
6706 target_type = PID_TYPE(target_pid);
ceef50611567 * AI fixed (temporary)
zipi
parents: 832
diff changeset
6707 target_id = PID_ID(target_pid);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6708 }
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6709
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6710 auto actor = &pActors[target_id];
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6711 int actor_distance = 0;
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6712 if (target_type == OBJECT_Actor)
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
6713 {
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6714 int distance_x = actor->vPosition.x - pParty->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6715 distance_y = actor->vPosition.y - pParty->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6716 distance_z = actor->vPosition.z - pParty->vPosition.z;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6717 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6718 if (actor_distance < 0)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6719 actor_distance = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6720 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6721
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6722 bool shooting_bow = false,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6723 shotting_laser = false,
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6724 shooting_wand = false,
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6725 melee_attack = false;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6726 if (laser_weapon_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6727 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6728 shotting_laser = true;
490
Nomad
parents: 488
diff changeset
6729 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6730 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6731 else if (wand_item_id)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6732 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6733 shooting_wand = true;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6734
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6735 int main_hand_idx = player->pEquipment.uMainHand;
490
Nomad
parents: 488
diff changeset
6736 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6737
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6738 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6739 player->pEquipment.uMainHand = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6740 }
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6741 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6742 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6743 melee_attack = true;
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6744
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6745 Vec3_int_ a3;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6746 a3.x = actor->vPosition.x - pParty->vPosition.x;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6747 a3.y = actor->vPosition.y - pParty->vPosition.y;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6748 a3.z = actor->vPosition.z - pParty->vPosition.z;
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6749 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6750
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
6751 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
1080
9456f2ed5ff9 getskillbonus continue cleaning
Gloval
parents: 1052
diff changeset
6752 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6753 _42FA66_do_explosive_impact(
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6754 actor->vPosition.x,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6755 actor->vPosition.y,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6756 actor->vPosition.z + actor->uActorHeight / 2,
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6757 0, 512, uActiveCharacter);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6758 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6759 else if (bow_idx)
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6760 {
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6761 shooting_bow = true;
490
Nomad
parents: 488
diff changeset
6762 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6763 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6764 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6765 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6766 melee_attack = true;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6767 ; // actor out of range or no actor; no ranged weapon so melee attacking air
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6768 }
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6769
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6770 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6771 {
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6772 int recovery = player->GetAttackRecoveryTime(false);
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6773 if (recovery < 30 )
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 295
diff changeset
6774 recovery = 30;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6775 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6776 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6777
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6778
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6779 int v34 = 0;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6780 if (shooting_wand)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6781 return;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6782 else if (shooting_bow)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6783 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6784 v34 = 5;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6785 player->PlaySound(SPEECH_50, 0);
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6786 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6787 if (shotting_laser)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6788 v34 = 7;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6789 else
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6790 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6791 int main_hand_idx = player->pEquipment.uMainHand;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 810
diff changeset
6792 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6793 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6794 pTurnEngine->_40471C();
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6795 }
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6796
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6797 switch (v34)
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6798 {
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6799 case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6800 case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6801 case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6802 case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6803 case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6804 case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6805 case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6806 case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break;
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6807 }
0
Ritor1
parents:
diff changeset
6808 }
Ritor1
parents:
diff changeset
6809
Ritor1
parents:
diff changeset
6810 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6811 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
6812 {
Ritor1
parents:
diff changeset
6813 int v4; // edi@1
Ritor1
parents:
diff changeset
6814 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
6815 int v6; // eax@2
Ritor1
parents:
diff changeset
6816 int v7; // eax@4
Ritor1
parents:
diff changeset
6817 int result; // eax@5
Ritor1
parents:
diff changeset
6818 int *v9; // edx@8
Ritor1
parents:
diff changeset
6819 signed int v10; // ebx@10
Ritor1
parents:
diff changeset
6820 int v11; // edi@11
Ritor1
parents:
diff changeset
6821 Actor *v12; // esi@12
Ritor1
parents:
diff changeset
6822 unsigned __int16 v13; // ax@12
Ritor1
parents:
diff changeset
6823 int v14; // eax@22
Ritor1
parents:
diff changeset
6824 char v15; // zf@30
Ritor1
parents:
diff changeset
6825 int v16; // esi@32
Ritor1
parents:
diff changeset
6826 int v17; // ecx@34
Ritor1
parents:
diff changeset
6827 stru319 *v18; // eax@39
Ritor1
parents:
diff changeset
6828 int v19; // edx@39
Ritor1
parents:
diff changeset
6829 int v20; // ecx@41
Ritor1
parents:
diff changeset
6830 unsigned __int16 v21; // ax@42
Ritor1
parents:
diff changeset
6831 unsigned int v22; // [sp+8h] [bp-24h]@11
Ritor1
parents:
diff changeset
6832 unsigned int v23; // [sp+Ch] [bp-20h]@7
Ritor1
parents:
diff changeset
6833 stru319 *v24; // [sp+10h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
6834 unsigned int v25; // [sp+14h] [bp-18h]@8
Ritor1
parents:
diff changeset
6835 int *v26; // [sp+18h] [bp-14h]@8
Ritor1
parents:
diff changeset
6836 int v27; // [sp+1Ch] [bp-10h]@10
Ritor1
parents:
diff changeset
6837 int *v28; // [sp+20h] [bp-Ch]@10
Ritor1
parents:
diff changeset
6838 unsigned int v29; // [sp+24h] [bp-8h]@7
Ritor1
parents:
diff changeset
6839 int v30; // [sp+28h] [bp-4h]@6
Ritor1
parents:
diff changeset
6840 int i; // [sp+38h] [bp+Ch]@33
Ritor1
parents:
diff changeset
6841 signed int v32; // [sp+3Ch] [bp+10h]@32
Ritor1
parents:
diff changeset
6842
Ritor1
parents:
diff changeset
6843 v4 = 0;
Ritor1
parents:
diff changeset
6844 v5 = this;
Ritor1
parents:
diff changeset
6845 v24 = this;
Ritor1
parents:
diff changeset
6846 if ( pRenderer->pRenderD3D )
Ritor1
parents:
diff changeset
6847 {
Ritor1
parents:
diff changeset
6848 v6 = a3 != 0;
Ritor1
parents:
diff changeset
6849 if ( a4 )
Ritor1
parents:
diff changeset
6850 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6851 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
6852 if ( v7 != -1 )
Ritor1
parents:
diff changeset
6853 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6854 else return 0;
0
Ritor1
parents:
diff changeset
6855 }
Ritor1
parents:
diff changeset
6856 else
Ritor1
parents:
diff changeset
6857 {
Ritor1
parents:
diff changeset
6858 v30 = 0;
Ritor1
parents:
diff changeset
6859 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
6860 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6861 v29 = viewparams->uScreen_topL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6862 v23 = viewparams->uScreen_BttmR_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6863 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
6864 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6865 v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6866 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
6867 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
0
Ritor1
parents:
diff changeset
6868 do
Ritor1
parents:
diff changeset
6869 {
Ritor1
parents:
diff changeset
6870 if ( (signed int)v29 < (signed int)v23 )
Ritor1
parents:
diff changeset
6871 {
Ritor1
parents:
diff changeset
6872 v28 = v9;
Ritor1
parents:
diff changeset
6873 v10 = v4;
Ritor1
parents:
diff changeset
6874 v27 = v23 - v29;
Ritor1
parents:
diff changeset
6875 do
Ritor1
parents:
diff changeset
6876 {
Ritor1
parents:
diff changeset
6877 v22 = *v28;
Ritor1
parents:
diff changeset
6878 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
6879 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
6880 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
6881 v12 = &pActors[PID_ID(v11)];
0
Ritor1
parents:
diff changeset
6882 v13 = v12->uAIState;
Ritor1
parents:
diff changeset
6883 if ( v13 != 5 )
Ritor1
parents:
diff changeset
6884 {
Ritor1
parents:
diff changeset
6885 if ( v13 != 4
Ritor1
parents:
diff changeset
6886 && v13 != 11
Ritor1
parents:
diff changeset
6887 && v13 != 19
Ritor1
parents:
diff changeset
6888 && v13 != 17
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
6889 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
6890 {
Ritor1
parents:
diff changeset
6891 if ( (!a4 || MonsterStats::BelongsToSupertype(v12->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
6892 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
6893 {
Ritor1
parents:
diff changeset
6894 v14 = 0;
Ritor1
parents:
diff changeset
6895 if ( v10 > 0 )
Ritor1
parents:
diff changeset
6896 {
Ritor1
parents:
diff changeset
6897 do
Ritor1
parents:
diff changeset
6898 {
Ritor1
parents:
diff changeset
6899 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
6900 break;
Ritor1
parents:
diff changeset
6901 ++v14;
Ritor1
parents:
diff changeset
6902 }
Ritor1
parents:
diff changeset
6903 while ( v14 < v30 );
Ritor1
parents:
diff changeset
6904 }
Ritor1
parents:
diff changeset
6905 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
6906 {
Ritor1
parents:
diff changeset
6907 ++v30;
Ritor1
parents:
diff changeset
6908 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
6909 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
6910 ++v10;
Ritor1
parents:
diff changeset
6911 }
Ritor1
parents:
diff changeset
6912 }
Ritor1
parents:
diff changeset
6913 }
Ritor1
parents:
diff changeset
6914 }
Ritor1
parents:
diff changeset
6915 }
Ritor1
parents:
diff changeset
6916 ++v28;
Ritor1
parents:
diff changeset
6917 --v27;
Ritor1
parents:
diff changeset
6918 }
Ritor1
parents:
diff changeset
6919 while ( v27 );
Ritor1
parents:
diff changeset
6920 v4 = v30;
Ritor1
parents:
diff changeset
6921 v5 = v24;
Ritor1
parents:
diff changeset
6922 }
Ritor1
parents:
diff changeset
6923 v9 = v26 + 640;
Ritor1
parents:
diff changeset
6924 v15 = v25-- == 1;
Ritor1
parents:
diff changeset
6925 v26 += 640;
Ritor1
parents:
diff changeset
6926 }
Ritor1
parents:
diff changeset
6927 while ( !v15 );
Ritor1
parents:
diff changeset
6928 }
Ritor1
parents:
diff changeset
6929 if ( v4 > 0 )
Ritor1
parents:
diff changeset
6930 {
Ritor1
parents:
diff changeset
6931 v32 = 1;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
6932 v16 = (int)dword_50BC10.data();
0
Ritor1
parents:
diff changeset
6933 do
Ritor1
parents:
diff changeset
6934 {
Ritor1
parents:
diff changeset
6935 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
6936 {
Ritor1
parents:
diff changeset
6937 v17 = dword_50BC10[i];
Ritor1
parents:
diff changeset
6938 if ( v17 < *(int *)v16 )
Ritor1
parents:
diff changeset
6939 {
Ritor1
parents:
diff changeset
6940 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
6941 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
6942 }
Ritor1
parents:
diff changeset
6943 }
Ritor1
parents:
diff changeset
6944 ++v32;
Ritor1
parents:
diff changeset
6945 v16 += 4;
Ritor1
parents:
diff changeset
6946 }
Ritor1
parents:
diff changeset
6947 while ( v32 - 1 < v4 );
Ritor1
parents:
diff changeset
6948 v5 = v24;
Ritor1
parents:
diff changeset
6949 if ( v4 > 0 )
Ritor1
parents:
diff changeset
6950 {
Ritor1
parents:
diff changeset
6951 v18 = v24;
Ritor1
parents:
diff changeset
6952 v19 = v4;
Ritor1
parents:
diff changeset
6953 do
Ritor1
parents:
diff changeset
6954 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
6955 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
6956 v18 += 4;
Ritor1
parents:
diff changeset
6957 --v19;
Ritor1
parents:
diff changeset
6958 }
Ritor1
parents:
diff changeset
6959 while ( v19 );
Ritor1
parents:
diff changeset
6960 }
Ritor1
parents:
diff changeset
6961 }
Ritor1
parents:
diff changeset
6962 v20 = 0;
Ritor1
parents:
diff changeset
6963 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
6964 {
Ritor1
parents:
diff changeset
6965 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
6966 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
6967 break;
Ritor1
parents:
diff changeset
6968 }
Ritor1
parents:
diff changeset
6969 if ( v20 != v4 )
Ritor1
parents:
diff changeset
6970 {
Ritor1
parents:
diff changeset
6971 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
6972 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
6973 return result;
Ritor1
parents:
diff changeset
6974 }
Ritor1
parents:
diff changeset
6975 }
Ritor1
parents:
diff changeset
6976 }
Ritor1
parents:
diff changeset
6977 return 0;
Ritor1
parents:
diff changeset
6978 }
Ritor1
parents:
diff changeset
6979
Ritor1
parents:
diff changeset
6980 //----- (0042F3D6) --------------------------------------------------------
Ritor1
parents:
diff changeset
6981 void InitializeTurnBasedAnimations(void *_this)
Ritor1
parents:
diff changeset
6982 {
Ritor1
parents:
diff changeset
6983 unsigned int *v1; // edi@1
Ritor1
parents:
diff changeset
6984
Ritor1
parents:
diff changeset
6985 pIconIDs_Turn[0] = pIconsFrameTable->FindIcon("turn0");
Ritor1
parents:
diff changeset
6986 pIconIDs_Turn[1] = pIconsFrameTable->FindIcon("turn1");
Ritor1
parents:
diff changeset
6987 pIconIDs_Turn[2] = pIconsFrameTable->FindIcon("turn2");
Ritor1
parents:
diff changeset
6988 pIconIDs_Turn[3] = pIconsFrameTable->FindIcon("turn3");
Ritor1
parents:
diff changeset
6989 pIconIDs_Turn[4] = pIconsFrameTable->FindIcon("turn4");
Ritor1
parents:
diff changeset
6990 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
Ritor1
parents:
diff changeset
6991 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
Ritor1
parents:
diff changeset
6992 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
Ritor1
parents:
diff changeset
6993 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
Ritor1
parents:
diff changeset
6994 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
6995 v1 = pIconIDs_Turn.data();
0
Ritor1
parents:
diff changeset
6996 do
Ritor1
parents:
diff changeset
6997 {
Ritor1
parents:
diff changeset
6998 pIconsFrameTable->InitializeAnimation(*v1);
Ritor1
parents:
diff changeset
6999 ++v1;
Ritor1
parents:
diff changeset
7000 }
Ritor1
parents:
diff changeset
7001 while ( (signed int)v1 < (signed int)&uIconID_TurnStop );
Ritor1
parents:
diff changeset
7002 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
Ritor1
parents:
diff changeset
7003 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
Ritor1
parents:
diff changeset
7004 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
Ritor1
parents:
diff changeset
7005 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
Ritor1
parents:
diff changeset
7006 }
Ritor1
parents:
diff changeset
7007
Ritor1
parents:
diff changeset
7008 //----- (0042F4DA) --------------------------------------------------------
Ritor1
parents:
diff changeset
7009 signed int __cdecl sub_42F4DA()
Ritor1
parents:
diff changeset
7010 {
Ritor1
parents:
diff changeset
7011 signed int v0; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7012 Actor *v1; // esi@4
0
Ritor1
parents:
diff changeset
7013 int v2; // ebx@5
Ritor1
parents:
diff changeset
7014 int v3; // eax@5
Ritor1
parents:
diff changeset
7015 int v4; // ebx@5
Ritor1
parents:
diff changeset
7016 unsigned int v5; // ecx@5
Ritor1
parents:
diff changeset
7017 int v6; // edx@6
Ritor1
parents:
diff changeset
7018 unsigned int v7; // edx@8
Ritor1
parents:
diff changeset
7019 unsigned int v8; // edx@10
Ritor1
parents:
diff changeset
7020 __int16 v9; // ax@12
Ritor1
parents:
diff changeset
7021 signed int result; // eax@20
Ritor1
parents:
diff changeset
7022 int v11; // [sp+Ch] [bp-10h]@5
Ritor1
parents:
diff changeset
7023 int v12; // [sp+10h] [bp-Ch]@5
Ritor1
parents:
diff changeset
7024 signed int v13; // [sp+14h] [bp-8h]@3
Ritor1
parents:
diff changeset
7025
Ritor1
parents:
diff changeset
7026 v0 = 5120;
Ritor1
parents:
diff changeset
7027 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
7028 v0 = 2560;
Ritor1
parents:
diff changeset
7029 v13 = 0;
Ritor1
parents:
diff changeset
7030 if ( (signed int)uNumActors <= 0 )
Ritor1
parents:
diff changeset
7031 {
Ritor1
parents:
diff changeset
7032 LABEL_20:
Ritor1
parents:
diff changeset
7033 result = 0;
Ritor1
parents:
diff changeset
7034 }
Ritor1
parents:
diff changeset
7035 else
Ritor1
parents:
diff changeset
7036 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7037 v1 = pActors.data();
0
Ritor1
parents:
diff changeset
7038 while ( 1 )
Ritor1
parents:
diff changeset
7039 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7040 v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7041 v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y);
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7042 v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z);
0
Ritor1
parents:
diff changeset
7043 v3 = v2;
Ritor1
parents:
diff changeset
7044 v4 = v11;
Ritor1
parents:
diff changeset
7045 v5 = v12;
Ritor1
parents:
diff changeset
7046 if ( v3 < v11 )
Ritor1
parents:
diff changeset
7047 {
Ritor1
parents:
diff changeset
7048 v6 = v3;
Ritor1
parents:
diff changeset
7049 v3 = v11;
Ritor1
parents:
diff changeset
7050 v4 = v6;
Ritor1
parents:
diff changeset
7051 }
Ritor1
parents:
diff changeset
7052 if ( v3 < v12 )
Ritor1
parents:
diff changeset
7053 {
Ritor1
parents:
diff changeset
7054 v7 = v3;
Ritor1
parents:
diff changeset
7055 v3 = v12;
Ritor1
parents:
diff changeset
7056 v5 = v7;
Ritor1
parents:
diff changeset
7057 }
Ritor1
parents:
diff changeset
7058 if ( v4 < (signed int)v5 )
Ritor1
parents:
diff changeset
7059 {
Ritor1
parents:
diff changeset
7060 v8 = v5;
Ritor1
parents:
diff changeset
7061 v5 = v4;
Ritor1
parents:
diff changeset
7062 v4 = v8;
Ritor1
parents:
diff changeset
7063 }
Ritor1
parents:
diff changeset
7064 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 )
Ritor1
parents:
diff changeset
7065 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7066 v9 = v1->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7067 if ( v1->uAIState != 5 )
0
Ritor1
parents:
diff changeset
7068 {
Ritor1
parents:
diff changeset
7069 if ( v9 != 4
Ritor1
parents:
diff changeset
7070 && v9 != 11
Ritor1
parents:
diff changeset
7071 && v9 != 19
Ritor1
parents:
diff changeset
7072 && v9 != 17
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7073 && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) )
0
Ritor1
parents:
diff changeset
7074 break;
Ritor1
parents:
diff changeset
7075 }
Ritor1
parents:
diff changeset
7076 }
Ritor1
parents:
diff changeset
7077 ++v13;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
7078 ++v1;
0
Ritor1
parents:
diff changeset
7079 if ( v13 >= (signed int)uNumActors )
Ritor1
parents:
diff changeset
7080 goto LABEL_20;
Ritor1
parents:
diff changeset
7081 }
Ritor1
parents:
diff changeset
7082 result = 1;
Ritor1
parents:
diff changeset
7083 }
Ritor1
parents:
diff changeset
7084 return result;
Ritor1
parents:
diff changeset
7085 }
Ritor1
parents:
diff changeset
7086
Ritor1
parents:
diff changeset
7087 //----- (0042F7EB) --------------------------------------------------------
Ritor1
parents:
diff changeset
7088 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
Ritor1
parents:
diff changeset
7089 {
Ritor1
parents:
diff changeset
7090 unsigned int v9; // edi@1
Ritor1
parents:
diff changeset
7091 signed int v10; // edx@3
Ritor1
parents:
diff changeset
7092 char *v11; // ecx@4
Ritor1
parents:
diff changeset
7093 unsigned __int16 v12; // ax@7
Ritor1
parents:
diff changeset
7094 unsigned int v13; // edx@9
Ritor1
parents:
diff changeset
7095 char *v14; // ecx@10
Ritor1
parents:
diff changeset
7096 int v15; // esi@17
Ritor1
parents:
diff changeset
7097 int v16; // eax@18
Ritor1
parents:
diff changeset
7098 int v17; // edi@20
Ritor1
parents:
diff changeset
7099 int v18; // esi@20
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7100 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1
0
Ritor1
parents:
diff changeset
7101 int v21; // [sp+7Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
7102 unsigned int v22; // [sp+80h] [bp-4h]@1
Ritor1
parents:
diff changeset
7103
Ritor1
parents:
diff changeset
7104 v9 = uSpriteID;
Ritor1
parents:
diff changeset
7105 v21 = x;
Ritor1
parents:
diff changeset
7106 v22 = uSpriteID;
Ritor1
parents:
diff changeset
7107
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7108 SpriteObject a1a; // [sp+Ch] [bp-78h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7109 //SpriteObject::SpriteObject(&a1a);
0
Ritor1
parents:
diff changeset
7110 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
7111
Ritor1
parents:
diff changeset
7112 if ( a9 )
Ritor1
parents:
diff changeset
7113 {
Ritor1
parents:
diff changeset
7114 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24));
Ritor1
parents:
diff changeset
7115 v9 = v22;
Ritor1
parents:
diff changeset
7116 }
Ritor1
parents:
diff changeset
7117 v10 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7118 a1a.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7119 a1a.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7120 a1a.spell_id = 0;
0
Ritor1
parents:
diff changeset
7121 a1a.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7122 a1a.uType = v9;
0
Ritor1
parents:
diff changeset
7123 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
7124 {
Ritor1
parents:
diff changeset
7125 LABEL_7:
Ritor1
parents:
diff changeset
7126 v12 = 0;
Ritor1
parents:
diff changeset
7127 }
Ritor1
parents:
diff changeset
7128 else
Ritor1
parents:
diff changeset
7129 {
Ritor1
parents:
diff changeset
7130 v11 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
7131 while ( (short)v9 != *(short *)v11 )
Ritor1
parents:
diff changeset
7132 {
Ritor1
parents:
diff changeset
7133 ++v10;
Ritor1
parents:
diff changeset
7134 v11 += 56;
Ritor1
parents:
diff changeset
7135 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
7136 goto LABEL_7;
Ritor1
parents:
diff changeset
7137 }
Ritor1
parents:
diff changeset
7138 v12 = v10;
Ritor1
parents:
diff changeset
7139 }
Ritor1
parents:
diff changeset
7140 a1a.uObjectDescID = v12;
Ritor1
parents:
diff changeset
7141 a1a.vPosition.z = z;
Ritor1
parents:
diff changeset
7142 a1a.vPosition.x = v21;
Ritor1
parents:
diff changeset
7143 a1a.vPosition.y = y;
Ritor1
parents:
diff changeset
7144 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
7145 a1a.uAttributes = attributes;
Ritor1
parents:
diff changeset
7146 a1a.uSectorID = pIndoor->GetSector(v21, y, z);
Ritor1
parents:
diff changeset
7147 a1a.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7148 a1a.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
7149 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
7150 if ( !(a1a.uAttributes & 0x10) )
Ritor1
parents:
diff changeset
7151 {
Ritor1
parents:
diff changeset
7152 v13 = 0;
222
8113753ed2ae more item init fixing
Gloval
parents: 190
diff changeset
7153 if ( (signed int)pItemsTable->uAllItemsCount > 0 )
0
Ritor1
parents:
diff changeset
7154 {
Ritor1
parents:
diff changeset
7155 v14 = (char *)&pItemsTable->pItems[0].uSpriteID;
Ritor1
parents:
diff changeset
7156 while ( *(short *)v14 != v9 )
Ritor1
parents:
diff changeset
7157 {
Ritor1
parents:
diff changeset
7158 ++v13;
Ritor1
parents:
diff changeset
7159 v14 += 48;
222
8113753ed2ae more item init fixing
Gloval
parents: 190
diff changeset
7160 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount )
0
Ritor1
parents:
diff changeset
7161 goto LABEL_16;
Ritor1
parents:
diff changeset
7162 }
Ritor1
parents:
diff changeset
7163 a1a.stru_24.uItemID = v13;
Ritor1
parents:
diff changeset
7164 }
Ritor1
parents:
diff changeset
7165 }
Ritor1
parents:
diff changeset
7166 LABEL_16:
Ritor1
parents:
diff changeset
7167 if ( a7 )
Ritor1
parents:
diff changeset
7168 {
Ritor1
parents:
diff changeset
7169 v15 = count;
Ritor1
parents:
diff changeset
7170 if ( count > 0 )
Ritor1
parents:
diff changeset
7171 {
Ritor1
parents:
diff changeset
7172 do
Ritor1
parents:
diff changeset
7173 {
Ritor1
parents:
diff changeset
7174 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
Ritor1
parents:
diff changeset
7175 v16 = rand();
Ritor1
parents:
diff changeset
7176 a1a.Create(
Ritor1
parents:
diff changeset
7177 (signed __int16)a1a.uFacing,
Ritor1
parents:
diff changeset
7178 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1),
Ritor1
parents:
diff changeset
7179 a4,
Ritor1
parents:
diff changeset
7180 0);
Ritor1
parents:
diff changeset
7181 --v15;
Ritor1
parents:
diff changeset
7182 }
Ritor1
parents:
diff changeset
7183 while ( v15 );
Ritor1
parents:
diff changeset
7184 }
Ritor1
parents:
diff changeset
7185 }
Ritor1
parents:
diff changeset
7186 else
Ritor1
parents:
diff changeset
7187 {
Ritor1
parents:
diff changeset
7188 v17 = count;
Ritor1
parents:
diff changeset
7189 v18 = stru_5C6E00->uIntegerHalfPi;
Ritor1
parents:
diff changeset
7190 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
7191 if ( count > 0 )
Ritor1
parents:
diff changeset
7192 {
Ritor1
parents:
diff changeset
7193 do
Ritor1
parents:
diff changeset
7194 {
Ritor1
parents:
diff changeset
7195 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0);
Ritor1
parents:
diff changeset
7196 --v17;
Ritor1
parents:
diff changeset
7197 }
Ritor1
parents:
diff changeset
7198 while ( v17 );
Ritor1
parents:
diff changeset
7199 }
Ritor1
parents:
diff changeset
7200 }
Ritor1
parents:
diff changeset
7201 return 1;
Ritor1
parents:
diff changeset
7202 }
Ritor1
parents:
diff changeset
7203
Ritor1
parents:
diff changeset
7204 //----- (0042F960) --------------------------------------------------------
Ritor1
parents:
diff changeset
7205 void __fastcall sub_42F960_create_object(int x, int y, int z)
Ritor1
parents:
diff changeset
7206 {
Ritor1
parents:
diff changeset
7207 int v3; // ebx@1
Ritor1
parents:
diff changeset
7208 int v4; // edi@1
Ritor1
parents:
diff changeset
7209 signed int v5; // edx@1
Ritor1
parents:
diff changeset
7210 char *v6; // ecx@2
Ritor1
parents:
diff changeset
7211 unsigned __int16 v7; // ax@5
Ritor1
parents:
diff changeset
7212 signed int v8; // eax@6
Ritor1
parents:
diff changeset
7213 signed int v9; // eax@7
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7214 //SpriteObject a1; // [sp+Ch] [bp-70h]@1
0
Ritor1
parents:
diff changeset
7215
Ritor1
parents:
diff changeset
7216 v3 = x;
Ritor1
parents:
diff changeset
7217 v4 = y;
Ritor1
parents:
diff changeset
7218
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7219 SpriteObject a1; // [sp+Ch] [bp-70h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7220 //SpriteObject::SpriteObject(&a1);
0
Ritor1
parents:
diff changeset
7221 a1.stru_24.Reset();
Ritor1
parents:
diff changeset
7222
Ritor1
parents:
diff changeset
7223 v5 = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7224 a1.spell_skill = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7225 a1.spell_level = 0;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7226 a1.spell_id = 0;
0
Ritor1
parents:
diff changeset
7227 a1.field_54 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7228 a1.uType = 800;
0
Ritor1
parents:
diff changeset
7229 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
7230 {
Ritor1
parents:
diff changeset
7231 LABEL_5:
Ritor1
parents:
diff changeset
7232 v7 = 0;
Ritor1
parents:
diff changeset
7233 }
Ritor1
parents:
diff changeset
7234 else
Ritor1
parents:
diff changeset
7235 {
Ritor1
parents:
diff changeset
7236 v6 = (char *)&pObjectList->pObjects->uObjectID;
Ritor1
parents:
diff changeset
7237 while ( *(short *)v6 != 800 )
Ritor1
parents:
diff changeset
7238 {
Ritor1
parents:
diff changeset
7239 ++v5;
Ritor1
parents:
diff changeset
7240 v6 += 56;
Ritor1
parents:
diff changeset
7241 if ( v5 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
7242 goto LABEL_5;
Ritor1
parents:
diff changeset
7243 }
Ritor1
parents:
diff changeset
7244 v7 = v5;
Ritor1
parents:
diff changeset
7245 }
Ritor1
parents:
diff changeset
7246 a1.uObjectDescID = v7;
Ritor1
parents:
diff changeset
7247 a1.vPosition.x = v3;
Ritor1
parents:
diff changeset
7248 a1.vPosition.y = v4;
Ritor1
parents:
diff changeset
7249 a1.vPosition.z = z;
Ritor1
parents:
diff changeset
7250 a1.uSoundID = 0;
Ritor1
parents:
diff changeset
7251 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
7252 a1.uSectorID = pIndoor->GetSector(v3, v4, z);
Ritor1
parents:
diff changeset
7253 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7254 a1.spell_caster_pid = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
7255 a1.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
7256 v8 = a1.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
7257 if ( v8 != -1 )
Ritor1
parents:
diff changeset
7258 {
Ritor1
parents:
diff changeset
7259 v9 = 8 * v8;
Ritor1
parents:
diff changeset
7260 LOBYTE(v9) = v9 | 2;
Ritor1
parents:
diff changeset
7261 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
7262 }
Ritor1
parents:
diff changeset
7263 }
Ritor1
parents:
diff changeset
7264
810
f5156b8c61ad savegame refactoring
Gloval
parents: 792
diff changeset
7265
0
Ritor1
parents:
diff changeset
7266
Ritor1
parents:
diff changeset
7267 //----- (0042FA66) --------------------------------------------------------
Ritor1
parents:
diff changeset
7268 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
Ritor1
parents:
diff changeset
7269 {
Ritor1
parents:
diff changeset
7270 int v6; // edi@1
Ritor1
parents:
diff changeset
7271 int v7; // esi@1
Ritor1
parents:
diff changeset
7272 char *v8; // ecx@2
Ritor1
parents:
diff changeset
7273 unsigned __int16 v9; // ax@5
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7274 //int v10; // eax@10
0
Ritor1
parents:
diff changeset
7275 signed int result; // eax@11
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7276 //__int16 v12; // ax@12
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7277 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
0
Ritor1
parents:
diff changeset
7278 int v14; // [sp+7Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
7279
Ritor1
parents:
diff changeset
7280 v6 = a1;
Ritor1
parents:
diff changeset
7281 v7 = a2;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7282 SpriteObject a1a; // [sp+Ch] [bp-74h]@1
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7283 //SpriteObject::SpriteObject(&a1a);
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7284 a1a.uType = 600;
0
Ritor1
parents:
diff changeset
7285 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
7286
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7287 a1a.spell_id = SPELL_FIRE_FIREBALL;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7288 a1a.spell_level = 8;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7289 a1a.spell_skill = 3;
0
Ritor1
parents:
diff changeset
7290 v14 = 0;
Ritor1
parents:
diff changeset
7291 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
7292 {
Ritor1
parents:
diff changeset
7293 LABEL_5:
Ritor1
parents:
diff changeset
7294 v9 = 0;
Ritor1
parents:
diff changeset
7295 }
Ritor1
parents:
diff changeset
7296 else
Ritor1
parents:
diff changeset
7297 {
Ritor1
parents:
diff changeset
7298 v8 = (char *)&pObjectList->pObjects->uObjectID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 490
diff changeset
7299 while ( (short)a1a.uType != *(short *)v8 )
0
Ritor1
parents:
diff changeset
7300 {
Ritor1
parents:
diff changeset
7301 ++v14;
Ritor1
parents:
diff changeset
7302 v8 += 56;
Ritor1
parents:
diff changeset
7303 if ( v14 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
7304 goto LABEL_5;
Ritor1
parents:
diff changeset
7305 }
Ritor1
parents:
diff changeset
7306 v9 = v14;
Ritor1
parents:
diff changeset
7307 }
Ritor1
parents:
diff changeset
7308 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
7309 a1a.vPosition.x = v6;
Ritor1
parents:
diff changeset
7310 a1a.vPosition.y = v7;
Ritor1
parents:
diff changeset
7311 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
7312 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
7313 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3);
Ritor1
parents:
diff changeset
7314 a1a.uSpriteFrameID = 0;
823
c1da83d8223f More spell renames
Nomad
parents: 822
diff changeset
7315 a1a.spell_target_pid = 0;
0
Ritor1
parents:
diff changeset
7316 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
7317 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
7318 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
7319 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
7320 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7321 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
0
Ritor1
parents:
diff changeset
7322 }
Ritor1
parents:
diff changeset
7323 else
Ritor1
parents:
diff changeset
7324 {
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
7325 a1a.spell_caster_pid = 0;
0
Ritor1
parents:
diff changeset
7326 }
Ritor1
parents:
diff changeset
7327 result = a1a.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
7328 if ( result != -1 )
Ritor1
parents:
diff changeset
7329 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7330 result = stru_50FE08.Add(PID(OBJECT_Item, result),
0
Ritor1
parents:
diff changeset
7331 a5,
Ritor1
parents:
diff changeset
7332 SLOWORD(a1a.vPosition.x),
Ritor1
parents:
diff changeset
7333 SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
7334 SLOWORD(a1a.vPosition.z),
Ritor1
parents:
diff changeset
7335 0,
Ritor1
parents:
diff changeset
7336 0);
Ritor1
parents:
diff changeset
7337 }
Ritor1
parents:
diff changeset
7338 return result;
Ritor1
parents:
diff changeset
7339 }
Ritor1
parents:
diff changeset
7340
Ritor1
parents:
diff changeset
7341 //----- (0042FB5C) --------------------------------------------------------
Ritor1
parents:
diff changeset
7342 bool __fastcall sub_42FB5C(signed int a1)
Ritor1
parents:
diff changeset
7343 {
Ritor1
parents:
diff changeset
7344 int v1; // ecx@3
Ritor1
parents:
diff changeset
7345 int v2; // ecx@4
Ritor1
parents:
diff changeset
7346 int v3; // ecx@5
Ritor1
parents:
diff changeset
7347 int v4; // ecx@6
Ritor1
parents:
diff changeset
7348 int v5; // ecx@7
Ritor1
parents:
diff changeset
7349 int v6; // ecx@8
Ritor1
parents:
diff changeset
7350 char v7; // zf@9
Ritor1
parents:
diff changeset
7351
Ritor1
parents:
diff changeset
7352 if ( a1 > 39 )
Ritor1
parents:
diff changeset
7353 {
Ritor1
parents:
diff changeset
7354 if ( a1 > 77 )
Ritor1
parents:
diff changeset
7355 {
Ritor1
parents:
diff changeset
7356 if ( a1 == 80 )
Ritor1
parents:
diff changeset
7357 return 0;
Ritor1
parents:
diff changeset
7358 if ( a1 > 84 )
Ritor1
parents:
diff changeset
7359 {
Ritor1
parents:
diff changeset
7360 if ( a1 <= 86 )
Ritor1
parents:
diff changeset
7361 return 0;
Ritor1
parents:
diff changeset
7362 v7 = a1 == 95;
Ritor1
parents:
diff changeset
7363 goto LABEL_20;
Ritor1
parents:
diff changeset
7364 }
Ritor1
parents:
diff changeset
7365 }
Ritor1
parents:
diff changeset
7366 else
Ritor1
parents:
diff changeset
7367 {
Ritor1
parents:
diff changeset
7368 if ( a1 == 77 )
Ritor1
parents:
diff changeset
7369 return 0;
Ritor1
parents:
diff changeset
7370 if ( a1 >= 46 )
Ritor1
parents:
diff changeset
7371 {
Ritor1
parents:
diff changeset
7372 if ( a1 <= 47 || a1 == 51 )
Ritor1
parents:
diff changeset
7373 return 0;
Ritor1
parents:
diff changeset
7374 v7 = a1 == 73;
Ritor1
parents:
diff changeset
7375 goto LABEL_20;
Ritor1
parents:
diff changeset
7376 }
Ritor1
parents:
diff changeset
7377 }
Ritor1
parents:
diff changeset
7378 return 1;
Ritor1
parents:
diff changeset
7379 }
Ritor1
parents:
diff changeset
7380 if ( a1 == 39 || (v1 = a1 - 2) == 0 )
Ritor1
parents:
diff changeset
7381 return 1;
Ritor1
parents:
diff changeset
7382 v2 = v1 - 3;
Ritor1
parents:
diff changeset
7383 if ( !v2 )
Ritor1
parents:
diff changeset
7384 return 0;
Ritor1
parents:
diff changeset
7385 v3 = v2 - 1;
Ritor1
parents:
diff changeset
7386 if ( !v3 || (v4 = v3 - 3) == 0 )
Ritor1
parents:
diff changeset
7387 return 1;
Ritor1
parents:
diff changeset
7388 v5 = v4 - 8;
Ritor1
parents:
diff changeset
7389 if ( !v5 )
Ritor1
parents:
diff changeset
7390 return 0;
Ritor1
parents:
diff changeset
7391 v6 = v5 - 1;
Ritor1
parents:
diff changeset
7392 if ( !v6 )
Ritor1
parents:
diff changeset
7393 return 1;
Ritor1
parents:
diff changeset
7394 v7 = v6 == 20;
Ritor1
parents:
diff changeset
7395 LABEL_20:
Ritor1
parents:
diff changeset
7396 if ( !v7 )
Ritor1
parents:
diff changeset
7397 return 1;
Ritor1
parents:
diff changeset
7398 return 0;
Ritor1
parents:
diff changeset
7399 }
Ritor1
parents:
diff changeset
7400
Ritor1
parents:
diff changeset
7401 //----- (0042FBDD) --------------------------------------------------------
Ritor1
parents:
diff changeset
7402 void __cdecl sub_42FBDD()
Ritor1
parents:
diff changeset
7403 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
7404 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
7405 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
Ritor1
parents:
diff changeset
7406 pRenderer->Present();
Ritor1
parents:
diff changeset
7407 }
Ritor1
parents:
diff changeset
7408
Ritor1
parents:
diff changeset
7409 //----- (0042FC15) --------------------------------------------------------
11
66319a734368 16.01.13(work)
Ritor1
parents: 0
diff changeset
7410 void __cdecl CloseWindowBackground()
0
Ritor1
parents:
diff changeset
7411 {
388
d95a91011d57 AudioPlayer::PlaySound
Nomad
parents: 377
diff changeset
7412 pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0);
0
Ritor1
parents:
diff changeset
7413 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
Ritor1
parents:
diff changeset
7414 pRenderer->Present();
Ritor1
parents:
diff changeset
7415 }
Ritor1
parents:
diff changeset
7416
Ritor1
parents:
diff changeset
7417 //----- (0042FC4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
7418 void __cdecl ProcessInputActions()
Ritor1
parents:
diff changeset
7419 {
Ritor1
parents:
diff changeset
7420 char v4; // al@9
Ritor1
parents:
diff changeset
7421 char v8; // bl@100
Ritor1
parents:
diff changeset
7422 unsigned __int16 v9; // ax@102
Ritor1
parents:
diff changeset
7423 int v10; // eax@103
Ritor1
parents:
diff changeset
7424 char v14; // al@159
Ritor1
parents:
diff changeset
7425 unsigned int v15; // eax@168
Ritor1
parents:
diff changeset
7426 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
Ritor1
parents:
diff changeset
7427 InputAction inputAction; // [sp+0h] [bp-8h]@7
Ritor1
parents:
diff changeset
7428 int v24; // [sp+4h] [bp-4h]@87
Ritor1
parents:
diff changeset
7429
Ritor1
parents:
diff changeset
7430 pGame->pKeyboardInstance->EnterCriticalSection();
Ritor1
parents:
diff changeset
7431 auto pKeyboard = pGame->pKeyboardInstance;
Ritor1
parents:
diff changeset
7432 if (!bAlwaysRun)
Ritor1
parents:
diff changeset
7433 {
Ritor1
parents:
diff changeset
7434 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
7435 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
7436 else
Ritor1
parents:
diff changeset
7437 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
7438 }
Ritor1
parents:
diff changeset
7439 else
Ritor1
parents:
diff changeset
7440 {
Ritor1
parents:
diff changeset
7441 if (pKeyboard->IsShiftHeld())
Ritor1
parents:
diff changeset
7442 pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
7443 else
Ritor1
parents:
diff changeset
7444 pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
Ritor1
parents:
diff changeset
7445 }
Ritor1
parents:
diff changeset
7446
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
7447 //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7448
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7449
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7450 // WUT? double event trigger
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7451 /*for ( uint i = 0; i < 30; ++i )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7452 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7453 if ( pKeyActionMap->pToggleTypes[i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7454 v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7455 else
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7456 v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7457 if ( v14 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7458 {
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7459 if (pCurrentScreen == SCREEN_GAME)
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7460 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7461 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7462 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7463 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7464 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7465 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7466 v15 = pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7467 if ( pMessageQueue_50CBD0->uNumMessages )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7468 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7469 v15 = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7470 if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7471 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7472 v15 = 1;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7473 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7474 pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7475 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7476 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7477 ++pMessageQueue_50CBD0->uNumMessages;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7478 continue;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7479 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7480 pMessageQueue_50CBD0->uNumMessages = 0;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7481 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7482 //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7483 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7484 }
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
7485 }*/
0
Ritor1
parents:
diff changeset
7486 if ( !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
7487 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7488 for ( uint i = 0; i < 30; ++i )
0
Ritor1
parents:
diff changeset
7489 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7490 inputAction = (InputAction)i;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7491 if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7492 v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
7493 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7494 v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
0
Ritor1
parents:
diff changeset
7495 if ( v4 )
Ritor1
parents:
diff changeset
7496 {
Ritor1
parents:
diff changeset
7497 switch ( inputAction )
Ritor1
parents:
diff changeset
7498 {
Ritor1
parents:
diff changeset
7499 case INPUT_MoveForward:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7500 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7501 break;
Ritor1
parents:
diff changeset
7502 if (!pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
7503 {
140
f4d7a9a8c363 Walk/run and other actions
Nomad
parents: 135
diff changeset
7504 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
0
Ritor1
parents:
diff changeset
7505 partyAction = PARTY_RunForward;
Ritor1
parents:
diff changeset
7506 else
Ritor1
parents:
diff changeset
7507 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7508 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7509 break;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7510 }
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7511 if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 )
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7512 {
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7513 pTurnEngine->uActionPointsLeft -= 26;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7514 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7515 partyAction = PARTY_RunForward;
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7516 else
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7517 partyAction = PARTY_WalkForward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7518 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7519 break;
0
Ritor1
parents:
diff changeset
7520 }
Ritor1
parents:
diff changeset
7521 break;
Ritor1
parents:
diff changeset
7522 case INPUT_MoveBackwards:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7523 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7524 break;
Ritor1
parents:
diff changeset
7525 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7526 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7527 if ( pParty->uFlags2 & 2 )
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7528 partyAction = PARTY_RunBackward;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7529 else
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7530 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7531 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7532 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7533 }
0
Ritor1
parents:
diff changeset
7534 if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 )
Ritor1
parents:
diff changeset
7535 {
Ritor1
parents:
diff changeset
7536 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
7537 if ( pParty->uFlags2 & 2 )
Ritor1
parents:
diff changeset
7538 partyAction = PARTY_RunBackward;
Ritor1
parents:
diff changeset
7539 else
Ritor1
parents:
diff changeset
7540 partyAction = PARTY_WalkBackward;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7541 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7542 break;
0
Ritor1
parents:
diff changeset
7543 }
Ritor1
parents:
diff changeset
7544 break;
Ritor1
parents:
diff changeset
7545 case INPUT_StrafeLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7546 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7547 break;
Ritor1
parents:
diff changeset
7548 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7549 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7550 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7551 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7552 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7553 }
0
Ritor1
parents:
diff changeset
7554 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
Ritor1
parents:
diff changeset
7555 break;
Ritor1
parents:
diff changeset
7556 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
7557 partyAction = PARTY_StrafeLeft;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7558 pPartyActionQueue->Add(partyAction);
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7559 break;
0
Ritor1
parents:
diff changeset
7560 case INPUT_StrafeRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7561 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7562 break;
Ritor1
parents:
diff changeset
7563 if (!pParty->bTurnBasedModeOn)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7564 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7565 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7566 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7567 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7568 }
0
Ritor1
parents:
diff changeset
7569 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
Ritor1
parents:
diff changeset
7570 break;
Ritor1
parents:
diff changeset
7571 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
7572 partyAction = PARTY_StrafeRight;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7573 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7574 break;
0
Ritor1
parents:
diff changeset
7575 case INPUT_TurnLeft:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7576 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7577 break;
Ritor1
parents:
diff changeset
7578 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
Ritor1
parents:
diff changeset
7579 {
Ritor1
parents:
diff changeset
7580 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
7581 {
Ritor1
parents:
diff changeset
7582 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
Ritor1
parents:
diff changeset
7583 break;
Ritor1
parents:
diff changeset
7584 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
7585 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7586 partyAction = PARTY_StrafeLeft;
0
Ritor1
parents:
diff changeset
7587 }
Ritor1
parents:
diff changeset
7588 else
Ritor1
parents:
diff changeset
7589 {
Ritor1
parents:
diff changeset
7590 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7591 partyAction = PARTY_FastTurnLeft;
0
Ritor1
parents:
diff changeset
7592 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7593 partyAction = PARTY_TurnLeft;
0
Ritor1
parents:
diff changeset
7594 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7595 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
7596 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
7597 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7598 pWeather->OnPlayerTurn(10);
0
Ritor1
parents:
diff changeset
7599 }
Ritor1
parents:
diff changeset
7600 break;
Ritor1
parents:
diff changeset
7601 case INPUT_TurnRight:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7602 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7603 break;
Ritor1
parents:
diff changeset
7604 if ( GetAsyncKeyState(17) ) // strafing
Ritor1
parents:
diff changeset
7605 {
Ritor1
parents:
diff changeset
7606 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
7607 {
Ritor1
parents:
diff changeset
7608 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
Ritor1
parents:
diff changeset
7609 break;
Ritor1
parents:
diff changeset
7610 pTurnEngine->uActionPointsLeft -= 26;
Ritor1
parents:
diff changeset
7611 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7612 partyAction = PARTY_StrafeRight;
0
Ritor1
parents:
diff changeset
7613 }
Ritor1
parents:
diff changeset
7614 else
Ritor1
parents:
diff changeset
7615 {
Ritor1
parents:
diff changeset
7616 if ( pParty->uFlags2 & 2 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7617 partyAction = PARTY_FastTurnRight;
0
Ritor1
parents:
diff changeset
7618 else
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7619 partyAction = PARTY_TurnRight;
0
Ritor1
parents:
diff changeset
7620 }
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7621 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
7622 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
Ritor1
parents:
diff changeset
7623 {
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7624 pWeather->OnPlayerTurn(-10);
0
Ritor1
parents:
diff changeset
7625 }
Ritor1
parents:
diff changeset
7626 break;
Ritor1
parents:
diff changeset
7627 case INPUT_Jump:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7628 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
0
Ritor1
parents:
diff changeset
7629 break;
Ritor1
parents:
diff changeset
7630 partyAction = (PartyAction)12;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7631 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7632 break;
0
Ritor1
parents:
diff changeset
7633 case INPUT_Yell:
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
7634 if (!pCurrentScreen && uActiveCharacter)
0
Ritor1
parents:
diff changeset
7635 {
Ritor1
parents:
diff changeset
7636 pParty->Yell();
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
7637 pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0);
0
Ritor1
parents:
diff changeset
7638 }
187
49728858c35e On player voices
Nomad
parents: 169
diff changeset
7639 break;
0
Ritor1
parents:
diff changeset
7640 case INPUT_Pass:
Ritor1
parents:
diff changeset
7641 if ( pCurrentScreen )
Ritor1
parents:
diff changeset
7642 break;
Ritor1
parents:
diff changeset
7643 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7644 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7645 pTurnEngine->field_18 |= 8u;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7646 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7647 }
0
Ritor1
parents:
diff changeset
7648 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
7649 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7650 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
0
Ritor1
parents:
diff changeset
7651 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7652 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
0
Ritor1
parents:
diff changeset
7653 if ( !pParty->bTurnBasedModeOn )
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7654 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
7655 pCastSpellInfo.data()->_427D48(uActiveCharacter);
0
Ritor1
parents:
diff changeset
7656 pTurnEngine->_40471C();
Ritor1
parents:
diff changeset
7657 }
Ritor1
parents:
diff changeset
7658 }
Ritor1
parents:
diff changeset
7659 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7660 case INPUT_Combat://if press ENTER
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7661 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7662 {
Ritor1
parents:
diff changeset
7663 if (pParty->bTurnBasedModeOn)
Ritor1
parents:
diff changeset
7664 {
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
7665 if (pTurnEngine->field_4 == OBJECT_Actor || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
0
Ritor1
parents:
diff changeset
7666 {
Ritor1
parents:
diff changeset
7667 pParty->bTurnBasedModeOn = 0;
Ritor1
parents:
diff changeset
7668 pTurnEngine->End(true);
Ritor1
parents:
diff changeset
7669 }
Ritor1
parents:
diff changeset
7670 }
Ritor1
parents:
diff changeset
7671 else
Ritor1
parents:
diff changeset
7672 {
Ritor1
parents:
diff changeset
7673 pTurnEngine->Start();
Ritor1
parents:
diff changeset
7674 pParty->bTurnBasedModeOn = true;
Ritor1
parents:
diff changeset
7675 }
Ritor1
parents:
diff changeset
7676 }
Ritor1
parents:
diff changeset
7677 break;
Ritor1
parents:
diff changeset
7678 case INPUT_CastReady:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7679 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7680 break;
Ritor1
parents:
diff changeset
7681 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7682 {
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7683 pTurnEngine->field_18 |= 8u;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7684 break;
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7685 }
0
Ritor1
parents:
diff changeset
7686 if ( !uActiveCharacter )
Ritor1
parents:
diff changeset
7687 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7688 v8 = pPlayers[uActiveCharacter]->uQuickSpell;
0
Ritor1
parents:
diff changeset
7689 if ( !v8
Ritor1
parents:
diff changeset
7690 || bUnderwater
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7691 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ?
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7692 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7693 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7694 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) :
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7695 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7696 v10 > pPlayers[uActiveCharacter]->sMana) )
0
Ritor1
parents:
diff changeset
7697 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7698 pPartyActionQueue = pPartyActionQueue;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7699 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7700 break;
0
Ritor1
parents:
diff changeset
7701 }
Ritor1
parents:
diff changeset
7702 else
Ritor1
parents:
diff changeset
7703 {
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7704 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
0
Ritor1
parents:
diff changeset
7705 }
Ritor1
parents:
diff changeset
7706 break;
Ritor1
parents:
diff changeset
7707 case INPUT_Attack:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7708 if (pCurrentScreen != SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7709 break;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7710 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3)
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7711 {
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7712 pTurnEngine->field_18 |= 8u;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7713 break;
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7714 }
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7715 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
0
Ritor1
parents:
diff changeset
7716 break;
Ritor1
parents:
diff changeset
7717 case INPUT_EventTrigger:
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 243
diff changeset
7718 if (pCurrentScreen == SCREEN_GAME)
0
Ritor1
parents:
diff changeset
7719 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7720 pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7721 break;
0
Ritor1
parents:
diff changeset
7722 }
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 141
diff changeset
7723 if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
0
Ritor1
parents:
diff changeset
7724 {
Ritor1
parents:
diff changeset
7725 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
7726 {
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7727 pMessageQueue_50CBD0->uNumMessages = 0;
0
Ritor1
parents:
diff changeset
7728 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
Ritor1
parents:
diff changeset
7729 {
Ritor1
parents:
diff changeset
7730 pMessageQueue_50CBD0->uNumMessages = 1;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7731 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
0
Ritor1
parents:
diff changeset
7732 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
Ritor1
parents:
diff changeset
7733 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
Ritor1
parents:
diff changeset
7734 ++pMessageQueue_50CBD0->uNumMessages;
Ritor1
parents:
diff changeset
7735 break;
Ritor1
parents:
diff changeset
7736 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7737 break;
0
Ritor1
parents:
diff changeset
7738 }
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7739 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
0
Ritor1
parents:
diff changeset
7740 }
Ritor1
parents:
diff changeset
7741 break;
Ritor1
parents:
diff changeset
7742 case INPUT_CharCycle:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7743 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
0
Ritor1
parents:
diff changeset
7744 break;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7745 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7746 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7747 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7748 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7749 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7750 break;
0
Ritor1
parents:
diff changeset
7751 case INPUT_LookUp:
Ritor1
parents:
diff changeset
7752 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
7753 break;
Ritor1
parents:
diff changeset
7754 partyAction = (PartyAction)7;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7755 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7756 break;
0
Ritor1
parents:
diff changeset
7757 case INPUT_CenterView:
Ritor1
parents:
diff changeset
7758 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
7759 break;
Ritor1
parents:
diff changeset
7760 partyAction = (PartyAction)9;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7761 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7762 break;
0
Ritor1
parents:
diff changeset
7763 case INPUT_LookDown:
Ritor1
parents:
diff changeset
7764 if ( pEventTimer->bPaused )
Ritor1
parents:
diff changeset
7765 break;
Ritor1
parents:
diff changeset
7766 partyAction = (PartyAction)8;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7767 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7768 break;
0
Ritor1
parents:
diff changeset
7769 case INPUT_FlyUp:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7770 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
7771 break;
Ritor1
parents:
diff changeset
7772 partyAction = (PartyAction)13;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7773 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7774 break;
0
Ritor1
parents:
diff changeset
7775 case INPUT_Land:
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7776 if ( pCurrentScreen || pEventTimer->bPaused )
0
Ritor1
parents:
diff changeset
7777 break;
Ritor1
parents:
diff changeset
7778 partyAction = (PartyAction)15;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7779 pPartyActionQueue->Add(partyAction);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7780 break;
0
Ritor1
parents:
diff changeset
7781 case INPUT_FlyDown:
Ritor1
parents:
diff changeset
7782 if ( !pCurrentScreen
Ritor1
parents:
diff changeset
7783 && !pEventTimer->bPaused )
Ritor1
parents:
diff changeset
7784 {
Ritor1
parents:
diff changeset
7785 partyAction = (PartyAction)14;
998
e4383e6dfbef ProcessInput
Ritor1
parents: 997
diff changeset
7786 pPartyActionQueue->Add(partyAction);
0
Ritor1
parents:
diff changeset
7787 }
Ritor1
parents:
diff changeset
7788 break;
Ritor1
parents:
diff changeset
7789 case INPUT_ZoomIn:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7790 /*if ( dword_50C9E8 >= 40 )
0
Ritor1
parents:
diff changeset
7791 break;
Ritor1
parents:
diff changeset
7792 dword_50C9EC[3 * dword_50C9E8] = 367;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7793 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7794 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7795 ++dword_50C9E8;*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7796 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
163
a0e7ad5425d4 14.02.13
Ritor1
parents: 151
diff changeset
7797 break;
0
Ritor1
parents:
diff changeset
7798 case INPUT_ZoomOut:
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7799 /*if ( dword_50C9E8 < 40 )
0
Ritor1
parents:
diff changeset
7800 {
Ritor1
parents:
diff changeset
7801 dword_50C9EC[3 * dword_50C9E8] = 368;
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7802 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
7803 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
0
Ritor1
parents:
diff changeset
7804 ++dword_50C9E8;
1012
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7805 }*/
9e823ad5eaa6 second msg_queue returned
Gloval
parents: 1009
diff changeset
7806 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
0
Ritor1
parents:
diff changeset
7807 break;
Ritor1
parents:
diff changeset
7808 case INPUT_AlwaysRun:
Ritor1
parents:
diff changeset
7809 bAlwaysRun = bAlwaysRun == 0;
Ritor1
parents:
diff changeset
7810 break;
17
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7811 default:
fe0d9a98213f 17.01.13 (fix Hint error)
Ritor1
parents: 11
diff changeset
7812 break;
0
Ritor1
parents:
diff changeset
7813 }
Ritor1
parents:
diff changeset
7814 }
Ritor1
parents:
diff changeset
7815 }
Ritor1
parents:
diff changeset
7816 }
Ritor1
parents:
diff changeset
7817 }