0
|
1 #include <stdlib.h>
|
|
2
|
|
3 #include "Spells.h"
|
|
4 #include "Overlays.h"
|
|
5 #include "Allocator.h"
|
|
6 #include "LOD.h"
|
|
7 #include "stru123.h"
|
189
|
8 #include "texts.h"
|
0
|
9
|
|
10 #include "mm7_data.h"
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16 struct SpellStats *pSpellStats;
|
|
17
|
|
18
|
|
19 stru324_spell stru_4E3ACC[102];
|
|
20
|
192
|
21 SpellData pSpellDatas[100]={
|
|
22 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
23 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},
|
|
24 {2, 2, 2, 2, 110, 110, 100, 90, 768, 0},
|
|
25 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
26 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0},
|
|
27 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0},
|
|
28 {8, 8, 8, 8, 100, 100, 90, 80, 1536, 0},
|
|
29 {10, 10, 10, 10, 150, 150, 150, 150, 1536, 0},
|
|
30 {15, 15, 15, 15, 120, 120, 120, 120, 1536, 0},
|
|
31 {20, 20, 20, 20, 100, 100, 100, 90, 264, 0},
|
|
32 {25, 25, 25, 25, 100, 100, 100, 90, 268, 0},
|
|
33 {30, 30, 30, 30, 90, 90, 90, 90, 3855, 0},
|
|
34 {1, 1, 1, 0, 60, 60, 60, 60, 0, 0},
|
|
35 {2, 2, 2, 2, 120, 120, 120, 100, 0, 0},
|
|
36 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
37 {4, 4, 4, 4, 110, 100, 90, 80, 258, 0},
|
|
38 {5, 5, 5, 5, 90, 90, 70, 50, 0, 0},
|
|
39 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0},
|
|
40 {10, 10, 10, 10, 100, 100, 90, 70, 2048, 0},
|
|
41 {15, 15, 15, 15, 200, 200, 200, 200, 0, 0},
|
|
42 {20, 20, 20, 20, 100, 100, 100, 90, 2570, 0},
|
|
43 {25, 25, 25, 25, 250, 250, 250, 250, 0, 0},
|
|
44 {30, 30, 30, 30, 90, 90, 90, 90, 276, 0},
|
|
45 {1, 1, 1, 1, 60, 60, 60, 20, 0, 0},
|
|
46 {2, 2, 2, 2, 110, 100, 90, 70, 514, 0},
|
|
47 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
48 {4, 4, 4, 4, 110, 100, 90, 80, 1024, 0},
|
|
49 {5, 5, 5, 5, 150, 150, 150, 150, 0, 0},
|
|
50 {8, 8, 8, 8, 200, 200, 200, 200, 0, 0},
|
|
51 {10, 10, 10, 10, 100, 100, 90, 80, 2313, 0},
|
|
52 {15, 15, 15, 15, 140, 140, 140, 140, 0, 0},
|
|
53 {20, 20, 20, 20, 200, 200, 200, 200, 0, 0},
|
|
54 {25, 25, 25, 25, 80, 80, 80, 80, 780, 0},
|
|
55 {30, 30, 30, 30, 250, 250, 250, 250, 0, 0},
|
|
56 {1, 1, 1, 1, 80, 80, 80, 80, 0, 0},
|
|
57 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
|
|
58 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
59 {4, 4, 4, 4, 110, 100, 90, 80, 773, 0},
|
|
60 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0},
|
|
61 {8, 8, 8, 8, 100, 100, 90, 80, 2304, 0},
|
|
62 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0},
|
|
63 {15, 15, 15, 15, 90, 90, 90, 80, 2048, 0},
|
|
64 {20, 20, 20, 20, 150, 150, 150, 150, 0, 0},
|
|
65 {25, 25, 25, 25, 100, 100, 100, 90, 276, 0},
|
|
66 {30, 30, 30, 30, 90, 90, 90, 90, 25, 0},
|
|
67 {1, 1, 1, 1, 100, 100, 100, 100, 0, 0},
|
|
68 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
|
|
69 {3, 3, 3, 3, 90, 90, 90, 90, 0, 0},
|
|
70 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0},
|
|
71 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0},
|
|
72 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0},
|
|
73 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0},
|
|
74 {15, 15, 15, 15, 100, 100, 100, 100, 2058, 0},
|
|
75 {20, 20, 20, 20, 240, 240, 240, 240, 0, 0},
|
|
76 {25, 25, 25, 25, 150, 150, 150, 150, 0, 0},
|
|
77 {30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0},
|
|
78 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},
|
|
79 {2, 2, 2, 2, 110, 110, 110, 110, 771, 0},
|
|
80 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
81 {4, 4, 4, 4, 110, 100, 90, 80, 0, 0},
|
|
82 {5, 5, 5, 5, 100, 100, 100, 100, 0, 0},
|
|
83 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0},
|
|
84 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0},
|
|
85 {15, 15, 15, 15, 80, 80, 80, 80, 0, 0},
|
|
86 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0},
|
|
87 {25, 25, 25, 25, 110, 110, 110, 100, 268, 0},
|
|
88 {30, 30, 30, 30, 120, 120, 120, 120, 0, 0},
|
|
89 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0},
|
|
90 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0},
|
|
91 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0},
|
|
92 {4, 4, 4, 4, 110, 100, 90, 80, 520, 0},
|
|
93 {5, 5, 5, 5, 110, 110, 110, 110, 0, 0},
|
|
94 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0},
|
|
95 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0},
|
|
96 {15, 15, 15, 15, 120, 120, 120, 120, 0, 0},
|
|
97 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0},
|
|
98 {25, 25, 25, 25, 110, 110, 110, 100, 1310, 0},
|
|
99 {30, 30, 30, 30, 100, 100, 100, 100, 0, 0},
|
|
100 {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0},
|
|
101 {10, 10, 10, 10, 120, 110, 100, 90, 4112, 0},
|
|
102 {15, 15, 15, 15, 120, 110, 100, 90, 0, 0},
|
|
103 {20, 20, 20, 20, 160, 140, 120, 100, 0, 0},
|
|
104 {25, 25, 25, 25, 140, 140, 140, 140, 0, 0},
|
|
105 {30, 30, 30, 30, 500, 500, 500, 500, 0, 0},
|
|
106 {35, 35, 35, 35, 135, 135, 120, 100, 281, 0},
|
|
107 {40, 40, 40, 40, 500, 500, 500, 500, 0, 0},
|
|
108 {45, 45, 45, 45, 250, 250, 250, 250, 0, 0},
|
|
109 {50, 50, 50, 50, 150, 150, 150, 135, 5140, 0},
|
|
110 {55, 55, 55, 55, 300, 300, 300, 300, 0, 0},
|
|
111 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0},
|
|
112 {15, 15, 15, 15, 120, 110, 100, 90, 2585, 0},
|
|
113 {20, 20, 20, 20, 120, 100, 90, 120, 0, 0},
|
|
114 {25, 25, 25, 25, 120, 120, 120, 120, 0, 0},
|
|
115 {30, 30, 30, 30, 90, 90, 80, 70, 1542, 0},
|
|
116 {35, 35, 35, 35, 120, 120, 100, 80, 0, 0},
|
|
117 {40, 40, 40, 40, 110, 110, 110, 110, 0, 0},
|
|
118 {45, 45, 45, 45, 200, 200, 200, 150, 0, 0},
|
|
119 {50, 50, 50, 50, 120, 120, 120, 100, 6400, 0},
|
|
120 {55, 55, 55, 55, 250, 250, 250, 250, 306, 0},
|
|
121 {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0}
|
|
122 };
|
0
|
123
|
|
124
|
|
125
|
|
126
|
|
127
|
|
128 //----- (0042EB31) --------------------------------------------------------
|
|
129 bool SpellBuff::NotExpired()
|
|
130 {
|
189
|
131 return (signed __int64)this->uExpireTime > 0 ? true:false;
|
0
|
132 }
|
|
133
|
|
134
|
|
135 //----- (00458585) --------------------------------------------------------
|
|
136 void SpellBuff::Reset()
|
|
137 {
|
|
138 SpellBuff *v1; // esi@1
|
|
139 unsigned __int16 v2; // ax@1
|
|
140
|
|
141 this->uSkill = 0;
|
|
142 this->uPower = 0;
|
|
143 this->uExpireTime = 0i64;
|
|
144 this->uCaster = 0;
|
|
145 this->uFlags = 0;
|
189
|
146 if ( this->uOverlayID )
|
0
|
147 {
|
189
|
148 ((OtherOverlay *)&stru_5E4C90._decor_events[20 * this->uOverlayID + 105])->Reset();
|
142
|
149 pOtherOverlayList->bRedraw = true;
|
189
|
150 this->uOverlayID = 0;
|
0
|
151 }
|
|
152 }
|
|
153
|
|
154 //----- (004585CA) --------------------------------------------------------
|
|
155 signed int SpellBuff::_4585CA(__int64 a2)
|
|
156 {
|
|
157 signed int result; // eax@3
|
|
158
|
|
159 if ( this->uExpireTime && (signed __int64)this->uExpireTime < a2 )
|
|
160 {
|
|
161 this->uExpireTime = 0i64;
|
|
162 this->uPower = 0;
|
|
163 this->uSkill = 0;
|
|
164 this->uOverlayID = 0;
|
|
165 result = 1;
|
|
166 }
|
|
167 else
|
|
168 {
|
|
169 result = 0;
|
|
170 }
|
|
171 return result;
|
|
172 }
|
|
173
|
|
174 //----- (004584E0) --------------------------------------------------------
|
|
175 signed int SpellBuff::Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int a5, unsigned __int8 a6)
|
|
176 {
|
|
177 SpellBuff *v6; // esi@1
|
|
178 signed int result; // eax@3
|
|
179 int v8; // eax@4
|
|
180
|
|
181 v6 = this;
|
|
182 if ( this->uExpireTime && (signed __int64)uExpireTime < (signed __int64)this->uExpireTime )
|
|
183 {
|
|
184 result = 0;
|
|
185 }
|
|
186 else
|
|
187 {
|
|
188 this->uSkill = uSkillLevel;
|
|
189 this->uPower = uPower;
|
|
190 LOWORD(v8) = this->uOverlayID;
|
|
191 this->uExpireTime = uExpireTime;
|
|
192 if ( (short)v8 )
|
|
193 {
|
|
194 v8 = (unsigned __int16)v8;
|
|
195 if ( (unsigned __int16)v8 != a5 )
|
|
196 {
|
|
197 ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v8 + 105])->Reset();
|
142
|
198 pOtherOverlayList->bRedraw = true;
|
0
|
199 v6->uOverlayID = 0;
|
|
200 }
|
|
201 }
|
|
202 v6->uOverlayID = a5;
|
|
203 v6->uCaster = a6;
|
|
204 result = 1;
|
|
205 }
|
|
206 return result;
|
|
207 }
|
|
208
|
|
209 //----- (0045384A) --------------------------------------------------------
|
|
210 void SpellStats::Initialize()
|
191
|
211 {
|
0
|
212
|
191
|
213 int decode_step;
|
|
214 char* test_string;
|
|
215 bool break_loop;
|
|
216 unsigned char c;
|
|
217 unsigned int temp_str_len;
|
|
218 char* tmp_pos;
|
189
|
219
|
191
|
220 if ( pSpellsTXT_Raw )
|
|
221 pAllocator->FreeChunk(pSpellsTXT_Raw);
|
|
222 pSpellsTXT_Raw = NULL;
|
189
|
223
|
191
|
224 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0);
|
|
225 strtok(pSpellsTXT_Raw, "\r");
|
|
226 strtok(NULL, "\r");
|
|
227 for(int i=1; i<100; ++i)
|
|
228 {
|
|
229 test_string=strtok(NULL, "\r")+1;
|
|
230 decode_step =0;
|
|
231 break_loop=false;
|
|
232 do
|
|
233 {
|
|
234 c = *(unsigned char*)test_string;
|
|
235 temp_str_len = 0;
|
|
236 while((c!='\t')&&(c>0))
|
|
237 {
|
|
238 ++temp_str_len;
|
|
239 c=test_string[temp_str_len];
|
|
240 }
|
|
241 tmp_pos=test_string+temp_str_len;
|
|
242 if (*tmp_pos == 0)
|
|
243 break_loop = true;
|
|
244 *tmp_pos = 0;
|
|
245 if (temp_str_len)
|
|
246 {
|
|
247 switch (decode_step)
|
|
248 {
|
|
249 case 2:
|
|
250 pInfos[i].pName=RemoveQuotes(test_string);
|
|
251 break;
|
|
252 case 3:
|
192
|
253 pInfos[i].uSchool = SPELL_SCHOOL_NONE;
|
191
|
254 if (!_strcmpi("fire", test_string) )
|
|
255 {
|
192
|
256 pInfos[i].uSchool =SPELL_SCHOOL_FIRE;
|
191
|
257 break;
|
|
258 }
|
|
259 if ( !_strcmpi("air", test_string) )
|
|
260 {
|
192
|
261 pInfos[i].uSchool = SPELL_SCHOOL_AIR;
|
191
|
262 break;
|
|
263 }
|
|
264 if ( !_strcmpi("water", test_string))
|
|
265 {
|
192
|
266 pInfos[i].uSchool = SPELL_SCHOOL_WATER;
|
191
|
267 break;
|
|
268 }
|
|
269 if ( !_strcmpi("earth", test_string))
|
|
270 {
|
192
|
271 pInfos[i].uSchool = SPELL_SCHOOL_EARTH;
|
191
|
272 break;
|
|
273 }
|
|
274 if ( !_strcmpi("spirit", test_string))
|
|
275 {
|
192
|
276 pInfos[i].uSchool = SPELL_SCHOOL_SPIRIT;
|
191
|
277 break;
|
|
278 }
|
|
279 if ( !_strcmpi("mind", test_string))
|
|
280 {
|
192
|
281 pInfos[i].uSchool = SPELL_SCHOOL_MIND;
|
191
|
282 break;
|
|
283 }
|
|
284 if ( !_strcmpi("body", test_string) )
|
|
285 {
|
192
|
286 pInfos[i].uSchool = SPELL_SCHOOL_BODY;
|
191
|
287 break;
|
|
288 }
|
|
289 if ( !_strcmpi("light", test_string) )
|
|
290 {
|
192
|
291 pInfos[i].uSchool = SPELL_SCHOOL_LIGHT;
|
191
|
292 break;
|
|
293 }
|
|
294 if ( !_strcmpi("dark", test_string))
|
|
295 {
|
192
|
296 pInfos[i].uSchool = SPELL_SCHOOL_DARK;
|
191
|
297 break;
|
|
298 }
|
|
299
|
|
300 if ( !_strcmpi("magic", test_string))
|
|
301 {
|
192
|
302 pInfos[i].uSchool = SPELL_SCHOOL_MAGIC;
|
191
|
303 break;
|
|
304 }
|
|
305 break;
|
|
306 case 4:
|
|
307 pInfos[i].pShortName=RemoveQuotes(test_string);
|
|
308 break;
|
|
309 case 5:
|
|
310 pInfos[i].pDescription=RemoveQuotes(test_string);
|
|
311 break;
|
|
312 case 6:
|
|
313 pInfos[i].pBasicSkillDesc=RemoveQuotes(test_string);
|
|
314 break;
|
|
315 case 7:
|
|
316 pInfos[i].pExpertSkillDesc=RemoveQuotes(test_string);
|
|
317 break;
|
|
318 case 8:
|
|
319 pInfos[i].pMasterSkillDesc=RemoveQuotes(test_string);
|
|
320 break;
|
|
321 case 9:
|
|
322 pInfos[i].pGrandmasterSkillDesc=RemoveQuotes(test_string);
|
|
323 break;
|
|
324 case 10:
|
|
325 int in_string_pos=0;
|
192
|
326 unsigned char test;
|
191
|
327 int in_str_len=strlen(test_string);
|
192
|
328 for (int j=0; j<in_str_len; ++j)
|
|
329 {
|
|
330 test= tolower(test_string[j]);
|
|
331 switch (test)
|
|
332 {
|
|
333 case 109:
|
|
334 pSpellDatas[i].field_12|=1;
|
|
335 break;
|
|
336 case 101:
|
|
337 pSpellDatas[i].field_12|=2;
|
|
338 break;
|
|
339 case 99:
|
|
340 pSpellDatas[i].field_12|=4;
|
|
341 break;
|
|
342 case 120:
|
|
343 pSpellDatas[i].field_12|=8;
|
|
344 break;
|
|
345 }
|
|
346 }
|
191
|
347 break;
|
|
348 }
|
|
349 }
|
|
350 else
|
|
351 break_loop=true;
|
|
352 ++decode_step;
|
|
353 test_string=tmp_pos+1;
|
|
354 } while ((decode_step<11)&&!break_loop);
|
|
355 if ((i%11)==0)
|
|
356 strtok(NULL, "\r");
|
|
357 }
|
|
358
|
|
359 } |