Mercurial > mm7
annotate Spells.cpp @ 1549:5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 09:16:55 +0200 |
parents | 4c787c28ddce |
children | 75fafd8ced59 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1104
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1104
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1104
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1104
diff
changeset
|
4 |
0 | 5 #include <stdlib.h> |
6 | |
7 #include "Spells.h" | |
8 #include "Overlays.h" | |
9 #include "Allocator.h" | |
10 #include "LOD.h" | |
189 | 11 #include "texts.h" |
0 | 12 |
13 #include "mm7_data.h" | |
1295 | 14 #include "Party.h" |
15 #include "Math.h" | |
16 #include "SpriteObject.h" | |
17 #include "ObjectList.h" | |
18 #include "Indoor.h" | |
19 #include "AudioPlayer.h" | |
20 #include "Actor.h" | |
21 #include "Game.h" | |
22 #include "stru6.h" | |
0 | 23 |
24 | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
25 std::array<TownPortalData, 6> TownPortalList = //4ECBB8 |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
26 {{ |
839 | 27 {Vec3_int_(-5121, 2107, 1), 1536, 0, 21, 0}, |
28 {Vec3_int_(-15148, -10240, 1473), 0, 0, 4, 0}, | |
29 {Vec3_int_(-10519, 5375, 753), 512, 0, 3, 0}, | |
30 {Vec3_int_(3114, -11055, 513), 0, 0, 10, 0}, | |
31 {Vec3_int_(-158, 7624, 1), 512, 0, 7, 0}, | |
32 {Vec3_int_(-1837, -4247, 65), 65, 0, 8, 0} | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
33 }} ; |
0 | 34 |
35 struct SpellStats *pSpellStats; | |
36 | |
37 | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
38 std::array<stru324_spell, 103> stru_4E3ACC = |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
39 {{ |
488 | 40 {10, 0}, |
41 {1000, 0}, {1010, 0}, {1020, 0}, {1030, 0}, {1040, 0}, {1050, 0}, {1060, 0}, {1070, 0}, {1080, 0}, {1090, 0}, {1100, 0}, | |
42 {2000, 0}, {2010, 0}, {2020, 0}, {2030, 0}, {2040, 0}, {2050, 0}, {2060, 0}, {2070, 0}, {2080, 0}, {2090, 0}, {2100, 0}, | |
43 {3000, 0}, {3010, 0}, {3020, 0}, {3030, 0}, {3040, 0}, {3050, 0}, {3060, 0}, {3070, 0}, {3080, 0}, {3090, 0}, {3100, 0}, | |
44 {4000, 0}, {4010, 0}, {4020, 0}, {4030, 0}, {4040, 0}, {4050, 0}, {4060, 0}, {4070, 0}, {4080, 0}, {4090, 0}, {4100, 0}, | |
45 {5000, 0}, {5010, 0}, {5020, 0}, {5030, 0}, {5040, 0}, {5050, 0}, {5060, 0}, {5070, 0}, {5080, 0}, {5090, 0}, {5100, 0}, | |
46 {6000, 0}, {6010, 0}, {6020, 0}, {6030, 0}, {6040, 0}, {6050, 0}, {6060, 0}, {6070, 0}, {6080, 0}, {6090, 0}, {6100, 0}, | |
47 {7000, 0}, {7010, 0}, {7020, 0}, {7030, 0}, {7040, 0}, {7050, 0}, {7060, 0}, {7070, 0}, {7080, 0}, {7090, 0}, {7100, 0}, | |
48 {8000, 0}, {8010, 0}, {8020, 0}, {8030, 0}, {8040, 0}, {8050, 0}, {8060, 0}, {8070, 0}, {8080, 0}, {8090, 0}, {8100, 0}, | |
1086 | 49 {9000, 0}, {9010, 0}, {9020, 0}, {9030, 0}, {9040, 0}, {9050, 0}, {9060, 0}, {9070, 0}, {9080, 0}, {9090, 0}, {9100, 0}, |
50 {545, 0}, | |
51 {545, 0}, | |
52 {555, 0} | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
53 }}; |
363 | 54 //9 spellbook pages 11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1! |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
55 std::array<SpellData, 100> pSpellDatas={{ |
363 | 56 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
57 | |
58 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},//0 | |
192 | 59 {2, 2, 2, 2, 110, 110, 100, 90, 768, 0}, |
60 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
61 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0}, | |
62 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0}, | |
63 {8, 8, 8, 8, 100, 100, 90, 80, 1536, 0}, | |
64 {10, 10, 10, 10, 150, 150, 150, 150, 1536, 0}, | |
65 {15, 15, 15, 15, 120, 120, 120, 120, 1536, 0}, | |
66 {20, 20, 20, 20, 100, 100, 100, 90, 264, 0}, | |
67 {25, 25, 25, 25, 100, 100, 100, 90, 268, 0}, | |
68 {30, 30, 30, 30, 90, 90, 90, 90, 3855, 0}, | |
363 | 69 |
70 {1, 1, 1, 0, 60, 60, 60, 60, 0, 0}, //1 | |
192 | 71 {2, 2, 2, 2, 120, 120, 120, 100, 0, 0}, |
72 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
73 {4, 4, 4, 4, 110, 100, 90, 80, 258, 0}, | |
74 {5, 5, 5, 5, 90, 90, 70, 50, 0, 0}, | |
75 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0}, | |
76 {10, 10, 10, 10, 100, 100, 90, 70, 2048, 0}, | |
77 {15, 15, 15, 15, 200, 200, 200, 200, 0, 0}, | |
78 {20, 20, 20, 20, 100, 100, 100, 90, 2570, 0}, | |
79 {25, 25, 25, 25, 250, 250, 250, 250, 0, 0}, | |
80 {30, 30, 30, 30, 90, 90, 90, 90, 276, 0}, | |
363 | 81 |
82 {1, 1, 1, 1, 60, 60, 60, 20, 0, 0}, //2 | |
192 | 83 {2, 2, 2, 2, 110, 100, 90, 70, 514, 0}, |
84 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
85 {4, 4, 4, 4, 110, 100, 90, 80, 1024, 0}, | |
86 {5, 5, 5, 5, 150, 150, 150, 150, 0, 0}, | |
87 {8, 8, 8, 8, 200, 200, 200, 200, 0, 0}, | |
88 {10, 10, 10, 10, 100, 100, 90, 80, 2313, 0}, | |
89 {15, 15, 15, 15, 140, 140, 140, 140, 0, 0}, | |
90 {20, 20, 20, 20, 200, 200, 200, 200, 0, 0}, | |
91 {25, 25, 25, 25, 80, 80, 80, 80, 780, 0}, | |
92 {30, 30, 30, 30, 250, 250, 250, 250, 0, 0}, | |
363 | 93 |
94 {1, 1, 1, 1, 80, 80, 80, 80, 0, 0}, //3 | |
192 | 95 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, |
96 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
97 {4, 4, 4, 4, 110, 100, 90, 80, 773, 0}, | |
98 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0}, | |
99 {8, 8, 8, 8, 100, 100, 90, 80, 2304, 0}, | |
100 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0}, | |
101 {15, 15, 15, 15, 90, 90, 90, 80, 2048, 0}, | |
102 {20, 20, 20, 20, 150, 150, 150, 150, 0, 0}, | |
103 {25, 25, 25, 25, 100, 100, 100, 90, 276, 0}, | |
104 {30, 30, 30, 30, 90, 90, 90, 90, 25, 0}, | |
363 | 105 |
106 {1, 1, 1, 1, 100, 100, 100, 100, 0, 0}, //4 | |
192 | 107 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, |
108 {3, 3, 3, 3, 90, 90, 90, 90, 0, 0}, | |
109 {4, 4, 4, 4, 120, 120, 120, 120, 0, 0}, | |
110 {5, 5, 5, 5, 120, 120, 120, 120, 0, 0}, | |
111 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0}, | |
112 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0}, | |
113 {15, 15, 15, 15, 100, 100, 100, 100, 2058, 0}, | |
114 {20, 20, 20, 20, 240, 240, 240, 240, 0, 0}, | |
115 {25, 25, 25, 25, 150, 150, 150, 150, 0, 0}, | |
116 {30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0}, | |
363 | 117 |
118 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, //5 | |
192 | 119 {2, 2, 2, 2, 110, 110, 110, 110, 771, 0}, |
120 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
121 {4, 4, 4, 4, 110, 100, 90, 80, 0, 0}, | |
122 {5, 5, 5, 5, 100, 100, 100, 100, 0, 0}, | |
123 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0}, | |
124 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0}, | |
125 {15, 15, 15, 15, 80, 80, 80, 80, 0, 0}, | |
126 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0}, | |
127 {25, 25, 25, 25, 110, 110, 110, 100, 268, 0}, | |
128 {30, 30, 30, 30, 120, 120, 120, 120, 0, 0}, | |
363 | 129 |
130 {1, 1, 1, 1, 120, 120, 120, 120, 0, 0}, //6 | |
192 | 131 {2, 2, 2, 2, 100, 100, 100, 100, 0, 0}, |
132 {3, 3, 3, 3, 120, 120, 120, 120, 0, 0}, | |
133 {4, 4, 4, 4, 110, 100, 90, 80, 520, 0}, | |
134 {5, 5, 5, 5, 110, 110, 110, 110, 0, 0}, | |
135 {8, 8, 8, 8, 120, 120, 120, 120, 0, 0}, | |
136 {10, 10, 10, 10, 120, 120, 120, 120, 0, 0}, | |
137 {15, 15, 15, 15, 120, 120, 120, 120, 0, 0}, | |
138 {20, 20, 20, 20, 120, 120, 120, 120, 0, 0}, | |
139 {25, 25, 25, 25, 110, 110, 110, 100, 1310, 0}, | |
140 {30, 30, 30, 30, 100, 100, 100, 100, 0, 0}, | |
363 | 141 |
142 {5, 5, 5, 5, 110, 100, 90, 80, 1024, 0}, //7 | |
192 | 143 {10, 10, 10, 10, 120, 110, 100, 90, 4112, 0}, |
144 {15, 15, 15, 15, 120, 110, 100, 90, 0, 0}, | |
145 {20, 20, 20, 20, 160, 140, 120, 100, 0, 0}, | |
146 {25, 25, 25, 25, 140, 140, 140, 140, 0, 0}, | |
147 {30, 30, 30, 30, 500, 500, 500, 500, 0, 0}, | |
148 {35, 35, 35, 35, 135, 135, 120, 100, 281, 0}, | |
149 {40, 40, 40, 40, 500, 500, 500, 500, 0, 0}, | |
150 {45, 45, 45, 45, 250, 250, 250, 250, 0, 0}, | |
151 {50, 50, 50, 50, 150, 150, 150, 135, 5140, 0}, | |
152 {55, 55, 55, 55, 300, 300, 300, 300, 0, 0}, | |
363 | 153 |
154 {10, 10, 10, 10, 140, 140, 140, 140, 0, 0}, //8 | |
192 | 155 {15, 15, 15, 15, 120, 110, 100, 90, 2585, 0}, |
156 {20, 20, 20, 20, 120, 100, 90, 120, 0, 0}, | |
157 {25, 25, 25, 25, 120, 120, 120, 120, 0, 0}, | |
158 {30, 30, 30, 30, 90, 90, 80, 70, 1542, 0}, | |
159 {35, 35, 35, 35, 120, 120, 100, 80, 0, 0}, | |
160 {40, 40, 40, 40, 110, 110, 110, 110, 0, 0}, | |
161 {45, 45, 45, 45, 200, 200, 200, 150, 0, 0}, | |
162 {50, 50, 50, 50, 120, 120, 120, 100, 6400, 0}, | |
163 {55, 55, 55, 55, 250, 250, 250, 250, 306, 0}, | |
164 {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0} | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
165 }}; |
0 | 166 |
490 | 167 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
168 std::array<unsigned int, 25> wand_spell_ids = |
490 | 169 { |
170 // 135 Wand of Fire 136 Wand of Sparks 137 Wand of Poison 138 Wand of Stunning 139 Wand of Harm | |
171 SPELL_FIRE_FIRE_BOLT, SPELL_AIR_SPARKS, SPELL_WATER_POISON_SPRAY, SPELL_EARTH_STUN, SPELL_BODY_HARM, | |
172 // 140 Fairy Wand of Light 141 Fairy Wand of Ice 142 Fairy Wand of Lashing 143 Fairy Wand of Mind 144 Fairy Wand of Swarms | |
173 SPELL_LIGHT_LIGHT_BOLT, SPELL_WATER_ICE_BOLT, SPELL_SPIRIT_SPIRIT_LASH, SPELL_MIND_MIND_BLAST, SPELL_EARTH_DEADLY_SWARM, | |
174 // 145 Alacorn Wand of Fireballs 146 Alacorn Wand of Acid 147 Alacorn Wand of Lightning 148 Alacorn Wand of Blades 149 Alacorn Wand of Charms | |
175 SPELL_FIRE_FIREBALL, SPELL_WATER_ACID_BURST, SPELL_AIR_LIGHNING_BOLT, SPELL_EARTH_BLADES, SPELL_MIND_CHARM, | |
176 // 150 Arcane Wand of Blasting 151 Arcane Wand of The Fist 152 Arcane Wand of Rocks 153 Arcane Wand of Paralyzing 154 Arcane Wand of Clouds | |
177 SPELL_WATER_ICE_BLAST, SPELL_BODY_FLYING_FIST, SPELL_EARTH_ROCK_BLAST, SPELL_LIGHT_PARALYZE, SPELL_DARK_TOXIC_CLOUD, | |
178 // 155 Mystic Wand of Implosion 156 Mystic Wand of Distortion 157 Mystic Wand of Sharpmetal 158 Mystic Wand of Shrinking 159 Mystic Wand of Incineration | |
179 SPELL_AIR_IMPLOSION, SPELL_EARTH_MASS_DISTORTION, SPELL_DARK_SHARPMETAL, SPELL_DARK_SHRINKING_RAY, SPELL_FIRE_INCINERATE | |
180 }; | |
181 | |
182 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
183 std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices = // 4E2430 |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
184 {{ //0 1 2 3 4 5 6 7 8 9 10 11 |
357 | 185 {0, 3, 1, 8, 11, 7, 4, 10, 6, 2, 5, 9}, |
186 {0, 11, 2, 9, 6, 8, 5, 10, 3, 7, 1, 4}, | |
187 {0, 4, 8, 9, 1, 10, 3, 11, 7, 6, 2, 5}, | |
188 {0, 7, 10, 8, 2, 11, 1, 5, 3, 6, 4, 9}, | |
189 {0, 5, 10, 11, 7, 2, 8, 1, 4, 9, 3, 6}, | |
190 {0, 5, 9, 8, 3, 7, 6, 4, 1, 11, 2, 10}, | |
191 {0, 1, 6, 9, 3, 5, 8, 11, 7, 10, 4, 2}, | |
192 {0, 1, 10, 11, 9, 4, 3, 6, 5, 7, 8, 2}, | |
193 {0, 9, 3, 7, 1, 5, 2, 10, 11, 8, 6, 4} | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1165
diff
changeset
|
194 }}; |
0 | 195 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
196 std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos={{ |
363 | 197 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
198 { 0, 0, 17, 13, 115, 2, 217, 15, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
199 299, 6, 28, 125, 130, 133, 294, 114, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
200 11, 232, 134, 233, 237, 171, 296, 231}, |
0 | 201 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
202 { 0, 0, 19, 9, 117, 3, 206, 13, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
203 285, 7, 16, 123, 113, 101, 201, 118, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
204 317, 110, 11, 230, 149, 236, 296, 234}, |
357 | 205 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
206 { 0, 0, 17, 9, 140, 0, 210, 34, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
207 293, 5, 15, 98, 78, 121, 175, 136, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
208 301, 115, 15, 226, 154, 225, 272, 220}, |
357 | 209 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
210 { 0, 0, 7, 9, 156, 2, 277, 9, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
211 11, 117, 111, 82, 180, 102, 303, 108, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
212 10, 229, 120, 221, 201, 217, 296, 225}, |
357 | 213 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
214 { 0, 0, 18, 8, 89, 15, 192, 14, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
215 292, 7, 22, 129, 125, 146, 217, 136, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
216 305, 115, 22, 226, 174, 237, 290, 231}, |
357 | 217 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
218 { 0, 0, 18, 12, 148, 9, 292, 7, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
219 17, 122, 121, 99, 220, 87, 293, 112, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
220 13, 236, 128, 213, 220, 223, 315, 223}, |
357 | 221 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
222 { 0, 0, 23, 14, 127, 8, 204, 0, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
223 306, 8, 14, 115, 122, 132, 200, 116, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
224 293, 122, 20, 228, 154, 228, 294, 239}, |
357 | 225 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
226 { 0, 0, 19, 14, 124, 10, 283, 12, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
227 8, 105, 113, 89, 190, 82, 298, 108, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
228 18, 181, 101, 204, 204, 203, 285, 218}, |
357 | 229 |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
230 { 0, 0, 18, 17, 110, 16, 201, 15, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
231 307, 15, 18, 148, 125, 166, 201, 123, |
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
232 275, 120, 28, 235, 217, 222, 324, 216}}}; |
0 | 233 |
234 | |
235 //----- (0042EB31) -------------------------------------------------------- | |
236 bool SpellBuff::NotExpired() | |
237 { | |
189 | 238 return (signed __int64)this->uExpireTime > 0 ? true:false; |
0 | 239 } |
240 | |
241 | |
242 //----- (00458585) -------------------------------------------------------- | |
243 void SpellBuff::Reset() | |
244 { | |
982 | 245 uSkill = 0; |
246 uPower = 0; | |
247 uExpireTime = 0i64; | |
248 uCaster = 0; | |
249 uFlags = 0; | |
250 if (uOverlayID) | |
0 | 251 { |
982 | 252 pOtherOverlayList->pOverlays[uOverlayID - 1].Reset(); |
142 | 253 pOtherOverlayList->bRedraw = true; |
982 | 254 uOverlayID = 0; |
0 | 255 } |
256 } | |
257 | |
258 //----- (004585CA) -------------------------------------------------------- | |
1340 | 259 bool SpellBuff::IsBuffExpiredToTime( __int64 time_end ) |
260 { | |
261 if (uExpireTime && (uExpireTime < time_end)) | |
0 | 262 { |
982 | 263 uExpireTime = 0; |
264 uPower = 0; | |
265 uSkill = 0; | |
266 uOverlayID = 0; | |
267 return true; | |
0 | 268 } |
982 | 269 return false; |
0 | 270 } |
271 | |
272 //----- (004584E0) -------------------------------------------------------- | |
1340 | 273 bool SpellBuff::Apply( signed __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int uOverlayID, unsigned __int8 caster ) |
274 { | |
275 if (this->uExpireTime && (uExpireTime < this->uExpireTime)) | |
982 | 276 return false; |
0 | 277 |
982 | 278 this->uSkill = uSkillLevel; |
279 this->uPower = uPower; | |
280 this->uExpireTime = uExpireTime; | |
281 if (this->uOverlayID && this->uOverlayID != uOverlayID) | |
0 | 282 { |
982 | 283 pOtherOverlayList->pOverlays[this->uOverlayID - 1].Reset(); |
284 pOtherOverlayList->bRedraw = true; | |
285 this->uOverlayID = 0; | |
0 | 286 } |
982 | 287 this->uOverlayID = uOverlayID; |
288 this->uCaster = caster; | |
289 | |
290 return true; | |
0 | 291 } |
292 | |
293 //----- (0045384A) -------------------------------------------------------- | |
294 void SpellStats::Initialize() | |
982 | 295 { |
191 | 296 int decode_step; |
297 char* test_string; | |
298 bool break_loop; | |
299 unsigned char c; | |
300 unsigned int temp_str_len; | |
301 char* tmp_pos; | |
189 | 302 |
191 | 303 if ( pSpellsTXT_Raw ) |
304 pAllocator->FreeChunk(pSpellsTXT_Raw); | |
305 pSpellsTXT_Raw = NULL; | |
189 | 306 |
191 | 307 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0); |
308 strtok(pSpellsTXT_Raw, "\r"); | |
309 strtok(NULL, "\r"); | |
310 for(int i=1; i<100; ++i) | |
311 { | |
312 test_string=strtok(NULL, "\r")+1; | |
313 decode_step =0; | |
314 break_loop=false; | |
315 do | |
316 { | |
317 c = *(unsigned char*)test_string; | |
318 temp_str_len = 0; | |
319 while((c!='\t')&&(c>0)) | |
320 { | |
321 ++temp_str_len; | |
322 c=test_string[temp_str_len]; | |
323 } | |
324 tmp_pos=test_string+temp_str_len; | |
325 if (*tmp_pos == 0) | |
326 break_loop = true; | |
327 *tmp_pos = 0; | |
328 if (temp_str_len) | |
329 { | |
330 switch (decode_step) | |
331 { | |
332 case 2: | |
333 pInfos[i].pName=RemoveQuotes(test_string); | |
334 break; | |
335 case 3: | |
192 | 336 pInfos[i].uSchool = SPELL_SCHOOL_NONE; |
1104 | 337 if (!_stricmp("fire", test_string) ) |
191 | 338 { |
192 | 339 pInfos[i].uSchool =SPELL_SCHOOL_FIRE; |
191 | 340 break; |
341 } | |
1104 | 342 if ( !_stricmp("air", test_string) ) |
191 | 343 { |
192 | 344 pInfos[i].uSchool = SPELL_SCHOOL_AIR; |
191 | 345 break; |
346 } | |
1104 | 347 if ( !_stricmp("water", test_string)) |
191 | 348 { |
192 | 349 pInfos[i].uSchool = SPELL_SCHOOL_WATER; |
191 | 350 break; |
351 } | |
1104 | 352 if ( !_stricmp("earth", test_string)) |
191 | 353 { |
192 | 354 pInfos[i].uSchool = SPELL_SCHOOL_EARTH; |
191 | 355 break; |
356 } | |
1104 | 357 if ( !_stricmp("spirit", test_string)) |
191 | 358 { |
192 | 359 pInfos[i].uSchool = SPELL_SCHOOL_SPIRIT; |
191 | 360 break; |
361 } | |
1104 | 362 if ( !_stricmp("mind", test_string)) |
191 | 363 { |
192 | 364 pInfos[i].uSchool = SPELL_SCHOOL_MIND; |
191 | 365 break; |
366 } | |
1104 | 367 if ( !_stricmp("body", test_string) ) |
191 | 368 { |
192 | 369 pInfos[i].uSchool = SPELL_SCHOOL_BODY; |
191 | 370 break; |
371 } | |
1104 | 372 if ( !_stricmp("light", test_string) ) |
191 | 373 { |
192 | 374 pInfos[i].uSchool = SPELL_SCHOOL_LIGHT; |
191 | 375 break; |
376 } | |
1104 | 377 if ( !_stricmp("dark", test_string)) |
191 | 378 { |
192 | 379 pInfos[i].uSchool = SPELL_SCHOOL_DARK; |
191 | 380 break; |
381 } | |
382 | |
1104 | 383 if ( !_stricmp("magic", test_string)) |
191 | 384 { |
192 | 385 pInfos[i].uSchool = SPELL_SCHOOL_MAGIC; |
191 | 386 break; |
387 } | |
388 break; | |
389 case 4: | |
390 pInfos[i].pShortName=RemoveQuotes(test_string); | |
391 break; | |
392 case 5: | |
393 pInfos[i].pDescription=RemoveQuotes(test_string); | |
394 break; | |
395 case 6: | |
396 pInfos[i].pBasicSkillDesc=RemoveQuotes(test_string); | |
397 break; | |
398 case 7: | |
399 pInfos[i].pExpertSkillDesc=RemoveQuotes(test_string); | |
400 break; | |
401 case 8: | |
402 pInfos[i].pMasterSkillDesc=RemoveQuotes(test_string); | |
403 break; | |
404 case 9: | |
405 pInfos[i].pGrandmasterSkillDesc=RemoveQuotes(test_string); | |
406 break; | |
407 case 10: | |
408 int in_string_pos=0; | |
192 | 409 unsigned char test; |
191 | 410 int in_str_len=strlen(test_string); |
192 | 411 for (int j=0; j<in_str_len; ++j) |
412 { | |
413 test= tolower(test_string[j]); | |
414 switch (test) | |
415 { | |
416 case 109: | |
417 pSpellDatas[i].field_12|=1; | |
418 break; | |
419 case 101: | |
420 pSpellDatas[i].field_12|=2; | |
421 break; | |
422 case 99: | |
423 pSpellDatas[i].field_12|=4; | |
424 break; | |
425 case 120: | |
426 pSpellDatas[i].field_12|=8; | |
427 break; | |
428 } | |
429 } | |
191 | 430 break; |
431 } | |
432 } | |
433 else | |
434 break_loop=true; | |
435 ++decode_step; | |
436 test_string=tmp_pos+1; | |
437 } while ((decode_step<11)&&!break_loop); | |
438 if ((i%11)==0) | |
439 strtok(NULL, "\r"); | |
440 } | |
441 | |
1295 | 442 } |
443 //----- (00448DF8) -------------------------------------------------------- | |
1519 | 444 void __fastcall EventCastSpell(int uSpellID, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)//sub_448DF8 |
1295 | 445 { |
446 int v9; // esi@1 | |
447 double v10; // st7@4 | |
448 double v11; // st6@4 | |
449 double v12; // st5@4 | |
450 double v13; // st7@6 | |
451 int v14; // ST44_4@7 | |
452 signed int v15; // ebx@9 | |
453 signed int v16; // edx@15 | |
454 char *v17; // ecx@16 | |
455 unsigned __int16 v18; // ax@20 | |
456 char *v19; // ecx@31 | |
457 int v20; // edx@35 | |
458 signed int v21; // edx@37 | |
459 char *v22; // ecx@38 | |
460 unsigned __int16 v23; // ax@41 | |
461 int i; // esi@42 | |
462 signed int v25; // edx@55 | |
463 char *v26; // ecx@56 | |
464 unsigned __int16 v27; // ax@59 | |
465 int j; // esi@60 | |
466 signed int v29; // edx@66 | |
467 char *v30; // ecx@67 | |
468 unsigned __int16 v31; // ax@70 | |
469 //Player *v32; // eax@80 | |
470 //unsigned __int16 v33; // si@85 | |
471 int v34; // eax@96 | |
472 int v35; // eax@97 | |
473 unsigned __int64 v36; // qax@99 | |
474 SpellBuff *v37; // ecx@99 | |
475 int v38; // esi@103 | |
476 signed __int64 v39; // qax@105 | |
477 int v40; // ebx@108 | |
478 int v41; // ebx@109 | |
479 int v42; // esi@111 | |
480 int v43; // ebx@111 | |
481 int v44; // eax@117 | |
482 //unsigned __int16 v45; // si@137 | |
483 unsigned __int16 v46; // [sp-8h] [bp-BCh]@99 | |
484 int v47; // [sp-4h] [bp-B8h]@35 | |
485 unsigned __int16 v48; // [sp-4h] [bp-B8h]@99 | |
486 int v49; // [sp+0h] [bp-B4h]@35 | |
487 int v50; // [sp+0h] [bp-B4h]@99 | |
488 int v51; // [sp+4h] [bp-B0h]@35 | |
489 unsigned __int8 v52; // [sp+4h] [bp-B0h]@99 | |
490 float v53; // [sp+14h] [bp-A0h]@4 | |
491 float v54; // [sp+18h] [bp-9Ch]@4 | |
492 int v55; // [sp+28h] [bp-8Ch]@7 | |
493 unsigned int yaw; // [sp+30h] [bp-84h]@7 | |
494 int pitch; // [sp+34h] [bp-80h]@7 | |
495 //SpriteObject a1; // [sp+38h] [bp-7Ch]@12 | |
496 int v59; // [sp+A8h] [bp-Ch]@1 | |
497 int v60; // [sp+ACh] [bp-8h]@1 | |
498 //int spellnum_; // [sp+B0h] [bp-4h]@1 | |
499 //signed int levela; // [sp+BCh] [bp+8h]@80 | |
500 int a6_4; // [sp+C8h] [bp+14h]@117 | |
501 float a7a; // [sp+CCh] [bp+18h]@6 | |
502 signed int a7b; // [sp+CCh] [bp+18h]@12 | |
503 int a7c; // [sp+CCh] [bp+18h]@29 | |
504 int a7d; // [sp+CCh] [bp+18h]@55 | |
505 float a8a; // [sp+D0h] [bp+1Ch]@6 | |
506 int a8b; // [sp+D0h] [bp+1Ch]@37 | |
507 int a8c; // [sp+D0h] [bp+1Ch]@55 | |
508 float toza; // [sp+D4h] [bp+20h]@6 | |
509 | |
510 v9 = 0; | |
511 v59 = uSkillLevel + 1; | |
1519 | 512 //spellnum_ = uSpellID; |
1295 | 513 v60 = 0; |
514 if ( tox || toy || toz ) | |
515 { | |
516 v10 = (double)tox - (double)fromx; | |
517 v53 = v10; | |
518 v11 = (double)toy - (double)fromy; | |
519 v54 = v11; | |
520 v12 = (double)toz; | |
521 } | |
522 else | |
523 { | |
524 v10 = (double)pParty->vPosition.x - (double)fromx; | |
525 v53 = v10; | |
526 v11 = (double)pParty->vPosition.y - (double)fromy; | |
527 v54 = v11; | |
528 v12 = (double)(pParty->vPosition.z + pParty->sEyelevel); | |
529 } | |
530 a7a = v12 - (double)fromz; | |
531 toza = v11 * v11; | |
532 a8a = v10 * v10; | |
533 v13 = sqrt(a7a * a7a + a8a + toza); | |
534 if ( v13 <= 1.0 ) | |
535 { | |
536 LOBYTE(v55) = 1; | |
537 yaw = 0; | |
538 pitch = 0; | |
539 } | |
540 else | |
541 { | |
542 v55 = (signed __int64)v13; | |
543 v14 = (signed __int64)sqrt(a8a + toza); | |
544 yaw = stru_5C6E00->Atan2((signed __int64)v53, (signed __int64)v54); | |
545 pitch = stru_5C6E00->Atan2(v14, (signed __int64)a7a); | |
546 } | |
547 v15 = v59; | |
548 if ( v59 <= 0 || v59 > 4 ) | |
549 v15 = 1; | |
550 a7b = v15; | |
551 | |
552 SpriteObject a1; // [sp+38h] [bp-7Ch]@12 | |
553 //SpriteObject::SpriteObject(&a1); | |
554 | |
1519 | 555 a1.uType = stru_4E3ACC[uSpellID].uType; |
556 if ( uSpellID > 58 ) | |
1295 | 557 { |
1519 | 558 if ( uSpellID == 69 ) |
1295 | 559 goto LABEL_117; |
1519 | 560 if ( uSpellID != 83 ) |
1295 | 561 return; |
562 v40 = v15 - 2; | |
563 if ( v40 ) | |
564 { | |
565 v41 = v40 - 1; | |
566 if ( !v41 ) | |
567 { | |
568 v42 = 14400 * uSkill; | |
569 v43 = 4 * uSkill + 10; | |
570 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
571 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
572 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
573 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
574 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
575 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
576 v36 = pParty->uTimePlayed + v39; | |
577 v37->Apply(v36, a7b, v43, 0, 0); | |
578 goto LABEL_139; | |
579 } | |
580 if ( v41 == 1 ) | |
581 { | |
582 v42 = 18000 * uSkill; | |
583 v43 = 5 * uSkill + 10; | |
584 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
585 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
586 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
587 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
588 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
589 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
590 v36 = pParty->uTimePlayed + v39; | |
591 v37->Apply(v36, a7b, v43, 0, 0); | |
592 goto LABEL_139; | |
593 } | |
594 } | |
595 v42 = 10800 * uSkill; | |
596 v43 = 3 * uSkill + 10; | |
597 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
598 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
599 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
600 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
601 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
602 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
603 v36 = pParty->uTimePlayed + v39; | |
604 v37->Apply(v36, a7b, v43, 0, 0); | |
605 goto LABEL_139; | |
606 } | |
1519 | 607 if ( uSpellID != 58 ) |
1295 | 608 { |
1519 | 609 switch ( uSpellID ) |
1295 | 610 { |
611 case 2: | |
612 case 6: | |
613 case 18: | |
614 case 26: | |
615 case 29: | |
616 case 32: | |
617 case 39: | |
618 case 41: | |
619 a1.stru_24.Reset(); | |
620 v16 = 0; | |
1519 | 621 a1.spell_id = uSpellID; |
1295 | 622 a1.spell_level = uSkill; |
623 a1.spell_skill = v15; | |
624 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
625 { | |
626 v18 = 0; | |
627 a1.uObjectDescID = v18; | |
628 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
629 a1.vPosition.x = fromx; | |
630 a1.uAttributes = 16; | |
631 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
632 a1.field_60_distance_related_prolly_lod = v55; | |
633 v20 = yaw; | |
634 a1.uSpriteFrameID = 0; | |
635 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
636 a1.spell_target_pid = 0; | |
637 a1.uFacing = yaw; | |
638 a1.uSoundID = 0; | |
639 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
640 a1.Create(v20, pitch, v49, 0); | |
641 goto LABEL_139; | |
642 } | |
643 v17 = (char *)&pObjectList->pObjects->uObjectID; | |
644 while ( (short)a1.uType != *(short *)v17 ) | |
645 { | |
646 ++v16; | |
647 v17 += 56; | |
648 if ( v16 >= (signed int)pObjectList->uNumObjects ) | |
649 { | |
650 v18 = 0; | |
651 a1.uObjectDescID = v18; | |
652 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
653 a1.vPosition.x = fromx; | |
654 a1.uAttributes = 16; | |
655 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
656 a1.field_60_distance_related_prolly_lod = v55; | |
657 v20 = yaw; | |
658 a1.uSpriteFrameID = 0; | |
659 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
660 a1.spell_target_pid = 0; | |
661 a1.uFacing = yaw; | |
662 a1.uSoundID = 0; | |
663 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
664 a1.Create(v20, pitch, v49, 0); | |
665 goto LABEL_139; | |
666 } | |
667 } | |
668 v18 = v16; | |
669 a1.uObjectDescID = v18; | |
670 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
671 a1.vPosition.x = fromx; | |
672 a1.uAttributes = 16; | |
673 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
674 a1.field_60_distance_related_prolly_lod = v55; | |
675 v20 = yaw; | |
676 a1.uSpriteFrameID = 0; | |
677 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
678 a1.spell_target_pid = 0; | |
679 a1.uFacing = yaw; | |
680 a1.uSoundID = 0; | |
681 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
682 a1.Create(v20, pitch, v49, 0); | |
683 goto LABEL_139; | |
684 case 24: | |
685 switch ( v15 ) | |
686 { | |
687 case 1: | |
688 v60 = 1; | |
689 break; | |
690 case 2: | |
691 v60 = 3; | |
692 break; | |
693 case 3: | |
694 v60 = 5; | |
695 break; | |
696 case 4: | |
697 v60 = 7; | |
698 break; | |
699 } | |
700 a7c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
701 if ( v60 != 1 ) | |
702 { | |
703 a8b = a7c / (v60 - 1); | |
704 a1.stru_24.Reset(); | |
705 v21 = 0; | |
1519 | 706 a1.spell_id = uSpellID; |
1295 | 707 a1.spell_level = uSkill; |
708 a1.spell_skill = v15; | |
709 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
710 { | |
711 v23 = 0; | |
712 } | |
713 else | |
714 { | |
715 v22 = (char *)&pObjectList->pObjects->uObjectID; | |
716 while ( (short)a1.uType != *(short *)v22 ) | |
717 { | |
718 ++v21; | |
719 v22 += 56; | |
720 if ( v21 >= (signed int)pObjectList->uNumObjects ) | |
721 { | |
722 v23 = 0; | |
723 a1.uObjectDescID = v23; | |
724 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
725 a1.vPosition.x = fromx; | |
726 a1.uAttributes = 16; | |
727 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
728 a1.field_60_distance_related_prolly_lod = v55; | |
729 a1.uSpriteFrameID = 0; | |
730 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
731 a1.spell_target_pid = 4; | |
732 a1.uSoundID = 0; | |
733 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) | |
734 { | |
735 a1.uFacing = i + yaw; | |
736 a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
737 } | |
738 goto LABEL_139; | |
739 } | |
740 } | |
741 v23 = v21; | |
742 } | |
743 a1.uObjectDescID = v23; | |
744 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
745 a1.vPosition.x = fromx; | |
746 a1.uAttributes = 16; | |
747 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
748 a1.field_60_distance_related_prolly_lod = v55; | |
749 a1.uSpriteFrameID = 0; | |
750 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
751 a1.spell_target_pid = 4; | |
752 a1.uSoundID = 0; | |
753 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) | |
754 { | |
755 a1.uFacing = i + yaw; | |
756 a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
757 } | |
758 goto LABEL_139; | |
759 } | |
760 a1.stru_24.Reset(); | |
761 v16 = 0; | |
1519 | 762 a1.spell_id = uSpellID; |
1295 | 763 a1.spell_level = uSkill; |
764 a1.spell_skill = v15; | |
765 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
766 { | |
767 v18 = 0; | |
768 a1.uObjectDescID = v18; | |
769 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
770 a1.vPosition.x = fromx; | |
771 a1.uAttributes = 16; | |
772 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
773 a1.field_60_distance_related_prolly_lod = v55; | |
774 v20 = yaw; | |
775 a1.uSpriteFrameID = 0; | |
776 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
777 a1.spell_target_pid = 0; | |
778 a1.uFacing = yaw; | |
779 a1.uSoundID = 0; | |
780 v51 = 0; | |
781 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
782 v47 = pitch; | |
783 a1.Create(v20, v47, v49, v51); | |
784 goto LABEL_139; | |
785 } | |
786 v19 = (char *)&pObjectList->pObjects->uObjectID; | |
787 do | |
788 { | |
789 if ( (short)a1.uType == *(short *)v19 ) | |
790 { | |
791 v18 = v16; | |
792 a1.uObjectDescID = v18; | |
793 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
794 a1.vPosition.x = fromx; | |
795 a1.uAttributes = 16; | |
796 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
797 a1.field_60_distance_related_prolly_lod = v55; | |
798 v20 = yaw; | |
799 a1.uSpriteFrameID = 0; | |
800 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
801 a1.spell_target_pid = 0; | |
802 a1.uFacing = yaw; | |
803 a1.uSoundID = 0; | |
804 v51 = 0; | |
805 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
806 v47 = pitch; | |
807 a1.Create(v20, v47, v49, v51); | |
808 goto LABEL_139; | |
809 } | |
810 ++v16; | |
811 v19 += 56; | |
812 } | |
813 while ( v16 < (signed int)pObjectList->uNumObjects ); | |
814 v18 = 0; | |
815 a1.uObjectDescID = v18; | |
816 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
817 a1.vPosition.x = fromx; | |
818 a1.uAttributes = 16; | |
819 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
820 a1.field_60_distance_related_prolly_lod = v55; | |
821 v20 = yaw; | |
822 a1.uSpriteFrameID = 0; | |
823 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
824 a1.spell_target_pid = 0; | |
825 a1.uFacing = yaw; | |
826 a1.uSoundID = 0; | |
827 v51 = 0; | |
828 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
829 v47 = pitch; | |
830 a1.Create(v20, v47, v49, v51); | |
831 goto LABEL_139; | |
832 case 15: | |
833 switch ( v15 ) | |
834 { | |
835 case 1: | |
836 v60 = 3; | |
837 break; | |
838 case 2: | |
839 v60 = 5; | |
840 break; | |
841 case 3: | |
842 v60 = 7; | |
843 break; | |
844 case 4: | |
845 v60 = 9; | |
846 break; | |
847 } | |
848 a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
849 a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1); | |
850 a1.stru_24.Reset(); | |
851 v25 = 0; | |
1519 | 852 a1.spell_id = uSpellID; |
1295 | 853 a1.spell_level = uSkill; |
854 a1.spell_skill = v15; | |
855 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
856 { | |
857 v27 = 0; | |
858 a1.uObjectDescID = v27; | |
859 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
860 a1.vPosition.x = fromx; | |
861 a1.uAttributes = 16; | |
862 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
863 a1.field_60_distance_related_prolly_lod = v55; | |
864 a1.uSpriteFrameID = 0; | |
865 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
866 a1.spell_target_pid = 4; | |
867 a1.uSoundID = 0; | |
868 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
869 { | |
870 a1.uFacing = j + yaw; | |
871 a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
872 } | |
873 goto LABEL_139; | |
874 } | |
875 v26 = (char *)&pObjectList->pObjects->uObjectID; | |
876 while ( (short)a1.uType != *(short *)v26 ) | |
877 { | |
878 ++v25; | |
879 v26 += 56; | |
880 if ( v25 >= (signed int)pObjectList->uNumObjects ) | |
881 { | |
882 v27 = 0; | |
883 a1.uObjectDescID = v27; | |
884 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
885 a1.vPosition.x = fromx; | |
886 a1.uAttributes = 16; | |
887 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
888 a1.field_60_distance_related_prolly_lod = v55; | |
889 a1.uSpriteFrameID = 0; | |
890 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
891 a1.spell_target_pid = 4; | |
892 a1.uSoundID = 0; | |
893 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
894 { | |
895 a1.uFacing = j + yaw; | |
896 a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
897 } | |
898 goto LABEL_139; | |
899 } | |
900 } | |
901 v27 = v25; | |
902 a1.uObjectDescID = v27; | |
903 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
904 a1.vPosition.x = fromx; | |
905 a1.uAttributes = 16; | |
906 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
907 a1.field_60_distance_related_prolly_lod = v55; | |
908 a1.uSpriteFrameID = 0; | |
909 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
910 a1.spell_target_pid = 4; | |
911 a1.uSoundID = 0; | |
912 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
913 { | |
914 a1.uFacing = j + yaw; | |
915 a1.Create( | |
916 (signed __int16)(j + (short)yaw), | |
917 pitch, | |
918 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
919 0); | |
920 } | |
921 goto LABEL_139; | |
922 case 43: | |
923 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
924 return; | |
925 a1.stru_24.Reset(); | |
926 v29 = 0; | |
1519 | 927 a1.spell_id = uSpellID; |
1295 | 928 a1.spell_level = uSkill; |
929 a1.spell_skill = v15; | |
930 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
931 { | |
932 v31 = 0; | |
933 a1.uObjectDescID = v31; | |
934 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
935 a1.vPosition.x = fromx; | |
936 a1.uAttributes = 16; | |
937 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
938 a1.field_60_distance_related_prolly_lod = v55; | |
939 a1.uSpriteFrameID = 0; | |
940 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
941 a1.spell_target_pid = 4; | |
942 a1.uSoundID = 0; | |
943 v51 = 0; | |
944 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
945 v20 = yaw; | |
946 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
947 a1.Create(v20, v47, v49, v51); | |
948 goto LABEL_139; | |
949 } | |
950 v30 = (char *)&pObjectList->pObjects->uObjectID; | |
951 break; | |
952 | |
953 case SPELL_FIRE_HASTE: | |
954 if ( v15 > 0 ) | |
955 { | |
956 if ( v15 <= 2 ) | |
957 { | |
958 v9 = 60 * (uSkill + 60); | |
959 } | |
960 else | |
961 { | |
962 if ( v15 == 3 ) | |
963 { | |
964 v9 = 180 * (uSkill + 20); | |
965 } | |
966 else | |
967 { | |
968 if ( v15 == 4 ) | |
969 v9 = 240 * (uSkill + 15); | |
970 } | |
971 } | |
972 } | |
973 //levela = 1; | |
974 //v32 = pParty->pPlayers;//[0].pConditions[1]; | |
975 //do | |
976 for (uint i = 0; i < 4; ++i) | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
977 if (pParty->pPlayers[i].IsWeak()) |
1295 | 978 return; |
979 //while ( v32 <= &pParty->pPlayers[3] ); | |
980 //if ( !levela ) | |
981 // return; | |
982 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), | |
983 v15, | |
984 0, | |
985 0, | |
986 0); | |
987 //v33 = spellnum_; | |
1519 | 988 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
989 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | |
990 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | |
991 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | |
1295 | 992 goto LABEL_138; |
993 case 17: | |
994 case 38: | |
995 case 51: | |
996 switch ( v15 ) | |
997 { | |
998 case 1: | |
999 case 2: | |
1000 v9 = 300 * (uSkill + 12); | |
1001 break; | |
1002 case 3: | |
1003 v9 = 900 * (uSkill + 4); | |
1004 break; | |
1005 case 4: | |
1006 v9 = 3600 * (uSkill + 1); | |
1007 break; | |
1008 } | |
1519 | 1009 switch ( uSpellID ) |
1295 | 1010 { |
1011 case 17: | |
1012 v60 = 0; | |
1013 uSkill = 14; | |
1014 break; | |
1015 case 38: | |
1016 v35 = uSkill + 5; | |
1017 uSkill = 15; | |
1018 v60 = v35; | |
1019 break; | |
1020 case 51: | |
1021 v34 = uSkill + 5; | |
1022 uSkill = 9; | |
1023 v60 = v34; | |
1024 break; | |
1025 } | |
1519 | 1026 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
1027 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | |
1028 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | |
1029 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | |
1295 | 1030 v52 = 0; |
1031 v50 = 0; | |
1032 v48 = v60; | |
1033 v46 = v15; | |
1034 v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); | |
1035 v37 = &pParty->pPartyBuffs[uSkill]; | |
1036 v37->Apply(v36, v46, v48, v50, v52); | |
1037 goto LABEL_139;; | |
1038 case 8: | |
1039 if ( v15 == 2 || v15 == 3 || v15 != 4 ) | |
1040 v38 = 60 * uSkill; | |
1041 else | |
1042 v38 = 600 * uSkill; | |
1519 | 1043 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
1044 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | |
1045 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | |
1046 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | |
1295 | 1047 v52 = 0; |
1048 v50 = 0; | |
1049 v48 = uSkill; | |
1050 v46 = v15; | |
1051 v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); | |
1052 v37 = &pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION]; | |
1053 v36 = pParty->uTimePlayed + v39; | |
1054 v37->Apply(v36, v46, v48, v50, v52); | |
1055 goto LABEL_139; | |
1056 case 3: | |
1057 case 14: | |
1058 case 25: | |
1059 case 36: | |
1060 goto LABEL_117; | |
1061 default: | |
1062 return; | |
1063 } | |
1064 while ( (short)a1.uType != *(short *)v30 ) | |
1065 { | |
1066 ++v29; | |
1067 v30 += 56; | |
1068 if ( v29 >= (signed int)pObjectList->uNumObjects ) | |
1069 { | |
1070 v31 = 0; | |
1071 a1.uObjectDescID = v31; | |
1072 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
1073 a1.vPosition.x = fromx; | |
1074 a1.uAttributes = 16; | |
1075 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
1076 a1.field_60_distance_related_prolly_lod = v55; | |
1077 a1.uSpriteFrameID = 0; | |
1078 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
1079 a1.spell_target_pid = 4; | |
1080 a1.uSoundID = 0; | |
1081 v51 = 0; | |
1082 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
1083 v20 = yaw; | |
1084 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
1085 a1.Create(v20, v47, v49, v51); | |
1086 goto LABEL_139; | |
1087 } | |
1088 } | |
1089 v31 = v29; | |
1090 a1.uObjectDescID = v31; | |
1091 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
1092 a1.vPosition.x = fromx; | |
1093 a1.uAttributes = 16; | |
1094 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
1095 a1.field_60_distance_related_prolly_lod = v55; | |
1096 a1.uSpriteFrameID = 0; | |
1097 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
1098 a1.spell_target_pid = 4; | |
1099 a1.uSoundID = 0; | |
1100 v51 = 0; | |
1101 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
1102 v20 = yaw; | |
1103 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
1104 a1.Create(v20, v47, v49, v51); | |
1105 goto LABEL_139; | |
1106 } | |
1107 LABEL_117: | |
1108 v44 = uSkill; | |
1109 a6_4 = 3600 * uSkill; | |
1110 if ( v15 == 1 ) | |
1111 { | |
1112 v60 = v44; | |
1113 goto LABEL_125; | |
1114 } | |
1115 if ( v15 == 2 ) | |
1116 { | |
1117 v44 = 2 * uSkill; | |
1118 v60 = v44; | |
1119 goto LABEL_125; | |
1120 } | |
1121 if ( v15 == 3 ) | |
1122 { | |
1123 v44 = 3 * uSkill; | |
1124 v60 = v44; | |
1125 goto LABEL_125; | |
1126 } | |
1127 if ( v15 == 4 ) | |
1128 { | |
1129 v44 = 4 * uSkill; | |
1130 v60 = v44; | |
1131 goto LABEL_125; | |
1132 } | |
1133 LABEL_125: | |
1519 | 1134 switch ( uSpellID ) |
1295 | 1135 { |
1136 case 3: | |
1137 uSkill = 6; | |
1138 break; | |
1139 case 14: | |
1140 uSkill = 0; | |
1141 break; | |
1142 case 25: | |
1143 uSkill = 17; | |
1144 break; | |
1145 case 36: | |
1146 uSkill = 4; | |
1147 break; | |
1148 case 58: | |
1149 uSkill = 12; | |
1150 break; | |
1151 case 69: | |
1152 uSkill = 1; | |
1153 break; | |
1154 } | |
1155 //v45 = spellnum_; | |
1519 | 1156 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
1157 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | |
1158 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | |
1159 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | |
1295 | 1160 pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), v15, v60, 0, 0); |
1161 //levela = 1; | |
1162 LABEL_138: | |
1163 //if ( levela ) | |
1164 LABEL_139: | |
1519 | 1165 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); |
1296 | 1166 } |
1167 //----- (00427769) -------------------------------------------------------- | |
1168 bool __fastcall sub_427769_spell(unsigned int uSpellID) | |
1169 { | |
1170 bool result; // eax@2 | |
1171 | |
1172 __debugbreak(); // refactor | |
1173 if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC ) | |
1174 result = 1; | |
1175 else | |
1176 result = 0; | |
1177 return result; | |
1297 | 1178 } |
1179 //----- (0043AFE3) -------------------------------------------------------- | |
1180 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4) | |
1181 { | |
1182 int result; // eax@1 | |
1183 unsigned int v5; // [sp-4h] [bp-8h]@9 | |
1184 | |
1185 result = 0; | |
1186 if ( a1 == 7 ) | |
1187 { | |
1188 if ( a3 <= 0 ) | |
1189 return result; | |
1190 if ( a3 <= 2 ) | |
1191 { | |
1192 v5 = 6; | |
1193 } | |
1194 else | |
1195 { | |
1196 if ( a3 == 3 ) | |
1197 { | |
1198 v5 = 8; | |
1199 } | |
1200 else | |
1201 { | |
1202 if ( a3 != 4 ) | |
1203 return result; | |
1204 v5 = 10; | |
1205 } | |
1206 } | |
1207 result = GetDiceResult(a2, v5); | |
1208 } | |
1209 else | |
1210 { | |
1211 if ( a1 == 44 ) | |
1212 result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100; | |
1213 else | |
1214 result = *((char *)&pSpellDatas[0].field_10 + 20 * a1) | |
1215 + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1)); | |
1216 } | |
1217 return result; | |
1295 | 1218 } |