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