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