annotate Spells.cpp @ 105:56e11be29db1

Слияние
author Ritor1
date Tue, 05 Feb 2013 19:08:52 +0600
parents 9c0607679772
children 8b8fd4d83fdc
rev   line source
0
Ritor1
parents:
diff changeset
1 #include <stdlib.h>
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 #include "Spells.h"
Ritor1
parents:
diff changeset
4 #include "Overlays.h"
Ritor1
parents:
diff changeset
5 #include "Allocator.h"
Ritor1
parents:
diff changeset
6 #include "LOD.h"
Ritor1
parents:
diff changeset
7 #include "stru123.h"
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9 #include "mm7_data.h"
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15 struct SpellStats *pSpellStats;
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18 stru324_spell stru_4E3ACC[102];
Ritor1
parents:
diff changeset
19 SpellData pSpellDatas[95];
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26 //----- (0042EB31) --------------------------------------------------------
Ritor1
parents:
diff changeset
27 bool SpellBuff::NotExpired()
Ritor1
parents:
diff changeset
28 {
Ritor1
parents:
diff changeset
29 bool result; // eax@1
Ritor1
parents:
diff changeset
30
Ritor1
parents:
diff changeset
31 result = 0;
Ritor1
parents:
diff changeset
32 if ( (signed __int64)this->uExpireTime > 0 )
Ritor1
parents:
diff changeset
33 result = 1;
Ritor1
parents:
diff changeset
34 return result;
Ritor1
parents:
diff changeset
35 }
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38 //----- (00458585) --------------------------------------------------------
Ritor1
parents:
diff changeset
39 void SpellBuff::Reset()
Ritor1
parents:
diff changeset
40 {
Ritor1
parents:
diff changeset
41 SpellBuff *v1; // esi@1
Ritor1
parents:
diff changeset
42 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 v1 = this;
Ritor1
parents:
diff changeset
45 v2 = this->uOverlayID;
Ritor1
parents:
diff changeset
46 this->uSkill = 0;
Ritor1
parents:
diff changeset
47 this->uPower = 0;
Ritor1
parents:
diff changeset
48 this->uExpireTime = 0i64;
Ritor1
parents:
diff changeset
49 this->uCaster = 0;
Ritor1
parents:
diff changeset
50 this->uFlags = 0;
Ritor1
parents:
diff changeset
51 if ( v2 )
Ritor1
parents:
diff changeset
52 {
Ritor1
parents:
diff changeset
53 ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v2 + 105])->Reset();
Ritor1
parents:
diff changeset
54 pOtherOverlayList->field_3EC = 1;
Ritor1
parents:
diff changeset
55 v1->uOverlayID = 0;
Ritor1
parents:
diff changeset
56 }
Ritor1
parents:
diff changeset
57 }
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59 //----- (004585CA) --------------------------------------------------------
Ritor1
parents:
diff changeset
60 signed int SpellBuff::_4585CA(__int64 a2)
Ritor1
parents:
diff changeset
61 {
Ritor1
parents:
diff changeset
62 signed int result; // eax@3
Ritor1
parents:
diff changeset
63
Ritor1
parents:
diff changeset
64 if ( this->uExpireTime && (signed __int64)this->uExpireTime < a2 )
Ritor1
parents:
diff changeset
65 {
Ritor1
parents:
diff changeset
66 this->uExpireTime = 0i64;
Ritor1
parents:
diff changeset
67 this->uPower = 0;
Ritor1
parents:
diff changeset
68 this->uSkill = 0;
Ritor1
parents:
diff changeset
69 this->uOverlayID = 0;
Ritor1
parents:
diff changeset
70 result = 1;
Ritor1
parents:
diff changeset
71 }
Ritor1
parents:
diff changeset
72 else
Ritor1
parents:
diff changeset
73 {
Ritor1
parents:
diff changeset
74 result = 0;
Ritor1
parents:
diff changeset
75 }
Ritor1
parents:
diff changeset
76 return result;
Ritor1
parents:
diff changeset
77 }
Ritor1
parents:
diff changeset
78
Ritor1
parents:
diff changeset
79 //----- (004584E0) --------------------------------------------------------
Ritor1
parents:
diff changeset
80 signed int SpellBuff::Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int a5, unsigned __int8 a6)
Ritor1
parents:
diff changeset
81 {
Ritor1
parents:
diff changeset
82 SpellBuff *v6; // esi@1
Ritor1
parents:
diff changeset
83 signed int result; // eax@3
Ritor1
parents:
diff changeset
84 int v8; // eax@4
Ritor1
parents:
diff changeset
85
Ritor1
parents:
diff changeset
86 v6 = this;
Ritor1
parents:
diff changeset
87 if ( this->uExpireTime && (signed __int64)uExpireTime < (signed __int64)this->uExpireTime )
Ritor1
parents:
diff changeset
88 {
Ritor1
parents:
diff changeset
89 result = 0;
Ritor1
parents:
diff changeset
90 }
Ritor1
parents:
diff changeset
91 else
Ritor1
parents:
diff changeset
92 {
Ritor1
parents:
diff changeset
93 this->uSkill = uSkillLevel;
Ritor1
parents:
diff changeset
94 this->uPower = uPower;
Ritor1
parents:
diff changeset
95 LOWORD(v8) = this->uOverlayID;
Ritor1
parents:
diff changeset
96 this->uExpireTime = uExpireTime;
Ritor1
parents:
diff changeset
97 if ( (short)v8 )
Ritor1
parents:
diff changeset
98 {
Ritor1
parents:
diff changeset
99 v8 = (unsigned __int16)v8;
Ritor1
parents:
diff changeset
100 if ( (unsigned __int16)v8 != a5 )
Ritor1
parents:
diff changeset
101 {
Ritor1
parents:
diff changeset
102 ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v8 + 105])->Reset();
Ritor1
parents:
diff changeset
103 pOtherOverlayList->field_3EC = 1;
Ritor1
parents:
diff changeset
104 v6->uOverlayID = 0;
Ritor1
parents:
diff changeset
105 }
Ritor1
parents:
diff changeset
106 }
Ritor1
parents:
diff changeset
107 v6->uOverlayID = a5;
Ritor1
parents:
diff changeset
108 v6->uCaster = a6;
Ritor1
parents:
diff changeset
109 result = 1;
Ritor1
parents:
diff changeset
110 }
Ritor1
parents:
diff changeset
111 return result;
Ritor1
parents:
diff changeset
112 }
Ritor1
parents:
diff changeset
113
Ritor1
parents:
diff changeset
114 //----- (0045384A) --------------------------------------------------------
Ritor1
parents:
diff changeset
115 void SpellStats::Initialize()
Ritor1
parents:
diff changeset
116 {
Ritor1
parents:
diff changeset
117 SpellStats *v1; // esi@1
Ritor1
parents:
diff changeset
118 const char *v2; // ebp@3
Ritor1
parents:
diff changeset
119 char *v3; // edi@3
Ritor1
parents:
diff changeset
120 signed int v4; // ebx@4
Ritor1
parents:
diff changeset
121 char *v5; // esi@4
Ritor1
parents:
diff changeset
122 char v6; // cl@5
Ritor1
parents:
diff changeset
123 int v7; // eax@5
Ritor1
parents:
diff changeset
124 size_t v8; // ebp@40
Ritor1
parents:
diff changeset
125 int v9; // eax@41
Ritor1
parents:
diff changeset
126 int v10; // eax@42
Ritor1
parents:
diff changeset
127 int v11; // eax@43
Ritor1
parents:
diff changeset
128 char *v12; // [sp+10h] [bp-10h]@3
Ritor1
parents:
diff changeset
129 signed int v13; // [sp+14h] [bp-Ch]@4
Ritor1
parents:
diff changeset
130 signed int v14; // [sp+18h] [bp-8h]@3
Ritor1
parents:
diff changeset
131 int v15; // [sp+1Ch] [bp-4h]@9
Ritor1
parents:
diff changeset
132
Ritor1
parents:
diff changeset
133 v1 = this;
Ritor1
parents:
diff changeset
134 if ( pSpellsTXT_Raw )
Ritor1
parents:
diff changeset
135 pAllocator->FreeChunk(pSpellsTXT_Raw);
Ritor1
parents:
diff changeset
136 pSpellsTXT_Raw = 0;
Ritor1
parents:
diff changeset
137 v2 = "\r";
Ritor1
parents:
diff changeset
138 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0);
Ritor1
parents:
diff changeset
139 strtok(pSpellsTXT_Raw, "\r");
Ritor1
parents:
diff changeset
140 strtok(0, "\r");
Ritor1
parents:
diff changeset
141 v14 = 1;
Ritor1
parents:
diff changeset
142 v12 = (char *)&pSpellDatas[1].field_10;
Ritor1
parents:
diff changeset
143 v3 = (char *)&v1->pInfos[1].uSchool;
Ritor1
parents:
diff changeset
144 do
Ritor1
parents:
diff changeset
145 {
Ritor1
parents:
diff changeset
146 v4 = 0;
Ritor1
parents:
diff changeset
147 v5 = strtok(0, v2) + 1;
Ritor1
parents:
diff changeset
148 v13 = 0;
Ritor1
parents:
diff changeset
149 do
Ritor1
parents:
diff changeset
150 {
Ritor1
parents:
diff changeset
151 v6 = *v5;
Ritor1
parents:
diff changeset
152 v7 = 0;
Ritor1
parents:
diff changeset
153 while ( v6 != 9 && v6 )
Ritor1
parents:
diff changeset
154 {
Ritor1
parents:
diff changeset
155 ++v7;
Ritor1
parents:
diff changeset
156 v6 = v5[v7];
Ritor1
parents:
diff changeset
157 }
Ritor1
parents:
diff changeset
158 v15 = (int)&v5[v7];
Ritor1
parents:
diff changeset
159 if ( !v5[v7] )
Ritor1
parents:
diff changeset
160 v13 = 1;
Ritor1
parents:
diff changeset
161 v5[v7] = 0;
Ritor1
parents:
diff changeset
162 if ( v7 )
Ritor1
parents:
diff changeset
163 {
Ritor1
parents:
diff changeset
164 switch ( v4 )
Ritor1
parents:
diff changeset
165 {
Ritor1
parents:
diff changeset
166 case 2:
Ritor1
parents:
diff changeset
167 *((char **)v3 - 7) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
168 break;
Ritor1
parents:
diff changeset
169 case 3:
Ritor1
parents:
diff changeset
170 *v3 = 4;
Ritor1
parents:
diff changeset
171 if ( _strcmpi("fire", v5) )
Ritor1
parents:
diff changeset
172 {
Ritor1
parents:
diff changeset
173 if ( _strcmpi("air", v5) )
Ritor1
parents:
diff changeset
174 {
Ritor1
parents:
diff changeset
175 if ( _strcmpi("water", v5) )
Ritor1
parents:
diff changeset
176 {
Ritor1
parents:
diff changeset
177 if ( _strcmpi("earth", v5) )
Ritor1
parents:
diff changeset
178 {
Ritor1
parents:
diff changeset
179 if ( _strcmpi("spirit", v5) )
Ritor1
parents:
diff changeset
180 {
Ritor1
parents:
diff changeset
181 if ( _strcmpi("mind", v5) )
Ritor1
parents:
diff changeset
182 {
Ritor1
parents:
diff changeset
183 if ( _strcmpi("body", v5) )
Ritor1
parents:
diff changeset
184 {
Ritor1
parents:
diff changeset
185 if ( _strcmpi("light", v5) )
Ritor1
parents:
diff changeset
186 {
Ritor1
parents:
diff changeset
187 if ( _strcmpi("dark", v5) )
Ritor1
parents:
diff changeset
188 {
Ritor1
parents:
diff changeset
189 if ( !_strcmpi("magic", v5) )
Ritor1
parents:
diff changeset
190 *v3 = 5;
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 else
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 *v3 = 10;
Ritor1
parents:
diff changeset
195 }
Ritor1
parents:
diff changeset
196 }
Ritor1
parents:
diff changeset
197 else
Ritor1
parents:
diff changeset
198 {
Ritor1
parents:
diff changeset
199 *v3 = 9;
Ritor1
parents:
diff changeset
200 }
Ritor1
parents:
diff changeset
201 }
Ritor1
parents:
diff changeset
202 else
Ritor1
parents:
diff changeset
203 {
Ritor1
parents:
diff changeset
204 *v3 = 8;
Ritor1
parents:
diff changeset
205 }
Ritor1
parents:
diff changeset
206 }
Ritor1
parents:
diff changeset
207 else
Ritor1
parents:
diff changeset
208 {
Ritor1
parents:
diff changeset
209 *v3 = 7;
Ritor1
parents:
diff changeset
210 }
Ritor1
parents:
diff changeset
211 }
Ritor1
parents:
diff changeset
212 else
Ritor1
parents:
diff changeset
213 {
Ritor1
parents:
diff changeset
214 *v3 = 6;
Ritor1
parents:
diff changeset
215 }
Ritor1
parents:
diff changeset
216 }
Ritor1
parents:
diff changeset
217 else
Ritor1
parents:
diff changeset
218 {
Ritor1
parents:
diff changeset
219 *v3 = 3;
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 }
Ritor1
parents:
diff changeset
222 else
Ritor1
parents:
diff changeset
223 {
Ritor1
parents:
diff changeset
224 *v3 = 2;
Ritor1
parents:
diff changeset
225 }
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227 else
Ritor1
parents:
diff changeset
228 {
Ritor1
parents:
diff changeset
229 *v3 = 1;
Ritor1
parents:
diff changeset
230 }
Ritor1
parents:
diff changeset
231 }
Ritor1
parents:
diff changeset
232 else
Ritor1
parents:
diff changeset
233 {
Ritor1
parents:
diff changeset
234 *v3 = 0;
Ritor1
parents:
diff changeset
235 }
Ritor1
parents:
diff changeset
236 break;
Ritor1
parents:
diff changeset
237 case 4:
Ritor1
parents:
diff changeset
238 *((char **)v3 - 6) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
239 break;
Ritor1
parents:
diff changeset
240 case 5:
Ritor1
parents:
diff changeset
241 *((char **)v3 - 5) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
242 break;
Ritor1
parents:
diff changeset
243 case 6:
Ritor1
parents:
diff changeset
244 *((char **)v3 - 4) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
245 break;
Ritor1
parents:
diff changeset
246 case 7:
Ritor1
parents:
diff changeset
247 *((char **)v3 - 3) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
248 break;
Ritor1
parents:
diff changeset
249 case 8:
Ritor1
parents:
diff changeset
250 *((char **)v3 - 2) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
251 break;
Ritor1
parents:
diff changeset
252 case 9:
Ritor1
parents:
diff changeset
253 *((char **)v3 - 1) = RemoveQuotes(v5);
Ritor1
parents:
diff changeset
254 break;
Ritor1
parents:
diff changeset
255 case 10:
Ritor1
parents:
diff changeset
256 v4 = 0;
Ritor1
parents:
diff changeset
257 v8 = strlen(v5);
Ritor1
parents:
diff changeset
258 if ( (signed int)v8 > 0 )
Ritor1
parents:
diff changeset
259 {
Ritor1
parents:
diff changeset
260 do
Ritor1
parents:
diff changeset
261 {
Ritor1
parents:
diff changeset
262 v9 = tolower((unsigned __int8)v5[v4]) - 99;
Ritor1
parents:
diff changeset
263 if ( v9 )
Ritor1
parents:
diff changeset
264 {
Ritor1
parents:
diff changeset
265 v10 = v9 - 2;
Ritor1
parents:
diff changeset
266 if ( v10 )
Ritor1
parents:
diff changeset
267 {
Ritor1
parents:
diff changeset
268 v11 = v10 - 8;
Ritor1
parents:
diff changeset
269 if ( v11 )
Ritor1
parents:
diff changeset
270 {
Ritor1
parents:
diff changeset
271 if ( v11 == 11 )
Ritor1
parents:
diff changeset
272 *v12 |= 8u;
Ritor1
parents:
diff changeset
273 }
Ritor1
parents:
diff changeset
274 else
Ritor1
parents:
diff changeset
275 {
Ritor1
parents:
diff changeset
276 *v12 |= 1u;
Ritor1
parents:
diff changeset
277 }
Ritor1
parents:
diff changeset
278 }
Ritor1
parents:
diff changeset
279 else
Ritor1
parents:
diff changeset
280 {
Ritor1
parents:
diff changeset
281 *v12 |= 2u;
Ritor1
parents:
diff changeset
282 }
Ritor1
parents:
diff changeset
283 }
Ritor1
parents:
diff changeset
284 else
Ritor1
parents:
diff changeset
285 {
Ritor1
parents:
diff changeset
286 *v12 |= 4u;
Ritor1
parents:
diff changeset
287 }
Ritor1
parents:
diff changeset
288 ++v4;
Ritor1
parents:
diff changeset
289 }
Ritor1
parents:
diff changeset
290 while ( v4 < (signed int)v8 );
Ritor1
parents:
diff changeset
291 }
Ritor1
parents:
diff changeset
292 v2 = "\r";
Ritor1
parents:
diff changeset
293 break;
Ritor1
parents:
diff changeset
294 default:
Ritor1
parents:
diff changeset
295 break;
Ritor1
parents:
diff changeset
296 }
Ritor1
parents:
diff changeset
297 }
Ritor1
parents:
diff changeset
298 else
Ritor1
parents:
diff changeset
299 {
Ritor1
parents:
diff changeset
300 v13 = 1;
Ritor1
parents:
diff changeset
301 }
Ritor1
parents:
diff changeset
302 ++v4;
Ritor1
parents:
diff changeset
303 v5 = (char *)(v15 + 1);
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305 while ( v4 - 1 <= 10 && !v13 );
Ritor1
parents:
diff changeset
306 if ( !(v14 % 11) )
Ritor1
parents:
diff changeset
307 strtok(0, v2);
Ritor1
parents:
diff changeset
308 v12 += 20;
Ritor1
parents:
diff changeset
309 ++v14;
Ritor1
parents:
diff changeset
310 v3 += 36;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 while ( (signed int)v12 <= (signed int)&pSpellDatas[90].field_12 );
Ritor1
parents:
diff changeset
313 }