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