Mercurial > mm7
comparison mm7_6.cpp @ 1005:8073f9a70e8b
CastSpellInfo::_427E01_cast_spell() more clean
author | zipi |
---|---|
date | Sat, 18 May 2013 18:36:08 +0100 |
parents | 9318dd3f3711 |
children | a32318b557c7 |
comparison
equal
deleted
inserted
replaced
1004:eac5af72b614 | 1005:8073f9a70e8b |
---|---|
2462 //int v50; // eax@141 | 2462 //int v50; // eax@141 |
2463 int v51; // eax@146 | 2463 int v51; // eax@146 |
2464 __int16 v52; // ax@153 | 2464 __int16 v52; // ax@153 |
2465 //int v53; // eax@153 | 2465 //int v53; // eax@153 |
2466 signed __int64 v54; // qax@164 | 2466 signed __int64 v54; // qax@164 |
2467 int v55; // edi@164 | 2467 Actor *v55; // edi@164 |
2468 //stru6 *v56; // eax@165 | 2468 //stru6 *v56; // eax@165 |
2469 int v57; // eax@169 | 2469 int v57; // eax@169 |
2470 signed __int64 v58; // qax@177 | 2470 signed __int64 v58; // qax@177 |
2471 int v59; // edi@177 | 2471 Actor *pActor; // edi@177 |
2472 unsigned __int16 v60; // ax@184 | 2472 unsigned __int16 v60; // ax@184 |
2473 int v61; // ecx@184 | 2473 int v61; // ecx@184 |
2474 //int v62; // eax@186 | 2474 //int v62; // eax@186 |
2475 int v63; // ecx@187 | 2475 int v63; // ecx@187 |
2476 int v64; // ecx@188 | 2476 int v64; // ecx@188 |
3079 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 | 3079 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 |
3080 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 | 3080 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100 |
3081 //int v669; // [sp+4h] [bp-E80h]@123 | 3081 //int v669; // [sp+4h] [bp-E80h]@123 |
3082 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 | 3082 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133 |
3083 int v671; // [sp+4h] [bp-E80h]@146 | 3083 int v671; // [sp+4h] [bp-E80h]@146 |
3084 unsigned int v672; // [sp+4h] [bp-E80h]@164 | 3084 //unsigned int v672; // [sp+4h] [bp-E80h]@164 |
3085 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 | 3085 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304 |
3086 //__int16 v674; // [sp+4h] [bp-E80h]@684 | 3086 //__int16 v674; // [sp+4h] [bp-E80h]@684 |
3087 const char *v675; // [sp+4h] [bp-E80h]@800 | 3087 const char *v675; // [sp+4h] [bp-E80h]@800 |
3088 int v676; // [sp+4h] [bp-E80h]@807 | 3088 int v676; // [sp+4h] [bp-E80h]@807 |
3089 int v677; // [sp+4h] [bp-E80h]@861 | 3089 int v677; // [sp+4h] [bp-E80h]@861 |
3295 return; | 3295 return; |
3296 } | 3296 } |
3297 | 3297 |
3298 switch ( pCastSpell->spellnum ) | 3298 switch ( pCastSpell->spellnum ) |
3299 { | 3299 { |
3300 case SPELL_101: | 3300 case SPELL_101: |
3301 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | 3301 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); |
3302 case SPELL_BOW_ARROW: | 3302 case SPELL_BOW_ARROW: |
3303 { | 3303 { |
3304 //v17 = pPlayer; | 3304 amount = 1; |
3305 _this = (ItemGen *)1; | 3305 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) |
3306 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | 3306 amount = 2; |
3307 _this = (ItemGen *)2; | 3307 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); |
3308 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); | 3308 pSpellSprite.stru_24.Reset(); |
3309 pSpellSprite.stru_24.Reset(); | 3309 pSpellSprite.spell_level = v2; |
3310 pSpellSprite.spell_level = v2; | 3310 pSpellSprite.spell_id = pCastSpell->spellnum; |
3311 pSpellSprite.spell_id = pCastSpell->spellnum; | 3311 pSpellSprite.spell_skill = v731; |
3312 pSpellSprite.spell_skill = v731; | 3312 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3313 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3313 if ( pPlayer->WearsItem(510, 2) ) |
3314 if ( pPlayer->WearsItem(510, 2) ) | 3314 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
3315 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | 3315 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3316 pSpellSprite.vPosition.x = pParty->vPosition.x; | 3316 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3317 pSpellSprite.vPosition.y = pParty->vPosition.y; | 3317 pSpellSprite.uAttributes = 0; |
3318 pSpellSprite.uAttributes = 0; | 3318 pSpellSprite.uSpriteFrameID = 0; |
3319 pSpellSprite.uSpriteFrameID = 0; | 3319 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3320 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3320 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3321 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 3321 pSpellSprite.spell_target_pid = a2; |
3322 pSpellSprite.spell_target_pid = a2; | 3322 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3323 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3323 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3324 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | 3324 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3325 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3325 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3326 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; | 3326 memcpy(&pSpellSprite.stru_24, &pPlayer[pPlayer->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); |
3327 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); | 3327 pSpellSprite.uAttributes = 256; |
3328 pSpellSprite.uAttributes = 256; | 3328 if ( pParty->bTurnBasedModeOn == 1 ) |
3329 if ( pParty->bTurnBasedModeOn == 1 ) | 3329 pSpellSprite.uAttributes = 260; |
3330 pSpellSprite.uAttributes = 260; | 3330 for ( i = 0; i < amount; ++i ) |
3331 for ( i = 0; i < (signed int)_this; ++i ) | 3331 { |
3332 { | 3332 if ( i ) |
3333 if ( i ) | 3333 pSpellSprite.vPosition.z += 32; |
3334 pSpellSprite.vPosition.z += 32; | 3334 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); |
3335 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | 3335 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
3336 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | 3336 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3337 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3337 ++pTurnEngine->field_1C; |
3338 ++pTurnEngine->field_1C; | 3338 } |
3339 } | 3339 break; |
3340 break; | 3340 } |
3341 } | 3341 case SPELL_LASER_PROJECTILE: |
3342 case SPELL_LASER_PROJECTILE: | 3342 { |
3343 { | |
3344 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | 3343 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); |
3345 pSpellSprite.stru_24.Reset(); | 3344 pSpellSprite.stru_24.Reset(); |
3346 pSpellSprite.spell_id = pCastSpell->spellnum; | 3345 pSpellSprite.spell_id = pCastSpell->spellnum; |
3347 pSpellSprite.spell_level = v723; | 3346 pSpellSprite.spell_level = v723; |
3348 pSpellSprite.spell_skill = v731; | 3347 pSpellSprite.spell_skill = v731; |
3355 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 3354 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3356 pSpellSprite.spell_target_pid = a2; | 3355 pSpellSprite.spell_target_pid = a2; |
3357 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3356 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3358 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | 3357 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3359 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3358 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3360 memcpy(&pSpellSprite.stru_24, | 3359 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3361 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | 3360 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); |
3362 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | 3361 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 |
3362 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); | |
3363 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | 3363 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); |
3364 HIBYTE(pSpellSprite.uAttributes) |= 1u; | 3364 HIBYTE(pSpellSprite.uAttributes) |= 1u; |
3365 pSpellSprite.uSectorID = v23; | 3365 pSpellSprite.uSectorID = v23; |
3366 if ( pParty->bTurnBasedModeOn == 1 ) | 3366 if ( pParty->bTurnBasedModeOn == 1 ) |
3367 LOBYTE(pSpellSprite.uAttributes) |= 4u; | 3367 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3368 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | 3368 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
3369 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3369 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3370 ++pTurnEngine->field_1C; | 3370 ++pTurnEngine->field_1C; |
3371 break; | 3371 break; |
3372 } | 3372 } |
3373 case SPELL_FIRE_TORCH_LIGHT: | 3373 case SPELL_FIRE_TORCH_LIGHT: |
3374 { | 3374 { |
3375 LODWORD(v733) = 3600 * v2; | |
3376 | |
3377 switch (v731) | 3375 switch (v731) |
3378 { | 3376 { |
3379 case 1: amount = 2; break; | 3377 case 1: amount = 2; break; |
3380 case 2: amount = 3; break; | 3378 case 2: amount = 3; break; |
3381 case 3: | 3379 case 3: |
3386 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3384 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3387 break; | 3385 break; |
3388 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); | 3386 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3389 LODWORD(v727) = 1; | 3387 LODWORD(v727) = 1; |
3390 break; | 3388 break; |
3391 } | 3389 } |
3392 case SPELL_FIRE_FIRE_SPIKE: | 3390 case SPELL_FIRE_FIRE_SPIKE: |
3393 { | 3391 { |
3394 v29 = v731 - 2; | 3392 switch (v731) |
3395 if ( v29 ) | 3393 { |
3396 { | 3394 case 1: amount = 3; break; |
3397 v30 = v29 - 1; | 3395 case 2: amount = 5; break; |
3398 if ( v30 ) | 3396 case 3: amount = 7; break; |
3399 { | 3397 case 4: amount = 9; break; |
3400 if ( v30 == 1 ) | 3398 default: |
3401 amount = 9; | 3399 assert(false); |
3402 else | 3400 } |
3403 amount = 3; | 3401 |
3404 } | 3402 //v31 = v3->uPlayerID; |
3405 else | 3403 //v32 = 8 * v31; |
3406 { | 3404 //LOBYTE(v32) = v32 | OBJECT_Player; |
3407 amount = 7; | 3405 |
3408 } | 3406 //if ( (signed int)uNumSpriteObjects > 0 ) |
3409 } | 3407 int _v733 = 0; |
3410 else | 3408 for (uint i = 0; i < uNumSpriteObjects; ++i) |
3411 { | 3409 { |
3412 amount = 5; | 3410 auto object = pSpriteObjects + i; |
3413 } | 3411 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
3414 //v31 = v3->uPlayerID; | 3412 ++_v733; |
3415 //v32 = 8 * v31; | 3413 /*v33 = (char *)&pSpriteObjects[0].field_48; |
3416 //LOBYTE(v32) = v32 | OBJECT_Player; | 3414 v730 = uNumSpriteObjects; |
3417 | 3415 do |
3418 //if ( (signed int)uNumSpriteObjects > 0 ) | 3416 { |
3419 int _v733 = 0; | 3417 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) |
3420 for (uint i = 0; i < uNumSpriteObjects; ++i) | 3418 ++HIDWORD(v733); |
3421 { | 3419 v33 += 112; |
3422 auto object = pSpriteObjects + i; | 3420 --v730; |
3423 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) | 3421 } |
3424 ++_v733; | 3422 while ( v730 );*/ |
3425 /*v33 = (char *)&pSpriteObjects[0].field_48; | 3423 } |
3426 v730 = uNumSpriteObjects; | 3424 if (_v733 > amount) |
3427 do | 3425 { |
3428 { | 3426 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3429 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | 3427 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3430 ++HIDWORD(v733); | 3428 pCastSpell->spellnum = 0; |
3431 v33 += 112; | 3429 continue; |
3432 --v730; | 3430 } |
3433 } | 3431 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3434 while ( v730 );*/ | 3432 break; |
3435 } | 3433 pSpellSprite.stru_24.Reset(); |
3436 if (_v733 > amount) | 3434 pSpellSprite.spell_id = pCastSpell->spellnum; |
3437 { | 3435 pSpellSprite.spell_level = v2; |
3438 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3436 pSpellSprite.spell_skill = v731; |
3439 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3437 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3440 pCastSpell->spellnum = 0; | 3438 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3441 continue; | 3439 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3442 } | 3440 pSpellSprite.uAttributes = 0; |
3443 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3441 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3444 break; | 3442 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3445 pSpellSprite.stru_24.Reset(); | 3443 pSpellSprite.uSpriteFrameID = 0; |
3446 pSpellSprite.spell_id = pCastSpell->spellnum; | 3444 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3447 pSpellSprite.spell_level = v2; | 3445 pSpellSprite.spell_target_pid = a2; |
3448 pSpellSprite.spell_skill = v731; | 3446 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3449 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3447 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3450 pSpellSprite.vPosition.y = pParty->vPosition.y; | 3448 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3451 pSpellSprite.vPosition.x = pParty->vPosition.x; | 3449 if ( pParty->bTurnBasedModeOn == 1 ) |
3452 pSpellSprite.uAttributes = 0; | 3450 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3453 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3451 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
3454 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 3452 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3455 pSpellSprite.uSpriteFrameID = 0; | 3453 ++pTurnEngine->field_1C; |
3456 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3457 pSpellSprite.spell_target_pid = a2; | |
3458 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3459 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3460 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3461 if ( pParty->bTurnBasedModeOn == 1 ) | |
3462 LOBYTE(pSpellSprite.uAttributes) |= 4u; | |
3463 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | |
3464 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3465 ++pTurnEngine->field_1C; | |
3466 LODWORD(v727) = 1; | |
3467 break; | |
3468 } | |
3469 case SPELL_AIR_IMPLOSION: | |
3470 { | |
3471 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3472 break; | |
3473 if (!a2) | |
3474 { | |
3475 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3476 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3477 pCastSpell->spellnum = 0; | |
3478 continue; | |
3479 } | |
3480 if (PID_TYPE(a2) != OBJECT_Actor) | |
3481 { | |
3482 LODWORD(v727) = 1; | 3454 LODWORD(v727) = 1; |
3483 break; | 3455 break; |
3484 } | 3456 } |
3485 v697.x = 0; | 3457 case SPELL_AIR_IMPLOSION: |
3486 v697.y = 0; | 3458 { |
3487 v697.z = 0; | 3459 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3488 pSpellSprite.stru_24.Reset(); | 3460 break; |
3489 pSpellSprite.spell_id = pCastSpell->spellnum; | 3461 if (!a2) |
3490 pSpellSprite.spell_level = v2; | 3462 { |
3491 pSpellSprite.spell_skill = v731; | 3463 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3492 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3464 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3493 pSpellSprite.uAttributes = 0; | 3465 pCastSpell->spellnum = 0; |
3494 pSpellSprite.uSectorID = 0; | 3466 continue; |
3495 pSpellSprite.uSpriteFrameID = 0; | 3467 } |
3496 pSpellSprite.field_60_distance_related_prolly_lod = 0; | 3468 if (PID_TYPE(a2) != OBJECT_Actor) |
3497 pSpellSprite.uFacing = 0; | 3469 { |
3498 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 3470 LODWORD(v727) = 1; |
3499 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3471 break; |
3500 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3472 } |
3501 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3473 v697.x = 0; |
3502 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3474 v697.y = 0; |
3503 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | 3475 v697.z = 0; |
3504 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | 3476 pSpellSprite.stru_24.Reset(); |
3505 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | 3477 pSpellSprite.spell_id = pCastSpell->spellnum; |
3506 LODWORD(v727) = 1; | 3478 pSpellSprite.spell_level = v2; |
3507 break; | 3479 pSpellSprite.spell_skill = v731; |
3508 } | 3480 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3509 case SPELL_EARTH_MASS_DISTORTION: | 3481 pSpellSprite.uAttributes = 0; |
3510 { | 3482 pSpellSprite.uSectorID = 0; |
3511 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3483 pSpellSprite.uSpriteFrameID = 0; |
3512 break; | 3484 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
3513 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | 3485 pSpellSprite.uFacing = 0; |
3514 { | 3486 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3487 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3488 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3489 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3490 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3491 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3492 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | |
3493 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
3515 LODWORD(v727) = 1; | 3494 LODWORD(v727) = 1; |
3516 break; | 3495 break; |
3517 } | 3496 } |
3518 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | 3497 case SPELL_EARTH_MASS_DISTORTION: |
3519 v704.x = 0; | 3498 { |
3520 v704.y = 0; | 3499 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3521 v704.z = 0; | 3500 break; |
3522 pSpellSprite.stru_24.Reset(); | 3501 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) |
3523 pSpellSprite.spell_id = pCastSpell->spellnum; | 3502 { |
3524 pSpellSprite.spell_level = v2; | 3503 LODWORD(v727) = 1; |
3525 pSpellSprite.spell_skill = v731; | 3504 break; |
3526 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3505 } |
3527 pSpellSprite.uAttributes = 0; | 3506 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); |
3528 pSpellSprite.uSectorID = 0; | 3507 v704.x = 0; |
3529 pSpellSprite.uSpriteFrameID = 0; | 3508 v704.y = 0; |
3530 pSpellSprite.field_60_distance_related_prolly_lod = 0; | 3509 v704.z = 0; |
3531 pSpellSprite.uFacing = 0; | 3510 pSpellSprite.stru_24.Reset(); |
3532 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 3511 pSpellSprite.spell_id = pCastSpell->spellnum; |
3533 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3512 pSpellSprite.spell_level = v2; |
3534 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3513 pSpellSprite.spell_skill = v731; |
3535 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3514 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3536 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3515 pSpellSprite.uAttributes = 0; |
3537 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); | 3516 pSpellSprite.uSectorID = 0; |
3538 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | 3517 pSpellSprite.uSpriteFrameID = 0; |
3539 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | 3518 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
3540 LODWORD(v727) = 1; | 3519 pSpellSprite.uFacing = 0; |
3541 break; | 3520 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3542 } | 3521 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3543 case SPELL_LIGHT_DESTROY_UNDEAD: | 3522 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
3544 { | 3523 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
3545 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | 3524 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
3546 break; | 3525 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); |
3547 //v730 = a2 >> 3; | 3526 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3548 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | 3527 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3549 v691.x = 0; | 3528 LODWORD(v727) = 1; |
3550 v691.y = 0; | 3529 break; |
3551 v691.z = 0; | 3530 } |
3552 pSpellSprite.stru_24.Reset(); | 3531 case SPELL_LIGHT_DESTROY_UNDEAD: |
3553 pSpellSprite.spell_id = pCastSpell->spellnum; | 3532 { |
3554 pSpellSprite.spell_level = v2; | 3533 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3555 pSpellSprite.spell_skill = v731; | 3534 break; |
3556 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3535 //v730 = a2 >> 3; |
3557 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3536 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; |
3558 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3537 v691.x = 0; |
3559 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3538 v691.y = 0; |
3560 pSpellSprite.uAttributes = 0; | 3539 v691.z = 0; |
3561 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | 3540 pSpellSprite.stru_24.Reset(); |
3562 pSpellSprite.uSpriteFrameID = 0; | 3541 pSpellSprite.spell_id = pCastSpell->spellnum; |
3563 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 3542 pSpellSprite.spell_level = v2; |
3564 pSpellSprite.spell_target_pid = a2; | 3543 pSpellSprite.spell_skill = v731; |
3565 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3544 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3566 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | 3545 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
3567 pSpellSprite.uAttributes |= 0x80u; | 3546 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
3568 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3547 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
3569 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); | 3548 pSpellSprite.uAttributes = 0; |
3570 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) | 3549 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); |
3571 { | 3550 pSpellSprite.uSpriteFrameID = 0; |
3572 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3551 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3573 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3552 pSpellSprite.spell_target_pid = a2; |
3574 pCastSpell->spellnum = 0; | 3553 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3575 continue; | 3554 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3576 } | 3555 pSpellSprite.uAttributes |= 0x80u; |
3577 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | 3556 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3578 LODWORD(v727) = 1; | 3557 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3579 break; | 3558 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3580 } | 3559 { |
3581 case SPELL_FIRE_FIRE_BOLT: | 3560 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3582 case SPELL_FIRE_FIREBALL: | 3561 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3583 case SPELL_FIRE_INCINERATE: | 3562 pCastSpell->spellnum = 0; |
3584 case SPELL_AIR_LIGHNING_BOLT: | 3563 continue; |
3585 case SPELL_WATER_ICE_BOLT: | 3564 } |
3586 case SPELL_WATER_ICE_BLAST: | 3565 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); |
3587 case SPELL_EARTH_STUN: | 3566 LODWORD(v727) = 1; |
3588 case SPELL_EARTH_DEADLY_SWARM: | 3567 break; |
3589 case SPELL_MIND_MIND_BLAST: | 3568 } |
3590 case SPELL_MIND_PSYCHIC_SHOCK: | 3569 case SPELL_FIRE_FIRE_BOLT: |
3591 case SPELL_BODY_HARM: | 3570 case SPELL_FIRE_FIREBALL: |
3592 case SPELL_LIGHT_LIGHT_BOLT: | 3571 case SPELL_FIRE_INCINERATE: |
3593 case SPELL_DARK_DRAGON_BREATH: | 3572 case SPELL_AIR_LIGHNING_BOLT: |
3594 { | 3573 case SPELL_WATER_ICE_BOLT: |
3574 case SPELL_WATER_ICE_BLAST: | |
3575 case SPELL_EARTH_STUN: | |
3576 case SPELL_EARTH_DEADLY_SWARM: | |
3577 case SPELL_MIND_MIND_BLAST: | |
3578 case SPELL_MIND_PSYCHIC_SHOCK: | |
3579 case SPELL_BODY_HARM: | |
3580 case SPELL_LIGHT_LIGHT_BOLT: | |
3581 case SPELL_DARK_DRAGON_BREATH: | |
3582 { | |
3595 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3583 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3596 break; | 3584 break; |
3597 pSpellSprite.stru_24.Reset(); | 3585 pSpellSprite.stru_24.Reset(); |
3598 pSpellSprite.spell_id = pCastSpell->spellnum; | 3586 pSpellSprite.spell_id = pCastSpell->spellnum; |
3599 pSpellSprite.spell_level = v2; | 3587 pSpellSprite.spell_level = v2; |
3620 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; | 3608 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
3621 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3609 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3622 ++pTurnEngine->field_1C; | 3610 ++pTurnEngine->field_1C; |
3623 LODWORD(v727) = 1; | 3611 LODWORD(v727) = 1; |
3624 break; | 3612 break; |
3625 } | 3613 } |
3626 case SPELL_WATER_ACID_BURST: | 3614 case SPELL_WATER_ACID_BURST: |
3627 case SPELL_EARTH_BLADES: | 3615 case SPELL_EARTH_BLADES: |
3628 case SPELL_BODY_FLYING_FIST: | 3616 case SPELL_BODY_FLYING_FIST: |
3629 case SPELL_DARK_TOXIC_CLOUD: | 3617 case SPELL_DARK_TOXIC_CLOUD: |
3630 { | 3618 { |
3631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3619 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3632 break; | 3620 break; |
3633 pSpellSprite.stru_24.Reset(); | 3621 pSpellSprite.stru_24.Reset(); |
3634 pSpellSprite.spell_id = pCastSpell->spellnum; | 3622 pSpellSprite.spell_id = pCastSpell->spellnum; |
3635 pSpellSprite.spell_level = v2; | 3623 pSpellSprite.spell_level = v2; |
3656 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3644 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3657 ++pTurnEngine->field_1C; | 3645 ++pTurnEngine->field_1C; |
3658 LODWORD(v727) = 1; | 3646 LODWORD(v727) = 1; |
3659 break; | 3647 break; |
3660 } | 3648 } |
3661 case SPELL_LIGHT_SUNRAY: | 3649 case SPELL_LIGHT_SUNRAY: |
3662 { | 3650 { |
3663 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | 3651 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
3664 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | 3652 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3665 { | 3653 { |
3666 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3654 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3667 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3655 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3696 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3684 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3697 ++pTurnEngine->field_1C; | 3685 ++pTurnEngine->field_1C; |
3698 LODWORD(v727) = 1; | 3686 LODWORD(v727) = 1; |
3699 } | 3687 } |
3700 break; | 3688 break; |
3701 } | 3689 } |
3702 case SPELL_LIGHT_PARALYZE: | 3690 case SPELL_LIGHT_PARALYZE: |
3703 { | 3691 { |
3704 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3692 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3705 break; | 3693 break; |
3706 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], | 3694 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3707 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) | 3695 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) |
3708 { | 3696 { |
3709 LODWORD(v727) = 1; | 3697 LODWORD(v727) = 1; |
3710 break; | 3698 break; |
3711 } | 3699 } |
3712 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | 3700 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); |
3713 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | 3701 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3714 v55 = v721; | 3702 v55 = &pActors[PID_ID(a2)]; |
3715 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | 3703 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); |
3716 *(char *)(v55 + 38) |= 8u; | 3704 BYTE2(v55->uAttributes) |= 8u; |
3717 *(short *)(v55 + 148) = 0; | 3705 v55->vVelocity.x = 0; |
3718 v672 = 0; | 3706 //v672 = 0; |
3719 *(short *)(v55 + 150) = 0; | 3707 v55->vVelocity.y = 0; |
3720 v661 = (Actor *)v55; | 3708 v661 = v55; |
3721 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | 3709 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
3722 LODWORD(v727) = 1; | 3710 LODWORD(v727) = 1; |
3723 break; | 3711 break; |
3724 } | 3712 } |
3725 case SPELL_EARTH_SLOW: | 3713 case SPELL_EARTH_SLOW: |
3726 { | 3714 { |
3727 if ( v731 == 2 ) | 3715 switch (v731) |
3728 { | 3716 { |
3729 v57 = 300 * v2; | 3717 case 1: LODWORD(v733) = 180 * v2; amount = 2; break; |
3730 amount = 2; | 3718 case 2: LODWORD(v733) = 300 * v2; amount = 2; break; |
3731 } | 3719 case 3: LODWORD(v733) = 300 * v2; amount = 4; break; |
3732 else if ( v731 == 3 ) | 3720 case 4: LODWORD(v733) = 300 * v2; amount = 8; break; |
3733 { | 3721 default: |
3734 amount = 4; | 3722 assert(false); |
3735 v57 = 300 * v2; | 3723 } |
3736 } | |
3737 else if ( v731 == 4 ) | |
3738 { | |
3739 v57 = 300 * v2; | |
3740 amount = 8; | |
3741 } | |
3742 else | |
3743 { | |
3744 v57 = 180 * v2; | |
3745 amount = 2; | |
3746 } | |
3747 // LABEL_174: | |
3748 LODWORD(v733) = v57; | |
3749 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3724 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3750 break; | 3725 break; |
3751 if (PID_TYPE(a2) != OBJECT_Actor | 3726 if (PID_TYPE(a2) != OBJECT_Actor |
3752 || (v721 = 836 * PID_ID(a2), | 3727 || (v721 = 836 * PID_ID(a2), |
3753 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | 3728 LODWORD(v718) = (int)&pActors[PID_ID(a2)], |
3755 { | 3730 { |
3756 LODWORD(v727) = 1; | 3731 LODWORD(v727) = 1; |
3757 break; | 3732 break; |
3758 } | 3733 } |
3759 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | 3734 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); |
3760 v59 = v721; | 3735 //v59 = v721; |
3736 pActor = &pActors[PID_ID(a2)]; | |
3761 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | 3737 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( |
3762 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | 3738 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0); |
3763 v731, | 3739 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3764 amount, | 3740 BYTE2(pActor->uAttributes) |= 8u; |
3765 0, | 3741 //v672 = 0; |
3766 0); | |
3767 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3768 v672 = 0; | |
3769 v661 = (Actor *)LODWORD(v718); | 3742 v661 = (Actor *)LODWORD(v718); |
3770 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | 3743 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
3771 LODWORD(v727) = 1; | 3744 LODWORD(v727) = 1; |
3772 break; | 3745 break; |
3773 } | 3746 } |
3774 case SPELL_MIND_CHARM: | 3747 case SPELL_MIND_CHARM: |
3775 { | 3748 { |
3776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3749 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3777 break; | 3750 break; |
3778 | 3751 |
3779 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | 3752 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
3780 { | 3753 { |
3824 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; | 3797 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; |
3825 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 3798 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3826 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); | 3799 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); |
3827 LODWORD(v727) = 1; | 3800 LODWORD(v727) = 1; |
3828 break; | 3801 break; |
3829 } | 3802 } |
3830 case SPELL_DARK_SHRINKING_RAY: | 3803 case SPELL_DARK_SHRINKING_RAY: |
3831 { | 3804 { |
3832 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3805 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3833 break; | 3806 break; |
3834 pSpellSprite.stru_24.Reset(); | 3807 pSpellSprite.stru_24.Reset(); |
3835 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 3808 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3836 pSpellSprite.vPosition.x = pParty->vPosition.x; | 3809 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3857 | 3830 |
3858 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3831 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3859 ++pTurnEngine->field_1C; | 3832 ++pTurnEngine->field_1C; |
3860 LODWORD(v727) = 1; | 3833 LODWORD(v727) = 1; |
3861 break; | 3834 break; |
3862 } | 3835 } |
3863 case SPELL_FIRE_FIRE_AURA: | 3836 case SPELL_FIRE_FIRE_AURA: |
3864 { | 3837 { |
3865 v63 = v731 - 1; | 3838 v63 = v731 - 1; |
3866 if ( !v63 ) | 3839 if ( !v63 ) |
3867 { | 3840 { |
3868 amount = 10; | 3841 amount = 10; |
3869 LODWORD(v733) = 3600 * v2; | 3842 LODWORD(v733) = 3600 * v2; |
3927 | 3900 |
3928 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3901 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3929 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3902 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3930 pCastSpell->spellnum = 0; | 3903 pCastSpell->spellnum = 0; |
3931 continue; | 3904 continue; |
3932 } | 3905 } |
3933 case SPELL_BODY_REGENERATION: | 3906 case SPELL_BODY_REGENERATION: |
3934 { | 3907 { |
3935 v70 = v731 - 1; | 3908 v70 = v731 - 1; |
3936 LODWORD(v733) = 3600 * v2; | 3909 LODWORD(v733) = 3600 * v2; |
3937 if ( v70 && (v71 = v70 - 1) != 0 ) | 3910 if ( v70 && (v71 = v70 - 1) != 0 ) |
3938 { | 3911 { |
3939 v72 = v71 - 1; | 3912 v72 = v71 - 1; |
3957 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); | 3930 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3958 | 3931 |
3959 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | 3932 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); |
3960 LODWORD(v727) = 1; | 3933 LODWORD(v727) = 1; |
3961 break; | 3934 break; |
3962 } | 3935 } |
3963 case SPELL_FIRE_PROTECTION_FROM_FIRE: | 3936 case SPELL_FIRE_PROTECTION_FROM_FIRE: |
3964 case SPELL_AIR_PROTECTION_FROM_AIR: | 3937 case SPELL_AIR_PROTECTION_FROM_AIR: |
3965 case SPELL_WATER_PROTECTION_FROM_WATER: | 3938 case SPELL_WATER_PROTECTION_FROM_WATER: |
3966 case SPELL_EARTH_PROTECTION_FROM_EARTH: | 3939 case SPELL_EARTH_PROTECTION_FROM_EARTH: |
3967 case SPELL_MIND_PROTECTION_FROM_MIND: | 3940 case SPELL_MIND_PROTECTION_FROM_MIND: |
3968 case SPELL_BODY_PROTECTION_FROM_BODY: | 3941 case SPELL_BODY_PROTECTION_FROM_BODY: |
3969 { | 3942 { |
3970 LODWORD(v733) = 3600 * v2; | 3943 LODWORD(v733) = 3600 * v2; |
3971 if ( v731 > 0 && v731 <= 4) | 3944 if ( v731 > 0 && v731 <= 4) |
3972 { | 3945 { |
3973 amount = v731 * v2; | 3946 amount = v731 * v2; |
3974 } | 3947 } |
4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | 3979 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4007 v90 = (double)(signed int)v733 * 4.2666669; | 3980 v90 = (double)(signed int)v733 * 4.2666669; |
4008 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | 3981 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); |
4009 LODWORD(v727) = 1; | 3982 LODWORD(v727) = 1; |
4010 break; | 3983 break; |
4011 } | 3984 } |
4012 case SPELL_FIRE_HASTE: | 3985 case SPELL_FIRE_HASTE: |
4013 { | 3986 { |
4014 if ( v731 == 1 || v731 == 2 ) | 3987 if ( v731 == 1 || v731 == 2 ) |
4015 { | 3988 { |
4016 LODWORD(v733) = 60 * (v2 + 60); | 3989 LODWORD(v733) = 60 * (v2 + 60); |
4017 } | 3990 } |
4018 else if ( v731 == 3 ) | 3991 else if ( v731 == 3 ) |
4043 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); | 4016 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4044 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | 4017 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4045 } | 4018 } |
4046 } | 4019 } |
4047 break; | 4020 break; |
4048 } | 4021 } |
4049 case SPELL_SPIRIT_BLESS: | 4022 case SPELL_SPIRIT_BLESS: |
4050 { | 4023 { |
4051 if ( v731 == 1 || v731 == 2 ) | 4024 if ( v731 == 1 || v731 == 2 ) |
4052 { | 4025 { |
4053 LODWORD(v733) = 300 * (v2 + 12); | 4026 LODWORD(v733) = 300 * (v2 + 12); |
4054 } | 4027 } |
4055 else if ( v731 == 3 ) | 4028 else if ( v731 == 3 ) |
4098 ++v105; | 4071 ++v105; |
4099 } | 4072 } |
4100 while ( v730b <= &pParty->pPlayers[3] ); | 4073 while ( v730b <= &pParty->pPlayers[3] ); |
4101 LODWORD(v727) = 1; | 4074 LODWORD(v727) = 1; |
4102 break; | 4075 break; |
4103 } | 4076 } |
4104 case SPELL_SPIRIT_SPIRIT_LASH: | 4077 case SPELL_SPIRIT_SPIRIT_LASH: |
4105 { | 4078 { |
4106 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) | 4079 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) |
4107 { | 4080 { |
4108 //v730 = a2 >> 3; | 4081 //v730 = a2 >> 3; |
4109 v112 = &pActors[PID_ID(a2)]; | 4082 v112 = &pActors[PID_ID(a2)]; |
4110 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | 4083 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); |
4216 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; | 4189 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4217 //LABEL_304: | 4190 //LABEL_304: |
4218 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | 4191 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); |
4219 LODWORD(v727) = 1; | 4192 LODWORD(v727) = 1; |
4220 break; | 4193 break; |
4221 } | 4194 } |
4222 case SPELL_FIRE_IMMOLATION: | 4195 case SPELL_FIRE_IMMOLATION: |
4223 { | 4196 { |
4224 if ( v731 == 4 && v139 == 1 ) | 4197 if ( v731 == 4 && v139 == 1 ) |
4225 LODWORD(v733) = 600 * v2; | 4198 LODWORD(v733) = 600 * v2; |
4226 else | 4199 else |
4227 LODWORD(v733) = 60 * v2; | 4200 LODWORD(v733) = 60 * v2; |
4228 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4201 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4234 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | 4207 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4235 | 4208 |
4236 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | 4209 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); |
4237 LODWORD(v727) = 1; | 4210 LODWORD(v727) = 1; |
4238 break; | 4211 break; |
4239 } | 4212 } |
4240 case SPELL_FIRE_METEOR_SHOWER: | 4213 case SPELL_FIRE_METEOR_SHOWER: |
4241 { | 4214 { |
4242 v149 = v731 - 1; | 4215 v149 = v731 - 1; |
4243 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | 4216 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) |
4244 { | 4217 { |
4245 if ( v151 == 1 ) | 4218 if ( v151 == 1 ) |
4246 _this = (ItemGen *)20; | 4219 _this = (ItemGen *)20; |
4405 while ( v168 < 4 ); | 4378 while ( v168 < 4 ); |
4406 | 4379 |
4407 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 4380 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4408 LODWORD(v727) = 1; | 4381 LODWORD(v727) = 1; |
4409 break; | 4382 break; |
4410 } | 4383 } |
4411 case SPELL_AIR_FEATHER_FALL: | 4384 case SPELL_AIR_FEATHER_FALL: |
4412 { | 4385 { |
4413 if ( v731 == 1 ) | 4386 switch (v731) |
4414 { | 4387 { |
4415 LODWORD(v733) = 300 * v2; | 4388 case 1: LODWORD(v733) = 300 * v2; break; |
4416 } | 4389 case 2: LODWORD(v733) = 600 * v2; break; |
4417 else if ( v731 == 2 ) | 4390 case 3: |
4418 { | 4391 case 4: LODWORD(v733) = 3600 * v2; break; |
4419 LODWORD(v733) = 600 * v2; | 4392 default: |
4420 } | 4393 assert(false); |
4421 else if ( v731 == 3 || v731 == 4 ) | |
4422 { | |
4423 LODWORD(v733) = 3600 * v2; | |
4424 //LABEL_353: | |
4425 //LODWORD(v733) = v173; | |
4426 } | 4394 } |
4427 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4395 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4428 break; | 4396 break; |
4429 v174 = 0; | 4397 v174 = 0; |
4430 do | 4398 do |
4436 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); | 4404 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4437 | 4405 |
4438 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 4406 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4439 LODWORD(v727) = 1; | 4407 LODWORD(v727) = 1; |
4440 break; | 4408 break; |
4441 } | 4409 } |
4442 case SPELL_AIR_SPARKS: | 4410 case SPELL_AIR_SPARKS: |
4443 { | 4411 { |
4444 v184 = v731 - 1; | 4412 switch (v731) |
4445 if ( v184 ) | 4413 { |
4446 { | 4414 case 1: amount = 3; break; |
4447 v185 = v184 - 1; | 4415 case 2: amount = 5; break; |
4448 if ( v185 ) | 4416 case 3: amount = 7; break; |
4449 { | 4417 case 4: amount = 9; break; |
4450 v186 = v185 - 1; | 4418 default: |
4451 if ( v186 ) | 4419 assert(false); |
4452 { | 4420 } |
4453 if ( v186 == 1 ) | 4421 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4454 amount = 9; | 4422 break; |
4455 } | 4423 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
4456 else | 4424 pSpellSprite.stru_24.Reset(); |
4457 { | 4425 pSpellSprite.spell_id = pCastSpell->spellnum; |
4458 amount = 7; | 4426 pSpellSprite.spell_level = v2; |
4459 } | 4427 pSpellSprite.spell_skill = v731; |
4460 } | 4428 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4461 else | 4429 pSpellSprite.vPosition.y = pParty->vPosition.y; |
4462 { | 4430 pSpellSprite.vPosition.x = pParty->vPosition.x; |
4463 amount = 5; | 4431 pSpellSprite.uAttributes = 0; |
4464 } | 4432 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4465 } | 4433 pSpellSprite.uSectorID = pIndoor->GetSector( |
4466 else | 4434 pParty->vPosition.x, |
4467 { | 4435 pParty->vPosition.y, |
4468 amount = 3; | 4436 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
4469 } | 4437 pSpellSprite.uSpriteFrameID = 0; |
4470 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4438 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4471 break; | 4439 pSpellSprite.spell_target_pid = a2; |
4472 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | 4440 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4473 pSpellSprite.stru_24.Reset(); | 4441 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4474 pSpellSprite.spell_id = pCastSpell->spellnum; | 4442 if ( pParty->bTurnBasedModeOn == 1 ) |
4475 pSpellSprite.spell_level = v2; | 4443 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4476 pSpellSprite.spell_skill = v731; | 4444 v188 = (signed int)_v726 / -2; |
4477 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 4445 v189 = (signed int)_v726 / 2; |
4478 pSpellSprite.vPosition.y = pParty->vPosition.y; | 4446 while ( v188 <= v189 ) |
4479 pSpellSprite.vPosition.x = pParty->vPosition.x; | 4447 { |
4480 pSpellSprite.uAttributes = 0; | 4448 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4481 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 4449 if ( pSpellSprite.Create( |
4482 pSpellSprite.uSectorID = pIndoor->GetSector( | 4450 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4483 pParty->vPosition.x, | 4451 v715.uPitchAngle, |
4484 pParty->vPosition.y, | 4452 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4485 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 4453 pCastSpell->uPlayerID + 1) != -1 |
4486 pSpellSprite.uSpriteFrameID = 0; | 4454 && pParty->bTurnBasedModeOn == 1 ) |
4487 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 4455 ++pTurnEngine->field_1C; |
4488 pSpellSprite.spell_target_pid = a2; | 4456 v188 += _v726 / (amount - 1); |
4489 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 4457 } |
4490 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 4458 LODWORD(v727) = 1; |
4491 if ( pParty->bTurnBasedModeOn == 1 ) | 4459 break; |
4492 LOBYTE(pSpellSprite.uAttributes) |= 4u; | 4460 } |
4493 v188 = (signed int)_v726 / -2; | |
4494 v189 = (signed int)_v726 / 2; | |
4495 while ( v188 <= v189 ) | |
4496 { | |
4497 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); | |
4498 if ( pSpellSprite.Create( | |
4499 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
4500 v715.uPitchAngle, | |
4501 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
4502 pCastSpell->uPlayerID + 1) != -1 | |
4503 && pParty->bTurnBasedModeOn == 1 ) | |
4504 ++pTurnEngine->field_1C; | |
4505 v188 += _v726 / (amount - 1); | |
4506 } | |
4507 LODWORD(v727) = 1; | |
4508 break; | |
4509 } | |
4510 | |
4511 case SPELL_AIR_JUMP: | 4461 case SPELL_AIR_JUMP: |
4512 { | 4462 { |
4513 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | 4463 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) |
4514 { | 4464 { |
4515 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | 4465 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! |
4516 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4466 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4517 break; | 4467 break; |
4524 while ( v191 < 4 ); | 4474 while ( v191 < 4 ); |
4525 BYTE1(pParty->uFlags) |= 1u; | 4475 BYTE1(pParty->uFlags) |= 1u; |
4526 pParty->uFallSpeed = 1000; | 4476 pParty->uFallSpeed = 1000; |
4527 LODWORD(v727) = 1; | 4477 LODWORD(v727) = 1; |
4528 break; | 4478 break; |
4529 } | 4479 } |
4530 case SPELL_AIR_INVISIBILITY: | 4480 case SPELL_AIR_INVISIBILITY: |
4531 { | 4481 { |
4532 v192 = v731 - 1; | 4482 switch (v731) |
4533 if ( v731 == 1 ) | 4483 { |
4534 { | 4484 case 1: LODWORD(v733) = 600 * v2; amount = v2; break; |
4535 amount = v2; | 4485 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break; |
4536 LODWORD(v733) = 600 * v2; | 4486 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break; |
4537 } | 4487 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break; |
4538 else if ( v731 == 2 ) | 4488 default: |
4539 { | 4489 assert(false); |
4540 v196 = 2 * v2; | 4490 } |
4541 amount = v196; | |
4542 LODWORD(v733) = 600 * v2; | |
4543 } | |
4544 else if ( v731 == 3 ) | |
4545 { | |
4546 v196 = 3 * v2; | |
4547 //goto LABEL_389; | |
4548 amount = v196; | |
4549 LODWORD(v733) = 600 * v2; | |
4550 } | |
4551 else if ( v731 == 4 ) | |
4552 { | |
4553 amount = 4 * v2; | |
4554 v195 = 3600 * v2; | |
4555 // LABEL_392: | |
4556 LODWORD(v733) = v195; | |
4557 } | |
4558 // LABEL_393: | |
4559 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | 4491 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4560 { | 4492 { |
4561 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | 4493 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4562 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4494 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4563 pCastSpell->spellnum = 0; | 4495 pCastSpell->spellnum = 0; |
4572 | 4504 |
4573 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | 4505 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
4574 LODWORD(v727) = 1; | 4506 LODWORD(v727) = 1; |
4575 } | 4507 } |
4576 break; | 4508 break; |
4577 } | 4509 } |
4578 case SPELL_AIR_FLY: | 4510 case SPELL_AIR_FLY: |
4579 { | 4511 { |
4580 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 4512 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4581 { | 4513 { |
4582 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | 4514 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! |
4583 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4515 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4584 break; | 4516 break; |
4585 } | 4517 } |
4586 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) | 4518 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
4587 { | 4519 { |
4588 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 4520 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4589 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4521 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4590 break; | 4522 break; |
4591 } | 4523 } |
4592 LODWORD(v733) = 3600 * v2; | 4524 LODWORD(v733) = 3600 * v2; |
4593 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | 4525 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) |
4594 amount = 1; | 4526 amount = 1; |
4595 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4527 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4596 break; | 4528 break; |
4597 v205 = 0; | 4529 v205 = 0; |
4598 do | 4530 do |
4599 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | 4531 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); |
4600 while ( v205 < 4 ); | 4532 while ( v205 < 4 ); |
4601 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | 4533 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); |
4602 v207 = pCastSpell->uPlayerID + 1; | 4534 v207 = pCastSpell->uPlayerID + 1; |
4603 v716 = v206; | 4535 v716 = v206; |
4604 | 4536 |
4605 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | 4537 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); |
4606 LODWORD(v727) = 1; | 4538 LODWORD(v727) = 1; |
4607 break; | 4539 break; |
4608 } | 4540 } |
4609 | |
4610 case SPELL_AIR_STARBURST: | 4541 case SPELL_AIR_STARBURST: |
4611 { | 4542 { |
4612 //v67 = 2; | 4543 //v67 = 2; |
4613 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 4544 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4614 { | 4545 { |
4615 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | 4546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! |
4616 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4547 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4617 pCastSpell->spellnum = 0; | 4548 pCastSpell->spellnum = 0; |
4618 continue; | 4549 continue; |
4619 } | 4550 } |
4620 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4551 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4621 break; | 4552 break; |
4622 v208 = PID_TYPE(a2); | 4553 v208 = PID_TYPE(a2); |
4623 LODWORD(v725) = PID_TYPE(a2); | 4554 LODWORD(v725) = PID_TYPE(a2); |
4624 if ( v208 == 3 ) | 4555 if ( v208 == 3 ) |
4625 { | 4556 { |
4626 v209 = PID_ID(a2); | 4557 v209 = PID_ID(a2); |
4627 LODWORD(v718) = pActors[v209].vPosition.x; | 4558 LODWORD(v718) = pActors[v209].vPosition.x; |
4628 v210 = pActors[v209].vPosition.y; | 4559 v210 = pActors[v209].vPosition.y; |
4629 v211 = pActors[v209].vPosition.z; | 4560 v211 = pActors[v209].vPosition.z; |
4630 v713 = v210; | 4561 v713 = v210; |
4631 } | |
4632 else | |
4633 { | |
4634 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4635 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4636 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4637 v214 = sub_42EBBE(2048, v213); | |
4638 v211 = pParty->vPosition.z; | |
4639 v713 = pParty->vPosition.y + v214; | |
4640 v208 = LODWORD(v725); | |
4641 } | |
4642 HIDWORD(v733) = 0; | |
4643 *(float *)&v732 = (double)v211; | |
4644 LODWORD(v725) = v211 + 2500; | |
4645 v721 = 0; | |
4646 *(float *)&y = (double)(v211 + 2500); | |
4647 v730 = v208 == 3 ? a2 : 0; | |
4648 a2 = 20; | |
4649 do | |
4650 { | |
4651 v215 = rand(); | |
4652 v216 = (double)v721; | |
4653 v217 = (double)SHIDWORD(v733); | |
4654 *(float *)&uRequiredMana = v217; | |
4655 _this = (ItemGen *)(v215 % 1000); | |
4656 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4657 *(float *)&v721 = v217 * v217; | |
4658 //*(float *)&v726 = v216 * v216; | |
4659 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4660 { | |
4661 LODWORD(v685) = 0; | |
4662 HIDWORD(v685) = 0; | |
4663 } | 4562 } |
4664 else | 4563 else |
4665 { | 4564 { |
4666 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); | 4565 v212 = stru_5C6E00->Cos(pParty->sRotationY); |
4667 v685 = __PAIR__( | 4566 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); |
4668 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | 4567 v213 = stru_5C6E00->Sin(pParty->sRotationY); |
4669 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | 4568 v214 = sub_42EBBE(2048, v213); |
4670 } | 4569 v211 = pParty->vPosition.z; |
4671 pSpellSprite.stru_24.Reset(); | 4570 v713 = pParty->vPosition.y + v214; |
4672 pSpellSprite.spell_id = pCastSpell->spellnum; | 4571 v208 = LODWORD(v725); |
4673 pSpellSprite.spell_level = v2; | 4572 } |
4674 pSpellSprite.spell_skill = v731; | 4573 HIDWORD(v733) = 0; |
4675 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | 4574 *(float *)&v732 = (double)v211; |
4676 pSpellSprite.uAttributes = 0; | 4575 LODWORD(v725) = v211 + 2500; |
4677 pSpellSprite.vPosition.x = LODWORD(v718); | 4576 v721 = 0; |
4678 pSpellSprite.vPosition.y = v713; | 4577 *(float *)&y = (double)(v211 + 2500); |
4679 pSpellSprite.uSectorID = 0; | 4578 v730 = v208 == 3 ? a2 : 0; |
4680 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | 4579 a2 = 20; |
4681 pSpellSprite.uSpriteFrameID = 0; | 4580 do |
4682 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | 4581 { |
4683 pSpellSprite.spell_target_pid = v730; | 4582 v215 = rand(); |
4684 //__debugbreak();//звездопад | 4583 v216 = (double)v721; |
4685 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | 4584 v217 = (double)SHIDWORD(v733); |
4686 pSpellSprite.uFacing = v685; | 4585 *(float *)&uRequiredMana = v217; |
4687 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | 4586 _this = (ItemGen *)(v215 % 1000); |
4688 if ( pParty->bTurnBasedModeOn == 1 ) | 4587 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; |
4689 pSpellSprite.uAttributes = 4; | 4588 *(float *)&v721 = v217 * v217; |
4690 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | 4589 //*(float *)&v726 = v216 * v216; |
4691 && pParty->bTurnBasedModeOn == 1 ) | 4590 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) |
4692 ++pTurnEngine->field_1C; | 4591 { |
4693 v721 = rand() % 1024 - 512; | 4592 LODWORD(v685) = 0; |
4694 v218 = rand(); | 4593 HIDWORD(v685) = 0; |
4695 v14 = a2-- == 1; | 4594 } |
4696 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | 4595 else |
4697 } | 4596 { |
4698 while ( !v14 ); | 4597 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4699 LODWORD(v727) = 1; | 4598 v685 = __PAIR__( |
4700 break; | 4599 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), |
4701 } | 4600 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); |
4702 | 4601 } |
4602 pSpellSprite.stru_24.Reset(); | |
4603 pSpellSprite.spell_id = pCastSpell->spellnum; | |
4604 pSpellSprite.spell_level = v2; | |
4605 pSpellSprite.spell_skill = v731; | |
4606 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
4607 pSpellSprite.uAttributes = 0; | |
4608 pSpellSprite.vPosition.x = LODWORD(v718); | |
4609 pSpellSprite.vPosition.y = v713; | |
4610 pSpellSprite.uSectorID = 0; | |
4611 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4612 pSpellSprite.uSpriteFrameID = 0; | |
4613 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
4614 pSpellSprite.spell_target_pid = v730; | |
4615 //__debugbreak();//звездопад | |
4616 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4617 pSpellSprite.uFacing = v685; | |
4618 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
4619 if ( pParty->bTurnBasedModeOn == 1 ) | |
4620 pSpellSprite.uAttributes = 4; | |
4621 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 | |
4622 && pParty->bTurnBasedModeOn == 1 ) | |
4623 ++pTurnEngine->field_1C; | |
4624 v721 = rand() % 1024 - 512; | |
4625 v218 = rand(); | |
4626 v14 = a2-- == 1; | |
4627 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4628 } | |
4629 while ( !v14 ); | |
4630 LODWORD(v727) = 1; | |
4631 break; | |
4632 } | |
4703 case SPELL_WATER_AWAKEN: | 4633 case SPELL_WATER_AWAKEN: |
4704 { | 4634 { |
4705 if ( v731 == 1 ) | 4635 switch (v731) |
4706 amount = 180 * v2; | 4636 { |
4707 else if ( v731 == 2) | 4637 case 1: amount = 180 * v2; break; |
4708 amount = 3600 * v2; | 4638 case 2: amount = 3600 * v2; break; |
4709 else if ( v731 == 3 ) | 4639 case 3: amount = 86400 * v2; break; |
4710 amount = 86400 * v2; | 4640 case 4: amount = 0; break; |
4711 else if ( v731 == 4 ) | 4641 default: |
4712 amount = 0; | 4642 assert(false); |
4713 // LABEL_433: | 4643 } |
4714 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4644 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4715 break; | 4645 break; |
4716 v222 = pParty->pPlayers; | 4646 v222 = pParty->pPlayers; |
4717 HIDWORD(v733) = (int)(char *)&pParty + 2508; | 4647 HIDWORD(v733) = (int)pParty->pPlayers;//(int)(char *)&pParty + 2508; |
4718 while ( 2 ) | 4648 //while ( 2 ) |
4719 { | 4649 for( int i=0; i < 4; i++ ) |
4650 { | |
4651 pPlayer = &pParty->pPlayers[i]; | |
4720 if ( v731 == 4 ) | 4652 if ( v731 == 4 ) |
4721 { | 4653 { |
4722 if ( v222->pConditions[2] ) | 4654 if ( pPlayer->pConditions[2] ) |
4723 { | 4655 { |
4724 //*((int *)v222 + 4) = 0; | 4656 //*((int *)v222 + 4) = 0; |
4725 //*((int *)v222 + 5) = 0; | 4657 //*((int *)v222 + 5) = 0; |
4726 v222->pConditions[2] = 0; | 4658 pPlayer->pConditions[2] = 0; |
4727 v222->PlaySound(SPEECH_103, 0); | 4659 pPlayer->PlaySound(SPEECH_103, 0); |
4728 } | 4660 } |
4729 } | 4661 } |
4730 else | 4662 else |
4731 { | 4663 { |
4732 v223 = v222->DiscardConditionIfLastsLongerThan( | 4664 v223 = pPlayer->DiscardConditionIfLastsLongerThan( |
4733 2u, | 4665 2u, |
4734 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | 4666 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); |
4735 v222 = (Player *)HIDWORD(v733); | 4667 if ( v223 ) |
4736 if ( v223 ) | 4668 pPlayer->PlaySound(SPEECH_103, 0); |
4737 v222->PlaySound(SPEECH_103, 0); | |
4738 } | 4669 } |
4739 ++v222;// += 6972; | 4670 } |
4740 HIDWORD(v733) = (int)v222; | 4671 LODWORD(v727) = 1; |
4741 if ( v222 >= &pParty->pPlayers[3] ) | 4672 break; |
4742 { | 4673 } |
4743 LODWORD(v727) = 1; | |
4744 break; | |
4745 } | |
4746 } | |
4747 } | |
4748 case SPELL_WATER_POISON_SPRAY: | 4674 case SPELL_WATER_POISON_SPRAY: |
4749 { | 4675 { |
4750 if ( v731 == 1 ) | 4676 if ( v731 == 1 ) |
4751 amount = 1; | 4677 amount = 1; |
4752 else if ( v731 == 2 ) | 4678 else if ( v731 == 2 ) |
5648 v343 = PID_ID(v342); | 5574 v343 = PID_ID(v342); |
5649 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | 5575 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); |
5650 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | 5576 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; |
5651 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | 5577 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); |
5652 BYTE2(pActors[v343].uAttributes) |= 8u; | 5578 BYTE2(pActors[v343].uAttributes) |= 8u; |
5653 v672 = 0; | 5579 //v672 = 0; |
5654 v661 = &pActors[v343]; | 5580 v661 = &pActors[v343]; |
5655 //LABEL_165: | 5581 //LABEL_165: |
5656 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | 5582 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); |
5657 } | 5583 } |
5658 LODWORD(v727) = 1; | 5584 LODWORD(v727) = 1; |
5659 break; | 5585 break; |
5660 } | 5586 } |
5661 case SPELL_SPIRIT_REMOVE_CURSE: | 5587 case SPELL_SPIRIT_REMOVE_CURSE: |