Mercurial > mm7
annotate CastSpellInfo.cpp @ 2183:172cfb4ee150
CastSpell
author | Ritor1 |
---|---|
date | Thu, 23 Jan 2014 23:35:10 +0600 |
parents | e1e4a8a20b5f |
children | e0863f5beee0 |
rev | line source |
---|---|
1296 | 1 #include "CastSpellInfo.h" |
2 #include "Actor.h" | |
3 #include "Party.h" | |
4 #include "mm7_data.h" | |
5 #include "MM7.h" | |
6 #include "BSPModel.h" | |
7 #include "Mouse.h" | |
8 #include "stru6.h" | |
9 #include "Game.h" | |
10 #include "GUIWindow.h" | |
11 #include "GUIFont.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Outdoor.h" | |
14 #include "Overlays.h" | |
15 #include "Events.h" | |
16 #include "Viewport.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
1980
diff
changeset
|
17 #include "OurMath.h" |
1296 | 18 #include "SpriteObject.h" |
19 #include "ObjectList.h" | |
20 #include "stru123.h" | |
2044 | 21 #include "Timer.h" |
1296 | 22 #include "IconFrameTable.h" |
23 #include "Awards.h" | |
24 #include "TurnEngine.h" | |
25 #include "texts.h" | |
26 #include "LOD.h" | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1793
diff
changeset
|
27 #include "Level/Decoration.h" |
1296 | 28 |
1517 | 29 const size_t CastSpellInfoCount = 10; |
30 std::array<CastSpellInfo, CastSpellInfoCount> pCastSpellInfo; | |
31 | |
1296 | 32 //----- (00427E01) -------------------------------------------------------- |
1517 | 33 void CastSpellInfoHelpers::_427E01_cast_spell() |
1296 | 34 { |
2179 | 35 int spell_level; // edi@1 |
1296 | 36 CastSpellInfo *pCastSpell; // ebx@2 |
37 signed int v6; // eax@14 | |
38 unsigned __int16 v11; // cx@45 | |
39 signed int i; // esi@76 | |
40 __int16 v23; // ax@88 | |
41 signed __int64 v54; // qax@164 | |
42 signed __int64 v58; // qax@177 | |
43 Actor *pActor; // edi@177 | |
44 unsigned __int16 v60; // ax@184 | |
45 int v61; // ecx@184 | |
46 double v90; // st7@245 | |
47 Player *v92; // eax@255 | |
48 int v105; // edi@271 | |
49 int v111; // eax@274 | |
50 Actor *v112; // esi@278 | |
2182 | 51 int dist_X; // eax@278 |
52 int new_dist_Y; | |
53 int dist_Z; | |
1296 | 54 int v114; // ebx@278 |
55 unsigned int v115; // ecx@278 | |
56 int v116; // edx@279 | |
57 int v117; // edx@281 | |
58 int v118; // edx@283 | |
59 signed int v122; // eax@286 | |
60 int v127; // eax@296 | |
61 int v153; // ecx@322 | |
62 int v154; // eax@322 | |
63 int v155; // eax@323 | |
64 int v156; // eax@323 | |
65 int v162; // edi@340 | |
66 signed int v164; // eax@340 | |
67 signed int v165; // edi@340 | |
68 signed int v168; // edi@343 | |
69 int v169; // eax@344 | |
70 signed int v174; // edi@355 | |
71 int v188; // esi@369 | |
72 int v189; // edi@369 | |
73 signed int v191; // edi@379 | |
74 signed int v205; // edi@405 | |
75 int v206; // eax@407 | |
76 __int16 v207; // cx@407 | |
77 int v208; // eax@411 | |
78 signed int v209; // ecx@412 | |
79 int v210; // edx@412 | |
80 signed int v211; // ecx@412 | |
81 int v212; // eax@413 | |
82 int v213; // eax@413 | |
83 int v214; // eax@413 | |
84 int v215; // eax@415 | |
85 double v216; // st7@415 | |
86 double v217; // st6@415 | |
87 signed __int64 v218; // qtt@423 | |
88 char v223; // al@438 | |
89 int v227; // esi@453 | |
90 unsigned int v228; // edi@454 | |
91 int v229; // edi@466 | |
92 ItemGen *v240; // ecx@472 | |
93 double v241; // st7@478 | |
94 ItemGen *v245; // edi@492 | |
95 int v254; // eax@513 | |
96 int v255; // esi@513 | |
97 int v256; // ecx@513 | |
98 int v257; // edx@514 | |
99 int v258; // ecx@514 | |
100 char v259; // al@516 | |
101 int v260; // eax@518 | |
102 int v261; // esi@519 | |
103 int v262; // edx@521 | |
104 int *v263; // ecx@521 | |
105 int v264; // esi@521 | |
106 int v265; // edx@521 | |
107 int *ii; // eax@522 | |
108 int v267; // eax@524 | |
109 int v268; // eax@524 | |
110 char v271; // al@531 | |
111 int v277; // edx@548 | |
112 int v278; // ecx@548 | |
113 char v279; // al@550 | |
114 int v280; // eax@552 | |
115 int *v281; // esi@553 | |
116 int v282; // edx@555 | |
117 int *v283; // ecx@555 | |
118 int v284; // esi@555 | |
119 int v285; // edx@555 | |
120 int *l; // eax@556 | |
121 ItemGen *v294; // esi@575 | |
122 int v295; // edx@575 | |
123 int kk; // edi@575 | |
124 char v313; // al@606pGame->GetStru6() | |
125 const char *v317; // ecx@617 | |
126 Player *v318; // ecx@619 | |
127 unsigned int v319; // edi@627 | |
128 int v323; // edi@635 | |
129 char *v324; // eax@635 | |
130 Player *v325; // ecx@640 | |
131 int v328; // ecx@651 | |
132 int v329; // ecx@652 | |
133 int v330; // edi@654 | |
134 signed int v342; // edi@668 | |
135 signed int v343; // edi@670 | |
136 unsigned __int64 v344; // ST08_8@670 | |
137 Player *v351; // edi@680 | |
138 Player *v357; // edi@694 | |
139 Actor *v369; // edi@705 | |
140 int v373; // eax@715 | |
141 int v374; // eax@717 | |
142 int v376; // eax@717 | |
143 Player *v377; // ecx@719 | |
144 int v381; // edi@727 | |
145 int v382; // ecx@727 | |
146 Player *v383; // eax@728 | |
147 int v384; // eax@733 | |
148 int v388; // edi@740 | |
149 int v396; // eax@752 | |
150 int v397; // eax@757 | |
151 int v398; // eax@757 | |
152 int v399; // eax@757 | |
153 Actor *v417; // eax@787 | |
154 int v418; // ecx@789 | |
155 __int16 v419; // ax@791 | |
156 signed int v420; // eax@793 | |
157 ItemGen *v421; // edx@793 | |
158 const char *v422; // eax@801 | |
159 signed int v426; // eax@815 | |
160 Actor *v433; // edi@832 | |
161 int v435; // ecx@837 | |
162 int v440; // eax@843 | |
163 int v441; // eax@847 | |
164 signed int v445; // edi@857 | |
165 __int16 v448; // ax@864 | |
166 char *v449; // esi@870 | |
167 int v450; // eax@870 | |
168 signed int v460; // eax@895 | |
169 Actor *v461; // eax@897 | |
170 unsigned __int16 v462; // cx@897 | |
171 signed int v463; // edx@897 | |
172 int v470; // edi@913 | |
173 int v471; // eax@917 | |
174 int v472; // eax@917 | |
175 int v498; // edi@931 | |
176 int v499; // eax@935 | |
177 int v500; // eax@935 | |
178 Player *v501; // edi@939 | |
179 int v505; // eax@943 | |
180 int v507; // edi@944 | |
181 signed int v509; // eax@944 | |
182 Actor *v518; // edx@957 | |
183 __int16 v519; // cx@958 | |
184 int v531; // eax@982 | |
185 int v533; // edi@983 | |
186 signed int v535; // eax@983 | |
187 signed int v536; // edi@983 | |
188 stru6 *v537; // eax@984 | |
189 double v549; // st7@991 | |
190 unsigned __int16 v550; // di@991 | |
191 Player *v553; // edi@1001 | |
192 unsigned __int16 v562; // di@1005 | |
193 signed int v563; // eax@1010 | |
194 unsigned int v564; // ecx@1011 | |
195 signed int v565; // eax@1012 | |
196 Player **v566; // ecx@1012 | |
197 int v567; // eax@1012 | |
198 Player *v571; // eax@1013 | |
199 char *v572; // ecx@1013 | |
200 signed int v576; // eax@1025 | |
201 Player *v577; // eax@1026 | |
202 int v578; // eax@1028 | |
203 __int16 v579; // ax@1029 | |
204 int v581; // edi@1031 | |
205 char *v585; // esi@1034 | |
206 signed int v587; // eax@1035 | |
207 char v591; // al@1048 | |
208 ItemGen *v592; // esi@1052 | |
209 int v596; // esi@1066 | |
210 unsigned int v597; // edi@1067 | |
211 NPCData *pNPCData; // eax@1089 | |
212 int v606; // edx@1091 | |
213 AwardType *v607; // ecx@1100 | |
214 __int16 v608; // ax@1102 | |
215 signed int v609; // eax@1104 | |
216 int v610; // edi@1106 | |
217 unsigned int v611; // eax@1106 | |
218 Player *v612; // edi@1106 | |
219 DDM_DLV_Header *v613; // eax@1108 | |
220 int v615; // edi@1119 | |
221 Player *v619; // edi@1123 | |
222 signed __int64 v623; // qax@1127 | |
223 int v625; // edi@1129 | |
224 signed int v627; // eax@1129 | |
225 signed int v628; // edi@1129 | |
226 int v629; // ecx@1130 | |
227 Player *v630; // eax@1131 | |
228 int v631; // eax@1137 | |
229 int v635; // edi@1142 | |
230 int v642; // edi@1156 | |
231 int v643; // eax@1156 | |
232 int v644; // eax@1156 | |
233 signed int v645; // eax@1158 | |
234 unsigned int v656; // [sp-4h] [bp-E88h]@639 | |
235 int v659; // [sp+0h] [bp-E84h]@123 | |
236 Actor *v661; // [sp+0h] [bp-E84h]@164 | |
237 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 | |
238 const char *v664; // [sp+0h] [bp-E84h]@802 | |
239 int v666; // [sp+4h] [bp-E80h]@12 | |
240 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 | |
241 int v675; // [sp+4h] [bp-E80h]@800 | |
242 int v679[800]; // [sp+14h] [bp-E70h]@515 | |
243 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 | |
244 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 | |
245 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 | |
246 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 | |
247 int v684; // [sp+D04h] [bp-180h]@416 | |
248 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 | |
249 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 | |
250 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 | |
251 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 | |
252 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 | |
253 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 | |
254 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 | |
255 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 | |
256 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 | |
257 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 | |
258 int v710; // [sp+D8Ch] [bp-F8h]@1156 | |
259 __int64 v712; // [sp+D94h] [bp-F0h]@991 | |
260 int v713; // [sp+D9Ch] [bp-E8h]@324 | |
261 int n; // [sp+DA0h] [bp-E4h]@1 | |
262 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | |
263 __int64 v717; // [sp+DC4h] [bp-C0h]@271 | |
264 float v718; // [sp+DCCh] [bp-B8h]@176 | |
265 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 | |
266 char *y; // [sp+DD4h] [bp-B0h]@325 | |
2182 | 267 int v721; |
268 int mon_id; | |
269 int dist_Y; // [sp+DD8h] [bp-ACh]@163 | |
1296 | 270 int v723; // [sp+E4Ch] [bp-38h]@1 |
271 ItemGen *_this; // [sp+E50h] [bp-34h]@23 | |
272 float v725; // [sp+E54h] [bp-30h]@23 | |
2182 | 273 int buff_resist; |
1296 | 274 Player *v726; // [sp+E58h] [bp-2Ch]@131 |
275 float v727; // [sp+E5Ch] [bp-28h]@1 | |
276 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 | |
277 Player *pPlayer; // [sp+E64h] [bp-20h]@8 | |
278 int v730; // [sp+E68h] [bp-1Ch]@53 | |
279 Player *v730b; | |
280 ItemGen *v730c; | |
2179 | 281 int skill_level; // [sp+E6Ch] [bp-18h]@48 |
1296 | 282 signed int v732; // [sp+E70h] [bp-14h]@325 |
283 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | |
2182 | 284 int duration; |
1296 | 285 signed int a2; // [sp+E7Ch] [bp-8h]@14 |
286 int amount; // [sp+E80h] [bp-4h]@1 | |
2183 | 287 int obj_type; |
1296 | 288 |
289 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 | |
290 | |
2179 | 291 spell_level = 0; |
1296 | 292 amount = 0; |
293 LODWORD(v733) = 0; | |
294 v723 = 0; | |
295 v727 = 0.0; | |
1517 | 296 for(n = 0; n < CastSpellInfoCount; ++n) |
1296 | 297 { |
1517 | 298 pCastSpell = &pCastSpellInfo[n]; |
1296 | 299 HIDWORD(v733) = (int)pCastSpell; |
1519 | 300 if ( pCastSpell->uSpellID == 0 ) |
1296 | 301 continue; |
302 | |
303 if (pParty->Invisible()) | |
304 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
305 | |
1519 | 306 if ( pCastSpell->uFlags & 0x3CA ) |
1296 | 307 { |
308 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) | |
1517 | 309 _427D48(); |
1296 | 310 continue; |
311 } | |
312 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
313 | |
314 a2 = pCastSpell->spell_target_pid; | |
315 if (!pCastSpell->spell_target_pid) | |
316 { | |
1519 | 317 if (pCastSpell->uSpellID == SPELL_LIGHT_DESTROY_UNDEAD || |
318 pCastSpell->uSpellID == SPELL_SPIRIT_TURN_UNDEAD || | |
319 pCastSpell->uSpellID == SPELL_DARK_CONTROL_UNDEAD ) | |
1296 | 320 v666 = 1; |
321 else | |
322 v666 = 0; | |
323 | |
324 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | |
325 v6 = pMouse->uPointingObjectID; | |
326 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) | |
327 a2 = pMouse->uPointingObjectID; | |
328 } | |
329 | |
330 | |
1519 | 331 pSpellSprite.uType = stru_4E3ACC[pCastSpell->uSpellID].uType; |
1296 | 332 if (pSpellSprite.uType) |
333 { | |
334 if (PID_TYPE(a2) == OBJECT_Actor) | |
335 { | |
1910
8d3723ca71e6
Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents:
1906
diff
changeset
|
336 Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &v715, 0); |
2179 | 337 spell_level = v723; |
1296 | 338 } |
339 else | |
340 { | |
341 v715.uYawAngle = pParty->sRotationY; | |
342 v715.uPitchAngle = pParty->sRotationX; | |
343 } | |
344 } | |
345 | |
346 LODWORD(v725) = 0; | |
347 _this = 0; | |
348 if (pCastSpell->forced_spell_skill_level) | |
349 { | |
350 v11 = pCastSpell->forced_spell_skill_level; | |
351 v723 = v11 & 0x3F; // 6 bytes | |
2179 | 352 spell_level = v723; |
1296 | 353 } |
354 else | |
355 { | |
356 //v667 = PLAYER_SKILL_STAFF; | |
1519 | 357 if (pCastSpell->uSpellID < SPELL_AIR_WIZARD_EYE) |
1296 | 358 v667 = PLAYER_SKILL_FIRE; |
1519 | 359 else if (pCastSpell->uSpellID < SPELL_WATER_AWAKEN) |
1296 | 360 v667 = PLAYER_SKILL_AIR; |
1519 | 361 else if (pCastSpell->uSpellID < SPELL_EARTH_STUN) |
1296 | 362 v667 = PLAYER_SKILL_WATER; |
1519 | 363 else if (pCastSpell->uSpellID < SPELL_SPIRIT_DETECT_LIFE) |
1296 | 364 v667 = PLAYER_SKILL_EARTH; |
1519 | 365 else if (pCastSpell->uSpellID < SPELL_MIND_REMOVE_FEAR) |
1296 | 366 v667 = PLAYER_SKILL_SPIRIT; |
1519 | 367 else if (pCastSpell->uSpellID < SPELL_BODY_CURE_WEAKNESS) |
1296 | 368 v667 = PLAYER_SKILL_MIND; |
1519 | 369 else if (pCastSpell->uSpellID < SPELL_LIGHT_LIGHT_BOLT) |
1296 | 370 v667 = PLAYER_SKILL_BODY; |
1519 | 371 else if (pCastSpell->uSpellID < SPELL_DARK_REANIMATE) |
1296 | 372 v667 = PLAYER_SKILL_LIGHT; |
1519 | 373 else if (pCastSpell->uSpellID < SPELL_BOW_ARROW) |
1296 | 374 v667 = PLAYER_SKILL_DARK; |
1519 | 375 else if (pCastSpell->uSpellID == SPELL_BOW_ARROW) |
1296 | 376 v667 = PLAYER_SKILL_BOW; |
377 else assert(false && "Unknown spell"); | |
378 | |
379 LODWORD(v725) = v667; | |
380 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; | |
2179 | 381 spell_level = v723; |
1296 | 382 v11 = pPlayer->pActiveSkills[LODWORD(v725)]; |
383 } | |
384 | |
2179 | 385 skill_level = SkillToMastery(v11); |
1296 | 386 |
387 if (pCastSpell->forced_spell_skill_level) | |
388 uRequiredMana = 0; | |
389 else | |
2179 | 390 uRequiredMana = pSpellDatas[pCastSpell->uSpellID].mana_per_skill[skill_level - 1]; |
391 sRecoveryTime = pSpellDatas[pCastSpell->uSpellID].recovery_per_skill[skill_level - 1]; | |
1296 | 392 |
393 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | |
394 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) | |
395 uRequiredMana = 0; | |
396 | |
1519 | 397 if (pCastSpell->uSpellID < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
1296 | 398 { |
2179 | 399 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2); // "Not enough spell points" |
1519 | 400 pCastSpell->uSpellID = 0; |
1296 | 401 continue; |
402 } | |
1519 | 403 v730 = pCastSpell->uSpellID; |
2179 | 404 if (pPlayer->IsCursed() && pCastSpell->uSpellID < SPELL_BOW_ARROW && rand() % 100 < 50)// |
1296 | 405 { |
406 if (!pParty->bTurnBasedModeOn) | |
407 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
408 else | |
409 { | |
1517 | 410 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpellInfo[n].uPlayerID] = 100; |
1296 | 411 pPlayer->SetRecoveryTime(sRecoveryTime); |
1448 | 412 pTurnEngine->ApplyPlayerAction(); |
1296 | 413 } |
2179 | 414 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // "Spell failed" |
1296 | 415 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
1519 | 416 pCastSpellInfo[n].uSpellID = 0; |
1296 | 417 pPlayer->sMana -= uRequiredMana; |
418 return; | |
419 } | |
420 | |
1519 | 421 switch ( pCastSpell->uSpellID ) |
1296 | 422 { |
2179 | 423 case SPELL_101: |
424 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
425 case SPELL_BOW_ARROW:// | |
426 { | |
427 amount = 1; | |
428 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
429 amount = 2; | |
430 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); | |
431 pSpellSprite.stru_24.Reset(); | |
432 pSpellSprite.spell_level = spell_level; | |
433 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
434 pSpellSprite.spell_skill = skill_level; | |
435 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
436 if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) ) | |
437 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
438 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
439 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
440 pSpellSprite.uAttributes = 0; | |
441 pSpellSprite.uSpriteFrameID = 0; | |
442 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
443 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
444 pSpellSprite.spell_target_pid = a2; | |
445 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
446 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
447 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
448 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
449 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); | |
450 pSpellSprite.uAttributes = 256; | |
451 if ( pParty->bTurnBasedModeOn == 1 ) | |
452 pSpellSprite.uAttributes = 260; | |
453 for ( i = 0; i < amount; ++i ) | |
454 { | |
455 if ( i ) | |
456 pSpellSprite.vPosition.z += 32; | |
457 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
458 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
459 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
460 ++pTurnEngine->pending_actions; | |
461 } | |
462 break; | |
463 } | |
464 case SPELL_LASER_PROJECTILE:// | |
465 { | |
466 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
467 pSpellSprite.stru_24.Reset(); | |
468 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
469 pSpellSprite.spell_level = v723; | |
470 pSpellSprite.spell_skill = skill_level; | |
471 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
472 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
473 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
474 pSpellSprite.uAttributes = 0; | |
475 pSpellSprite.uSpriteFrameID = 0; | |
476 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
477 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
478 pSpellSprite.spell_target_pid = a2; | |
479 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
480 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
481 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
482 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; | |
483 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uMainHand - 1],sizeof(pSpellSprite.stru_24)); | |
484 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
485 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); | |
486 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
487 HIBYTE(pSpellSprite.uAttributes) |= 1; | |
488 if ( pParty->bTurnBasedModeOn == 1 ) | |
489 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
490 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
491 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
492 ++pTurnEngine->pending_actions; | |
493 break; | |
494 } | |
495 case SPELL_FIRE_TORCH_LIGHT:// | |
496 { | |
497 switch (skill_level) | |
498 { | |
499 case 1: amount = 2; break; | |
500 case 2: amount = 3; break; | |
501 case 3: | |
502 case 4: amount = 4; break; | |
503 default: | |
504 assert(false); | |
505 } | |
506 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
507 break; | |
508 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * spell_level * 4.2666669), skill_level, amount, 0, 0); | |
509 LODWORD(v727) = 1; | |
510 break; | |
511 } | |
512 case SPELL_FIRE_FIRE_SPIKE:// | |
513 { | |
514 switch (skill_level) | |
515 { | |
516 case 1: amount = 3; break; | |
517 case 2: amount = 5; break; | |
518 case 3: amount = 7; break; | |
519 case 4: amount = 9; break; | |
520 default: | |
521 assert(false); | |
522 } | |
523 int _v733 = 0; | |
524 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
525 { | |
526 SpriteObject* object = &pSpriteObjects[i]; | |
527 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) | |
528 ++_v733; | |
529 } | |
530 if ( _v733 > amount ) | |
531 { | |
532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
533 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
534 pCastSpell->uSpellID = 0; | |
535 continue; | |
536 } | |
537 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
538 break; | |
539 pSpellSprite.stru_24.Reset(); | |
540 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
541 pSpellSprite.spell_level = spell_level; | |
542 pSpellSprite.spell_skill = skill_level; | |
543 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
544 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
545 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
546 pSpellSprite.uAttributes = 0; | |
547 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
548 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
549 pSpellSprite.uSpriteFrameID = 0; | |
550 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
551 pSpellSprite.spell_target_pid = a2; | |
552 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
553 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
554 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
555 if ( pParty->bTurnBasedModeOn == 1 ) | |
556 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
557 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
558 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
559 ++pTurnEngine->pending_actions; | |
560 LODWORD(v727) = 1; | |
561 break; | |
562 } | |
563 case SPELL_AIR_IMPLOSION:// | |
564 { | |
2182 | 565 mon_id = PID_ID(a2); |
2179 | 566 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
567 break; | |
568 if (!a2) | |
569 { | |
570 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
571 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
572 pCastSpell->uSpellID = 0; | |
573 continue; | |
574 } | |
575 if (PID_TYPE(a2) == OBJECT_Actor) | |
576 { | |
577 v697.x = 0; | |
578 v697.y = 0; | |
579 v697.z = 0; | |
580 pSpellSprite.stru_24.Reset(); | |
581 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
582 pSpellSprite.spell_level = spell_level; | |
583 pSpellSprite.spell_skill = skill_level; | |
584 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
585 pSpellSprite.uAttributes = 0; | |
586 pSpellSprite.uSectorID = 0; | |
587 pSpellSprite.uSpriteFrameID = 0; | |
588 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
589 pSpellSprite.uFacing = 0; | |
590 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
591 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2182 | 592 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; |
593 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z; | |
594 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; | |
595 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id); | |
596 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v697); | |
2179 | 597 } |
598 LODWORD(v727) = 1; | |
599 break; | |
1296 | 600 } |
2179 | 601 case SPELL_EARTH_MASS_DISTORTION:// |
602 { | |
2182 | 603 mon_id = PID_ID(a2); |
2179 | 604 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
605 break; | |
2182 | 606 if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) ) |
2179 | 607 { |
2182 | 608 pActors[mon_id].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); |
2179 | 609 v704.x = 0; |
610 v704.y = 0; | |
611 v704.z = 0; | |
612 pSpellSprite.stru_24.Reset(); | |
613 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
614 pSpellSprite.spell_level = spell_level; | |
615 pSpellSprite.spell_skill = skill_level; | |
616 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
617 pSpellSprite.uAttributes = 0; | |
618 pSpellSprite.uSectorID = 0; | |
619 pSpellSprite.uSpriteFrameID = 0; | |
620 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
621 pSpellSprite.uFacing = 0; | |
622 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
623 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2182 | 624 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; |
625 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; | |
626 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z; | |
627 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id); | |
628 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v704); | |
2179 | 629 } |
630 LODWORD(v727) = 1; | |
631 break; | |
632 } | |
633 case SPELL_LIGHT_DESTROY_UNDEAD:// | |
634 { | |
635 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
636 break; | |
637 //v730 = a2 >> 3; | |
638 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
639 v691.x = 0; | |
640 v691.y = 0; | |
641 v691.z = 0; | |
642 pSpellSprite.stru_24.Reset(); | |
643 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
644 pSpellSprite.spell_level = spell_level; | |
645 pSpellSprite.spell_skill = skill_level; | |
646 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
647 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
648 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
649 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
650 pSpellSprite.uAttributes = 0; | |
651 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
652 pSpellSprite.uSpriteFrameID = 0; | |
653 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
654 pSpellSprite.spell_target_pid = a2; | |
655 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
656 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
657 pSpellSprite.uAttributes |= 0x80u; | |
658 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
659 int obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
660 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
661 { | |
662 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
663 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
664 pCastSpell->uSpellID = 0; | |
665 continue; | |
666 } | |
667 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
668 LODWORD(v727) = 1; | |
669 break; | |
670 } | |
671 case SPELL_FIRE_FIRE_BOLT:// | |
672 case SPELL_FIRE_FIREBALL:// | |
673 case SPELL_FIRE_INCINERATE:// | |
674 case SPELL_AIR_LIGHNING_BOLT:// | |
675 case SPELL_WATER_ICE_BOLT:// | |
676 case SPELL_WATER_ICE_BLAST:// | |
677 case SPELL_EARTH_STUN:// | |
678 case SPELL_EARTH_DEADLY_SWARM:// | |
679 case SPELL_MIND_MIND_BLAST:// | |
680 case SPELL_MIND_PSYCHIC_SHOCK:// | |
681 case SPELL_BODY_HARM:// | |
682 case SPELL_LIGHT_LIGHT_BOLT:// | |
683 case SPELL_DARK_DRAGON_BREATH:// | |
684 { | |
685 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
686 break; | |
687 pSpellSprite.stru_24.Reset(); | |
688 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
689 pSpellSprite.spell_level = spell_level; | |
690 pSpellSprite.spell_skill = skill_level; | |
691 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
692 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
693 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
694 pSpellSprite.uAttributes = 0; | |
695 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
696 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
697 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
698 else | |
699 pSpellSprite.uSectorID = 0; | |
700 pSpellSprite.uSpriteFrameID = 0; | |
701 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
702 pSpellSprite.spell_target_pid = a2; | |
703 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
704 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
705 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
706 if ( pParty->bTurnBasedModeOn == 1 ) | |
707 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
708 if ( pCastSpell->uSpellID == SPELL_AIR_LIGHNING_BOLT ) | |
709 LOBYTE(pSpellSprite.uAttributes) |= 0x40; | |
710 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
711 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
712 ++pTurnEngine->pending_actions; | |
713 LODWORD(v727) = 1; | |
714 break; | |
715 } | |
716 case SPELL_WATER_ACID_BURST:// | |
717 case SPELL_EARTH_BLADES:// | |
718 case SPELL_BODY_FLYING_FIST:// | |
719 case SPELL_DARK_TOXIC_CLOUD:// | |
720 { | |
721 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
722 break; | |
723 pSpellSprite.stru_24.Reset(); | |
724 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
725 pSpellSprite.spell_level = spell_level; | |
726 pSpellSprite.spell_skill = skill_level; | |
727 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
728 pSpellSprite.uAttributes = 0; | |
729 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
730 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
731 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
732 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
733 pSpellSprite.uSpriteFrameID = 0; | |
734 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
735 pSpellSprite.spell_target_pid = a2; | |
736 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
737 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
738 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
739 if ( pParty->bTurnBasedModeOn == 1 ) | |
740 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
741 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
742 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
743 ++pTurnEngine->pending_actions; | |
744 LODWORD(v727) = 1; | |
745 break; | |
746 } | |
747 case SPELL_LIGHT_SUNRAY:// | |
748 { | |
749 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | |
750 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )// | |
751 { | |
752 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
753 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
754 pCastSpell->uSpellID = 0; | |
755 continue; | |
756 } | |
757 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
758 { | |
759 pSpellSprite.stru_24.Reset(); | |
760 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
761 pSpellSprite.spell_skill = skill_level; | |
762 pSpellSprite.spell_level = spell_level; | |
763 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
764 pSpellSprite.uAttributes = 0; | |
765 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
766 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
767 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
768 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
769 pSpellSprite.uSpriteFrameID = 0; | |
770 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
771 pSpellSprite.spell_target_pid = a2; | |
772 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
773 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
774 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
775 if ( pParty->bTurnBasedModeOn == 1 ) | |
776 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
777 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
778 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
779 ++pTurnEngine->pending_actions; | |
780 LODWORD(v727) = 1; | |
781 } | |
782 break; | |
783 } | |
784 case SPELL_LIGHT_PARALYZE:// | |
785 { | |
786 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
787 break; | |
2182 | 788 mon_id = PID_ID(a2); |
789 if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 9) ) | |
2179 | 790 { |
791 Actor::AI_Stand(PID_ID(a2), 4, 0x80, 0); | |
2182 | 792 pActors[mon_id].pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, 0, 0, 0); |
793 pActors[mon_id].uAttributes |= 0x80000; | |
794 pActors[mon_id].vVelocity.x = 0; | |
795 pActors[mon_id].vVelocity.y = 0; | |
796 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); | |
2179 | 797 } |
798 LODWORD(v727) = 1; | |
799 break; | |
800 } | |
801 case SPELL_EARTH_SLOW:// | |
802 { | |
803 switch (skill_level) | |
804 { | |
2182 | 805 case 1: LODWORD(v733) = 180 * spell_level; amount = 2; break;//LODWORD(v733)??? |
2179 | 806 case 2: LODWORD(v733) = 300 * spell_level; amount = 2; break; |
807 case 3: LODWORD(v733) = 300 * spell_level; amount = 4; break; | |
808 case 4: LODWORD(v733) = 300 * spell_level; amount = 8; break; | |
809 default: | |
810 assert(false); | |
811 } | |
812 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
813 break; | |
2181 | 814 //v721 = 836 * PID_ID(a2); |
2182 | 815 mon_id = PID_ID(a2); |
816 if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) ) | |
2181 | 817 { |
2182 | 818 pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0); |
819 pActors[mon_id].uAttributes |= 0x80000; | |
820 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); | |
2181 | 821 } |
822 LODWORD(v727) = 1; | |
823 break; | |
824 } | |
825 case SPELL_MIND_CHARM:// | |
826 { | |
827 v61 = PID_ID(a2); | |
828 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
829 break; | |
830 if ( stru_50C198.GetMagicalResistance(&pActors[v61], 7) ) | |
2179 | 831 { |
2181 | 832 uint power = 300 * spell_level; |
833 if ( skill_level == 2 ) | |
834 power = 600 * spell_level; | |
835 else if ( skill_level == 3 ) | |
836 power = 29030400; | |
837 | |
838 pActors[v61].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); | |
839 pActors[v61].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); | |
840 pActors[v61].pActorBuffs[ACTOR_BUFF_CHARM].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), skill_level, 0, 0, 0); | |
841 pSpellSprite.stru_24.Reset(); | |
842 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
843 pSpellSprite.spell_level = spell_level; | |
844 pSpellSprite.spell_skill = skill_level; | |
845 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
846 pSpellSprite.vPosition.x = pActors[v61].vPosition.x; | |
847 pSpellSprite.vPosition.y = pActors[v61].vPosition.y; | |
848 pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight; | |
849 pSpellSprite.uAttributes = 0; | |
850 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z); | |
851 pSpellSprite.uSpriteFrameID = 0; | |
852 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
853 pSpellSprite.spell_target_pid = a2; | |
854 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
855 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
856 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
857 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
858 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
2179 | 859 } |
860 LODWORD(v727) = 1; | |
861 break; | |
862 } | |
2181 | 863 case SPELL_DARK_SHRINKING_RAY:// |
864 { | |
865 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
866 break; | |
867 pSpellSprite.stru_24.Reset(); | |
868 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
869 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
870 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
871 pSpellSprite.uAttributes = 0; | |
872 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
873 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
874 pSpellSprite.uSpriteFrameID = 0; | |
875 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
876 pSpellSprite.spell_target_pid = a2; | |
877 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
878 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
879 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
880 pSpellSprite.spell_skill = skill_level; | |
881 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
882 pSpellSprite.spell_level = 300 * spell_level; | |
883 if ( pParty->bTurnBasedModeOn == 1 ) | |
884 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
885 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
886 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
887 ++pTurnEngine->pending_actions; | |
888 LODWORD(v727) = 1; | |
889 break; | |
890 } | |
891 case SPELL_FIRE_FIRE_AURA: // | |
892 { | |
893 switch (skill_level) | |
894 { | |
2182 | 895 case 1: duration = 3600 * spell_level; amount = 10; break; // |
896 case 2: duration = 3600 * spell_level; amount = 11; break; // | |
897 case 3: duration = 3600 * spell_level; amount = 12; break; | |
898 case 4: duration = 0; amount = 12; break; | |
2181 | 899 default: |
900 assert(false); | |
901 } | |
902 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
903 break; | |
904 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; | |
905 ItemDesc* _item = &pItemsTable->pItems[v730c->uItemID]; | |
906 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
907 if ( v730c->uItemID < 64 || v730c->uItemID > 65 | |
908 && !v730c->IsBroken() | |
909 && !v730c->uSpecEnchantmentType | |
910 && !v730c->uEnchantmentType | |
911 && ( _item->uEquipType == EQUIP_SINGLE_HANDED || _item->uEquipType == EQUIP_TWO_HANDED || _item->uEquipType == EQUIP_BOW) | |
912 && !pItemsTable->IsMaterialNonCommon(v730c) ) | |
913 { | |
914 v730c->uSpecEnchantmentType = amount; | |
915 if ( skill_level != 4 ) | |
916 { | |
2182 | 917 v730c->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335); |
2181 | 918 v730c->uAttributes |= ITEM_TEMP_BONUS; |
919 } | |
920 v730c->uAttributes |= ITEM_AURA_EFFECT_RED; | |
921 _50C9A8_item_enchantment_timer = 256; | |
922 LODWORD(v727) = 1; | |
923 break; | |
924 } | |
925 _50C9D0_AfterEnchClickEventId = 113; | |
926 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
927 _50C9D8_AfterEnchClickEventTimeout = 1; | |
928 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
929 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
930 pCastSpell->uSpellID = 0; | |
931 continue; | |
932 } | |
933 case SPELL_BODY_REGENERATION:// | |
934 { | |
935 switch (skill_level) | |
936 { | |
2182 | 937 case 1: amount = 1; break; |
938 case 2: amount = 1; break; | |
939 case 3: amount = 3; break; | |
940 case 4: amount = 10; break; | |
941 default: | |
942 assert(false); | |
943 } | |
944 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
945 break; | |
946 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); | |
947 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0); | |
948 LODWORD(v727) = 1; | |
949 break; | |
950 } | |
951 case SPELL_FIRE_PROTECTION_FROM_FIRE:// | |
952 case SPELL_AIR_PROTECTION_FROM_AIR:// | |
953 case SPELL_WATER_PROTECTION_FROM_WATER:// | |
954 case SPELL_EARTH_PROTECTION_FROM_EARTH:// | |
955 case SPELL_MIND_PROTECTION_FROM_MIND:// | |
956 case SPELL_BODY_PROTECTION_FROM_BODY:// | |
957 { | |
958 switch (skill_level) | |
959 { | |
960 case 1: | |
961 case 2: | |
962 case 3: | |
963 case 4: amount = skill_level * spell_level; break; | |
964 default: | |
965 assert(false); | |
966 } | |
967 switch (pCastSpell->uSpellID) | |
968 { | |
969 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
970 buff_resist = PARTY_BUFF_RESIST_FIRE; | |
971 break; | |
972 case SPELL_AIR_PROTECTION_FROM_AIR: | |
973 buff_resist = PARTY_BUFF_RESIST_AIR; | |
974 break; | |
975 case SPELL_WATER_PROTECTION_FROM_WATER: | |
976 buff_resist = PARTY_BUFF_RESIST_WATER; | |
977 break; | |
978 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
979 buff_resist = PARTY_BUFF_RESIST_EARTH; | |
980 break; | |
981 case SPELL_MIND_PROTECTION_FROM_MIND: | |
982 buff_resist = PARTY_BUFF_RESIST_MIND; | |
983 break; | |
984 case SPELL_BODY_PROTECTION_FROM_BODY: | |
985 buff_resist = PARTY_BUFF_RESIST_BODY; | |
986 break; | |
987 default: | |
988 assert(false); | |
989 continue; | |
990 } | |
991 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
992 break; | |
993 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
994 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
995 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
997 //v90 = (double)(signed int)(3600 * spell_level) * 4.2666669; | |
998 pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0); | |
999 LODWORD(v727) = 1; | |
1000 break; | |
1001 } | |
1002 case SPELL_FIRE_HASTE:// | |
1003 { | |
1004 switch (skill_level) | |
1005 { | |
1006 case 1: duration = 60 * (spell_level + 60); break; | |
1007 case 2: duration = 60 * (spell_level + 60); break; | |
1008 case 3: duration = 180 * (spell_level + 20); break; | |
1009 case 4: duration = 240 * (spell_level + 15); break; | |
1010 default: | |
1011 assert(false); | |
1012 } | |
1013 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
1014 { | |
1015 LODWORD(v727) = 1; | |
1016 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) | |
1017 { | |
1018 if ( pParty->pPlayers[pl_id].pConditions[Condition_Weak] ) | |
1019 LODWORD(v727) = 0; | |
1020 } | |
1021 if (LODWORD(v727)) | |
1022 { | |
1023 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); | |
1024 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
1025 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1026 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1027 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1028 } | |
1029 } | |
1030 break; | |
1031 } | |
1032 case SPELL_SPIRIT_BLESS:// | |
1033 { | |
1034 switch (skill_level) | |
1035 { | |
1036 case 1: duration = 300 * (spell_level + 12); break; | |
1037 case 2: duration = 300 * (spell_level + 12); break; | |
1038 case 3: duration = 900 * (spell_level + 4); break; | |
1039 case 4: duration = 3600 * (spell_level + 1); break; | |
2181 | 1040 default: |
1041 assert(false); | |
1042 } | |
2182 | 1043 amount = spell_level + 5; |
1044 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1045 break; | |
1046 if ( skill_level == 1 ) | |
1047 { | |
1048 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); | |
1049 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); | |
1050 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + | |
1051 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), 1, amount, v111, 0); | |
1052 LODWORD(v727) = 1; | |
1053 break; | |
1054 } | |
1055 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) | |
1056 { | |
1057 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); | |
1058 v111 = pOtherOverlayList->_4418B1(10000, pl_id + 310, 0, 65536); | |
1059 pParty->pPlayers[pl_id].pPlayerBuffs[1].Apply(pParty->uTimePlayed + | |
1060 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, v111, 0); | |
1061 } | |
1062 LODWORD(v727) = 1; | |
1063 break; | |
1064 } | |
1065 case SPELL_SPIRIT_SPIRIT_LASH:// | |
1066 { | |
1067 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) | |
1068 { | |
1069 int mon_id = PID_ID(a2); | |
1070 dist_X = abs(pActors[mon_id].vPosition.x - pParty->vPosition.x); | |
1071 dist_Y = abs(pActors[mon_id].vPosition.y - pParty->vPosition.y); | |
1072 dist_Z = abs(pActors[mon_id].vPosition.z - pParty->vPosition.z); | |
1073 int count = dist_X; | |
1074 new_dist_Y = dist_Y; | |
1075 if ( dist_X < dist_Y ) | |
1076 { | |
1077 v116 = dist_X; | |
1078 dist_X = dist_Y; | |
1079 new_dist_Y = v116; | |
1080 } | |
1081 if ( dist_X < dist_Z ) | |
1082 { | |
1083 v117 = dist_X; | |
1084 dist_X = dist_Z; | |
1085 dist_Z = v117; | |
1086 } | |
1087 if ( new_dist_Y < dist_Z ) | |
1088 { | |
1089 v118 = dist_Z; | |
1090 dist_Z = new_dist_Y; | |
1091 new_dist_Y = v118; | |
1092 } | |
1093 count = ((unsigned int)(11 * new_dist_Y) >> 5) + (dist_Z >> 2) + dist_X; | |
1094 if ( (double)count <= 307.2 ) | |
1095 { | |
1096 v701.x = 0; | |
1097 v701.y = 0; | |
1098 v701.z = 0; | |
1099 pSpellSprite.stru_24.Reset(); | |
1100 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1101 pSpellSprite.spell_level = v723; | |
1102 pSpellSprite.spell_skill = skill_level; | |
1103 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1104 pSpellSprite.uAttributes = 0; | |
1105 pSpellSprite.uSectorID = 0; | |
1106 pSpellSprite.uSpriteFrameID = 0; | |
1107 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
1108 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1109 pSpellSprite.uFacing = 0; | |
1110 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1111 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; | |
1112 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; | |
1113 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z - (unsigned int)(signed __int64)((double)pActors[mon_id].uActorHeight * -0.8); | |
1114 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); | |
1115 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v701); | |
1116 LODWORD(v727) = 1; | |
1117 } | |
1118 else | |
1119 { | |
1120 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);//" !!!" | |
1121 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1122 pCastSpell->uSpellID = 0; | |
1123 } | |
1124 } | |
1125 break; | |
1126 } | |
1127 case SPELL_AIR_SHIELD:// | |
1128 case SPELL_EARTH_STONESKIN:// | |
1129 case SPELL_SPIRIT_HEROISM:// | |
1130 { | |
1131 switch (skill_level) | |
1132 { | |
1133 case 1: duration = 300 * (spell_level + 12); break; | |
1134 case 2: duration = 300 * (spell_level + 12); break; | |
1135 case 3: duration = 900 * (spell_level + 4); break; | |
1136 case 4: duration = 3600 * (spell_level + 1); break; | |
1137 default: | |
1138 assert(false); | |
1139 } | |
1140 switch (pCastSpell->uSpellID) | |
1141 { | |
1142 case SPELL_AIR_SHIELD: | |
1143 amount = 0; | |
1144 buff_resist = PARTY_BUFF_SHIELD; | |
1145 break; | |
1146 case SPELL_EARTH_STONESKIN: | |
1147 amount = spell_level + 5; | |
1148 buff_resist = PARTY_BUFF_STONE_SKIN; | |
1149 break; | |
1150 case SPELL_SPIRIT_HEROISM: | |
1151 amount = spell_level + 5; | |
1152 buff_resist = PARTY_BUFF_HEROISM; | |
1153 break; | |
1154 default: | |
1155 assert(false); | |
1156 continue; | |
1157 } | |
1158 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1159 break; | |
1160 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
1161 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1162 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1163 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1164 pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + | |
1165 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); | |
1166 LODWORD(v727) = 1; | |
1167 break; | |
1168 } | |
1169 case SPELL_FIRE_IMMOLATION:// | |
1170 { | |
1171 if ( skill_level == 4 ) | |
1172 duration = 600 * spell_level; | |
1173 else | |
1174 duration = 60 * spell_level; | |
1175 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1176 break; | |
1177 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
1178 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1179 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1180 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1181 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + | |
1182 (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, spell_level, 0, 0); | |
1183 LODWORD(v727) = 1; | |
1184 break; | |
1185 } | |
1186 case SPELL_FIRE_METEOR_SHOWER:// | |
1187 { | |
1188 //if (skill_level < 3)// | |
1189 //break; | |
1190 int meteor_num; | |
1191 if ( skill_level == 4 ) | |
1192 meteor_num = 20; | |
1193 else | |
1194 meteor_num = 16; | |
1195 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1196 { | |
1197 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! | |
1198 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1199 pCastSpell->uSpellID = 0; | |
1200 continue; | |
1201 } | |
1202 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1203 break; | |
2183 | 1204 obj_type = PID_TYPE(a2); |
2182 | 1205 mon_id = PID_ID(a2); |
1206 if (obj_type == OBJECT_Actor)// ., | |
1207 { | |
1208 dist_X = pActors[mon_id].vPosition.x; | |
1209 dist_Y = pActors[mon_id].vPosition.y; | |
1210 dist_Z = pActors[mon_id].vPosition.z; | |
1211 } | |
1212 else | |
1213 { | |
1214 dist_X = pParty->vPosition.x + fixpoint_mul(2048, stru_5C6E00->Cos(pParty->sRotationY)); | |
1215 dist_Y = pParty->vPosition.y + fixpoint_mul(2048, stru_5C6E00->Sin(pParty->sRotationY)); | |
1216 dist_Z = pParty->vPosition.z; | |
1217 } | |
1218 unsigned __int64 k = 0; | |
1219 int j = 0; | |
1220 if ( meteor_num > 0 ) | |
1221 { | |
1222 v730 = obj_type == OBJECT_Actor ? a2 : 0; | |
1223 for ( meteor_num; meteor_num; meteor_num-- ) | |
1224 { | |
1225 a2 = rand() % 1000; | |
2183 | 1226 if ( sqrt(((double)a2 - 2500) * ((double)a2 - 2500) + j * j + k * k) <= 1.0 ) |
2182 | 1227 { |
1228 LODWORD(v687) = 0; | |
1229 HIDWORD(v687) = 0; | |
1230 } | |
1231 else | |
1232 { | |
2183 | 1233 HIDWORD(v687) = stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), (double)a2 - 2500); |
2182 | 1234 LODWORD(v687) = stru_5C6E00->Atan2(j, k); |
1235 } | |
1236 pSpellSprite.stru_24.Reset(); | |
1237 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1238 pSpellSprite.spell_level = spell_level; | |
1239 pSpellSprite.spell_skill = skill_level; | |
1240 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1241 pSpellSprite.uAttributes = 0; | |
1242 pSpellSprite.vPosition.x = dist_X; | |
1243 pSpellSprite.vPosition.y = dist_Y; | |
2183 | 1244 pSpellSprite.vPosition.z = a2 + dist_Z; |
2182 | 1245 pSpellSprite.uSectorID = 0; |
1246 pSpellSprite.uSpriteFrameID = 0; | |
1247 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1248 pSpellSprite.spell_target_pid = v730; | |
1249 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
1250 pSpellSprite.uFacing = v687; | |
1251 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1252 if ( pParty->bTurnBasedModeOn == 1 ) | |
1253 pSpellSprite.uAttributes = 4; | |
1254 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
1255 ++pTurnEngine->pending_actions; | |
1256 j = rand() % 1024 - 512; | |
1257 k = rand() % 1024 - 512; | |
1258 } | |
1259 } | |
1260 LODWORD(v727) = 1; | |
1261 break; | |
1262 } | |
1263 case SPELL_FIRE_INFERNO:// | |
1264 { | |
1265 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1266 { | |
1267 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
1268 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1269 pCastSpell->uSpellID = 0; | |
1270 continue; | |
1271 } | |
1272 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1273 break; | |
1274 int mon_num = pRenderer->_466_GetActorsInViewport(4096); | |
1275 v700.x = 0; | |
1276 v700.y = 0; | |
1277 v700.z = 0; | |
1278 pSpellSprite.stru_24.Reset(); | |
1279 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1280 pSpellSprite.spell_level = spell_level; | |
1281 pSpellSprite.spell_skill = skill_level; | |
1282 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1283 pSpellSprite.uAttributes = 0; | |
1284 pSpellSprite.uSectorID = 0; | |
1285 pSpellSprite.uSpriteFrameID = 0; | |
1286 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
1287 pSpellSprite.uFacing = 0; | |
1288 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1289 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1290 for ( uint i = 0; i < mon_num; i++ ) | |
1291 { | |
1292 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.x; | |
1293 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.y; | |
1294 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[i]].uActorHeight * -0.8); | |
1295 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[i]); | |
1296 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[i], &v700); | |
1297 pGame->GetStru6()->_4A81CA(&pSpellSprite); | |
1298 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1E, 0x40); | |
1299 } | |
1300 LODWORD(v727) = 1; | |
1301 break; | |
1302 } | |
2183 | 1303 case SPELL_AIR_WIZARD_EYE:// |
1304 { | |
1305 duration = 3600 * spell_level; | |
1306 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1307 break; | |
1308 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) | |
1309 v169 = pOtherOverlayList->_4418B1(2000, pl_id + 100, 0, 65536); | |
1310 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, v169, 0); | |
1311 LODWORD(v727) = 1; | |
1312 break; | |
1313 } | |
1314 case SPELL_AIR_FEATHER_FALL:// | |
1315 { | |
1316 switch (skill_level) | |
1317 { | |
1318 case 1: duration = 300 * spell_level; break; | |
1319 case 2: duration = 600 * spell_level; break; | |
1320 case 3: duration = 3600 * spell_level; break; | |
1321 case 4: duration = 3600 * spell_level; break; | |
1322 default: | |
1323 assert(false); | |
1324 } | |
1325 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1326 break; | |
1327 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) | |
1328 pOtherOverlayList->_4418B1(2010, pl_id + 100, 0, 65536); | |
1329 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
1330 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1331 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1332 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 1333 |
2183 | 1334 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + |
1335 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); | |
1336 LODWORD(v727) = 1; | |
1337 break; | |
1338 } | |
1339 case SPELL_AIR_SPARKS:// | |
1340 { | |
1341 switch (skill_level) | |
1342 { | |
1343 case 1: amount = 3; break; | |
1344 case 2: amount = 5; break; | |
1345 case 3: amount = 7; break; | |
1346 case 4: amount = 9; break; | |
1347 default: | |
1348 assert(false); | |
1349 } | |
1350 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1351 break; | |
1352 int _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
1353 pSpellSprite.stru_24.Reset(); | |
1354 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1355 pSpellSprite.spell_level = spell_level; | |
1356 pSpellSprite.spell_skill = skill_level; | |
1357 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1358 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
1359 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
1360 pSpellSprite.uAttributes = 0; | |
1361 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1362 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, | |
1363 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
1364 pSpellSprite.uSpriteFrameID = 0; | |
1365 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1366 pSpellSprite.spell_target_pid = a2; | |
1367 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
1368 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1369 if ( pParty->bTurnBasedModeOn == 1 ) | |
1370 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
1371 v188 = (signed int)_v726 / -2; | |
1372 v189 = (signed int)_v726 / 2; | |
1373 while ( v188 <= v189 ) | |
1374 { | |
1375 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); | |
1376 if ( pSpellSprite.Create((signed __int16)(v188 + LOWORD(v715.uYawAngle)), v715.uPitchAngle, | |
1377 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 | |
1378 && pParty->bTurnBasedModeOn == 1 ) | |
1379 ++pTurnEngine->pending_actions; | |
1380 v188 += _v726 / (amount - 1); | |
1381 } | |
1382 LODWORD(v727) = 1; | |
1383 break; | |
1384 } | |
1385 case SPELL_AIR_JUMP:// | |
1386 { | |
1387 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
1388 { | |
1389 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
1390 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1391 break; | |
1392 } | |
1393 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1394 break; | |
1395 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) | |
1396 pOtherOverlayList->_4418B1(2040, pl_id + 100, 0, 65536); | |
1397 pParty->uFlags |= 0x100; | |
1398 pParty->uFallSpeed = 1000; | |
1399 LODWORD(v727) = 1; | |
1400 break; | |
1401 } | |
1402 case SPELL_AIR_INVISIBILITY:// | |
1403 { | |
1404 switch (skill_level) | |
1405 { | |
1406 case 1: duration = 600 * spell_level; amount = spell_level; break; | |
1407 case 2: duration = 600 * spell_level; amount = 2 * spell_level; break; | |
1408 case 3: duration = 600 * spell_level; amount = 3 * spell_level; break; | |
1409 case 4: duration = 3600 * spell_level; amount = 4 * spell_level; break; | |
1410 default: | |
1411 assert(false); | |
1412 } | |
1413 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
1414 { | |
1415 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | |
1416 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1417 pCastSpell->uSpellID = 0; | |
1418 continue; | |
1419 } | |
1420 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
1421 { | |
1422 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); | |
1423 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1424 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1425 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1426 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + | |
1427 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); | |
1428 LODWORD(v727) = 1; | |
1429 } | |
1430 break; | |
1431 } | |
1432 case SPELL_AIR_FLY:// | |
1433 { | |
1434 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1435 { | |
1436 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
1437 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1438 break; | |
1439 } | |
1440 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | |
1441 { | |
1442 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
1443 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1444 break; | |
1445 } | |
1446 if ( skill_level == 1 || skill_level == 2 || skill_level == 3 ) | |
1447 amount = 1; | |
1448 else | |
1449 amount = 0; | |
1450 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1451 break; | |
1452 for ( uint pl_id = 0; pl_id < 4; pl_id++) | |
1453 pOtherOverlayList->_4418B1(2090, pl_id + 100, 0, 65536); | |
1454 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
1455 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) | |
1456 * 0.033333335), skill_level, amount, v206, pCastSpell->uPlayerID + 1); | |
1457 LODWORD(v727) = 1; | |
1458 break; | |
1459 } | |
1460 case SPELL_AIR_STARBURST:// | |
1461 { | |
1462 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1463 { | |
1464 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
1465 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1466 pCastSpell->uSpellID = 0; | |
1467 continue; | |
1468 } | |
1469 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1470 break; | |
1471 obj_type = PID_TYPE(a2); | |
1472 mon_id = PID_ID(a2); | |
1473 if ( obj_type == OBJECT_Actor ) | |
1474 { | |
1475 dist_X = pActors[mon_id].vPosition.x; | |
1476 dist_Y = pActors[mon_id].vPosition.y; | |
1477 dist_Z = pActors[mon_id].vPosition.z; | |
1478 } | |
1479 else | |
1480 { | |
1481 dist_X = pParty->vPosition.x + fixpoint_mul(2048, stru_5C6E00->Cos(pParty->sRotationY)); | |
1482 dist_Y = pParty->vPosition.y + fixpoint_mul(2048, stru_5C6E00->Sin(pParty->sRotationY)); | |
1483 dist_Z = pParty->vPosition.z; | |
1484 } | |
1485 unsigned __int64 k = 0; | |
1486 int j = 0; | |
1487 v730 = obj_type == OBJECT_Actor ? a2 : 0; | |
1488 for ( uint star_num = 20; star_num; star_num-- ) | |
1489 { | |
1490 a2 = rand() % 1000; | |
1491 if ( sqrt(((double)a2 + (double)dist_Z - (double)(dist_Z + 2500)) * ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500)) | |
1492 + j * j + k * k) <= 1.0 ) | |
1493 { | |
1494 LODWORD(v685) = 0; | |
1495 HIDWORD(v685) = 0; | |
1496 } | |
1497 else | |
1498 { | |
1499 HIDWORD(v685) = stru_5C6E00->Atan2((signed __int64)sqrt(j * j + k * k), ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500))); | |
1500 LODWORD(v685) = stru_5C6E00->Atan2(j, k); | |
1501 } | |
1502 pSpellSprite.stru_24.Reset(); | |
1503 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1504 pSpellSprite.spell_level = spell_level; | |
1505 pSpellSprite.spell_skill = skill_level; | |
1506 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1507 pSpellSprite.uAttributes = 0; | |
1508 pSpellSprite.vPosition.x = dist_X; | |
1509 pSpellSprite.vPosition.y = dist_Y; | |
1510 pSpellSprite.vPosition.z = (int)(a2 + (dist_Z + 2500)); | |
1511 pSpellSprite.uSectorID = 0; | |
1512 pSpellSprite.uSpriteFrameID = 0; | |
1513 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1514 pSpellSprite.spell_target_pid = v730; | |
1515 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
1516 pSpellSprite.uFacing = v685; | |
1517 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1518 if ( pParty->bTurnBasedModeOn == 1 ) | |
1519 pSpellSprite.uAttributes = 4; | |
1520 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
1521 && pParty->bTurnBasedModeOn == 1 ) | |
1522 ++pTurnEngine->pending_actions; | |
1523 j = rand() % 1024 - 512; | |
1524 k = rand() % 1024 - 512; | |
1525 } | |
1526 LODWORD(v727) = 1; | |
1527 break; | |
1528 } | |
1529 case SPELL_WATER_AWAKEN:// | |
1530 { | |
1531 switch (skill_level) | |
1532 { | |
1533 case 1: amount = 180 * spell_level; break; | |
1534 case 2: amount = 3600 * spell_level; break; | |
1535 case 3: amount = 86400 * spell_level; break; | |
1536 case 4: amount = 0; break; | |
1537 default: | |
1538 assert(false); | |
1539 } | |
1540 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1541 break; | |
1542 for( int i=0; i < 4; i++ ) | |
1543 { | |
1544 if ( skill_level == 4 ) | |
1545 { | |
1546 if ( pParty->pPlayers[i].pConditions[Condition_Sleep] ) | |
1547 { | |
1548 //*((int *)v222 + 4) = 0; | |
1549 //*((int *)v222 + 5) = 0; | |
1550 pParty->pPlayers[i].pConditions[Condition_Sleep] = 0; | |
1551 pParty->pPlayers[i].PlaySound(SPEECH_103, 0); | |
1552 } | |
1553 } | |
1554 else | |
1555 { | |
1556 if ( pParty->pPlayers[i].DiscardConditionIfLastsLongerThan(2, pParty->uTimePlayed - | |
1557 (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)) ) | |
1558 pParty->pPlayers[i].PlaySound(SPEECH_103, 0); | |
1559 } | |
1560 } | |
1561 LODWORD(v727) = 1; | |
1562 break; | |
1563 } | |
1564 case SPELL_WATER_POISON_SPRAY:// | |
1565 { | |
1566 switch (skill_level) | |
1567 { | |
1568 case 1: amount = 1; break; | |
1569 case 2: amount = 3; break; | |
1570 case 3: amount = 5; break; | |
1571 case 4: amount = 7; break; | |
1572 default: | |
1573 assert(false); | |
1574 } | |
1575 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1576 break; | |
1577 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
1578 if ( amount == 1 ) | |
1579 { | |
1580 pSpellSprite.stru_24.Reset(); | |
1581 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1582 pSpellSprite.spell_skill = skill_level; | |
1583 pSpellSprite.spell_level = spell_level; | |
1584 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1585 pSpellSprite.uAttributes = 0; | |
1586 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
1587 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
1588 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1589 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
1590 pSpellSprite.uSpriteFrameID = 0; | |
1591 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1592 pSpellSprite.spell_target_pid = a2; | |
1593 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
1594 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
1595 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1596 if ( pParty->bTurnBasedModeOn == 1 ) | |
1597 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
1598 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
1599 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
1600 ++pTurnEngine->pending_actions; | |
1601 } | |
1602 else | |
1603 { | |
1604 pSpellSprite.stru_24.Reset(); | |
1605 pSpellSprite.spell_id = pCastSpell->uSpellID; | |
1606 pSpellSprite.spell_level = spell_level; | |
1607 pSpellSprite.spell_skill = skill_level; | |
1608 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
1609 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
1610 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
1611 pSpellSprite.uAttributes = 0; | |
1612 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1613 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
1614 pSpellSprite.uSpriteFrameID = 0; | |
1615 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1616 pSpellSprite.spell_target_pid = a2; | |
1617 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
1618 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1619 if ( pParty->bTurnBasedModeOn == 1 ) | |
1620 LOBYTE(pSpellSprite.uAttributes) |= 4; | |
1621 v227 = _v733 / -2; | |
1622 signed int _y = _v733 / 2; | |
1623 if ( v227 <= _y ) | |
1624 { | |
1625 v228 = v715.uYawAngle; | |
1626 do | |
1627 { | |
1628 pSpellSprite.uFacing = v227 + v228; | |
1629 if ( pSpellSprite.Create(pSpellSprite.uFacing, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
1630 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
1631 ++pTurnEngine->pending_actions; | |
1632 v227 += _v733 / (amount - 1); | |
1633 } | |
1634 while ( v227 <= _y ); | |
1635 } | |
1636 } | |
1637 LODWORD(v727) = 1; | |
1638 break; | |
1639 } | |
1640 case SPELL_WATER_WATER_WALK: | |
1641 { | |
1296 | 1642 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
1643 { | |
1644 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
1645 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1646 break; | |
1647 } | |
2179 | 1648 if ( skill_level == 2 || skill_level != 3 && skill_level != 4 ) |
1649 v229 = 600 * spell_level; | |
1296 | 1650 else |
2179 | 1651 v229 = 3600 * spell_level; |
1296 | 1652 LODWORD(v733) = v229; |
1653 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1654 break; | |
2182 | 1655 v169 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); |
1519 | 1656 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
1657 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
1658 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
1659 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 1660 |
2179 | 1661 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), |
2182 | 1662 skill_level, amount, v169, pCastSpell->uPlayerID + 1); |
2179 | 1663 if ( skill_level == 4 ) |
1296 | 1664 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; |
1665 LODWORD(v727) = 1; | |
1666 break; | |
1667 } | |
1668 case SPELL_WATER_RECHARGE_ITEM: | |
1669 { | |
1670 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1671 break; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1362
diff
changeset
|
1672 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; |
1296 | 1673 |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1674 if ( v240->GetItemEquipType() != 12 || v240->uAttributes & 2 ) |
1296 | 1675 { |
1682 | 1676 _50C9D0_AfterEnchClickEventId = 113; |
1677 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
1678 _50C9D8_AfterEnchClickEventTimeout = 1; | |
1296 | 1679 |
1680 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
1681 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 1682 pCastSpell->uSpellID = 0; |
1296 | 1683 continue; |
1684 } | |
2179 | 1685 if ( skill_level == 1 || skill_level == 2 ) |
1296 | 1686 v241 = (double)v723 * 0.0099999998 + 0.5; |
2179 | 1687 else if ( skill_level == 3 ) |
1296 | 1688 v241 = (double)v723 * 0.0099999998 + 0.69999999; |
2179 | 1689 else if ( skill_level == 4 ) |
1296 | 1690 v241 = (double)v723 * 0.0099999998 + 0.80000001; |
1691 else | |
1692 v241 = 0.0; | |
1693 if ( v241 > 1.0 ) | |
1694 v241 = 1.0; | |
1695 int uNewCharges = v240->uMaxCharges * v241; | |
1696 v240->uMaxCharges = uNewCharges; | |
1697 v240->uNumCharges = uNewCharges; | |
1698 if ( uNewCharges <= 0 ) | |
1699 { | |
1700 v240 = 0; | |
1682 | 1701 _50C9D0_AfterEnchClickEventId = 113; |
1702 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
1703 _50C9D8_AfterEnchClickEventTimeout = 1; | |
1296 | 1704 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
1705 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 1706 pCastSpell->uSpellID = 0; |
2179 | 1707 spell_level = v723; |
1296 | 1708 continue; |
1709 } | |
1710 v240->uAttributes |= 0x40u; | |
1711 _50C9A8_item_enchantment_timer = 256; | |
1712 LODWORD(v727) = 1; | |
1713 break; | |
1714 } | |
1715 case SPELL_WATER_ENCHANT_ITEM: | |
1716 { | |
1717 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1682 | 1718 break; |
1296 | 1719 uRequiredMana = 0; |
2179 | 1720 amount = 10 * spell_level; |
1296 | 1721 v730 = 1; |
1722 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1362
diff
changeset
|
1723 v245 = &pPlayer->pInventoryItemList[a2]; |
1296 | 1724 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; |
1725 if ( | |
2179 | 1726 skill_level == 1 || skill_level == 2 && _v725->uEquipType > 2 || |
1727 skill_level == 3 || skill_level == 4 && | |
1296 | 1728 v245->uItemID <= 134 && |
1729 v245->uSpecEnchantmentType == 0 && | |
1730 v245->uEnchantmentType == 0 && | |
1599 | 1731 v245->m_enchantmentStrength== 0 && |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1558
diff
changeset
|
1732 !v245->IsBroken() ) |
1296 | 1733 { |
1734 if ( v245->GetValue() < 450 || | |
2179 | 1735 (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2) |
1296 | 1736 ) |
1737 { | |
1738 v730 = 0; | |
1739 } | |
2080 | 1740 |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
1741 __debugbreak(); // castspellinfo.cpp(1962): warning C4700: uninitialized local variable 'v271' used |
2179 | 1742 if ( rand() % 100 < 10 * spell_level || |
1743 (rand() % 100 < 80 && (skill_level == 3 || skill_level == 4 )) || | |
1296 | 1744 v245->GetValue() < 450 || |
2179 | 1745 (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4) && v271 >= 0 && v271 <= 2) |
1296 | 1746 ) |
1747 { | |
1748 v313 = _v725->uEquipType; | |
1749 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 ) | |
1750 { | |
1751 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
1752 v245->uEnchantmentType = 0; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
1753 __debugbreak(); // castspellinfo.cpp(1971): warning C4700: uninitialized local variable 'v294' used |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1754 for ( kk = pItemsTable->pEnchantments[0].to_item[v245->GetItemEquipType() + 1]; |
1296 | 1755 ; |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1756 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[v245->GetItemEquipType() + 1] ) |
1296 | 1757 { |
1758 ++v245->uEnchantmentType; | |
1759 if ( kk >= v295 ) | |
1760 break; | |
1761 } | |
1762 v255 = 10;//pItemsTable->field_116D8[17]; | |
1763 v256 = 10;//pItemsTable->field_116D8[16]; | |
1599 | 1764 v245->m_enchantmentStrength = v256 + rand() % (v255 - v256 + 1); |
1296 | 1765 v245->uAttributes |= 0x20u; |
1766 _50C9A8_item_enchantment_timer = 256; | |
1767 LODWORD(v727) = 1; | |
1768 break; | |
1769 } | |
2179 | 1770 else if ( skill_level == 3 || skill_level == 4) |
1296 | 1771 { |
1772 v257 = pItemsTable->pSpecialEnchantments_count; | |
1773 v258 = 0; | |
1774 v725 = 0.0; | |
1775 int _v733 = 0; | |
1776 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
1777 { | |
1778 v730 = (int)&v679; | |
1779 do | |
1780 { | |
1781 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
1782 if ( !v259 || v259 == 1 ) | |
1783 { | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1784 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() |
1296 | 1785 + 4] |
1786 + v258 * 28); | |
1787 LODWORD(v725) += v260; | |
1788 if ( v260 ) | |
1789 { | |
1790 v261 = v730; | |
1791 v730 += 4; | |
1792 *(int *)v261 = _v733; | |
1793 } | |
1794 } | |
1795 ++_v733; | |
1796 ++v258; | |
1797 } | |
1798 while ( _v733 < v257 ); | |
1799 } | |
1800 v262 = rand() % SLODWORD(v725); | |
1801 v263 = v679; | |
1802 v245->uSpecEnchantmentType = v679[0]; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1803 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4]; |
1296 | 1804 v265 = v262 + 1; |
1805 if ( v264 < v265 ) | |
1806 { | |
1807 for ( ii = v679; ; ii = (int *)v732 ) | |
1808 { | |
1809 v267 = (int)(ii + 1); | |
1810 v732 = v267; | |
1811 v268 = *(int *)v267; | |
1812 *(int *)(v245 + 12) = v268; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1813 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[v245->GetItemEquipType() |
1296 | 1814 + 4]; |
1815 if ( v264 >= v265 ) | |
1816 break; | |
1817 } | |
1818 } | |
1819 | |
1820 v277 = pItemsTable->pSpecialEnchantments_count; | |
1821 v278 = 0; | |
1822 v725 = 0.0; | |
1823 _v733 = 0; | |
1824 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
1825 { | |
1826 int *_v730 = v679; | |
1827 do | |
1828 { | |
1829 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); | |
1830 if ( !v279 || v279 == 1 ) | |
1831 { | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1832 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[v245->GetItemEquipType()]); |
1296 | 1833 _v733 += v280; |
1834 if ( v280 ) | |
1835 { | |
1836 v281 = _v730; | |
1837 ++_v730; | |
1838 *v281 = _v733; | |
1839 } | |
1840 } | |
1841 ++_v733; | |
1842 ++v278; | |
1843 } | |
1844 while ( _v733 < v277 ); | |
1845 } | |
1846 v282 = rand() % _v733; | |
1847 v283 = v679; | |
1848 v245->uSpecEnchantmentType = v679[0]; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1849 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[v245->GetItemEquipType() ]; |
1296 | 1850 v285 = v282 + 1; |
1851 for ( l = v679; v284 < v285; ++l ) | |
1852 { | |
1853 v245->uSpecEnchantmentType = *(l+1); | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
1854 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[v245->GetItemEquipType()]; |
1296 | 1855 } |
1856 ++v245->uSpecEnchantmentType; | |
1857 v245->uAttributes |= 0x20u; | |
1858 _50C9A8_item_enchantment_timer = 256; | |
1859 LODWORD(v727) = 1; | |
1860 break; | |
1861 } | |
1862 } | |
1863 else | |
1864 { | |
1865 if ( !(BYTE1(v245->uAttributes) & 2) ) | |
1866 { | |
1867 v245->uAttributes |= 2; | |
1868 } | |
1869 } | |
1870 | |
1871 } | |
1872 | |
1873 if ( LODWORD(v727) == 0 ) | |
1874 { | |
1875 v317 = pGlobalTXT_LocalizationStrings[428]; | |
1876 if ( v730 == 0 ) | |
1877 v317 = pGlobalTXT_LocalizationStrings[585]; | |
1878 ShowStatusBarString(v317, 2u); | |
1879 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1880 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
1519 | 1881 pCastSpell->uSpellID = 0; |
1296 | 1882 v318->PlaySound(SPEECH_43, 0); |
1883 } | |
1884 | |
1885 break; | |
1886 } | |
1887 case SPELL_WATER_TOWN_PORTAL: | |
1888 { | |
2179 | 1889 amount = 10 * spell_level; |
1296 | 1890 if ( pPlayer->sMana < (signed int)uRequiredMana ) |
1891 break; | |
2179 | 1892 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && skill_level != 4 || rand() % 100 >= amount && skill_level != 4 ) |
1296 | 1893 { |
1894 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
1895 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 1896 pCastSpell->uSpellID = 0; |
1296 | 1897 continue; |
1898 } | |
1899 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); | |
1900 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
1901 LODWORD(v727) = 1; | |
1902 break; | |
1903 } | |
1904 case SPELL_WATER_LLOYDS_BEACON: | |
1905 { | |
2179 | 1906 LODWORD(v733) = 604800 * spell_level; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1459
diff
changeset
|
1907 if ( !_stricmp(pCurrentMapName, "d05.blv") ) |
1296 | 1908 { |
1909 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
1910 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 1911 pCastSpell->uSpellID = 0; |
1296 | 1912 continue; |
1913 } | |
1914 v319 = uRequiredMana; | |
1915 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
1916 { | |
1917 pEventTimer->Pause(); | |
1918 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0); | |
1919 qword_506350 = (signed int)v733; | |
1920 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; | |
1921 ::uRequiredMana = v319; | |
1922 ::sRecoveryTime = sRecoveryTime; | |
1923 dword_50633C = pCastSpell->sound_id; | |
1519 | 1924 dword_506338 = pCastSpell->uSpellID; |
1925 pCastSpell->uFlags |= 0x20u; | |
1296 | 1926 } |
1927 break; | |
1928 } | |
1929 case SPELL_EARTH_STONE_TO_FLESH: | |
1930 { | |
1931 __debugbreak(); // missing GM ? | |
2179 | 1932 switch (skill_level) |
1296 | 1933 { |
2179 | 1934 case 1: amount = 3600 * spell_level; break; |
1935 case 2: amount = 3600 * spell_level; break; | |
1936 case 3: amount = 86400 * spell_level; break; | |
1296 | 1937 case 4: break; |
1938 default: | |
1939 assert(false); | |
1940 } | |
1941 //LABEL_634: | |
1942 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1943 break; | |
1944 v323 = pCastSpell->uPlayerID_2; | |
2057 | 1945 v324 = (char *)&pParty->pPlayers[v323].pConditions[Condition_Pertified]; |
1946 if ( !pParty->pPlayers[v323].pConditions[Condition_Pertified] ) | |
1296 | 1947 { |
1948 LODWORD(v727) = 1; | |
1949 break; | |
1950 } | |
2179 | 1951 if ( skill_level == 4 ) |
1296 | 1952 { |
1953 *(int *)v324 = 0; | |
1954 *((int *)v324 + 1) = 0; | |
1955 LODWORD(v727) = 1; | |
1956 break; | |
1957 } | |
1958 v732 = amount << 7; | |
1959 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
1960 v656 = 15; | |
1961 v325 = &pParty->pPlayers[v323]; | |
1962 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
1963 LODWORD(v727) = 1; | |
1964 break; | |
1965 } | |
1966 case SPELL_EARTH_ROCK_BLAST: | |
1967 { | |
1968 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
1969 break; | |
1970 pSpellSprite.stru_24.Reset(); | |
1519 | 1971 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 1972 pSpellSprite.spell_level = spell_level; |
1973 pSpellSprite.spell_skill = skill_level; | |
1296 | 1974 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
1975 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
1976 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
1977 pSpellSprite.uAttributes = 0; | |
1978 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2179 | 1979 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
1296 | 1980 pSpellSprite.uSpriteFrameID = 0; |
1981 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
1982 pSpellSprite.spell_target_pid = a2; | |
1983 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
1984 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
1985 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
1986 if ( pParty->bTurnBasedModeOn == 1 ) | |
1987 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
1988 | |
1989 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
1990 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
1450 | 1991 ++pTurnEngine->pending_actions; |
1296 | 1992 LODWORD(v727) = 1; |
1993 break; | |
1994 } | |
1995 case SPELL_EARTH_DEATH_BLOSSOM: | |
1996 { | |
1997 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1998 { | |
1999 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
2000 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 2001 pCastSpell->uSpellID = 0; |
1296 | 2002 continue; |
2003 } | |
2004 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2005 break; | |
2006 pSpellSprite.uType = 4090; | |
2007 pSpellSprite.stru_24.Reset(); | |
1519 | 2008 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2009 pSpellSprite.spell_level = spell_level; |
2010 pSpellSprite.spell_skill = skill_level; | |
1296 | 2011 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2012 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
2013 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
2014 pSpellSprite.uAttributes = 0; | |
2015 pSpellSprite.uSectorID = 0; | |
2016 pSpellSprite.uSpriteFrameID = 0; | |
2017 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
2018 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
2019 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2020 pSpellSprite.spell_target_pid = a2; | |
2021 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); | |
2022 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2023 if ( pParty->bTurnBasedModeOn == 1 ) | |
2024 pSpellSprite.uAttributes = 4; | |
2025 | |
2026 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
2027 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
1450 | 2028 ++pTurnEngine->pending_actions; |
1296 | 2029 LODWORD(v727) = 1; |
2030 break; | |
2031 } | |
2032 case SPELL_SPIRIT_DETECT_LIFE: | |
2033 { | |
2179 | 2034 v328 = skill_level - 2; |
1296 | 2035 if ( v328 ) |
2036 { | |
2037 v329 = v328 - 1; | |
2038 if ( v329 && v329 != 1 ) | |
2179 | 2039 v330 = 600 * spell_level; |
1296 | 2040 else |
2179 | 2041 v330 = 3600 * spell_level; |
1296 | 2042 } |
2043 else | |
2044 { | |
2179 | 2045 v330 = 1800 * spell_level; |
1296 | 2046 } |
2047 LODWORD(v733) = v330; | |
2048 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2049 break; | |
1519 | 2050 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
2051 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
2052 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
2053 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 2054 |
2179 | 2055 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, 0, 0, 0); |
1296 | 2056 LODWORD(v727) = 1; |
2057 break; | |
2058 } | |
2059 case SPELL_SPIRIT_FATE: | |
2060 { | |
2179 | 2061 switch (skill_level) |
1296 | 2062 { |
2179 | 2063 case 1: amount = 1 * spell_level; break; |
2064 case 2: amount = 2 * spell_level; break; | |
2065 case 3: amount = 4 * spell_level; break; | |
2066 case 4: amount = 6 * spell_level; break; | |
1296 | 2067 default: |
2068 assert(false); | |
2069 } | |
2070 LODWORD(v733) = 300; | |
2071 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2072 break; | |
2073 v342 = pCastSpell->spell_target_pid; | |
2074 if ( v342 == 0 ) | |
2075 { | |
1519 | 2076 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2077 |
2179 | 2078 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0); |
1296 | 2079 LODWORD(v727) = 1; |
2080 break; | |
2081 } | |
2082 if (PID_TYPE(v342) == OBJECT_Actor) | |
2083 { | |
2084 v343 = PID_ID(v342); | |
2085 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
2086 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
2179 | 2087 pActors[v343].pActorBuffs[ACTOR_BUFF_FATE].Apply(v344, skill_level, amount, 0, 0); |
1296 | 2088 BYTE2(pActors[v343].uAttributes) |= 8u; |
2089 //v672 = 0; | |
2090 v661 = &pActors[v343]; | |
2091 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); | |
2092 } | |
2093 LODWORD(v727) = 1; | |
2094 break; | |
2095 } | |
2096 case SPELL_SPIRIT_REMOVE_CURSE: | |
2097 { | |
2179 | 2098 switch (skill_level) |
1296 | 2099 { |
2179 | 2100 case 1: amount = 3600 * spell_level; break; |
2101 case 2: amount = 3600 * spell_level; break; | |
2102 case 3: amount = 86400 * spell_level; break; | |
1296 | 2103 case 4: amount = 0; break; |
2104 default: | |
2105 assert(false); | |
2106 } | |
2107 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2108 break; | |
2109 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
2057 | 2110 if ( !v351->pConditions[Condition_Cursed] ) |
1296 | 2111 { |
2112 LODWORD(v727) = 1; | |
2113 break; | |
2114 } | |
2179 | 2115 if ( skill_level == 4 ) |
1296 | 2116 { |
2057 | 2117 LODWORD(v351->pConditions[Condition_Cursed]) = 0; |
2118 HIDWORD(v351->pConditions[Condition_Cursed]) = 0; | |
1296 | 2119 } |
2120 else | |
2121 { | |
2122 v732 = amount << 7; | |
2123 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
2124 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) | |
2125 { | |
2126 LODWORD(v727) = 1; | |
2127 break; | |
2128 } | |
2129 } | |
1519 | 2130 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2131 LODWORD(v727) = 1; |
2132 break; | |
2133 } | |
2134 case SPELL_SPIRIT_PRESERVATION: | |
2135 { | |
2179 | 2136 if ( skill_level == 4 ) |
2137 LODWORD(v733) = 900 * (spell_level + 4); | |
1296 | 2138 else |
2179 | 2139 LODWORD(v733) = 300 * (spell_level + 12); |
1296 | 2140 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2141 break; | |
2179 | 2142 if ( skill_level == 1 || skill_level == 2 ) |
1296 | 2143 { |
1519 | 2144 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
2179 | 2145 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, 0, 0, 0); |
1296 | 2146 LODWORD(v727) = 1; |
2147 break; | |
2148 } | |
2149 a2 = 0; | |
2150 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
2151 v357 = pParty->pPlayers.data();//[0].pPlayerBuffs[11]; |
1296 | 2152 do |
2153 { | |
1519 | 2154 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, a2); |
2179 | 2155 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, skill_level, 0, 0, 0); |
1296 | 2156 ++a2; |
2157 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
2158 } | |
2159 while ( v357 <= &pParty->pPlayers[3] ); | |
2160 LODWORD(v727) = 1; | |
2161 break; | |
2162 } | |
2163 case SPELL_SPIRIT_TURN_UNDEAD: | |
2164 { | |
2179 | 2165 if ( skill_level == 1 || skill_level == 2) |
2166 LODWORD(v733) = 60 * (spell_level + 3); | |
1296 | 2167 else |
2179 | 2168 LODWORD(v733) = 300 * spell_level + 180; |
1296 | 2169 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2170 break; | |
2182 | 2171 int _v726 = pRenderer->_466_GetActorsInViewport(4096); |
2155 | 2172 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFF, 192); |
1296 | 2173 ++pSpellSprite.uType; |
2174 pSpellSprite.stru_24.Reset(); | |
1519 | 2175 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2176 pSpellSprite.spell_level = spell_level; |
2177 pSpellSprite.spell_skill = skill_level; | |
1296 | 2178 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2179 pSpellSprite.uAttributes = 0; | |
2180 pSpellSprite.uSectorID = 0; | |
2181 pSpellSprite.uSpriteFrameID = 0; | |
2182 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
2183 pSpellSprite.uFacing = 0; | |
2184 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2185 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2186 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
2187 { | |
2182 | 2188 v369 = &pActors[_50BF30_actors_in_viewport_ids[a2]]; |
1296 | 2189 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
2190 { | |
2191 pSpellSprite.vPosition.x = v369->vPosition.x; | |
2192 pSpellSprite.vPosition.y = v369->vPosition.y; | |
2154 | 2193 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * -0.8); |
1296 | 2194 |
2182 | 2195 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 2196 pSpellSprite.Create(0, 0, 0, 0); |
2179 | 2197 v369->pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
2198 skill_level, 0, 0, 0); | |
1296 | 2199 } |
2200 } | |
2201 LODWORD(v727) = 1; | |
2202 break; | |
2203 } | |
2204 case SPELL_SPIRIT_RAISE_DEAD: | |
2205 { | |
2179 | 2206 if ( skill_level == 4 ) |
1296 | 2207 amount = 0; |
2208 else | |
2179 | 2209 amount = 86400 * spell_level; |
1296 | 2210 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2211 break; | |
2212 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); | |
2213 v373 = pCastSpell->uPlayerID_2; | |
2214 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
2215 { | |
2216 LODWORD(v727) = 1; | |
2217 break; | |
2218 } | |
2181 | 2219 //v14 = skill_level == 4; |
1296 | 2220 pParty->pPlayers[v373].sHealth = 1; |
2181 | 2221 if ( skill_level == 4 ) |
1296 | 2222 { |
2223 v374 = pCastSpell->uPlayerID_2; | |
2224 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
2225 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
2226 v376 = pCastSpell->uPlayerID_2; | |
2227 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
2228 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
2229 } | |
2230 else | |
2231 { | |
2232 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
2233 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
2234 0xEu, | |
2235 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2236 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
2237 0xDu, | |
2238 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2239 } | |
2240 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
2241 v377->SetCondition(1, 0); | |
2242 LODWORD(v727) = 1; | |
2243 break; | |
2244 } | |
2245 case SPELL_SPIRIT_SHARED_LIFE: | |
2246 { | |
2179 | 2247 if ( skill_level == 4 ) |
2248 amount = 4 * spell_level; | |
1296 | 2249 else |
2179 | 2250 amount = 3 * spell_level; |
1296 | 2251 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2252 break; | |
2253 v381 = 0; | |
2254 signed int _v733 = amount; | |
2255 v730 = 0; | |
2256 v382 = 1; | |
2257 do | |
2258 { | |
2259 v383 = pPlayers[v382]; | |
2260 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
2261 v682[v381++] = v382; | |
2262 ++v382; | |
2263 } | |
2264 while ( v382 <= 4 ); | |
2265 v384 = 0; | |
2266 v730 = v381; | |
2267 if ( v381 > 0 ) | |
2268 { | |
2269 do | |
2270 _v733 += pPlayers[v682[v384++]]->sHealth; | |
2271 while ( v384 < v381 ); | |
2272 } | |
2273 v732 = (signed __int64)((double)_v733 / (double)v730); | |
2274 _v733 = 0; | |
2275 if ( v381 > 0 ) | |
2276 { | |
2277 do | |
2278 { | |
2279 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
2280 v726 = pPlayers[v682[_v733]]; | |
2281 v726->sHealth = v732; | |
2282 //v386 = v726->GetMaxHealth(); | |
2283 if ( v726->sHealth > v726->GetMaxHealth()) | |
2284 v726->sHealth = v726->GetMaxHealth(); | |
2285 if ( v726->sHealth > 0 ) | |
2286 { | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1340
diff
changeset
|
2287 v726->SetUnconcious(0); |
1296 | 2288 } |
2289 v388 = _v733; | |
2290 | |
1519 | 2291 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, LOWORD(v682[_v733]) - 1); |
1296 | 2292 _v733 = v388 + 1; |
2293 } | |
2294 while ( v388 + 1 < v730 ); | |
2295 } | |
2296 LODWORD(v727) = 1; | |
2297 break; | |
2298 } | |
2299 case SPELL_SPIRIT_RESSURECTION: | |
2300 { | |
2179 | 2301 switch (skill_level) |
1296 | 2302 { |
2179 | 2303 case 1: amount = 180 * spell_level; break; |
2304 case 2: amount = 10800 * spell_level; break; | |
2305 case 3: amount = 259200 * spell_level; break; | |
1296 | 2306 case 4: amount = 0; break; |
2307 default: | |
2308 assert(false); | |
2309 } | |
2310 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2311 break; | |
2312 v396 = pCastSpell->uPlayerID_2; | |
2313 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
2314 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
2315 { | |
2316 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
2317 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
2179 | 2318 if ( skill_level == 4 ) |
1296 | 2319 { |
2320 v397 = pCastSpell->uPlayerID_2; | |
2321 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
2322 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
2323 v398 = pCastSpell->uPlayerID_2; | |
2324 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
2325 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
2326 v399 = pCastSpell->uPlayerID_2; | |
2327 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
2328 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
2329 } | |
2330 else | |
2331 { | |
2332 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
2333 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
2334 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2335 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
2336 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2337 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
2338 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2339 } | |
2340 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); | |
2341 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; | |
1519 | 2342 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2343 } |
2344 LODWORD(v727) = 1; | |
2345 break; | |
2346 } | |
2347 case SPELL_MIND_CURE_PARALYSIS: | |
2348 { | |
2179 | 2349 switch (skill_level) |
1296 | 2350 { |
2179 | 2351 case 1: amount = 3600 * spell_level; break; |
2352 case 2: amount = 3600 * spell_level; break; | |
2353 case 3: amount = 86400 * spell_level; break; | |
1296 | 2354 case 4: amount = 0; break; |
2355 default: | |
2356 assert(false); | |
2357 } | |
2358 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2359 break; | |
2360 | |
1519 | 2361 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2362 v323 = pCastSpell->uPlayerID_2; |
2363 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
2364 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
2365 { | |
2366 LODWORD(v727) = 1; | |
2367 break; | |
2368 } | |
2179 | 2369 if ( skill_level == 4 ) |
1296 | 2370 { |
2371 *(int *)v324 = 0; | |
2372 *((int *)v324 + 1) = 0; | |
2373 LODWORD(v727) = 1; | |
2374 break; | |
2375 } | |
2376 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
2377 v656 = 12; | |
2378 v325 = &pParty->pPlayers[v323]; | |
2379 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
2380 LODWORD(v727) = 1; | |
2381 break; | |
2382 } | |
2383 case SPELL_MIND_REMOVE_FEAR: | |
2384 { | |
2179 | 2385 switch (skill_level) |
1296 | 2386 { |
2179 | 2387 case 1: amount = 180 * spell_level; break; |
2388 case 2: amount = 3600 * spell_level; break; | |
2389 case 3: amount = 86400 * spell_level; break; | |
1296 | 2390 case 4: amount = 0; break; |
2391 default: | |
2392 assert(false); | |
2393 } | |
2394 | |
2395 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2396 break; | |
2397 | |
1519 | 2398 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2399 v323 = pCastSpell->uPlayerID_2; |
2400 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
2401 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
2402 { | |
2403 LODWORD(v727) = 1; | |
2404 break; | |
2405 } | |
2179 | 2406 if ( skill_level == 4 ) |
1296 | 2407 { |
2408 *(int *)v324 = 0; | |
2409 *((int *)v324 + 1) = 0; | |
2410 LODWORD(v727) = 1; | |
2411 break; | |
2412 } | |
2413 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
2414 v656 = 3; | |
2415 v325 = &pParty->pPlayers[v323]; | |
2416 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
2417 LODWORD(v727) = 1; | |
2418 break; | |
2419 } | |
2420 case SPELL_MIND_TELEPATHY: | |
2421 { | |
2422 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2423 break; | |
2424 if (PID_TYPE(a2) != OBJECT_Actor) | |
2425 { | |
2426 LODWORD(v727) = 1; | |
2427 break; | |
2428 } | |
2429 v417 = &pActors[PID_ID(a2)]; | |
2430 Actor * _v730 = v417; | |
2431 if ( !(BYTE2(v417->uAttributes) & 0x80) ) | |
2432 { | |
2433 v417->SetRandomGoldIfTheresNoItem(); | |
2434 v417 = _v730; | |
2435 } | |
2436 v418 = v417->array_000234[3].uItemID; | |
2437 signed int _v733 = 0; | |
2438 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
2439 _v733 = v417->array_000234[3].uSpecEnchantmentType; | |
2440 | |
2441 //ItemGen::ItemGen(&v683); | |
2442 v683.Reset(); | |
2443 | |
2444 v419 = _v730->uCarriedItemID; | |
2445 if (v419) | |
2446 { | |
2447 v683.uItemID = v419; | |
2448 //goto LABEL_799; | |
2449 } | |
2450 else | |
2451 { | |
2452 v420 = 0; | |
2453 v421 = _v730->array_000234; | |
1709
8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents:
1682
diff
changeset
|
2454 while ( !v421->uItemID || v421->GetItemEquipType() == 18 ) |
1296 | 2455 { |
2456 ++v420; | |
2457 ++v421; | |
2458 if ( v420 >= 4 ) | |
2459 break; | |
2460 } | |
2461 if ( v420 < 4 ) | |
2462 { | |
2463 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683)); | |
2179 | 2464 spell_level = v723; |
1296 | 2465 //v1 = 0; |
2466 } | |
2467 } | |
2468 // LABEL_799: | |
2469 if ( _v733 != 0 ) | |
2470 { | |
2471 v675 = _v733; | |
2472 if (v683.uItemID) | |
2473 { | |
2474 v422 = v683.GetDisplayName(); | |
2475 sprintf(pTmpBuf2.data(), "(%s), and %d gold", v422, v675); | |
2476 | |
2477 } | |
2478 else | |
2479 { | |
2480 v664 = "%d gold"; | |
2481 sprintf(pTmpBuf2.data(), v664, v675); | |
2482 } | |
2483 } | |
2484 else | |
2485 { | |
2486 if (v683.uItemID) | |
2487 { | |
2488 const char *_v675 = v683.GetDisplayName(); | |
2489 v664 = "(%s)"; | |
2490 sprintf(pTmpBuf2.data(), v664, _v675); | |
2491 } | |
2492 else | |
2493 { | |
2494 strcpy(pTmpBuf2.data(), "nothing"); | |
2181 | 2495 ShowStatusBarString(pTmpBuf2.data(), 2); |
1296 | 2496 } |
2497 } | |
2181 | 2498 ShowStatusBarString(pTmpBuf2.data(), 2); |
1296 | 2499 pSpellSprite.stru_24.Reset(); |
1519 | 2500 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2501 pSpellSprite.spell_level = spell_level; |
2502 pSpellSprite.spell_skill = skill_level; | |
1296 | 2503 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2504 pSpellSprite.vPosition.x = _v730->vPosition.x; | |
2505 pSpellSprite.vPosition.y = _v730->vPosition.y; | |
2506 pSpellSprite.vPosition.z = _v730->uActorHeight; | |
2507 pSpellSprite.uAttributes = 0; | |
2181 | 2508 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); |
1296 | 2509 pSpellSprite.uSpriteFrameID = 0; |
2510 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2511 pSpellSprite.spell_target_pid = a2; | |
2512 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2513 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2514 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
2515 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2516 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
2517 LODWORD(v727) = 1; | |
2518 break; | |
2519 } | |
2520 case SPELL_MIND_BERSERK: | |
2521 { | |
2179 | 2522 switch (skill_level) |
1296 | 2523 { |
2179 | 2524 case 1: amount = 300 * spell_level; break; |
2525 case 2: amount = 300 * spell_level; break; | |
2526 case 3: amount = 600 * spell_level; break; | |
1296 | 2527 case 4: amount = 3600; break; |
2528 default: | |
2529 assert(false); | |
2530 } | |
2531 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2532 break; | |
2533 v426 = PID_ID(a2); | |
2534 if (PID_TYPE(a2) != OBJECT_Actor) | |
2535 { | |
2536 LODWORD(v727) = 1; | |
2537 break; | |
2538 } | |
2539 v730 = 836 * v426; | |
2540 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
2541 { | |
1947 | 2542 pActors[v426].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); |
1956
542c13cd72e2
pActorBuffs[12] to pActorBuffs[ACTOR_BUFF_ENSLAVED]
Grumpy7
parents:
1955
diff
changeset
|
2543 pActors[v426].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); |
1953 | 2544 pActors[v426].pActorBuffs[ACTOR_BUFF_BERSERK].Apply( |
1296 | 2545 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
2179 | 2546 skill_level, 0, 0, 0); |
1296 | 2547 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
2548 } | |
2549 pSpellSprite.stru_24.Reset(); | |
1519 | 2550 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2551 pSpellSprite.spell_level = spell_level; |
2552 pSpellSprite.spell_skill = skill_level; | |
1296 | 2553 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2554 v61 = v426; | |
2555 pSpellSprite.uObjectDescID = v60; | |
2181 | 2556 pSpellSprite.vPosition.x = pActors[v61].vPosition.x; |
2557 pSpellSprite.vPosition.y = pActors[v61].vPosition.y; | |
2558 pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight; | |
1296 | 2559 pSpellSprite.uAttributes = 0; |
2181 | 2560 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z); |
1296 | 2561 pSpellSprite.uSpriteFrameID = 0; |
2562 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2563 pSpellSprite.spell_target_pid = a2; | |
2564 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2565 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2566 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
2567 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2568 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
2569 LODWORD(v727) = 1; | |
2570 break; | |
2571 } | |
2572 case SPELL_MIND_ENSLAVE: | |
2573 { | |
2574 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2575 break; | |
2179 | 2576 amount = 600 * spell_level; |
1296 | 2577 if (PID_TYPE(a2) != OBJECT_Actor) |
2578 { | |
2579 LODWORD(v727) = 1; | |
2580 break; | |
2581 } | |
2582 v730 = 836 * PID_ID(a2); | |
2583 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
2584 break; | |
2585 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
2586 { | |
1953 | 2587 pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); |
1947 | 2588 pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); |
1956
542c13cd72e2
pActorBuffs[12] to pActorBuffs[ACTOR_BUFF_ENSLAVED]
Grumpy7
parents:
1955
diff
changeset
|
2589 pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
2179 | 2590 skill_level, 0, 0, 0); |
1296 | 2591 } |
2592 pSpellSprite.stru_24.Reset(); | |
1519 | 2593 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2594 pSpellSprite.spell_level = spell_level; |
2595 pSpellSprite.spell_skill = skill_level; | |
1296 | 2596 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2597 v61 = PID_ID(a2); | |
2598 pSpellSprite.uObjectDescID = v60; | |
2181 | 2599 pSpellSprite.vPosition.x = pActors[v61].vPosition.x; |
2600 pSpellSprite.vPosition.y = pActors[v61].vPosition.y; | |
2601 pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight; | |
1296 | 2602 pSpellSprite.uAttributes = 0; |
2181 | 2603 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z); |
1296 | 2604 pSpellSprite.uSpriteFrameID = 0; |
2605 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2606 pSpellSprite.spell_target_pid = a2; | |
2607 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
2608 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
2609 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
2610 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2611 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
2612 LODWORD(v727) = 1; | |
2613 break; | |
2614 } | |
2615 case SPELL_MIND_MASS_FEAR: | |
2616 { | |
2179 | 2617 if ( skill_level == 4 ) |
2618 amount = 300 * spell_level; | |
1296 | 2619 else |
2179 | 2620 amount = 180 * spell_level; |
1296 | 2621 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2622 break; | |
2182 | 2623 int _v726 = pRenderer->_466_GetActorsInViewport(4096); |
2155 | 2624 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 192); |
1296 | 2625 ++pSpellSprite.uType; |
2626 pSpellSprite.stru_24.Reset(); | |
1519 | 2627 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 2628 pSpellSprite.spell_level = spell_level; |
2629 pSpellSprite.spell_skill = skill_level; | |
1296 | 2630 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
2631 pSpellSprite.uAttributes = 0; | |
2632 pSpellSprite.uSectorID = 0; | |
2633 pSpellSprite.uSpriteFrameID = 0; | |
2634 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
2635 pSpellSprite.uFacing = 0; | |
2636 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
2637 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
2638 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
2639 { | |
2182 | 2640 v433 = &pActors[_50BF30_actors_in_viewport_ids[a2]]; |
1296 | 2641 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
2642 break; | |
2643 pSpellSprite.vPosition.x = v433->vPosition.x; | |
2644 pSpellSprite.vPosition.y = v433->vPosition.y; | |
2154 | 2645 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * -0.8); |
1296 | 2646 |
2182 | 2647 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 2648 pSpellSprite.Create(0, 0, 0, 0); |
2649 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
2650 { | |
1950 | 2651 v433->pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
2179 | 2652 skill_level, 0, 0, 0); |
1296 | 2653 } |
2654 } | |
2655 LODWORD(v727) = 1; | |
2656 break; | |
2657 } | |
2658 case SPELL_MIND_CURE_INSANITY: | |
2659 { | |
2179 | 2660 v435 = skill_level - 2; |
2661 if ( skill_level == 4 ) | |
1296 | 2662 amount = 0; |
2663 else | |
2179 | 2664 amount = 86400 * spell_level; |
1296 | 2665 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2666 break; | |
2667 | |
1519 | 2668 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2669 v440 = pCastSpell->uPlayerID_2; |
2670 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
2671 { | |
2672 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
2673 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
2179 | 2674 if ( skill_level == 4 ) |
1296 | 2675 { |
2676 v441 = pCastSpell->uPlayerID_2; | |
2677 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
2678 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
2679 } | |
2680 else | |
2681 { | |
2682 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
2683 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
2684 } | |
2685 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
2686 v377->SetCondition(1, 0); | |
2687 } | |
2688 LODWORD(v727) = 1; | |
2689 break; | |
2690 } | |
2691 case SPELL_EARTH_TELEKINESIS: | |
2692 { | |
2179 | 2693 switch (skill_level) |
1296 | 2694 { |
2179 | 2695 case 1: amount = 2 * spell_level; break; |
2696 case 2: amount = 2 * spell_level; break; | |
2697 case 3: amount = 3 * spell_level; break; | |
2698 case 4: amount = 4 * spell_level; break; | |
1296 | 2699 default: |
2700 assert(false); | |
2701 } | |
2702 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2703 break; | |
2704 v445 = PID_ID(a2); | |
2705 if (PID_TYPE(a2) == OBJECT_Item) | |
2706 { | |
2707 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
2708 v450 = *(int *)v449; | |
2709 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
2710 { | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1793
diff
changeset
|
2711 pParty->PartyFindsGold(*((int *)v449 + 3), 0); |
1296 | 2712 viewparams->bRedrawGameUI = 1; |
2713 } | |
2714 else | |
2715 { | |
2716 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); | |
2717 ShowStatusBarString(pTmpBuf2.data(), 2u); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1519
diff
changeset
|
2718 if ( !pParty->AddItemToParty(&pSpriteObjects[v445].stru_24) ) |
1296 | 2719 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); |
2720 } | |
2721 SpriteObject::OnInteraction(v445); | |
2722 } | |
2723 else | |
2724 { | |
2725 if (PID_TYPE(a2) == OBJECT_Actor) | |
2726 { | |
1966
7840fe323f67
stru319::LootActor(struct Actor *pActor) to Actor::LootActor
Grumpy7
parents:
1956
diff
changeset
|
2727 pActors[v445].LootActor(); |
1296 | 2728 } |
2729 else | |
2730 { | |
2731 if (PID_TYPE(a2) != OBJECT_Decoration) | |
2732 { | |
2733 if (PID_TYPE(a2) != OBJECT_BModel) | |
2734 { | |
2735 LODWORD(v727) = 1; | |
2736 break; | |
2737 } | |
1408 | 2738 OpenedTelekinesis = true; |
1296 | 2739 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
1408 | 2740 v448 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; |
1296 | 2741 else |
1408 | 2742 v448 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; |
2743 EventProcessor(v448, a2, 1); | |
1296 | 2744 LODWORD(v727) = 1; |
2745 break; | |
2746 } | |
1408 | 2747 OpenedTelekinesis = true; |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1477
diff
changeset
|
2748 if ( pLevelDecorations[v445].uEventID ) |
1296 | 2749 { |
1408 | 2750 EventProcessor(v448, a2, 1); |
1296 | 2751 LODWORD(v727) = 1; |
2752 break; | |
2753 } | |
1408 | 2754 if ( pLevelDecorations[v445].IsInteractive() ) |
1296 | 2755 { |
1408 | 2756 activeLevelDecoration = &pLevelDecorations[v445]; |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1709
diff
changeset
|
2757 EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1); |
1296 | 2758 activeLevelDecoration = NULL; |
2759 } | |
2760 } | |
2761 } | |
2762 LODWORD(v727) = 1; | |
2763 break; | |
2764 } | |
2765 case SPELL_BODY_CURE_WEAKNESS: | |
2766 { | |
2179 | 2767 switch (skill_level) |
1296 | 2768 { |
2179 | 2769 case 1: amount = 180 * spell_level; break; |
2770 case 2: amount = 3600 * spell_level; break; | |
2771 case 3: amount = 86400 * spell_level; break; | |
1296 | 2772 case 4: amount = 0; break; |
2773 default: | |
2774 assert(false); | |
2775 } | |
2776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2777 break; | |
2778 | |
1519 | 2779 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2780 v323 = pCastSpell->uPlayerID_2; |
2781 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
2782 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
2783 { | |
2784 LODWORD(v727) = 1; | |
2785 break; | |
2786 } | |
2179 | 2787 if ( skill_level == 4 ) |
1296 | 2788 { |
2789 *(int *)v324 = 0; | |
2790 *((int *)v324 + 1) = 0; | |
2791 LODWORD(v727) = 1; | |
2792 break; | |
2793 } | |
2794 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
2795 v656 = 1; | |
2796 v325 = &pParty->pPlayers[v323]; | |
2797 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
2798 LODWORD(v727) = 1; | |
2799 break; | |
2800 } | |
2801 case SPELL_BODY_FIRST_AID: | |
2802 { | |
2179 | 2803 switch (skill_level) |
1296 | 2804 { |
2179 | 2805 case 1: amount = 2 * spell_level + 5; break; |
2806 case 2: amount = 3 * spell_level + 5; break; | |
2807 case 3: amount = 4 * spell_level + 5; break; | |
2808 case 4: amount = 5 * spell_level + 5; break; | |
1296 | 2809 default: |
2810 assert(false); | |
2811 } | |
2812 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2813 break; | |
2814 v460 = pCastSpell->spell_target_pid; | |
2815 if (!v460) | |
2816 { | |
2817 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); | |
1519 | 2818 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2819 } |
2820 else | |
2821 { | |
2822 if (PID_TYPE(v460) == OBJECT_Actor) | |
2823 { | |
2824 v461 = &pActors[PID_ID(v460)]; | |
2825 v462 = v461->uAIState; | |
2826 v463 = v461->pMonsterInfo.uHP; | |
2827 if ( v462 != 5 ) | |
2828 { | |
2829 if ( v462 != 4 ) | |
2830 { | |
2831 if ( v462 != 19 ) | |
2832 { | |
2833 if ( v462 != 11 ) | |
2834 { | |
2835 v461->sCurrentHP += amount; | |
2836 if ( v461->sCurrentHP > v463 ) | |
2837 v461->sCurrentHP = v463; | |
2838 } | |
2839 } | |
2840 } | |
2841 } | |
2842 } | |
2843 } | |
2844 LODWORD(v727) = 1; | |
2845 break; | |
2846 } | |
2847 case SPELL_BODY_CURE_POISON: | |
2848 { | |
2179 | 2849 switch (skill_level) |
1296 | 2850 { |
2179 | 2851 case 1: amount = 3600 * spell_level; break; |
2852 case 2: amount = 3600 * spell_level; break; | |
2853 case 3: amount = 86400 * spell_level; break; | |
1296 | 2854 case 4: amount = 0; break; |
2855 default: | |
2856 assert(false); | |
2857 } | |
2858 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
2859 break; | |
2860 | |
1519 | 2861 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2862 v470 = pCastSpell->uPlayerID_2; |
2863 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
2864 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
2865 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
2866 { | |
2867 LODWORD(v727) = 1; | |
2868 break; | |
2869 } | |
2179 | 2870 if ( skill_level == 4 ) |
1296 | 2871 { |
2872 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
2873 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
2874 v471 = pCastSpell->uPlayerID_2; | |
2875 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
2876 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
2877 v472 = pCastSpell->uPlayerID_2; | |
2878 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
2879 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
2880 LODWORD(v727) = 1; | |
2881 break; | |
2882 } | |
2883 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
2884 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
2885 6u, | |
2886 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2887 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
2888 8u, | |
2889 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2890 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
2891 v656 = 10; | |
2892 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
2893 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
2894 LODWORD(v727) = 1; | |
2895 break; | |
2896 } | |
2897 case SPELL_BODY_PROTECTION_FROM_MAGIC: | |
2898 { | |
2179 | 2899 amount = spell_level; |
2900 LODWORD(v733) = 3600 * spell_level; | |
1296 | 2901 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2902 break; | |
2903 | |
1519 | 2904 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
2905 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
2906 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
2907 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 2908 |
2179 | 2909 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, spell_level, 0, 0); |
1296 | 2910 LODWORD(v727) = 1; |
2911 break; | |
2912 } | |
2913 case SPELL_BODY_HAMMERHANDS: | |
2914 { | |
2179 | 2915 LODWORD(v733) = 3600 * spell_level; |
2916 amount = spell_level; | |
1296 | 2917 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2918 break; | |
2179 | 2919 if ( skill_level == 4 ) |
1296 | 2920 { |
1519 | 2921 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
2922 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
2923 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
2924 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 2925 v732 = (int)v733 << 7; |
2926 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
2179 | 2927 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); |
2928 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); | |
2929 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); | |
1296 | 2930 |
2179 | 2931 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, spell_level, spell_level, 0); |
1296 | 2932 LODWORD(v727) = 1; |
2933 break; | |
2934 } | |
1519 | 2935 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2936 |
2179 | 2937 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, spell_level, spell_level, 0); |
1296 | 2938 LODWORD(v727) = 1; |
2939 break; | |
2940 } | |
2941 case SPELL_BODY_CURE_DISEASE: | |
2942 { | |
2179 | 2943 if ( skill_level == 4 ) |
1296 | 2944 amount = 0; |
2945 else | |
2179 | 2946 amount = 86400 * spell_level; |
1296 | 2947 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2948 break; | |
2949 | |
1519 | 2950 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 2951 v498 = pCastSpell->uPlayerID_2; |
2952 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
2953 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
2954 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
2955 { | |
2956 LODWORD(v727) = 1; | |
2957 break; | |
2958 } | |
2179 | 2959 if ( skill_level == 4 ) |
1296 | 2960 { |
2961 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
2962 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
2963 v499 = pCastSpell->uPlayerID_2; | |
2964 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
2965 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
2966 v500 = pCastSpell->uPlayerID_2; | |
2967 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
2968 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
2969 } | |
2970 else | |
2971 { | |
2972 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
2973 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
2974 7u, | |
2975 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2976 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
2977 9u, | |
2978 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
2979 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
2980 v656 = 11; | |
2981 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
2982 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
2983 } | |
2984 LODWORD(v727) = 1; | |
2985 break; | |
2986 } | |
2987 case SPELL_BODY_POWER_CURE: | |
2988 { | |
2179 | 2989 amount = 5 * spell_level + 10; |
1296 | 2990 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
2991 break; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
2992 v501 = pParty->pPlayers.data(); |
1296 | 2993 int v1 = 0; |
2994 do | |
2995 { | |
1519 | 2996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, v1); |
1296 | 2997 v501->Heal(amount); |
2998 ++v501; | |
2999 ++v1; | |
3000 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
3001 while ( (signed int)v501 < (signed int)pParty->pHirelings.data() ); |
1296 | 3002 LODWORD(v727) = 1; |
3003 break; | |
3004 } | |
3005 case SPELL_LIGHT_DISPEL_MAGIC: | |
3006 { | |
2179 | 3007 sRecoveryTime -= spell_level; |
1296 | 3008 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3009 break; | |
3010 | |
2155 | 3011 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192); |
2182 | 3012 v505 = pRenderer->_466_GetActorsInViewport(4096); |
1296 | 3013 ++pSpellSprite.uType; |
3014 //signed int _v733 = v505; | |
3015 v688.x = 0; | |
3016 v688.y = 0; | |
3017 v688.z = 0; | |
3018 pSpellSprite.stru_24.Reset(); | |
1519 | 3019 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3020 pSpellSprite.spell_level = spell_level; |
3021 pSpellSprite.spell_skill = skill_level; | |
1296 | 3022 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3023 pSpellSprite.uAttributes = 0; | |
3024 pSpellSprite.uSectorID = 0; | |
3025 pSpellSprite.uSpriteFrameID = 0; | |
3026 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3027 pSpellSprite.uFacing = 0; | |
3028 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3029 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3030 a2 = 0; | |
3031 for ( a2 = 0; a2 < v505; ++a2 ) | |
3032 { | |
2182 | 3033 v507 = _50BF30_actors_in_viewport_ids[a2]; |
1296 | 3034 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
3035 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; | |
2154 | 3036 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * -0.8); |
2182 | 3037 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 3038 v509 = pSpellSprite.Create(0, 0, 0, 0); |
2182 | 3039 DamageMonsterFromParty(PID(OBJECT_Item, v509), _50BF30_actors_in_viewport_ids[a2], &v688); |
1296 | 3040 } |
3041 for ( a2 = 0; a2 < v505; ++a2 ) | |
3042 { | |
2182 | 3043 pActor = &pActors[_50BF30_actors_in_viewport_ids[a2]]; |
1296 | 3044 pSpellSprite.vPosition.x = pActor->vPosition.x; |
3045 pSpellSprite.vPosition.y = pActor->vPosition.y; | |
2154 | 3046 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * -0.8); |
2182 | 3047 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 3048 pSpellSprite.Create(0, 0, 0, 0); |
3049 for (int i = 0; i < 22; ++i) | |
3050 { | |
3051 pActor->pActorBuffs[i].Reset(); | |
3052 } | |
3053 } | |
3054 LODWORD(v727) = 1; | |
3055 break; | |
3056 } | |
3057 case SPELL_LIGHT_SUMMON_ELEMENTAL: | |
3058 { | |
2179 | 3059 switch (skill_level) |
1296 | 3060 { |
2179 | 3061 case 1: v733 = 300 * spell_level; amount = 1; break; |
3062 case 2: v733 = 300 * spell_level; amount = 1; break; | |
3063 case 3: v733 = 900 * spell_level; amount = 3; break; | |
3064 case 4: v733 = 900 * spell_level; amount = 5; break; | |
1296 | 3065 default: |
3066 assert(false); | |
3067 } | |
3068 //v733 = __PAIR__(0, v516); | |
3069 signed int _v733 = 0; | |
3070 if ( (signed int)uNumActors > 0 ) | |
3071 { | |
3072 v518 = pActors.data();//[0].uAIState; | |
1980 | 3073 size_t _v726 = uNumActors; |
1296 | 3074 do |
3075 { | |
3076 v519 = v518->uAIState; | |
3077 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) | |
3078 ++_v733; | |
3079 ++v518; | |
3080 --_v726; | |
3081 } | |
3082 while ( _v726 != 0 ); | |
3083 } | |
3084 if ( _v733 >= amount ) | |
3085 { | |
3086 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
3087 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3088 pCastSpell->uSpellID = 0; |
1296 | 3089 continue; |
3090 } | |
3091 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3092 break; | |
2179 | 3093 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, skill_level, v733); |
1296 | 3094 LODWORD(v727) = 1; |
3095 break; | |
3096 } | |
3097 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
3098 { | |
2179 | 3099 switch (skill_level) |
1296 | 3100 { |
2179 | 3101 case 1: LODWORD(v733) = 10800 * spell_level; amount = 3 * spell_level + 10; break; |
3102 case 2: LODWORD(v733) = 10800 * spell_level; amount = 3 * spell_level + 10; break; | |
3103 case 3: LODWORD(v733) = 14400 * spell_level; amount = 4 * spell_level + 10; break; | |
3104 case 4: LODWORD(v733) = 18000 * spell_level; amount = 5 * spell_level + 10; break; | |
1296 | 3105 default: |
3106 assert(false); | |
3107 } | |
3108 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3109 break; | |
3110 | |
1519 | 3111 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
3112 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
3113 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
3114 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 3115 |
2179 | 3116 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); |
1296 | 3117 LODWORD(v727) = 1; |
3118 break; | |
3119 } | |
3120 case SPELL_LIGHT_PRISMATIC_LIGHT: | |
3121 { | |
3122 //v67 = 2; | |
3123 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3124 { | |
3125 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
3126 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3127 pCastSpell->uSpellID = 0; |
1296 | 3128 continue; |
3129 } | |
3130 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3131 break; | |
2182 | 3132 v531 = pRenderer->_466_GetActorsInViewport(4096); |
1296 | 3133 ++pSpellSprite.uType; |
3134 v694.x = 0; | |
3135 v694.y = 0; | |
3136 v694.z = 0; | |
3137 pSpellSprite.stru_24.Reset(); | |
1519 | 3138 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3139 pSpellSprite.spell_level = spell_level; |
3140 pSpellSprite.spell_skill = skill_level; | |
1296 | 3141 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3142 pSpellSprite.uAttributes = 0; | |
3143 pSpellSprite.uSectorID = 0; | |
3144 pSpellSprite.uSpriteFrameID = 0; | |
3145 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3146 pSpellSprite.uFacing = 0; | |
3147 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3148 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3149 a2 = 0; | |
3150 if ( (signed int)v531 > 0 ) | |
3151 { | |
3152 do | |
3153 { | |
2182 | 3154 v533 = _50BF30_actors_in_viewport_ids[a2]; |
1296 | 3155 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
3156 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; | |
2154 | 3157 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * -0.8); |
2182 | 3158 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 3159 v535 = pSpellSprite.Create(0, 0, 0, 0); |
3160 v536 = a2; | |
2182 | 3161 DamageMonsterFromParty(PID(OBJECT_Item, v535), _50BF30_actors_in_viewport_ids[a2], &v694); |
1296 | 3162 a2 = v536 + 1; |
3163 } | |
3164 while ( v536 + 1 < (signed int)v531 ); | |
3165 } | |
3166 v537 = pGame->GetStru6(); | |
3167 pGame->GetStru6()->_4A8BFC(); | |
3168 LODWORD(v727) = 1; | |
3169 break; | |
3170 } | |
3171 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
3172 { | |
2179 | 3173 switch (skill_level) |
1296 | 3174 { |
2179 | 3175 case 1: LODWORD(v733) = 14400 * spell_level; amount = 4 * spell_level; break; |
3176 case 2: LODWORD(v733) = 14400 * spell_level; amount = 4 * spell_level; break; | |
3177 case 3: LODWORD(v733) = 14400 * spell_level; amount = 4 * spell_level; break; | |
3178 case 4: LODWORD(v733) = 18000 * spell_level; amount = 5 * spell_level; break; | |
1296 | 3179 default: |
3180 assert(false); | |
3181 } | |
3182 v730 = LODWORD(v733); | |
3183 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3184 break; | |
3185 | |
1519 | 3186 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
3187 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
3188 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
3189 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 3190 |
3191 v732 = v730 << 7; | |
3192 v549 = (double)(v730 << 7) * 0.033333335; | |
3193 *((float *)&v733 + 1) = v549; | |
3194 v712 = (signed __int64)v549; | |
2179 | 3195 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, skill_level, amount, 0, 0); |
3196 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, skill_level, amount, 0, 0); | |
3197 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, skill_level, amount, 0, 0); | |
3198 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, skill_level, amount, 0, 0); | |
3199 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, skill_level, amount, 0, 0); | |
3200 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, skill_level, amount, 0, 0); | |
3201 v550 = spell_level + 5; | |
1296 | 3202 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( |
3203 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
2179 | 3204 skill_level, |
1296 | 3205 v550, 0, 0); |
3206 | |
2179 | 3207 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), skill_level, v550, 0, 0); |
1296 | 3208 LODWORD(v727) = 1; |
3209 break; | |
3210 } | |
3211 case SPELL_LIGHT_HOUR_OF_POWER: | |
3212 { | |
2179 | 3213 switch (skill_level) |
1296 | 3214 { |
3215 case 1: LODWORD(v733) = 4; amount = 4; break; | |
3216 case 2: LODWORD(v733) = 4; amount = 4; break; | |
3217 case 3: LODWORD(v733) = 12; amount = 12; break; | |
3218 case 4: LODWORD(v733) = 20; amount = 15; break; | |
3219 default: | |
3220 assert(false); | |
3221 } | |
3222 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3223 break; | |
2179 | 3224 y = (char *)(60 * (spell_level * LODWORD(v733) + 60)); |
3225 v732 = (300 * amount * spell_level + 60) << 7; | |
3226 v730 = spell_level + 5; | |
1296 | 3227 int _v726 = 0; |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
3228 v553 = pParty->pPlayers.data();//[0].pConditions[1]; |
1296 | 3229 *((float *)&v733) = (double)v732 * 0.033333335; |
3230 do | |
3231 { | |
1519 | 3232 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); |
3233 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); | |
3234 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); | |
3235 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); | |
1296 | 3236 |
3237 //((SpellBuff *)(v553 + 6056))->Apply( | |
2179 | 3238 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), skill_level, v730, 0, 0); |
1296 | 3239 if ( *(_QWORD *)v553 ) |
3240 _v726 = 1; | |
3241 ++v553; | |
3242 } | |
3243 while ( v553 <= &pParty->pPlayers[3] ); | |
2179 | 3244 v562 = skill_level; |
3245 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), skill_level, v730, 0, 0); | |
1296 | 3246 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0); |
3247 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0); | |
3248 if (!_v726) | |
3249 { | |
3250 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0); | |
3251 } | |
3252 LODWORD(v727) = 1; | |
3253 break; | |
3254 } | |
2179 | 3255 case SPELL_LIGHT_DIVINE_INTERVENTION:// |
1296 | 3256 { |
3257 amount = 3; | |
2179 | 3258 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3 ) |
1296 | 3259 { |
3260 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3261 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3262 pCastSpell->uSpellID = 0; |
1296 | 3263 continue; |
3264 } | |
3265 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3266 break; | |
2179 | 3267 for ( uint pl_id = 0; pl_id < 4; pl_id++ ) |
1296 | 3268 { |
2179 | 3269 for ( v563 = 0; v563 <= 19; v563++) |
1296 | 3270 { |
2179 | 3271 LODWORD(pPlayers[pl_id]->pConditions[v563]) = 0; |
3272 HIDWORD(pPlayers[pl_id]->pConditions[v563]) = 0; | |
1296 | 3273 } |
2179 | 3274 pPlayers[pl_id]->sHealth = pPlayers[pl_id]->GetMaxHealth(); |
3275 pPlayers[pl_id]->sMana = pPlayers[pl_id]->GetMaxMana(); | |
3276 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); | |
1296 | 3277 } |
3278 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
2179 | 3279 pPlayer->sAgeModifier = 120; |
1296 | 3280 else |
2179 | 3281 pPlayer->sAgeModifier = pPlayer->sAgeModifier + 10; |
3282 sRecoveryTime += -5 * spell_level; | |
3283 ++pPlayer->uNumDivineInterventionCastsThisDay; | |
1296 | 3284 LODWORD(v727) = 1; |
3285 break; | |
3286 } | |
3287 case SPELL_DARK_REANIMATE: | |
3288 { | |
2179 | 3289 switch (skill_level) |
1296 | 3290 { |
2179 | 3291 case 1: amount = 2 * spell_level; break; |
3292 case 2: amount = 3 * spell_level; break; | |
3293 case 3: amount = 4 * spell_level; break; | |
3294 case 4: amount = 5 * spell_level; break; | |
1296 | 3295 default: |
3296 assert(false); | |
3297 } | |
3298 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3299 break; | |
3300 v576 = pCastSpell->spell_target_pid; | |
3301 if (!v576) | |
3302 { | |
3303 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; | |
1519 | 3304 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
1296 | 3305 if ( *((_QWORD *)v585 + 14) ) |
3306 { | |
3307 ((Player *)v585)->SetCondition(0x11u, 1); | |
3308 v587 = ((Player *)v585)->GetSexByVoice(); | |
3309 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); | |
3310 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
3311 } | |
3312 break; | |
3313 } | |
3314 v577 = (Player *)(PID_ID(v576)); | |
3315 //v726 = v577; | |
3316 if ( v577 == (Player *)-1 ) | |
3317 { | |
3318 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
3319 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3320 pCastSpell->uSpellID = 0; |
1296 | 3321 continue; |
3322 } | |
3323 v578 = (int)&pActors[(int)v577]; | |
3324 v721 = v578; | |
3325 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
3326 { | |
3327 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3328 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3329 pCastSpell->uSpellID = 0; |
1296 | 3330 continue; |
3331 } | |
3332 ++pSpellSprite.uType; | |
3333 pSpellSprite.stru_24.Reset(); | |
1519 | 3334 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3335 pSpellSprite.spell_level = spell_level; |
3336 pSpellSprite.spell_skill = skill_level; | |
1296 | 3337 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3338 pSpellSprite.uAttributes = 0; | |
3339 pSpellSprite.uSectorID = 0; | |
3340 pSpellSprite.uSpriteFrameID = 0; | |
3341 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3342 v581 = v721; | |
3343 pSpellSprite.uFacing = 0; | |
3344 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3345 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3346 pSpellSprite.vPosition.x = *(short *)(v721 + 142); | |
3347 pSpellSprite.vPosition.y = *(short *)(v721 + 144); | |
3348 v732 = *(short *)(v721 + 138); | |
2154 | 3349 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * -0.8); |
1296 | 3350 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); |
3351 pSpellSprite.Create(0, 0, 0, 0); | |
3352 if ( *(char *)(v581 + 52) > amount ) | |
3353 break; | |
3354 Actor::Resurrect((unsigned int)v577); | |
3355 *(char *)(v581 + 61) = 0; | |
3356 *(char *)(v581 + 53) = 0; | |
3357 *(char *)(v581 + 54) = 0; | |
3358 *(char *)(v581 + 55) = 0; | |
3359 *(char *)(v581 + 56) = 0; | |
3360 *(char *)(v581 + 57) = 0; | |
3361 *(int *)(v581 + 712) = 9999; | |
3362 *(char *)(v581 + 38) &= 0xF7u; | |
3363 *(int *)(v581 + 708) = 0; | |
3364 ((SpellBuff *)(v581 + 356))->Reset(); | |
3365 ((SpellBuff *)(v581 + 228))->Reset(); | |
3366 ((SpellBuff *)(v581 + 404))->Reset(); | |
3367 if ( *(short *)(v581 + 40) > 10 * amount ) | |
3368 *(short *)(v581 + 40) = 10 * amount; | |
3369 LODWORD(v727) = 1; | |
3370 break; | |
3371 } | |
3372 case SPELL_DARK_VAMPIRIC_WEAPON: | |
3373 { | |
3374 amount = 16; | |
2179 | 3375 if ( skill_level == 4 ) |
1296 | 3376 { |
3377 LODWORD(v733) = 0; | |
3378 } | |
3379 else | |
3380 { | |
2179 | 3381 LODWORD(v733) = 3600 * spell_level; |
1296 | 3382 } |
3383 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3384 break; | |
3385 __debugbreak(); | |
3386 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1362
diff
changeset
|
3387 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; |
1296 | 3388 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; |
3389 _v733->UpdateTempBonus(pParty->uTimePlayed); | |
3390 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65 | |
3391 || LOBYTE(_v733->uAttributes) & 2 | |
3392 || _v733->uSpecEnchantmentType != 0 | |
3393 || _v733->uEnchantmentType != 0 | |
3394 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2 | |
3395 || pItemsTable->IsMaterialNonCommon(_v733) ) | |
3396 { | |
1682 | 3397 _50C9D0_AfterEnchClickEventId = 113; |
3398 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
3399 _50C9D8_AfterEnchClickEventTimeout = 1; | |
1296 | 3400 |
3401 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3402 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3403 pCastSpell->uSpellID = 0; |
1296 | 3404 continue; |
3405 } | |
3406 v592 = _v733; | |
2181 | 3407 //v14 = skill_level == 4; |
1296 | 3408 _v733->uSpecEnchantmentType = 16; |
2181 | 3409 if ( skill_level != 4 ) |
1296 | 3410 { |
3411 v732 = (int)v733 << 7; | |
3412 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
3413 v592->uAttributes |= 8u; | |
3414 } | |
3415 LOBYTE(v592->uAttributes) |= 0x80u; | |
3416 _50C9A8_item_enchantment_timer = 256; | |
3417 LODWORD(v727) = 1; | |
3418 break; | |
3419 } | |
3420 case SPELL_DARK_SHARPMETAL: | |
3421 { | |
2179 | 3422 switch (skill_level) |
1296 | 3423 { |
3424 case 1: amount = 5; break; | |
3425 case 2: amount = 5; break; | |
3426 case 3: amount = 7; break; | |
3427 case 4: amount = 9; break; | |
3428 default: | |
3429 assert(false); | |
3430 } | |
3431 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3432 break; | |
1980 | 3433 signed int _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); |
1296 | 3434 pSpellSprite.stru_24.Reset(); |
1519 | 3435 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3436 pSpellSprite.spell_level = spell_level; |
3437 pSpellSprite.spell_skill = skill_level; | |
1296 | 3438 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3439 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3440 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3441 pSpellSprite.uAttributes = 0; | |
3442 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3443 pSpellSprite.uSectorID = pIndoor->GetSector( | |
3444 pParty->vPosition.x, | |
3445 pParty->vPosition.y, | |
3446 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
3447 pSpellSprite.uSpriteFrameID = 0; | |
3448 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3449 pSpellSprite.spell_target_pid = a2; | |
3450 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3451 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3452 if ( pParty->bTurnBasedModeOn == 1 ) | |
3453 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3454 v596 = (signed int)_v726 / -2; | |
3455 y = (char *)((signed int)_v726 / 2); | |
3456 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
3457 { | |
3458 v597 = v715.uYawAngle; | |
3459 do | |
3460 { | |
3461 pSpellSprite.uFacing = v596 + v597; | |
3462 if ( pSpellSprite.Create( | |
3463 v596 + v597, | |
3464 v715.uPitchAngle, | |
3465 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3466 pCastSpell->uPlayerID + 1) != -1 | |
3467 && pParty->bTurnBasedModeOn == 1 ) | |
1450 | 3468 ++pTurnEngine->pending_actions; |
1296 | 3469 v596 += _v726 / (amount - 1); |
3470 } | |
3471 while ( v596 <= (signed int)y ); | |
3472 } | |
3473 LODWORD(v727) = 1; | |
3474 break; | |
3475 } | |
3476 case SPELL_DARK_CONTROL_UNDEAD: | |
3477 { | |
3478 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3479 break; | |
2179 | 3480 switch (skill_level) |
1296 | 3481 { |
2179 | 3482 case 1: LODWORD(v733) = 180 * spell_level; break; |
3483 case 2: LODWORD(v733) = 180 * spell_level; break; | |
3484 case 3: LODWORD(v733) = 300 * spell_level; break; | |
1296 | 3485 case 4: LODWORD(v733) = 29030400; break; |
3486 default: | |
3487 assert(false); | |
3488 } | |
3489 if (PID_TYPE(a2) != OBJECT_Actor) | |
3490 { | |
3491 LODWORD(v727) = 1; | |
3492 break; | |
3493 } | |
3494 pActor = &pActors[PID_ID(a2)]; | |
3495 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
3496 break; | |
3497 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) ) | |
3498 { | |
3499 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3500 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3501 pCastSpell->uSpellID = 0; |
1296 | 3502 continue; |
3503 } | |
1953 | 3504 pActor->pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); |
1947 | 3505 pActor->pActorBuffs[ACTOR_BUFF_CHARM].Reset(); |
1956
542c13cd72e2
pActorBuffs[12] to pActorBuffs[ACTOR_BUFF_ENSLAVED]
Grumpy7
parents:
1955
diff
changeset
|
3506 pActor->pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
2179 | 3507 skill_level, 0, 0, 0); |
1296 | 3508 pSpellSprite.stru_24.Reset(); |
1519 | 3509 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3510 pSpellSprite.spell_level = spell_level; |
3511 pSpellSprite.spell_skill = skill_level; | |
1296 | 3512 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3513 | |
3514 pSpellSprite.uObjectDescID = v60; | |
2181 | 3515 pSpellSprite.vPosition.x = pActor->vPosition.x; |
3516 pSpellSprite.vPosition.y = pActor->vPosition.y; | |
3517 pSpellSprite.vPosition.z = pActor->vPosition.z + pActor->uActorHeight; | |
1296 | 3518 pSpellSprite.uAttributes = 0; |
2181 | 3519 pSpellSprite.uSectorID = pIndoor->GetSector(pActor->vPosition.x, pActor->vPosition.y, pSpellSprite.vPosition.z); |
1296 | 3520 pSpellSprite.uSpriteFrameID = 0; |
3521 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3522 pSpellSprite.spell_target_pid = a2; | |
3523 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3524 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3525 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | |
3526 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3527 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | |
3528 LODWORD(v727) = 1; | |
3529 break; | |
3530 } | |
3531 case SPELL_DARK_SACRIFICE: | |
3532 { | |
3533 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3534 break; | |
3535 int _v733 = 0; | |
3536 memset(&achieved_awards, 0, 4000); | |
3537 int i = 0; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
3538 pNPCData = pParty->pHirelings.data(); |
1296 | 3539 do |
3540 { | |
3541 if ( pNPCData->pName != 0) | |
3542 { | |
3543 v606 = _v733++; | |
3544 achieved_awards[v606] = (AwardType)(i + 1); | |
3545 } | |
3546 ++i; | |
3547 ++pNPCData; | |
3548 } | |
3549 while ( pNPCData <= &pParty->pHirelings[1] ); | |
3550 i = 0; | |
3551 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
3552 { | |
3553 pNPCData = pNPCStats->pNewNPCData; | |
3554 //__debugbreak(); // data offset | |
3555 AwardType *_v734 = &achieved_awards[_v733]; | |
3556 do | |
3557 { | |
3558 if ( pNPCData->uFlags & 0x80 | |
3559 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName)) | |
3560 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) ) | |
3561 { | |
3562 v607 = _v734; | |
3563 ++_v734; | |
3564 *v607 = (AwardType)(i + 3); | |
3565 } | |
3566 ++i; | |
3567 ++pNPCData; | |
3568 } | |
3569 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs ); | |
3570 } | |
3571 v608 = pCastSpell->uPlayerID_2; | |
3572 if ( v608 != 4 && v608 != 5 | |
1793
4dee76d79c78
dword_5B65CC to npcIdToDismissAfterDialogue, Party::field_709 to Party::hirelingScrollPosition
Grumpy7
parents:
1736
diff
changeset
|
3573 || (v609 = (signed int)*(&pFontCChar + v608 + pParty->hirelingScrollPosition), v609 <= 0) |
1296 | 3574 || v609 >= 3 ) |
3575 { | |
3576 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3577 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3578 pCastSpell->uSpellID = 0; |
1296 | 3579 continue; |
3580 } | |
3581 v610 = 76 * v609; | |
3582 //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
3583 pParty->pHirelings[v609-1].evt_B = 0; | |
3584 v611 = pIconsFrameTable->FindIcon("spell96"); | |
3585 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
3586 pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611); | |
3587 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
3588 pParty->pHirelings[v609-1].evt_A = 1; | |
3589 | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1829
diff
changeset
|
3590 v612 = pParty->pPlayers.data(); |
1296 | 3591 do |
3592 { | |
3593 v612->sHealth = v612->GetMaxHealth(); | |
3594 v612->sMana = v612->GetMaxMana(); | |
3595 ++v612; | |
3596 } | |
3597 while ( v612 <= &pParty->pPlayers[3] ); | |
3598 v613 = &pOutdoor->ddm; | |
3599 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3600 v613 = &pIndoor->dlv; | |
3601 v613->uReputation += 15; | |
3602 if ( v613->uReputation > 10000 ) | |
3603 v613->uReputation = 10000; | |
3604 LODWORD(v727) = 1; | |
3605 break; | |
3606 } | |
3607 case SPELL_DARK_PAIN_REFLECTION: | |
3608 { | |
2179 | 3609 switch (skill_level) |
1296 | 3610 { |
2179 | 3611 case 1: LODWORD(v733) = 300 * (spell_level + 12); break; |
3612 case 2: LODWORD(v733) = 300 * (spell_level + 12); break; | |
3613 case 3: LODWORD(v733) = 300 * (spell_level + 12); break; | |
3614 case 4: LODWORD(v733) = 900 * (spell_level + 4); break; | |
1296 | 3615 default: |
3616 assert(false); | |
3617 } | |
2179 | 3618 amount = spell_level + 5; |
1296 | 3619 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3620 break; | |
2179 | 3621 if ( skill_level != 3 && skill_level != 4 ) |
1296 | 3622 { |
1519 | 3623 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); |
2182 | 3624 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); |
1296 | 3625 LODWORD(v727) = 1; |
3626 break; | |
3627 } | |
2182 | 3628 for ( uint pl_id = 0; pl_id , 4; pl_id++ ) |
1296 | 3629 { |
2182 | 3630 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); |
3631 pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + | |
3632 (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); | |
1296 | 3633 } |
3634 LODWORD(v727) = 1; | |
3635 break; | |
3636 } | |
3637 case SPELL_DARK_SOULDRINKER: | |
3638 { | |
3639 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3640 break; | |
3641 pGame->GetIndoorCamera(); | |
3642 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
2182 | 3643 signed int _v733 = pRenderer->_466_GetActorsInViewport(v623); |
1296 | 3644 v707.x = 0; |
3645 v707.y = 0; | |
3646 v707.z = 0; | |
3647 pSpellSprite.stru_24.Reset(); | |
1519 | 3648 pSpellSprite.spell_id = pCastSpell->uSpellID; |
2179 | 3649 pSpellSprite.spell_level = spell_level; |
3650 pSpellSprite.spell_skill = skill_level; | |
1296 | 3651 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3652 pSpellSprite.uAttributes = 0; | |
3653 pSpellSprite.uSectorID = 0; | |
3654 pSpellSprite.uSpriteFrameID = 0; | |
3655 pSpellSprite.field_60_distance_related_prolly_lod = 0; | |
3656 pSpellSprite.uFacing = 0; | |
3657 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3658 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3659 a2 = 0; | |
3660 int _v726 = 0; | |
3661 if ( _v733 > 0 ) | |
3662 { | |
2179 | 3663 _v726 = (_v733 * (7 * spell_level + 25)); |
1296 | 3664 do |
3665 { | |
2182 | 3666 v625 = _50BF30_actors_in_viewport_ids[a2]; |
1296 | 3667 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
3668 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; | |
3669 //v732 = pActors[v625].uActorHeight; | |
2154 | 3670 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * -0.8); |
2182 | 3671 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); |
1296 | 3672 v627 = pSpellSprite.Create(0, 0, 0, 0); |
3673 v628 = a2; | |
2182 | 3674 DamageMonsterFromParty(PID(OBJECT_Item, v627), _50BF30_actors_in_viewport_ids[a2], &v707); |
1296 | 3675 a2 = v628 + 1; |
3676 } | |
3677 while ( v628 + 1 < _v733 ); | |
3678 } | |
3679 v730 = 0; | |
3680 v629 = 1; | |
3681 do | |
3682 { | |
3683 v630 = pPlayers[v629]; | |
3684 if ( !v630->pConditions[2] | |
3685 && !v630->pConditions[12] | |
3686 && !v630->pConditions[13] | |
3687 && !v630->pConditions[14] | |
3688 && !v630->pConditions[15] | |
3689 && !v630->pConditions[16] ) | |
3690 { | |
3691 v631 = v730++; | |
3692 v681[v631] = v629; | |
3693 } | |
3694 ++v629; | |
3695 } | |
3696 while ( v629 <= 4 ); | |
3697 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
3698 _v733 = 0; | |
3699 if ( v730 > 0 ) | |
3700 { | |
3701 do | |
3702 { | |
3703 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
3704 v726 = pPlayers[v681[_v733]]; | |
3705 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
3706 v726->sHealth += v732; | |
3707 //v726 = *(Player **)v632; | |
3708 //v634 = v726->GetMaxHealth(); | |
3709 if ( v726->sHealth > v726->GetMaxHealth()) | |
3710 v726->sHealth = v726->GetMaxHealth(); | |
3711 v635 = _v733; | |
3712 | |
1519 | 3713 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, WORD2(v733)); |
1296 | 3714 _v733 = v635 + 1; |
3715 } | |
3716 while ( v635 + 1 < v730 ); | |
3717 } | |
3718 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
3719 LODWORD(v727) = 1; | |
3720 break; | |
3721 } | |
3722 case SPELL_DARK_ARMAGEDDON: | |
3723 { | |
3724 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3725 { | |
3726 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
3727 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3728 pCastSpell->uSpellID = 0; |
1296 | 3729 continue; |
3730 } | |
2179 | 3731 if ( skill_level == 4) |
1296 | 3732 amount = 4; |
3733 else | |
3734 amount = 3; | |
3735 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
3736 { | |
3737 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3738 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
1519 | 3739 pCastSpell->uSpellID = 0; |
1296 | 3740 continue; |
3741 } | |
3742 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3743 break; | |
3744 pParty->armageddon_timer = 256; | |
2179 | 3745 pParty->armageddonDamage = spell_level; |
1296 | 3746 ++pPlayer->uNumArmageddonCasts; |
3747 if ( pParty->bTurnBasedModeOn == 1 ) | |
1450 | 3748 ++pTurnEngine->pending_actions; |
1980 | 3749 int _v726 = 50; |
1296 | 3750 do |
3751 { | |
3752 v642 = rand() % 4096 - 2048; | |
3753 v643 = rand(); | |
3754 v721 = v642 + pParty->vPosition.x; | |
3755 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
3756 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0); | |
3757 v644 = rand(); | |
3758 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
3759 --_v726; | |
3760 } | |
3761 while ( _v726 != 0 ); | |
3762 LODWORD(v727) = 1; | |
3763 break; | |
3764 } | |
3765 | |
3766 default: | |
3767 break; | |
3768 } | |
1519 | 3769 if ( pCastSpell->uFlags & 0x20 ) |
1296 | 3770 { |
3771 if ( v727 != 0.0 ) | |
1519 | 3772 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
1296 | 3773 } |
3774 else | |
3775 { | |
3776 if ( sRecoveryTime < 0 ) | |
3777 sRecoveryTime = 0; | |
3778 if ( pParty->bTurnBasedModeOn ) | |
3779 { | |
3780 v645 = sRecoveryTime; | |
3781 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; | |
3782 pPlayer->SetRecoveryTime(v645); | |
3783 if ( !some_active_character ) | |
1448 | 3784 pTurnEngine->ApplyPlayerAction(); |
1296 | 3785 } |
3786 else | |
3787 { | |
3788 pPlayer->SetRecoveryTime( | |
3789 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3790 } | |
3791 if ( v727 != 0.0 ) | |
3792 { | |
3793 pPlayer->PlaySound(SPEECH_49, 0); | |
3794 if ( v727 != 0.0 ) | |
1519 | 3795 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
1296 | 3796 } |
3797 } | |
1519 | 3798 pCastSpell->uSpellID = 0; |
2179 | 3799 spell_level = v723; |
1296 | 3800 continue; |
3801 } | |
3802 | |
3803 } | |
3804 //----- (00427DA0) -------------------------------------------------------- | |
1519 | 3805 size_t PushCastSpellInfo(uint16_t uSpellID, uint16_t uPlayerID, __int16 skill_level, uint16_t uFlags, int spell_sound_id) |
1296 | 3806 { |
1517 | 3807 for (size_t i = 0; i < CastSpellInfoCount; i++) |
1296 | 3808 { |
1519 | 3809 if (!pCastSpellInfo[i].uSpellID) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1420
diff
changeset
|
3810 { |
1519 | 3811 pCastSpellInfo[i].uSpellID = uSpellID; |
1517 | 3812 pCastSpellInfo[i].uPlayerID = uPlayerID; |
1519 | 3813 if (uFlags & 0x10) |
1517 | 3814 pCastSpellInfo[i].uPlayerID_2 = uPlayerID; |
3815 pCastSpellInfo[i].field_6 = 0; | |
3816 pCastSpellInfo[i].spell_target_pid = 0; | |
1519 | 3817 pCastSpellInfo[i].uFlags = uFlags; |
1517 | 3818 pCastSpellInfo[i].forced_spell_skill_level = skill_level; |
3819 pCastSpellInfo[i].sound_id = spell_sound_id; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1420
diff
changeset
|
3820 return i; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1420
diff
changeset
|
3821 } |
1296 | 3822 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1420
diff
changeset
|
3823 return -1; |
1296 | 3824 } |
3825 //----- (00427D48) -------------------------------------------------------- | |
1517 | 3826 void CastSpellInfoHelpers::_427D48() |
1296 | 3827 { |
1517 | 3828 for (size_t i = 0; i < CastSpellInfoCount; i++) |
1296 | 3829 { |
1519 | 3830 if (pCastSpellInfo[i].uSpellID && pCastSpellInfo[i].uFlags & 0x3CA) |
1296 | 3831 { |
1519 | 3832 pCastSpellInfo[i].uSpellID = 0; |
1517 | 3833 pGUIWindow_Settings->Release(); |
3834 pGUIWindow_Settings = 0; | |
3835 pMouse->SetCursorBitmap("MICON1"); | |
3836 GameUI_Footer_TimeLeft = 0; | |
1682 | 3837 _50C9A0_IsEnchantingInProgress = 0; |
1517 | 3838 back_to_game(); |
1296 | 3839 } |
3840 } | |
3841 } | |
3842 //----- (0042777D) -------------------------------------------------------- | |
3843 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) | |
3844 { | |
3845 //bool result; // eax@2 | |
3846 //__int16 v6; // bx@4 | |
3847 //Player *v7; // eax@4 | |
3848 //char v8; // zf@12 | |
3849 unsigned __int16 v9; // cx@16 | |
3850 unsigned int v10; // eax@18 | |
3851 unsigned __int8 v11; // sf@18 | |
3852 unsigned __int8 v12; // of@18 | |
3853 unsigned __int16 v13; // cx@21 | |
3854 unsigned int v14; // eax@23 | |
3855 //stru277 *v15; // esi@27 | |
3856 //stru277 *v16; // eax@28 | |
3857 //GUIWindow *v17; // eax@43 | |
3858 //GUIWindow *v18; // [sp-30h] [bp-48h]@44 | |
3859 //unsigned int v19; // [sp-2Ch] [bp-44h]@44 | |
3860 //unsigned int v20; // [sp-28h] [bp-40h]@44 | |
3861 //unsigned int v21; // [sp-24h] [bp-3Ch]@44 | |
3862 //unsigned int v22; // [sp-20h] [bp-38h]@44 | |
3863 //int v23; // [sp-1Ch] [bp-34h]@44 | |
3864 //int v24; // [sp-18h] [bp-30h]@44 | |
3865 //unsigned int v25; // [sp-14h] [bp-2Ch]@43 | |
3866 //unsigned int v26; // [sp-10h] [bp-28h]@43 | |
3867 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43 | |
3868 //char *v28; // [sp-8h] [bp-20h]@43 | |
3869 //Texture *v29; // [sp-4h] [bp-1Ch]@43 | |
3870 //__int16 a3a; // [sp+10h] [bp-8h]@1 | |
3871 //__int16 a2a; // [sp+14h] [bp-4h]@1 | |
3872 | |
3873 //a3a = uPlayerID; | |
3874 //a2a = a1; | |
3875 | |
3876 //if ( pParty->bTurnBasedModeOn != 1 | |
3877 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) | |
3878 if (pParty->bTurnBasedModeOn) | |
3879 { | |
1340 | 3880 if (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) |
1296 | 3881 return; |
3882 } | |
3883 | |
3884 | |
3885 //v6 = a5; | |
3886 //v7 = &pParty->pPlayers[uPlayerID]; | |
3887 assert(uPlayerID < 4); | |
1980 | 3888 Player* player = &pParty->pPlayers[uPlayerID]; |
1296 | 3889 if ( !(a5 & 0x10) ) |
3890 { | |
3891 switch ( a1 ) | |
3892 { | |
3893 case SPELL_SPIRIT_FATE: | |
3894 case SPELL_BODY_FIRST_AID: | |
3895 case SPELL_DARK_REANIMATE: | |
3896 //HIBYTE(v6) = HIBYTE(a5) | 1; | |
3897 a5 |= 0x0100; | |
3898 break; | |
3899 | |
3900 case SPELL_FIRE_FIRE_AURA: | |
3901 case SPELL_WATER_RECHARGE_ITEM: | |
3902 case SPELL_WATER_ENCHANT_ITEM: | |
3903 case SPELL_DARK_VAMPIRIC_WEAPON: | |
3904 //LOBYTE(v6) = a5 | 0x80; | |
3905 a5 |= 0x0080; | |
3906 break; | |
3907 | |
3908 case SPELL_FIRE_FIRE_BOLT: | |
3909 case SPELL_FIRE_FIREBALL: | |
3910 case SPELL_FIRE_INCINERATE: | |
3911 case SPELL_AIR_LIGHNING_BOLT: | |
3912 case SPELL_AIR_IMPLOSION: | |
3913 case SPELL_WATER_POISON_SPRAY: | |
3914 case SPELL_WATER_ICE_BOLT: | |
3915 case SPELL_WATER_ACID_BURST: | |
3916 case SPELL_WATER_ICE_BLAST: | |
3917 case SPELL_EARTH_STUN: | |
3918 case SPELL_EARTH_SLOW: | |
3919 case SPELL_EARTH_DEADLY_SWARM: | |
3920 case SPELL_EARTH_BLADES: | |
3921 case SPELL_EARTH_MASS_DISTORTION: | |
3922 case SPELL_SPIRIT_SPIRIT_LASH: | |
3923 case SPELL_MIND_MIND_BLAST: | |
3924 case SPELL_MIND_CHARM: | |
3925 case SPELL_MIND_PSYCHIC_SHOCK: | |
3926 case SPELL_BODY_HARM: | |
3927 case SPELL_BODY_FLYING_FIST: | |
3928 case SPELL_LIGHT_LIGHT_BOLT: | |
3929 case SPELL_LIGHT_DESTROY_UNDEAD: | |
3930 case SPELL_LIGHT_SUNRAY: | |
3931 case SPELL_DARK_TOXIC_CLOUD: | |
3932 case SPELL_DARK_SHRINKING_RAY: | |
3933 case SPELL_DARK_SHARPMETAL: | |
3934 case SPELL_DARK_DRAGON_BREATH: | |
3935 if ( !a6 ) | |
3936 a5 |= 0x0008; | |
3937 break; | |
3938 case SPELL_MIND_TELEPATHY: | |
3939 case SPELL_MIND_BERSERK: | |
3940 case SPELL_MIND_ENSLAVE: | |
3941 case SPELL_LIGHT_PARALYZE: | |
3942 case SPELL_DARK_CONTROL_UNDEAD: | |
3943 //LABEL_9: | |
3944 //v6 = a5 | 8; | |
3945 a5 |= 0x0008; | |
3946 break; | |
3947 | |
3948 case SPELL_EARTH_TELEKINESIS: | |
3949 a5 |= 0x0040; | |
3950 break; | |
3951 | |
3952 case SPELL_SPIRIT_BLESS: | |
3953 if (a4 && ~a4 & 0x01C0) | |
3954 //goto LABEL_25; | |
3955 { | |
3956 a5 |= 0x0002; | |
3957 break; | |
3958 } | |
3959 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0) | |
3960 //goto LABEL_25; | |
3961 { | |
3962 a5 |= 0x0002; | |
3963 break; | |
3964 } | |
3965 break; | |
3966 | |
3967 case SPELL_SPIRIT_PRESERVATION: | |
3968 v9 = a4; | |
3969 if ( !a4 ) | |
3970 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; | |
3971 //goto LABEL_18; | |
3972 v10 = SkillToMastery(v9); | |
3973 v12 = __OFSUB__(v10, 3); | |
3974 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
3975 //goto LABEL_24; | |
3976 if ( v11 ^ v12 ) | |
3977 { | |
3978 a5 |= 0x0002; | |
3979 break; | |
3980 } | |
3981 break; | |
3982 | |
3983 case SPELL_DARK_PAIN_REFLECTION: | |
3984 v9 = a4; | |
3985 if ( !a4 ) | |
3986 v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; | |
3987 //LABEL_18: | |
3988 v10 = SkillToMastery(v9); | |
3989 v12 = __OFSUB__(v10, 3); | |
3990 v11 = ((v10 - 3) & 0x80000000u) != 0; | |
3991 //goto LABEL_24; | |
3992 if ( v11 ^ v12 ) | |
3993 { | |
3994 a5 |= 0x0002; | |
3995 break; | |
3996 } | |
3997 break; | |
3998 | |
3999 case SPELL_BODY_HAMMERHANDS: | |
4000 v13 = a4; | |
4001 if ( !a4 ) | |
4002 v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; | |
4003 v14 = SkillToMastery(v13); | |
4004 v12 = __OFSUB__(v14, 4); | |
4005 v11 = ((v14 - 4) & 0x80000000u) != 0; | |
4006 //LABEL_24: | |
4007 if ( v11 ^ v12 ) | |
4008 //goto LABEL_25; | |
4009 { | |
4010 a5 |= 0x0002; | |
4011 break; | |
4012 } | |
4013 break; | |
4014 | |
4015 case SPELL_EARTH_STONE_TO_FLESH: | |
4016 case SPELL_SPIRIT_REMOVE_CURSE: | |
4017 case SPELL_SPIRIT_RAISE_DEAD: | |
4018 case SPELL_SPIRIT_RESSURECTION: | |
4019 case SPELL_MIND_REMOVE_FEAR: | |
4020 case SPELL_MIND_CURE_PARALYSIS: | |
4021 case SPELL_MIND_CURE_INSANITY: | |
4022 case SPELL_BODY_CURE_WEAKNESS: | |
4023 case SPELL_BODY_REGENERATION: | |
4024 case SPELL_BODY_CURE_POISON: | |
4025 case SPELL_BODY_CURE_DISEASE: | |
4026 //LABEL_25: | |
4027 //v6 = a5 | 2; | |
4028 a5 |= 0x0002; | |
4029 break; | |
4030 | |
4031 case SPELL_DARK_SACRIFICE: | |
4032 //HIBYTE(v6) = HIBYTE(a5) | 2; | |
4033 a5 |= 0x0200; | |
4034 break; | |
4035 default: | |
4036 break; | |
4037 } | |
4038 } | |
4039 | |
4040 | |
4041 if (a5 & 0x3CA) | |
4042 { | |
1517 | 4043 for (uint i = 0; i < CastSpellInfoCount; ++i) |
1519 | 4044 if (pCastSpellInfo[i].uFlags & 0x3CA) |
1296 | 4045 { |
1519 | 4046 pCastSpellInfo[i].uSpellID = 0; |
1296 | 4047 break; |
4048 } | |
4049 } | |
4050 | |
1517 | 4051 for (uint i = 0; i < CastSpellInfoCount; ++i) |
1296 | 4052 { |
1980 | 4053 CastSpellInfo* spell = &pCastSpellInfo[i]; |
1519 | 4054 if (!spell->uSpellID) |
1296 | 4055 continue; |
4056 | |
1519 | 4057 spell->uSpellID = 0; |
4058 if (spell->uFlags & 0x3CA) | |
1296 | 4059 { |
4060 pGUIWindow_Settings->Release(); | |
4061 pGUIWindow_Settings = nullptr; | |
4062 pMouse->SetCursorBitmap("MICON1"); | |
4063 GameUI_Footer_TimeLeft = 0; | |
1682 | 4064 _50C9A0_IsEnchantingInProgress = 0; |
1296 | 4065 back_to_game(); |
4066 } | |
4067 } | |
4068 | |
1517 | 4069 int result = PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
1296 | 4070 if ( result != -1 ) |
4071 { | |
4072 if ( a5 & 2 ) | |
4073 { | |
4074 if ( pGUIWindow_Settings ) | |
4075 return; | |
4076 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); | |
4077 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); | |
4078 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); | |
4079 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); | |
4080 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
4081 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1296 | 4082 return; |
4083 } | |
4084 if ( a5 & 8 ) | |
4085 { | |
4086 if ( pGUIWindow_Settings ) | |
4087 return; | |
4088 | |
4089 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); | |
4090 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
4091 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1296 | 4092 return; |
4093 } | |
4094 if ( a5 & 0x40 ) | |
4095 { | |
4096 if ( pGUIWindow_Settings ) | |
4097 return; | |
4098 | |
4099 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); | |
1326 | 4100 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Telekinesis, 0, 0, "", 0); |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
4101 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1296 | 4102 return; |
4103 } | |
4104 if ( (char)a5 < 0 ) | |
4105 { | |
4106 if ( pGUIWindow_Settings ) | |
4107 return; | |
4108 ++pIcons_LOD->uTexturePacksCount; | |
4109 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
4110 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1455 | 4111 pGUIWindow_Settings = pCastSpellInfo[result].GetCastSpellInInventoryWindow(); |
1682 | 4112 _50C9A0_IsEnchantingInProgress = 1; |
1296 | 4113 some_active_character = uActiveCharacter; |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
4114 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1296 | 4115 return; |
4116 } | |
4117 if ( HIBYTE(a5) & 1 ) | |
4118 { | |
4119 if ( pGUIWindow_Settings ) | |
4120 return; | |
4121 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); | |
4122 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); | |
4123 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); | |
4124 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); | |
4125 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); | |
4126 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); | |
1829
e4e27261d84e
sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents:
1828
diff
changeset
|
4127 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
1296 | 4128 } |
4129 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) | |
4130 { | |
4131 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); | |
4132 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, | |
4133 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | |
4134 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | |
4135 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "", | |
4136 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0); | |
4137 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178, | |
4138 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth, | |
4139 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, | |
4140 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", | |
4141 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); | |
4142 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); | |
4143 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); | |
4144 } | |
4145 } | |
4146 } |