annotate Spells.cpp @ 332:e8fcde8ba3fc

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