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