Mercurial > mm7
comparison mm7_6.cpp @ 889:279a315ff122
* first cast_spell clean
* feather fall fix
author | zipi |
---|---|
date | Tue, 02 Apr 2013 23:02:04 +0100 |
parents | abf7b7d2c8f7 |
children | dba25247e74f |
comparison
equal
deleted
inserted
replaced
888:abf7b7d2c8f7 | 889:279a315ff122 |
---|---|
3180 v2 = 0; | 3180 v2 = 0; |
3181 amount = 0; | 3181 amount = 0; |
3182 LODWORD(v733) = 0; | 3182 LODWORD(v733) = 0; |
3183 v723 = 0; | 3183 v723 = 0; |
3184 v727 = 0.0; | 3184 v727 = 0.0; |
3185 n = 0; | 3185 //n = 0; |
3186 while ( 1 ) | 3186 //while ( 1 ) |
3187 for(n = 0; n < 10; ++n) | |
3187 { | 3188 { |
3188 v3 = &v711[n]; | 3189 v3 = &v711[n]; |
3189 HIDWORD(v733) = (int)v3; | 3190 HIDWORD(v733) = (int)v3; |
3190 if ( v3->spellnum == 0 ) | 3191 if ( v3->spellnum == 0 ) |
3191 goto LABEL_1166; | 3192 continue; |
3192 | 3193 |
3193 if (pParty->Invisible()) | 3194 if (pParty->Invisible()) |
3194 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 3195 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
3195 | 3196 |
3196 if ( v3->field_8 & 0x3CA ) | 3197 if ( v3->field_8 & 0x3CA ) |
3197 { | 3198 { |
3198 if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) | 3199 if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) |
3199 v711->_427D48(1u); | 3200 v711->_427D48(1u); |
3200 goto LABEL_1166; | 3201 continue; |
3201 } | 3202 } |
3202 pPlayer = &pParty->pPlayers[v3->uPlayerID]; | 3203 pPlayer = &pParty->pPlayers[v3->uPlayerID]; |
3203 | 3204 |
3204 a2 = v3->spell_target_pid; | 3205 a2 = v3->spell_target_pid; |
3205 if (!a2) | 3206 if (!a2) |
3296 | 3297 |
3297 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | 3298 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || |
3298 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) | 3299 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
3299 uRequiredMana = 0; | 3300 uRequiredMana = 0; |
3300 | 3301 |
3301 if (v3->spellnum >= PLAYER_SKILL_BOW || pPlayer->sMana >= uRequiredMana) | 3302 if (v3->spellnum >= SPELL_BOW_ARROW || pPlayer->sMana >= uRequiredMana) |
3302 break; | 3303 { |
3304 v730 = v3->spellnum; | |
3305 if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW) | |
3306 if (rand() % 100 < 50) | |
3307 { | |
3308 if (!pParty->bTurnBasedModeOn) | |
3309 { | |
3310 //v646 = pPlayer; | |
3311 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3312 //v647 = n; | |
3313 } | |
3314 else | |
3315 { | |
3316 //v647 = n; | |
3317 //v646 = pPlayer; | |
3318 //v648 = sRecoveryTime; | |
3319 //v649 = pPlayer; | |
3320 pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; | |
3321 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3322 pTurnEngine->_40471C(); | |
3323 } | |
3324 | |
3325 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3326 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3327 v711[n].spellnum = 0; | |
3328 pPlayer->sMana -= uRequiredMana; | |
3329 return; | |
3330 } | |
3331 | |
3332 switch ( v3->spellnum ) | |
3333 { | |
3334 case SPELL_101: | |
3335 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3336 case SPELL_BOW_ARROW: | |
3337 v17 = pPlayer; | |
3338 _this = (ItemGen *)1; | |
3339 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3340 _this = (ItemGen *)2; | |
3341 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3342 a1.stru_24.Reset(); | |
3343 a1.spell_level = v2; | |
3344 a1.spell_id = v3->spellnum; | |
3345 a1.spell_skill = v731; | |
3346 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3347 if ( v17->WearsItem(510, 2) ) | |
3348 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3349 a1.vPosition.x = pParty->vPosition.x; | |
3350 a1.vPosition.y = pParty->vPosition.y; | |
3351 a1.uAttributes = 0; | |
3352 a1.uSpriteFrameID = 0; | |
3353 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3354 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3355 a1.spell_target_pid = a2; | |
3356 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3357 a1.uFacing = LOWORD(v715.uYawAngle); | |
3358 a1.uSoundID = LOWORD(v3->sound_id); | |
3359 v20 = &pParty->pPlayers[v3->uPlayerID]; | |
3360 memcpy(&a1.stru_24, &v20[v20->pEquipment.uBow], sizeof(a1.stru_24)); | |
3361 a1.uAttributes = 256; | |
3362 if ( pParty->bTurnBasedModeOn == 1 ) | |
3363 a1.uAttributes = 260; | |
3364 for ( i = 0; i < (signed int)_this; ++i ) | |
3365 { | |
3366 if ( i ) | |
3367 a1.vPosition.z += 32; | |
3368 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3369 if ( a1.Create( | |
3370 v715.uYawAngle, | |
3371 v715.uPitchAngle, | |
3372 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3373 v3->uPlayerID + 1) != -1 | |
3374 && pParty->bTurnBasedModeOn == 1 ) | |
3375 ++pTurnEngine->field_1C; | |
3376 } | |
3377 goto play_sound_and_continue; | |
3378 | |
3379 case SPELL_LASER_PROJECTILE: | |
3380 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3381 a1.stru_24.Reset(); | |
3382 a1.spell_id = v3->spellnum; | |
3383 a1.spell_level = v723; | |
3384 a1.spell_skill = v731; | |
3385 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3386 a1.vPosition.x = pParty->vPosition.x; | |
3387 a1.vPosition.y = pParty->vPosition.y; | |
3388 a1.uAttributes = 0; | |
3389 a1.uSpriteFrameID = 0; | |
3390 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3391 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3392 a1.spell_target_pid = a2; | |
3393 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3394 a1.uFacing = LOWORD(v715.uYawAngle); | |
3395 a1.uSoundID = LOWORD(v3->sound_id); | |
3396 memcpy( | |
3397 &a1.stru_24, | |
3398 &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3399 * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand | |
3400 + 5], | |
3401 sizeof(a1.stru_24)); | |
3402 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); | |
3403 HIBYTE(a1.uAttributes) |= 1u; | |
3404 a1.uSectorID = v23; | |
3405 if ( pParty->bTurnBasedModeOn == 1 ) | |
3406 LOBYTE(a1.uAttributes) |= 4u; | |
3407 if ( a1.Create( | |
3408 v715.uYawAngle, | |
3409 v715.uPitchAngle, | |
3410 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3411 v3->uPlayerID + 1) != -1 | |
3412 && pParty->bTurnBasedModeOn == 1 ) | |
3413 ++pTurnEngine->field_1C; | |
3414 goto play_sound_and_continue; | |
3415 | |
3416 case SPELL_FIRE_TORCH_LIGHT: | |
3417 LODWORD(v733) = 3600 * v2; | |
3418 | |
3419 switch (v731) | |
3420 { | |
3421 case 1: amount = 2; break; | |
3422 case 2: amount = 3; break; | |
3423 case 3: | |
3424 case 4: amount = 4; break; | |
3425 default: | |
3426 assert(false); | |
3427 } | |
3428 | |
3429 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3430 goto play_sound_and_continue; | |
3431 | |
3432 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); | |
3433 LODWORD(v727) = 1; | |
3434 goto play_sound_and_continue; | |
3435 | |
3436 case SPELL_FIRE_FIRE_SPIKE: | |
3437 { | |
3438 v29 = v731 - 2; | |
3439 if ( v29 ) | |
3440 { | |
3441 v30 = v29 - 1; | |
3442 if ( v30 ) | |
3443 { | |
3444 if ( v30 == 1 ) | |
3445 amount = 9; | |
3446 else | |
3447 amount = 3; | |
3448 } | |
3449 else | |
3450 { | |
3451 amount = 7; | |
3452 } | |
3453 } | |
3454 else | |
3455 { | |
3456 amount = 5; | |
3457 } | |
3458 //v31 = v3->uPlayerID; | |
3459 //v32 = 8 * v31; | |
3460 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3461 | |
3462 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3463 int _v733 = 0; | |
3464 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3465 { | |
3466 auto object = pSpriteObjects + i; | |
3467 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, v3->uPlayerID)) | |
3468 ++_v733; | |
3469 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3470 v730 = uNumSpriteObjects; | |
3471 do | |
3472 { | |
3473 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3474 ++HIDWORD(v733); | |
3475 v33 += 112; | |
3476 --v730; | |
3477 } | |
3478 while ( v730 );*/ | |
3479 } | |
3480 if (_v733 > amount) | |
3481 { | |
3482 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3483 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3484 v3->spellnum = 0; | |
3485 continue; | |
3486 } | |
3487 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3488 goto play_sound_and_continue; | |
3489 | |
3490 a1.stru_24.Reset(); | |
3491 a1.spell_id = v3->spellnum; | |
3492 a1.spell_level = v2; | |
3493 a1.spell_skill = v731; | |
3494 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3495 a1.vPosition.y = pParty->vPosition.y; | |
3496 a1.vPosition.x = pParty->vPosition.x; | |
3497 a1.uAttributes = 0; | |
3498 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3499 a1.uSectorID = pIndoor->GetSector( | |
3500 pParty->vPosition.x, | |
3501 pParty->vPosition.y, | |
3502 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3503 a1.uSpriteFrameID = 0; | |
3504 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3505 a1.spell_target_pid = a2; | |
3506 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3507 a1.uFacing = LOWORD(v715.uYawAngle); | |
3508 a1.uSoundID = LOWORD(v3->sound_id); | |
3509 if ( pParty->bTurnBasedModeOn == 1 ) | |
3510 LOBYTE(a1.uAttributes) |= 4u; | |
3511 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3512 if ( a1.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3513 ++pTurnEngine->field_1C; | |
3514 LODWORD(v727) = 1; | |
3515 goto play_sound_and_continue; | |
3516 } | |
3517 | |
3518 case 20: | |
3519 { | |
3520 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3521 goto play_sound_and_continue; | |
3522 if (!a2) | |
3523 { | |
3524 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3525 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3526 v3->spellnum = 0; | |
3527 continue; | |
3528 } | |
3529 if (PID_TYPE(a2) != OBJECT_Actor) | |
3530 { | |
3531 LODWORD(v727) = 1; | |
3532 goto play_sound_and_continue; | |
3533 } | |
3534 v697.x = 0; | |
3535 v697.y = 0; | |
3536 v697.z = 0; | |
3537 a1.stru_24.Reset(); | |
3538 a1.spell_id = v3->spellnum; | |
3539 a1.spell_level = v2; | |
3540 a1.spell_skill = v731; | |
3541 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3542 a1.uAttributes = 0; | |
3543 a1.uSectorID = 0; | |
3544 a1.uSpriteFrameID = 0; | |
3545 a1.field_60_distance_related_prolly_lod = 0; | |
3546 a1.uFacing = 0; | |
3547 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3548 a1.uSoundID = LOWORD(v3->sound_id); | |
3549 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3550 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3551 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3552 a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3553 auto obj_id = a1.Create(0, 0, 0, 0); | |
3554 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
3555 LODWORD(v727) = 1; | |
3556 goto play_sound_and_continue; | |
3557 } | |
3558 | |
3559 case 44: | |
3560 { | |
3561 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3562 goto play_sound_and_continue; | |
3563 | |
3564 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3565 { | |
3566 LODWORD(v727) = 1; | |
3567 goto play_sound_and_continue; | |
3568 } | |
3569 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3570 v704.x = 0; | |
3571 v704.y = 0; | |
3572 v704.z = 0; | |
3573 a1.stru_24.Reset(); | |
3574 a1.spell_id = v3->spellnum; | |
3575 a1.spell_level = v2; | |
3576 a1.spell_skill = v731; | |
3577 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3578 a1.uAttributes = 0; | |
3579 a1.uSectorID = 0; | |
3580 a1.uSpriteFrameID = 0; | |
3581 a1.field_60_distance_related_prolly_lod = 0; | |
3582 a1.uFacing = 0; | |
3583 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3584 a1.uSoundID = LOWORD(v3->sound_id); | |
3585 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3586 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3587 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3588 a1.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3589 | |
3590 auto obj_id = a1.Create(0, 0, 0, 0); | |
3591 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | |
3592 | |
3593 LODWORD(v727) = 1; | |
3594 goto play_sound_and_continue; | |
3595 } | |
3596 | |
3597 case 79: | |
3598 { | |
3599 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
3600 goto play_sound_and_continue; | |
3601 //v730 = a2 >> 3; | |
3602 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3603 v691.x = 0; | |
3604 v691.y = 0; | |
3605 v691.z = 0; | |
3606 a1.stru_24.Reset(); | |
3607 a1.spell_id = v3->spellnum; | |
3608 a1.spell_level = v2; | |
3609 a1.spell_skill = v731; | |
3610 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3611 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3612 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3613 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3614 a1.uAttributes = 0; | |
3615 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3616 a1.uSpriteFrameID = 0; | |
3617 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3618 a1.spell_target_pid = a2; | |
3619 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3620 a1.uFacing = LOWORD(v715.uYawAngle); | |
3621 a1.uAttributes |= 0x80u; | |
3622 a1.uSoundID = LOWORD(v3->sound_id); | |
3623 | |
3624 auto obj_id = a1.Create(0, 0, 0, 0); | |
3625 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) | |
3626 { | |
3627 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3628 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3629 v3->spellnum = 0; | |
3630 continue; | |
3631 } | |
3632 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3633 LODWORD(v727) = 1; | |
3634 goto play_sound_and_continue; | |
3635 } | |
3636 | |
3637 | |
3638 case SPELL_FIRE_FIRE_BOLT: | |
3639 case SPELL_FIRE_FIREBALL: | |
3640 case SPELL_FIRE_INCINERATE: | |
3641 case SPELL_AIR_LIGHNING_BOLT: | |
3642 case SPELL_WATER_ICE_BOLT: | |
3643 case SPELL_WATER_ICE_BLAST: | |
3644 case SPELL_EARTH_STUN: | |
3645 case SPELL_EARTH_DEADLY_SWARM: | |
3646 case SPELL_MIND_MIND_BLAST: | |
3647 case SPELL_MIND_PSYCHIC_SHOCK: | |
3648 case SPELL_BODY_HARM: | |
3649 case SPELL_LIGHT_LIGHT_BOLT: | |
3650 case SPELL_DARK_DRAGON_BREATH: | |
3651 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3652 goto play_sound_and_continue; | |
3653 a1.stru_24.Reset(); | |
3654 a1.spell_id = v3->spellnum; | |
3655 a1.spell_level = v2; | |
3656 a1.spell_skill = v731; | |
3657 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3658 a1.vPosition.y = pParty->vPosition.y; | |
3659 a1.vPosition.x = pParty->vPosition.x; | |
3660 a1.uAttributes = 0; | |
3661 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3662 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3663 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, | |
3664 pParty->vPosition.y, | |
3665 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3666 else a1.uSectorID = 0; | |
3667 | |
3668 a1.uSpriteFrameID = 0; | |
3669 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3670 a1.spell_target_pid = a2; | |
3671 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3672 a1.uFacing = LOWORD(v715.uYawAngle); | |
3673 a1.uSoundID = LOWORD(v3->sound_id); | |
3674 if ( pParty->bTurnBasedModeOn == 1 ) | |
3675 LOBYTE(a1.uAttributes) |= 4u; | |
3676 if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3677 LOBYTE(a1.uAttributes) |= 0x40u; | |
3678 | |
3679 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3680 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3681 ++pTurnEngine->field_1C; | |
3682 LODWORD(v727) = 1; | |
3683 goto play_sound_and_continue; | |
3684 | |
3685 | |
3686 | |
3687 case 29: | |
3688 case 39: | |
3689 case 76: | |
3690 case 90: | |
3691 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3692 goto play_sound_and_continue; | |
3693 a1.stru_24.Reset(); | |
3694 a1.spell_id = v3->spellnum; | |
3695 a1.spell_level = v2; | |
3696 a1.spell_skill = v731; | |
3697 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3698 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3699 a1.vPosition.y = pParty->vPosition.y; | |
3700 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3701 v660 = pParty->vPosition.y; | |
3702 goto LABEL_153; | |
3703 case 87: | |
3704 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | |
3705 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | |
3706 { | |
3707 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3708 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3709 v3->spellnum = 0; | |
3710 continue; | |
3711 } | |
3712 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3713 goto LABEL_152; | |
3714 goto play_sound_and_continue; | |
3715 | |
3716 | |
3717 case 81: | |
3718 { | |
3719 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3720 goto play_sound_and_continue; | |
3721 | |
3722 if (PID_TYPE(a2) != OBJECT_Actor || | |
3723 (v730 = PID_ID(a2), | |
3724 v721 = (int)&pActors[PID_ID(a2)], | |
3725 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) ) | |
3726 { | |
3727 LODWORD(v727) = 1; | |
3728 goto play_sound_and_continue; | |
3729 } | |
3730 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3731 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3732 v55 = v721; | |
3733 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3734 *(char *)(v55 + 38) |= 8u; | |
3735 *(short *)(v55 + 148) = 0; | |
3736 v672 = 0; | |
3737 *(short *)(v55 + 150) = 0; | |
3738 v661 = (Actor *)v55; | |
3739 goto LABEL_165; | |
3740 } | |
3741 | |
3742 case 35: | |
3743 if ( v731 == 2 ) | |
3744 { | |
3745 v57 = 300 * v2; | |
3746 } | |
3747 else | |
3748 { | |
3749 if ( v731 == 3 ) | |
3750 { | |
3751 amount = 4; | |
3752 v57 = 300 * v2; | |
3753 goto LABEL_174; | |
3754 } | |
3755 if ( v731 == 4 ) | |
3756 { | |
3757 v57 = 300 * v2; | |
3758 amount = 8; | |
3759 goto LABEL_174; | |
3760 } | |
3761 v57 = 180 * v2; | |
3762 } | |
3763 amount = 2; | |
3764 LABEL_174: | |
3765 LODWORD(v733) = v57; | |
3766 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3767 goto play_sound_and_continue; | |
3768 if (PID_TYPE(a2) != OBJECT_Actor | |
3769 || (v721 = 836 * PID_ID(a2), | |
3770 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3771 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3772 { | |
3773 LODWORD(v727) = 1; | |
3774 goto play_sound_and_continue; | |
3775 } | |
3776 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3777 v59 = v721; | |
3778 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3779 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
3780 v731, | |
3781 amount, | |
3782 0, | |
3783 0); | |
3784 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3785 v672 = 0; | |
3786 v661 = (Actor *)LODWORD(v718); | |
3787 goto LABEL_165; | |
3788 | |
3789 | |
3790 case 60: | |
3791 { | |
3792 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3793 goto play_sound_and_continue; | |
3794 | |
3795 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3796 { | |
3797 LODWORD(v727) = 1; | |
3798 goto play_sound_and_continue; | |
3799 } | |
3800 | |
3801 uint power = 300 * v2; | |
3802 if ( v731 == 2 ) | |
3803 { | |
3804 power = 600 * v2; | |
3805 } | |
3806 else if ( v731 == 3 ) | |
3807 power = 29030400; | |
3808 | |
3809 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3810 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3811 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3812 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3813 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3814 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3815 v731, 0, 0, 0); | |
3816 a1.stru_24.Reset(); | |
3817 a1.spell_id = v3->spellnum; | |
3818 a1.spell_level = v2; | |
3819 a1.spell_skill = v731; | |
3820 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
3821 v61 = PID_ID(a2); | |
3822 goto LABEL_1086; | |
3823 } | |
3824 | |
3825 case 92: | |
3826 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3827 goto play_sound_and_continue; | |
3828 a1.stru_24.Reset(); | |
3829 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3830 a1.vPosition.x = pParty->vPosition.x; | |
3831 a1.vPosition.y = pParty->vPosition.y; | |
3832 a1.uAttributes = 0; | |
3833 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3834 a1.uSectorID = pIndoor->GetSector( | |
3835 pParty->vPosition.x, | |
3836 pParty->vPosition.y, | |
3837 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3838 a1.uSpriteFrameID = 0; | |
3839 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3840 a1.spell_target_pid = a2; | |
3841 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3842 a1.uFacing = LOWORD(v715.uYawAngle); | |
3843 a1.uSoundID = LOWORD(v3->sound_id); | |
3844 a1.spell_skill = v731; | |
3845 a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3846 a1.spell_level = 300 * v2; | |
3847 if ( pParty->bTurnBasedModeOn == 1 ) | |
3848 LOBYTE(a1.uAttributes) |= 4u; | |
3849 | |
3850 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3851 | |
3852 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3853 ++pTurnEngine->field_1C; | |
3854 LODWORD(v727) = 1; | |
3855 goto play_sound_and_continue; | |
3856 | |
3857 case 4: | |
3858 { | |
3859 v63 = v731 - 1; | |
3860 if ( !v63 ) | |
3861 { | |
3862 amount = 10; | |
3863 goto LABEL_195; | |
3864 } | |
3865 v64 = v63 - 1; | |
3866 if ( !v64 ) | |
3867 { | |
3868 amount = 11; | |
3869 goto LABEL_195; | |
3870 } | |
3871 v65 = v64 - 1; | |
3872 if ( !v65 ) | |
3873 { | |
3874 amount = 12; | |
3875 LABEL_195: | |
3876 LODWORD(v733) = 3600 * v2; | |
3877 goto LABEL_196; | |
3878 } | |
3879 if ( v65 == 1 ) | |
3880 { | |
3881 LODWORD(v733) = 0; | |
3882 amount = 12; | |
3883 } | |
3884 LABEL_196: | |
3885 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3886 goto play_sound_and_continue; | |
3887 v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | |
3888 auto _itm = &pItemsTable->pItems[v730c->uItemID]; | |
3889 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
3890 if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) | |
3891 { | |
3892 if (!v730c->Broken()) | |
3893 { | |
3894 if (!v730c->uSpecEnchantmentType) | |
3895 { | |
3896 if (!v730c->uEnchantmentType) | |
3897 { | |
3898 v68 = _itm->uEquipType; | |
3899 if ( !v68 || v68 == 1 || v68 == 2 ) | |
3900 { | |
3901 if ( !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3902 { | |
3903 v69 = v730c; | |
3904 v14 = v731 == 4; | |
3905 *(int *)(v730 + 12) = amount; | |
3906 if ( !v14 ) | |
3907 { | |
3908 *(_QWORD *)(v69 + 28) = pParty->uTimePlayed | |
3909 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3910 * 0.033333335); | |
3911 *(int *)(v69 + 20) |= 8u; | |
3912 } | |
3913 *(int *)(v69 + 20) |= 0x10u; | |
3914 dword_50C9A8 = 256; | |
3915 LODWORD(v727) = 1; | |
3916 play_sound_and_continue: | |
3917 if ( v3->field_8 & 0x20 ) | |
3918 { | |
3919 if ( v727 != 0.0 ) | |
3920 pAudioPlayer->PlaySound( | |
3921 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3922 0, | |
3923 0, | |
3924 -1, | |
3925 0, | |
3926 v3->sound_id, | |
3927 0, | |
3928 0); | |
3929 } | |
3930 else | |
3931 { | |
3932 if ( sRecoveryTime < 0 ) | |
3933 sRecoveryTime = 0; | |
3934 if ( pParty->bTurnBasedModeOn ) | |
3935 { | |
3936 v645 = sRecoveryTime; | |
3937 pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; | |
3938 pPlayer->SetRecoveryTime(v645); | |
3939 if ( !some_active_character ) | |
3940 pTurnEngine->_40471C(); | |
3941 } | |
3942 else | |
3943 { | |
3944 pPlayer->SetRecoveryTime( | |
3945 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3946 } | |
3947 if ( v727 != 0.0 ) | |
3948 { | |
3949 pPlayer->PlaySound(SPEECH_49, 0); | |
3950 if ( v727 != 0.0 ) | |
3951 pAudioPlayer->PlaySound( | |
3952 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3953 0, | |
3954 0, | |
3955 -1, | |
3956 0, | |
3957 v3->sound_id, | |
3958 0, | |
3959 0); | |
3960 | |
3961 v3->spellnum = 0; | |
3962 v2 = v723; | |
3963 continue; | |
3964 } | |
3965 } | |
3966 v3->spellnum = 0; | |
3967 v2 = v723; | |
3968 continue; | |
3969 } | |
3970 } | |
3971 } | |
3972 } | |
3973 } | |
3974 } | |
3975 | |
3976 dword_50C9D0 = 113; | |
3977 dword_50C9D4 = 0; | |
3978 dword_50C9D8 = 1; | |
3979 | |
3980 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3981 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3982 v3->spellnum = 0; | |
3983 continue; | |
3984 } | |
3985 | |
3986 case SPELL_BODY_REGENERATION: | |
3987 { | |
3988 v70 = v731 - 1; | |
3989 LODWORD(v733) = 3600 * v2; | |
3990 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3991 { | |
3992 v72 = v71 - 1; | |
3993 if ( v72 ) | |
3994 { | |
3995 if ( v72 == 1 ) | |
3996 amount = 10; | |
3997 } | |
3998 else | |
3999 { | |
4000 amount = 3; | |
4001 } | |
4002 } | |
4003 else | |
4004 { | |
4005 amount = 1; | |
4006 } | |
4007 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4008 goto play_sound_and_continue; | |
4009 | |
4010 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
4011 | |
4012 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | |
4013 LODWORD(v727) = 1; | |
4014 goto play_sound_and_continue; | |
4015 } | |
4016 | |
4017 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4018 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4019 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4020 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4021 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4022 case SPELL_BODY_PROTECTION_FROM_BODY: | |
4023 v76 = v731 - 1; | |
4024 LODWORD(v733) = 3600 * v2; | |
4025 if ( v76 ) | |
4026 { | |
4027 v77 = v76 - 1; | |
4028 if ( v77 ) | |
4029 { | |
4030 v78 = v77 - 1; | |
4031 if ( v78 ) | |
4032 { | |
4033 if ( v78 != 1 ) | |
4034 goto LABEL_232; | |
4035 v79 = 4 * v2; | |
4036 } | |
4037 else | |
4038 { | |
4039 v79 = 3 * v2; | |
4040 } | |
4041 } | |
4042 else | |
4043 { | |
4044 v79 = 2 * v2; | |
4045 } | |
4046 amount = v79; | |
4047 } | |
4048 else | |
4049 { | |
4050 amount = v2; | |
4051 } | |
4052 LABEL_232: | |
4053 //v80 = v3->spellnum; | |
4054 switch (v3->spellnum) | |
4055 { | |
4056 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4057 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
4058 break; | |
4059 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4060 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
4061 break; | |
4062 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4063 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
4064 break; | |
4065 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4066 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
4067 break; | |
4068 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4069 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
4070 break; | |
4071 case SPELL_BODY_PROTECTION_FROM_BODY: | |
4072 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
4073 break; | |
4074 default: | |
4075 assert(false); | |
4076 continue; | |
4077 } | |
4078 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4079 goto play_sound_and_continue; | |
4080 | |
4081 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4082 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4083 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4084 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4085 | |
4086 v90 = (double)(signed int)v733 * 4.2666669; | |
4087 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4088 LODWORD(v727) = 1; | |
4089 goto play_sound_and_continue; | |
4090 | |
4091 case SPELL_FIRE_HASTE: | |
4092 if ( v731 <= 0 ) | |
4093 goto LABEL_254; | |
4094 if ( v731 <= 2 ) | |
4095 { | |
4096 v91 = 60 * (v2 + 60); | |
4097 } | |
4098 else | |
4099 { | |
4100 if ( v731 == 3 ) | |
4101 { | |
4102 v91 = 180 * (v2 + 20); | |
4103 } | |
4104 else | |
4105 { | |
4106 if ( v731 != 4 ) | |
4107 goto LABEL_254; | |
4108 v91 = 240 * (v2 + 15); | |
4109 } | |
4110 } | |
4111 LODWORD(v733) = v91; | |
4112 LABEL_254: | |
4113 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4114 { | |
4115 v92 = pParty->pPlayers;//[0].pConditions[1]; | |
4116 LODWORD(v727) = 1; | |
4117 do | |
4118 { | |
4119 if ( v92->pConditions ) | |
4120 LODWORD(v727) = 0; | |
4121 ++v92; | |
4122 } | |
4123 while ( v92 <= &pParty->pPlayers[3] ); | |
4124 if (LODWORD(v727)) | |
4125 { | |
4126 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4127 | |
4128 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4129 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4130 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4131 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4132 } | |
4133 } | |
4134 goto play_sound_and_continue; | |
4135 | |
4136 case SPELL_SPIRIT_BLESS: | |
4137 v101 = v731 - 1; | |
4138 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4139 { | |
4140 v103 = v102 - 1; | |
4141 if ( v103 ) | |
4142 { | |
4143 if ( v103 != 1 ) | |
4144 goto LABEL_269; | |
4145 v104 = 3600 * (v2 + 1); | |
4146 } | |
4147 else | |
4148 { | |
4149 v104 = 900 * (v2 + 4); | |
4150 } | |
4151 } | |
4152 else | |
4153 { | |
4154 v104 = 300 * (v2 + 12); | |
4155 } | |
4156 LODWORD(v733) = v104; | |
4157 LABEL_269: | |
4158 amount = v2 + 5; | |
4159 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4160 goto play_sound_and_continue; | |
4161 if ( v731 == 1 ) | |
4162 { | |
4163 v108 = v3->uPlayerID_2; | |
4164 v109 = v3->spellnum; | |
4165 v110 = pGame->GetStru6(); | |
4166 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
4167 v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); | |
4168 //v668 = 0; | |
4169 v716 = v111; | |
4170 //v658 = v111; | |
4171 //v653 = amount; | |
4172 //v651 = 1; | |
4173 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4174 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
4175 //LABEL_103: | |
4176 //HIDWORD(v650) = HIDWORD(v28); | |
4177 //LABEL_104: | |
4178 //LODWORD(v650) = v28; | |
4179 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); | |
4180 LODWORD(v727) = 1; | |
4181 goto play_sound_and_continue; | |
4182 } | |
4183 v105 = 0; | |
4184 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4185 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4186 do | |
4187 { | |
4188 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); | |
4189 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); | |
4190 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4191 ++v730b; | |
4192 ++v105; | |
4193 } | |
4194 while ( v730b <= &pParty->pPlayers[3] ); | |
4195 LODWORD(v727) = 1; | |
4196 goto play_sound_and_continue; | |
4197 | |
4198 case 52: | |
4199 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) | |
4200 { | |
4201 //v730 = a2 >> 3; | |
4202 v112 = &pActors[PID_ID(a2)]; | |
4203 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4204 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4205 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4206 _this = (ItemGen *)v113; | |
4207 v114 = v721; | |
4208 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4209 if ( v113 < v721 ) | |
4210 { | |
4211 v116 = v113; | |
4212 v113 = v721; | |
4213 v114 = v116; | |
4214 } | |
4215 if ( v113 < (signed int)v115 ) | |
4216 { | |
4217 v117 = v113; | |
4218 v113 = (int)v115; | |
4219 v115 = v117; | |
4220 } | |
4221 if ( v114 < (signed int)v115 ) | |
4222 { | |
4223 v118 = v115; | |
4224 v115 = v114; | |
4225 v114 = v118; | |
4226 } | |
4227 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4228 if ( (double)(signed int)this <= 307.2 ) | |
4229 { | |
4230 v701.x = 0; | |
4231 v701.y = 0; | |
4232 v701.z = 0; | |
4233 a1.stru_24.Reset(); | |
4234 v119 = HIDWORD(v733); | |
4235 a1.spell_id = *(int *)HIDWORD(v733); | |
4236 a1.spell_level = v723; | |
4237 a1.spell_skill = v731; | |
4238 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4239 a1.uAttributes = 0; | |
4240 a1.uSectorID = 0; | |
4241 a1.uSpriteFrameID = 0; | |
4242 a1.field_60_distance_related_prolly_lod = 0; | |
4243 a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4244 a1.uFacing = 0; | |
4245 a1.uSoundID = *(short *)(v119 + 16); | |
4246 a1.vPosition.x = v112->vPosition.x; | |
4247 a1.vPosition.y = v112->vPosition.y; | |
4248 a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4249 a1.spell_target_pid = PID(OBJECT_Actor, a2); | |
4250 v122 = a1.Create(0, 0, 0, 0); | |
4251 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | |
4252 LODWORD(v727) = 1; | |
4253 } | |
4254 else | |
4255 { | |
4256 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4257 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4258 *(int *)HIDWORD(v733) = 0; | |
4259 } | |
4260 v3 = (stru277 *)HIDWORD(v733); | |
4261 } | |
4262 goto play_sound_and_continue; | |
4263 | |
4264 case SPELL_AIR_SHIELD: | |
4265 case SPELL_EARTH_STONESKIN: | |
4266 case SPELL_SPIRIT_HEROISM: | |
4267 v123 = v731 - 1; | |
4268 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4269 { | |
4270 v125 = v124 - 1; | |
4271 if ( v125 ) | |
4272 { | |
4273 if ( v125 != 1 ) | |
4274 goto LABEL_296; | |
4275 v126 = 3600 * (v2 + 1); | |
4276 } | |
4277 else | |
4278 { | |
4279 v126 = 900 * (v2 + 4); | |
4280 } | |
4281 } | |
4282 else | |
4283 { | |
4284 v126 = 300 * (v2 + 12); | |
4285 } | |
4286 LODWORD(v733) = v126; | |
4287 LABEL_296: | |
4288 v127 = v3->spellnum; | |
4289 if ( v127 == 17 ) | |
4290 { | |
4291 amount = 0; | |
4292 LODWORD(v725) = 14; | |
4293 } | |
4294 else | |
4295 { | |
4296 if ( v127 == 38 ) | |
4297 { | |
4298 LODWORD(v725) = 15; | |
4299 amount = v2 + 5; | |
4300 } | |
4301 else | |
4302 { | |
4303 if ( v127 != 51 ) | |
4304 continue; | |
4305 LODWORD(v725) = 9; | |
4306 amount = v2 + 5; | |
4307 } | |
4308 } | |
4309 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4310 goto play_sound_and_continue; | |
4311 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4312 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4313 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4314 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4315 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; | |
4316 //LABEL_304: | |
4317 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4318 LODWORD(v727) = 1; | |
4319 goto play_sound_and_continue; | |
4320 | |
4321 case SPELL_FIRE_IMMOLATION: | |
4322 v138 = v731 - 2; | |
4323 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
4324 v140 = 600 * v2; | |
4325 else | |
4326 v140 = 60 * v2; | |
4327 LODWORD(v733) = v140; | |
4328 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4329 goto play_sound_and_continue; | |
4330 | |
4331 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4332 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4333 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4334 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4335 | |
4336 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4337 LODWORD(v727) = 1; | |
4338 goto play_sound_and_continue; | |
4339 | |
4340 case 9: | |
4341 v149 = v731 - 1; | |
4342 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4343 { | |
4344 if ( v151 == 1 ) | |
4345 _this = (ItemGen *)20; | |
4346 } | |
4347 else | |
4348 { | |
4349 _this = (ItemGen *)16; | |
4350 } | |
4351 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4352 { | |
4353 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! | |
4354 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4355 v3->spellnum = 0; | |
4356 continue; | |
4357 } | |
4358 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4359 goto play_sound_and_continue; | |
4360 LODWORD(v725) = PID_TYPE(a2); | |
4361 if (PID_TYPE(a2) == OBJECT_Actor) | |
4362 { | |
4363 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; | |
4364 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4365 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4366 LODWORD(v727) = v153; | |
4367 } | |
4368 else | |
4369 { | |
4370 v155 = stru_5C6E00->Cos(pParty->sRotationY); | |
4371 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4372 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4373 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4374 v154 = pParty->vPosition.z; | |
4375 } | |
4376 HIDWORD(v733) = v154; | |
4377 v713 = v154 + 2500; | |
4378 v721 = 0; | |
4379 LODWORD(v718) = 0; | |
4380 if ( (signed int)_this > 0 ) | |
4381 { | |
4382 *(float *)&y = (double)SHIDWORD(v733); | |
4383 *(float *)&v732 = (double)v713; | |
4384 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4385 auto _this_cpy = (int)_this; | |
4386 do | |
4387 { | |
4388 v157 = rand(); | |
4389 v158 = (double)SLODWORD(v718); | |
4390 v718 = v158; | |
4391 v159 = (double)v721; | |
4392 *(float *)&v721 = v159; | |
4393 a2 = v157 % 1000; | |
4394 *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; | |
4395 v725 = v159 * v159; | |
4396 *(float *)&_this = v158 * v158; | |
4397 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4398 { | |
4399 LODWORD(v687) = 0; | |
4400 HIDWORD(v687) = 0; | |
4401 } | |
4402 else | |
4403 { | |
4404 x = (signed __int64)sqrt(*(float *)&_this + v725); | |
4405 v687 = __PAIR__( | |
4406 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4407 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
4408 } | |
4409 a1.stru_24.Reset(); | |
4410 a1.spell_id = v3->spellnum; | |
4411 a1.spell_level = v2; | |
4412 a1.spell_skill = v731; | |
4413 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4414 a1.uAttributes = 0; | |
4415 a1.vPosition.x = uRequiredMana; | |
4416 a1.vPosition.y = LODWORD(v727); | |
4417 a1.uSectorID = 0; | |
4418 a1.vPosition.z = a2 + v713; | |
4419 a1.uSpriteFrameID = 0; | |
4420 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4421 a1.spell_target_pid = v730; | |
4422 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4423 a1.uFacing = v687; | |
4424 a1.uSoundID = LOWORD(v3->sound_id); | |
4425 if ( pParty->bTurnBasedModeOn == 1 ) | |
4426 a1.uAttributes = 4; | |
4427 if ( a1.Create( | |
4428 v687, | |
4429 SHIDWORD(v687), | |
4430 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4431 0) != -1 | |
4432 && pParty->bTurnBasedModeOn == 1 ) | |
4433 ++pTurnEngine->field_1C; | |
4434 LODWORD(v718) = rand() % 1024 - 512; | |
4435 v160 = rand(); | |
4436 v14 = _this_cpy-- == 1; | |
4437 v721 = (unsigned __int64)(v160 % 1024) - 512; | |
4438 } | |
4439 while ( !v14 ); | |
4440 } | |
4441 LODWORD(v727) = 1; | |
4442 goto play_sound_and_continue; | |
4443 | |
4444 case 10: | |
4445 { | |
4446 //v67 = 2; | |
4447 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4448 { | |
4449 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4450 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4451 v3->spellnum = 0; | |
4452 continue; | |
4453 } | |
4454 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4455 goto play_sound_and_continue; | |
4456 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4457 v700.z = 0; | |
4458 v700.y = 0; | |
4459 v700.x = 0; | |
4460 a1.stru_24.Reset(); | |
4461 a1.spell_id = v3->spellnum; | |
4462 a1.spell_level = v2; | |
4463 a1.spell_skill = v731; | |
4464 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4465 a1.uAttributes = 0; | |
4466 a1.uSectorID = 0; | |
4467 a1.uSpriteFrameID = 0; | |
4468 a1.field_60_distance_related_prolly_lod = 0; | |
4469 a1.uFacing = 0; | |
4470 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4471 a1.uSoundID = LOWORD(v3->sound_id); | |
4472 a2 = 0; | |
4473 if ( (signed int)_v726 > 0 ) | |
4474 { | |
4475 do | |
4476 { | |
4477 v162 = dword_50BF30[a2]; | |
4478 a1.vPosition.x = pActors[v162].vPosition.x; | |
4479 a1.vPosition.y = pActors[v162].vPosition.y; | |
4480 a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4481 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4482 v164 = a1.Create(0, 0, 0, 0); | |
4483 v165 = a2; | |
4484 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
4485 pGame->GetStru6()->_4A81CA(&a1); | |
4486 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
4487 a2 = v165 + 1; | |
4488 } | |
4489 while ( v165 + 1 < (signed int)_v726 ); | |
4490 } | |
4491 LODWORD(v727) = 1; | |
4492 goto play_sound_and_continue; | |
4493 } | |
4494 | |
4495 case SPELL_AIR_WIZARD_EYE: | |
4496 LODWORD(v733) = 3600 * v2; | |
4497 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4498 goto play_sound_and_continue; | |
4499 v168 = 0; | |
4500 do | |
4501 { | |
4502 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); | |
4503 v716 = v169; | |
4504 } | |
4505 while ( v168 < 4 ); | |
4506 | |
4507 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4508 LODWORD(v727) = 1; | |
4509 goto play_sound_and_continue; | |
4510 | |
4511 case SPELL_AIR_FEATHER_FALL: | |
4512 v170 = v731 - 1; | |
4513 if ( !v170 ) | |
4514 { | |
4515 v173 = 300 * v2; | |
4516 goto LABEL_353; | |
4517 } | |
4518 v171 = v170 - 1; | |
4519 if ( !v171 ) | |
4520 { | |
4521 v173 = 600 * v2; | |
4522 goto LABEL_353; | |
4523 } | |
4524 v172 = v171 - 1; | |
4525 if ( !v172 || v172 == 1 ) | |
4526 { | |
4527 v173 = 3600 * v2; | |
4528 LABEL_353: | |
4529 LODWORD(v733) = v173; | |
4530 } | |
4531 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4532 goto play_sound_and_continue; | |
4533 v174 = 0; | |
4534 do | |
4535 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); | |
4536 while ( v174 < 4 ); | |
4537 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4538 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4539 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4540 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4541 | |
4542 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); | |
4543 LODWORD(v727) = 1; | |
4544 goto play_sound_and_continue; | |
4545 | |
4546 case SPELL_AIR_SPARKS: | |
4547 { | |
4548 v184 = v731 - 1; | |
4549 if ( v184 ) | |
4550 { | |
4551 v185 = v184 - 1; | |
4552 if ( v185 ) | |
4553 { | |
4554 v186 = v185 - 1; | |
4555 if ( v186 ) | |
4556 { | |
4557 if ( v186 == 1 ) | |
4558 amount = 9; | |
4559 } | |
4560 else | |
4561 { | |
4562 amount = 7; | |
4563 } | |
4564 } | |
4565 else | |
4566 { | |
4567 amount = 5; | |
4568 } | |
4569 } | |
4570 else | |
4571 { | |
4572 amount = 3; | |
4573 } | |
4574 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4575 goto play_sound_and_continue; | |
4576 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4577 a1.stru_24.Reset(); | |
4578 a1.spell_id = v3->spellnum; | |
4579 a1.spell_level = v2; | |
4580 a1.spell_skill = v731; | |
4581 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4582 a1.vPosition.y = pParty->vPosition.y; | |
4583 a1.vPosition.x = pParty->vPosition.x; | |
4584 a1.uAttributes = 0; | |
4585 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4586 a1.uSectorID = pIndoor->GetSector( | |
4587 pParty->vPosition.x, | |
4588 pParty->vPosition.y, | |
4589 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4590 a1.uSpriteFrameID = 0; | |
4591 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4592 a1.spell_target_pid = a2; | |
4593 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4594 a1.uSoundID = LOWORD(v3->sound_id); | |
4595 if ( pParty->bTurnBasedModeOn == 1 ) | |
4596 LOBYTE(a1.uAttributes) |= 4u; | |
4597 v188 = (signed int)_v726 / -2; | |
4598 v189 = (signed int)_v726 / 2; | |
4599 while ( v188 <= v189 ) | |
4600 { | |
4601 a1.uFacing = v188 + LOWORD(v715.uYawAngle); | |
4602 if ( a1.Create( | |
4603 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
4604 v715.uPitchAngle, | |
4605 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4606 v3->uPlayerID + 1) != -1 | |
4607 && pParty->bTurnBasedModeOn == 1 ) | |
4608 ++pTurnEngine->field_1C; | |
4609 v188 += _v726 / (amount - 1); | |
4610 } | |
4611 LODWORD(v727) = 1; | |
4612 goto play_sound_and_continue; | |
4613 } | |
4614 | |
4615 case 16: | |
4616 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4617 { | |
4618 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4619 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4620 goto play_sound_and_continue; | |
4621 } | |
4622 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4623 goto play_sound_and_continue; | |
4624 v191 = 0; | |
4625 do | |
4626 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); | |
4627 while ( v191 < 4 ); | |
4628 BYTE1(pParty->uFlags) |= 1u; | |
4629 pParty->uFallSpeed = 1000; | |
4630 LODWORD(v727) = 1; | |
4631 goto play_sound_and_continue; | |
4632 | |
4633 case SPELL_AIR_INVISIBILITY: | |
4634 v192 = v731 - 1; | |
4635 if ( !v192 ) | |
4636 { | |
4637 amount = v2; | |
4638 goto LABEL_391; | |
4639 } | |
4640 v193 = v192 - 1; | |
4641 if ( !v193 ) | |
4642 { | |
4643 v196 = 2 * v2; | |
4644 LABEL_389: | |
4645 amount = v196; | |
4646 LABEL_391: | |
4647 v195 = 600 * v2; | |
4648 goto LABEL_392; | |
4649 } | |
4650 v194 = v193 - 1; | |
4651 if ( !v194 ) | |
4652 { | |
4653 v196 = 3 * v2; | |
4654 goto LABEL_389; | |
4655 } | |
4656 if ( v194 != 1 ) | |
4657 goto LABEL_393; | |
4658 amount = 4 * v2; | |
4659 v195 = 3600 * v2; | |
4660 LABEL_392: | |
4661 LODWORD(v733) = v195; | |
4662 LABEL_393: | |
4663 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4664 { | |
4665 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | |
4666 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4667 v3->spellnum = 0; | |
4668 continue; | |
4669 } | |
4670 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4671 { | |
4672 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4673 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4674 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4675 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4676 | |
4677 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4678 LODWORD(v727) = 1; | |
4679 } | |
4680 goto play_sound_and_continue; | |
4681 | |
4682 case 21: | |
4683 { | |
4684 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4685 { | |
4686 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4687 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4688 goto play_sound_and_continue; | |
4689 } | |
4690 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4691 { | |
4692 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4693 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4694 goto play_sound_and_continue; | |
4695 } | |
4696 LODWORD(v733) = 3600 * v2; | |
4697 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4698 amount = 1; | |
4699 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4700 goto play_sound_and_continue; | |
4701 v205 = 0; | |
4702 do | |
4703 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4704 while ( v205 < 4 ); | |
4705 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
4706 v207 = v3->uPlayerID + 1; | |
4707 v716 = v206; | |
4708 | |
4709 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4710 LODWORD(v727) = 1; | |
4711 goto play_sound_and_continue; | |
4712 } | |
4713 | |
4714 case 22: | |
4715 { | |
4716 //v67 = 2; | |
4717 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4718 { | |
4719 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4720 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4721 v3->spellnum = 0; | |
4722 continue; | |
4723 } | |
4724 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4725 goto play_sound_and_continue; | |
4726 v208 = PID_TYPE(a2); | |
4727 LODWORD(v725) = PID_TYPE(a2); | |
4728 if ( v208 == 3 ) | |
4729 { | |
4730 v209 = PID_ID(a2); | |
4731 LODWORD(v718) = pActors[v209].vPosition.x; | |
4732 v210 = pActors[v209].vPosition.y; | |
4733 v211 = pActors[v209].vPosition.z; | |
4734 v713 = v210; | |
4735 } | |
4736 else | |
4737 { | |
4738 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4739 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4740 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4741 v214 = sub_42EBBE(2048, v213); | |
4742 v211 = pParty->vPosition.z; | |
4743 v713 = pParty->vPosition.y + v214; | |
4744 v208 = LODWORD(v725); | |
4745 } | |
4746 HIDWORD(v733) = 0; | |
4747 *(float *)&v732 = (double)v211; | |
4748 LODWORD(v725) = v211 + 2500; | |
4749 v721 = 0; | |
4750 *(float *)&y = (double)(v211 + 2500); | |
4751 v730 = v208 == 3 ? a2 : 0; | |
4752 a2 = 20; | |
4753 do | |
4754 { | |
4755 v215 = rand(); | |
4756 v216 = (double)v721; | |
4757 v217 = (double)SHIDWORD(v733); | |
4758 *(float *)&uRequiredMana = v217; | |
4759 _this = (ItemGen *)(v215 % 1000); | |
4760 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4761 *(float *)&v721 = v217 * v217; | |
4762 //*(float *)&v726 = v216 * v216; | |
4763 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4764 { | |
4765 LODWORD(v685) = 0; | |
4766 HIDWORD(v685) = 0; | |
4767 } | |
4768 else | |
4769 { | |
4770 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); | |
4771 v685 = __PAIR__( | |
4772 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4773 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4774 } | |
4775 a1.stru_24.Reset(); | |
4776 a1.spell_id = v3->spellnum; | |
4777 a1.spell_level = v2; | |
4778 a1.spell_skill = v731; | |
4779 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4780 a1.uAttributes = 0; | |
4781 a1.vPosition.x = LODWORD(v718); | |
4782 a1.vPosition.y = v713; | |
4783 a1.uSectorID = 0; | |
4784 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4785 a1.uSpriteFrameID = 0; | |
4786 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4787 a1.spell_target_pid = v730; | |
4788 __debugbreak(); | |
4789 a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4790 a1.uFacing = v685; | |
4791 a1.uSoundID = LOWORD(v3->sound_id); | |
4792 if ( pParty->bTurnBasedModeOn == 1 ) | |
4793 a1.uAttributes = 4; | |
4794 if ( a1.Create( | |
4795 v685, | |
4796 SHIDWORD(v685), | |
4797 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4798 0) != -1 | |
4799 && pParty->bTurnBasedModeOn == 1 ) | |
4800 ++pTurnEngine->field_1C; | |
4801 v721 = rand() % 1024 - 512; | |
4802 v218 = rand(); | |
4803 v14 = a2-- == 1; | |
4804 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4805 } | |
4806 while ( !v14 ); | |
4807 LODWORD(v727) = 1; | |
4808 goto play_sound_and_continue; | |
4809 } | |
4810 | |
4811 case 23: | |
4812 v219 = v731 - 2; | |
4813 if ( v219 ) | |
4814 { | |
4815 v220 = v219 - 1; | |
4816 if ( v220 ) | |
4817 { | |
4818 if ( v220 == 1 ) | |
4819 { | |
4820 amount = 0; | |
4821 goto LABEL_433; | |
4822 } | |
4823 v221 = 180 * v2; | |
4824 } | |
4825 else | |
4826 { | |
4827 v221 = 86400 * v2; | |
4828 } | |
4829 } | |
4830 else | |
4831 { | |
4832 v221 = 3600 * v2; | |
4833 } | |
4834 amount = v221; | |
4835 LABEL_433: | |
4836 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4837 goto play_sound_and_continue; | |
4838 v222 = (char *)pParty->pPlayers; | |
4839 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4840 break; | |
4841 case 24: | |
4842 v224 = v731 - 2; | |
4843 if ( v224 ) | |
4844 { | |
4845 v225 = v224 - 1; | |
4846 if ( v225 ) | |
4847 { | |
4848 if ( v225 == 1 ) | |
4849 amount = 7; | |
4850 else | |
4851 amount = 1; | |
4852 } | |
4853 else | |
4854 { | |
4855 amount = 5; | |
4856 } | |
4857 } | |
4858 else | |
4859 { | |
4860 amount = 3; | |
4861 } | |
4862 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4863 goto play_sound_and_continue; | |
4864 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4865 if ( amount == 1 ) | |
4866 { | |
4867 LABEL_152: | |
4868 a1.stru_24.Reset(); | |
4869 a1.spell_id = v3->spellnum; | |
4870 a1.spell_skill = v731; | |
4871 a1.spell_level = v2; | |
4872 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4873 a1.vPosition.y = pParty->vPosition.y; | |
4874 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4875 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4876 v660 = pParty->vPosition.y; | |
4877 LABEL_153: | |
4878 a1.uAttributes = 0; | |
4879 a1.vPosition.x = pParty->vPosition.x; | |
4880 a1.vPosition.z = v51; | |
4881 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
4882 a1.uSpriteFrameID = 0; | |
4883 a1.uSectorID = v52; | |
4884 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4885 a1.spell_target_pid = a2; | |
4886 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4887 a1.uFacing = LOWORD(v715.uYawAngle); | |
4888 a1.uSoundID = LOWORD(v3->sound_id); | |
4889 | |
4890 if ( pParty->bTurnBasedModeOn == 1 ) | |
4891 LOBYTE(a1.uAttributes) |= 4u; | |
4892 | |
4893 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
4894 | |
4895 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4896 ++pTurnEngine->field_1C; | |
4897 } | |
4898 else | |
4899 { | |
4900 a1.stru_24.Reset(); | |
4901 a1.spell_id = v3->spellnum; | |
4902 a1.spell_level = v2; | |
4903 a1.spell_skill = v731; | |
4904 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4905 a1.vPosition.y = pParty->vPosition.y; | |
4906 a1.vPosition.x = pParty->vPosition.x; | |
4907 a1.uAttributes = 0; | |
4908 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4909 a1.uSectorID = pIndoor->GetSector( | |
4910 pParty->vPosition.x, | |
4911 pParty->vPosition.y, | |
4912 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4913 a1.uSpriteFrameID = 0; | |
4914 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4915 a1.spell_target_pid = a2; | |
4916 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4917 a1.uSoundID = LOWORD(v3->sound_id); | |
4918 if ( pParty->bTurnBasedModeOn == 1 ) | |
4919 LOBYTE(a1.uAttributes) |= 4u; | |
4920 v227 = SHIDWORD(v733) / -2; | |
4921 y = (char *)(SHIDWORD(v733) / 2); | |
4922 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4923 { | |
4924 v228 = v715.uYawAngle; | |
4925 do | |
4926 { | |
4927 a1.uFacing = v227 + v228; | |
4928 if ( a1.Create( | |
4929 v227 + v228, | |
4930 v715.uPitchAngle, | |
4931 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4932 v3->uPlayerID + 1) != -1 | |
4933 && pParty->bTurnBasedModeOn == 1 ) | |
4934 ++pTurnEngine->field_1C; | |
4935 v227 += SHIDWORD(v733) / (amount - 1); | |
4936 } | |
4937 while ( v227 <= (signed int)y ); | |
4938 } | |
4939 } | |
4940 LODWORD(v727) = 1; | |
4941 goto play_sound_and_continue; | |
4942 | |
4943 case 27: | |
4944 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4945 { | |
4946 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4947 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4948 goto play_sound_and_continue; | |
4949 } | |
4950 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4951 v229 = 600 * v2; | |
4952 else | |
4953 v229 = 3600 * v2; | |
4954 LODWORD(v733) = v229; | |
4955 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4956 goto play_sound_and_continue; | |
4957 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
4958 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4959 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4960 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4961 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4962 | |
4963 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4964 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4965 v731, | |
4966 amount, | |
4967 v716, | |
4968 v3->uPlayerID + 1); | |
4969 if ( v731 == 4 ) | |
4970 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4971 LODWORD(v727) = 1; | |
4972 goto play_sound_and_continue; | |
4973 | |
4974 case 28: | |
4975 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4976 goto play_sound_and_continue; | |
4977 v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | |
4978 y = v240; | |
4979 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4980 { | |
4981 dword_50C9D0 = 113; | |
4982 dword_50C9D4 = 0; | |
4983 dword_50C9D8 = 1; | |
4984 | |
4985 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4986 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4987 v3->spellnum = 0; | |
4988 continue; | |
4989 } | |
4990 if ( v731 == 1 || v731 == 2 ) | |
4991 { | |
4992 v241 = (double)v723 * 0.0099999998 + 0.5; | |
4993 } | |
4994 else | |
4995 { | |
4996 if ( v731 == 3 ) | |
4997 { | |
4998 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
4999 } | |
5000 else | |
5001 { | |
5002 if ( v731 != 4 ) | |
5003 { | |
5004 v241 = 0.0; | |
5005 goto LABEL_484; | |
5006 } | |
5007 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
5008 } | |
5009 } | |
5010 if ( v241 > 1.0 ) | |
5011 v241 = 1.0; | |
5012 LABEL_484: | |
5013 v732 = (unsigned __int8)v240[25]; | |
5014 v242 = (signed __int64)((double)v732 * v241); | |
5015 v243 = y; | |
5016 y[25] = v242; | |
5017 *((int *)v243 + 4) = (unsigned __int8)v242; | |
5018 if ( (unsigned __int8)v242 <= 0 ) | |
5019 { | |
5020 *(int *)v243 = 0; | |
5021 dword_50C9D0 = 113; | |
5022 dword_50C9D4 = 0; | |
5023 dword_50C9D8 = 1; | |
5024 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
5025 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5026 v3->spellnum = 0; | |
5027 v2 = v723; | |
5028 continue; | |
5029 } | |
5030 *((int *)v243 + 5) |= 0x40u; | |
5031 dword_50C9A8 = 256; | |
5032 LODWORD(v727) = 1; | |
5033 goto play_sound_and_continue; | |
5034 | |
5035 case 30: | |
5036 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5037 goto play_sound_and_continue; | |
5038 uRequiredMana = 0; | |
5039 HIDWORD(v733) = 10 * v2; | |
5040 v730 = 1; | |
5041 v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
5042 if ( v731 == 1 ) | |
5043 { | |
5044 v245 = (int)&v244[36 * a2 + 532]; | |
5045 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5046 v311 = __OFSUB__(*(int *)v245, 134); | |
5047 v14 = *(int *)v245 == 134; | |
5048 v310 = *(int *)v245 - 134 < 0; | |
5049 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5050 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5051 { | |
5052 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
5053 { | |
5054 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
5055 { | |
5056 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
5057 { | |
5058 v312 = v309[28]; | |
5059 if ( v312 ) | |
5060 { | |
5061 if ( v312 != 1 ) | |
5062 { | |
5063 if ( v312 != 2 ) | |
5064 { | |
5065 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5066 if ( !(v244[36 * a2 + 552] & 2) ) | |
5067 { | |
5068 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5069 { | |
5070 uRequiredMana = 1; | |
5071 v730 = 0; | |
5072 } | |
5073 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5074 uRequiredMana = 1; | |
5075 if (!uRequiredMana) | |
5076 { | |
5077 v313 = *(char *)(LODWORD(v725) + 28); | |
5078 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5079 { | |
5080 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5081 *(int *)(v245 + 4) = 0; | |
5082 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5083 + 1]; | |
5084 ; | |
5085 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5086 + 1] ) | |
5087 { | |
5088 ++*(int *)(v245 + 4); | |
5089 if ( j >= v314 ) | |
5090 break; | |
5091 } | |
5092 v254 = rand(); | |
5093 v255 = 10;//pItemsTable->field_116D8[17]; | |
5094 v256 = 10;//pItemsTable->field_116D8[16]; | |
5095 LABEL_611: | |
5096 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5097 LABEL_612: | |
5098 _this->uItemID |= 0x20u; | |
5099 | |
5100 dword_50C9A8 = 256; | |
5101 LODWORD(v727) = 1; | |
5102 goto play_sound_and_continue; | |
5103 } | |
5104 goto LABEL_615; | |
5105 } | |
5106 LABEL_613: | |
5107 v316 = _this->uItemID; | |
5108 if ( !(BYTE1(v316) & 2) ) | |
5109 { | |
5110 LOBYTE(v316) = v316 | 2; | |
5111 _this->uItemID = v316; | |
5112 } | |
5113 } | |
5114 } | |
5115 } | |
5116 } | |
5117 } | |
5118 } | |
5119 } | |
5120 } | |
5121 LABEL_616: | |
5122 if ( LODWORD(v727) == 0 ) | |
5123 { | |
5124 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5125 if ( v730 == 0 ) | |
5126 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5127 ShowStatusBarString(v317, 2u); | |
5128 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5129 __debugbreak(); // decompilation error; most probably v318 is the caster, filled in case 54 | |
5130 //v318 = v726; | |
5131 v3->spellnum = 0; | |
5132 v318->PlaySound(SPEECH_43, 0); | |
5133 } | |
5134 goto play_sound_and_continue; | |
5135 } | |
5136 if ( v731 != 2 ) | |
5137 { | |
5138 if ( v731 == 3 ) | |
5139 { | |
5140 v245 = (int)&v244[36 * a2 + 532]; | |
5141 v269 = *(int *)v245; | |
5142 if ( *(int *)v245 > 134 | |
5143 || *(int *)(v245 + 12) != 0 | |
5144 || *(int *)(v245 + 4) != 0 | |
5145 || *(int *)(v245 + 8) != 0 | |
5146 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5147 goto LABEL_616; | |
5148 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5149 LODWORD(v725) = (int)v270; | |
5150 v271 = v270[28]; | |
5151 if ( v271 && v271 != 1 && v271 != 2 ) | |
5152 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5153 else | |
5154 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5155 if ( v272 ) | |
5156 { | |
5157 uRequiredMana = 1; | |
5158 v730 = 0; | |
5159 } | |
5160 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5161 uRequiredMana = 1; | |
5162 if (uRequiredMana) | |
5163 goto LABEL_613; | |
5164 v273 = v725; | |
5165 v274 = *(char *)(LODWORD(v725) + 28); | |
5166 if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) | |
5167 { | |
5168 if ( rand() % 100 < 80 | |
5169 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5170 { | |
5171 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5172 *(int *)(v245 + 4) = 0; | |
5173 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5174 ; | |
5175 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5176 + 1] ) | |
5177 { | |
5178 ++*(int *)(v245 + 4); | |
5179 if ( k >= v275 ) | |
5180 break; | |
5181 } | |
5182 v254 = rand(); | |
5183 v255 = 10;//pItemsTable->field_116D8[19]; | |
5184 v256 = 10;//pItemsTable->field_116D8[18]; | |
5185 goto LABEL_611; | |
5186 } | |
5187 v277 = pItemsTable->pSpecialEnchantments_count; | |
5188 v278 = 0; | |
5189 v725 = 0.0; | |
5190 HIDWORD(v733) = 0; | |
5191 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5192 { | |
5193 v730 = (int)&v679; | |
5194 do | |
5195 { | |
5196 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5197 if ( !v279 || v279 == 1 ) | |
5198 { | |
5199 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5200 + 4] | |
5201 + v278 * 28); | |
5202 LODWORD(v725) += v280; | |
5203 if ( v280 ) | |
5204 { | |
5205 v281 = v730; | |
5206 v730 += 4; | |
5207 *(int *)v281 = HIDWORD(v733); | |
5208 } | |
5209 } | |
5210 ++HIDWORD(v733); | |
5211 ++v278; | |
5212 } | |
5213 while ( SHIDWORD(v733) < v277 ); | |
5214 } | |
5215 v282 = rand() % SLODWORD(v725); | |
5216 v283 = v679; | |
5217 *(int *)(v245 + 12) = v679; | |
5218 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5219 v285 = v282 + 1; | |
5220 if ( v284 < v285 ) | |
5221 { | |
5222 for ( l = &v679; ; l = (int *)v732 ) | |
5223 { | |
5224 v287 = (int)(l + 1); | |
5225 v732 = v287; | |
5226 v288 = *(int *)v287; | |
5227 *(int *)(v245 + 12) = v288; | |
5228 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5229 + 4]; | |
5230 if ( v284 >= v285 ) | |
5231 break; | |
5232 } | |
5233 } | |
5234 goto LABEL_525; | |
5235 } | |
5236 } | |
5237 else | |
5238 { | |
5239 __debugbreak(); // v726 is most probably the caster, filled in case 54 | |
5240 if ( v731 != 4 | |
5241 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5242 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5243 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5244 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5245 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5246 goto LABEL_616; | |
5247 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5248 LODWORD(v725) = (int)v247; | |
5249 v248 = v247[28]; | |
5250 if ( v248 && v248 != 1 && v248 != 2 ) | |
5251 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5252 else | |
5253 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5254 if ( v249 ) | |
5255 { | |
5256 uRequiredMana = 1; | |
5257 v730 = 0; | |
5258 } | |
5259 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5260 uRequiredMana = 1; | |
5261 if (uRequiredMana) | |
5262 goto LABEL_613; | |
5263 v250 = v725; | |
5264 v251 = *(char *)(LODWORD(v725) + 28); | |
5265 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) | |
5266 { | |
5267 if ( rand() % 100 < 80 | |
5268 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5269 { | |
5270 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5271 *(int *)(v245 + 4) = 0; | |
5272 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5273 ; | |
5274 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5275 + 1] ) | |
5276 { | |
5277 ++*(int *)(v245 + 4); | |
5278 if ( m >= v252 ) | |
5279 break; | |
5280 } | |
5281 v254 = rand(); | |
5282 v255 = 10;// pItemsTable->field_116D8[21]; | |
5283 v256 = 10;//pItemsTable->field_116D8[20]; | |
5284 goto LABEL_611; | |
5285 } | |
5286 v257 = pItemsTable->pSpecialEnchantments_count; | |
5287 v258 = 0; | |
5288 v725 = 0.0; | |
5289 HIDWORD(v733) = 0; | |
5290 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5291 { | |
5292 v730 = (int)&v679; | |
5293 do | |
5294 { | |
5295 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5296 if ( !v259 || v259 == 1 ) | |
5297 { | |
5298 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5299 + 4] | |
5300 + v258 * 28); | |
5301 LODWORD(v725) += v260; | |
5302 if ( v260 ) | |
5303 { | |
5304 v261 = v730; | |
5305 v730 += 4; | |
5306 *(int *)v261 = HIDWORD(v733); | |
5307 } | |
5308 } | |
5309 ++HIDWORD(v733); | |
5310 ++v258; | |
5311 } | |
5312 while ( SHIDWORD(v733) < v257 ); | |
5313 } | |
5314 v262 = rand() % SLODWORD(v725); | |
5315 v263 = v679; | |
5316 *(int *)(v245 + 12) = v679; | |
5317 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5318 v265 = v262 + 1; | |
5319 if ( v264 < v265 ) | |
5320 { | |
5321 for ( ii = &v679; ; ii = (int *)v732 ) | |
5322 { | |
5323 v267 = (int)(ii + 1); | |
5324 v732 = v267; | |
5325 v268 = *(int *)v267; | |
5326 *(int *)(v245 + 12) = v268; | |
5327 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5328 + 4]; | |
5329 if ( v264 >= v265 ) | |
5330 break; | |
5331 } | |
5332 } | |
5333 LABEL_525: | |
5334 ++*(int *)(v245 + 12); | |
5335 goto LABEL_612; | |
5336 } | |
5337 } | |
5338 LABEL_615: | |
5339 //v1 = 0; | |
5340 goto LABEL_616; | |
5341 } | |
5342 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5343 _this = v289; | |
5344 v290 = v289->uItemID; | |
5345 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5346 if ( v290 > 134 | |
5347 || _this->uSpecEnchantmentType != 0 | |
5348 || _this->uEnchantmentType != 0 | |
5349 || _this->_bonus_strength != 0 | |
5350 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5351 || v291 == 1 | |
5352 || v291 == 2 | |
5353 || _this->Broken()) | |
5354 goto LABEL_616; | |
5355 if ( _this->GetValue() < 0x1C2 ) | |
5356 uRequiredMana = 1; | |
5357 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5358 uRequiredMana = 1; | |
5359 if ( uRequiredMana != 0 ) | |
5360 { | |
5361 dword_50C9D0 = 113; | |
5362 dword_50C9D4 = 0; | |
5363 dword_50C9D8 = 1; | |
5364 | |
5365 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5366 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5367 v3->spellnum = 0; | |
5368 continue; | |
5369 } | |
5370 v292 = *(char *)(LODWORD(v725) + 28); | |
5371 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5372 { | |
5373 v2 = v723; | |
5374 //v1 = 0; | |
5375 | |
5376 dword_50C9D0 = 113; | |
5377 dword_50C9D4 = 0; | |
5378 dword_50C9D8 = 1; | |
5379 | |
5380 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5381 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5382 v3->spellnum = 0; | |
5383 continue; | |
5384 } | |
5385 if ( rand() % 100 >= 80 ) | |
5386 { | |
5387 v297 = pItemsTable->pSpecialEnchantments_count; | |
5388 v294 = _this; | |
5389 v298 = 0; | |
5390 v725 = 0.0; | |
5391 HIDWORD(v733) = 0; | |
5392 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5393 { | |
5394 v730 = (int)&v679; | |
5395 do | |
5396 { | |
5397 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5398 if ( !v299 || v299 == 1 ) | |
5399 { | |
5400 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5401 + v298 * 28); | |
5402 LODWORD(v725) += v300; | |
5403 if ( v300 ) | |
5404 { | |
5405 v301 = v730; | |
5406 v730 += 4; | |
5407 *(int *)v301 = HIDWORD(v733); | |
5408 } | |
5409 } | |
5410 ++HIDWORD(v733); | |
5411 ++v298; | |
5412 } | |
5413 while ( SHIDWORD(v733) < v297 ); | |
5414 } | |
5415 v302 = rand() % SLODWORD(v725); | |
5416 v303 = v679; | |
5417 v294->uSpecEnchantmentType = v679; | |
5418 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5419 v305 = v302 + 1; | |
5420 if ( v304 < v305 ) | |
5421 { | |
5422 for ( jj = &v679; ; jj = (int *)v732 ) | |
5423 { | |
5424 v307 = (int)(jj + 1); | |
5425 v732 = v307; | |
5426 v308 = *(int *)v307; | |
5427 v294->uSpecEnchantmentType = v308; | |
5428 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5429 if ( v304 >= v305 ) | |
5430 break; | |
5431 } | |
5432 } | |
5433 ++v294->uSpecEnchantmentType; | |
5434 } | |
5435 else | |
5436 { | |
5437 v293 = rand(); | |
5438 v294 = _this; | |
5439 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5440 _this->uEnchantmentType = 0; | |
5441 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5442 ; | |
5443 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5444 + 1] ) | |
5445 { | |
5446 ++v294->uEnchantmentType; | |
5447 if ( kk >= v295 ) | |
5448 break; | |
5449 } | |
5450 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5451 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5452 } | |
5453 v294->uAttributes |= 0x20u; | |
5454 dword_50C9A8 = 256; | |
5455 LODWORD(v727) = 1; | |
5456 goto play_sound_and_continue; | |
5457 | |
5458 case SPELL_WATER_TOWN_PORTAL: | |
5459 amount = 10 * v2; | |
5460 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5461 goto play_sound_and_continue; | |
5462 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5463 { | |
5464 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5465 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5466 v3->spellnum = 0; | |
5467 continue; | |
5468 } | |
5469 town_portal_caster_id = LOBYTE(v3->uPlayerID); | |
5470 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
5471 LODWORD(v727) = 1; | |
5472 goto play_sound_and_continue; | |
5473 case 33: | |
5474 LODWORD(v733) = 604800 * v2; | |
5475 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5476 { | |
5477 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5478 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5479 v3->spellnum = 0; | |
5480 continue; | |
5481 } | |
5482 v319 = uRequiredMana; | |
5483 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5484 { | |
5485 pEventTimer->Pause(); | |
5486 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5487 qword_506350 = (signed int)v733; | |
5488 _506348_current_lloyd_playerid = v3->uPlayerID; | |
5489 ::uRequiredMana = v319; | |
5490 ::sRecoveryTime = sRecoveryTime; | |
5491 dword_50633C = v3->sound_id; | |
5492 dword_506338 = v3->spellnum; | |
5493 LOBYTE(v3->field_8) |= 0x20u; | |
5494 } | |
5495 goto play_sound_and_continue; | |
5496 case 40: | |
5497 v320 = v731 - 2; | |
5498 if ( !v320 ) | |
5499 goto LABEL_632; | |
5500 v321 = v320 - 1; | |
5501 if ( v321 ) | |
5502 { | |
5503 if ( v321 == 1 ) | |
5504 goto LABEL_634; | |
5505 LABEL_632: | |
5506 v322 = 3600 * v2; | |
5507 } | |
5508 else | |
5509 { | |
5510 v322 = 86400 * v2; | |
5511 } | |
5512 amount = v322; | |
5513 LABEL_634: | |
5514 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5515 goto play_sound_and_continue; | |
5516 v323 = v3->uPlayerID_2; | |
5517 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
5518 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5519 { | |
5520 LODWORD(v727) = 1; | |
5521 goto play_sound_and_continue; | |
5522 } | |
5523 if ( v731 == 4 ) | |
5524 { | |
5525 *(int *)v324 = 0; | |
5526 *((int *)v324 + 1) = 0; | |
5527 LODWORD(v727) = 1; | |
5528 goto play_sound_and_continue; | |
5529 } | |
5530 v732 = amount << 7; | |
5531 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5532 v656 = 15; | |
5533 goto LABEL_640; | |
5534 | |
5535 case 41: | |
5536 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5537 goto play_sound_and_continue; | |
5538 a1.stru_24.Reset(); | |
5539 a1.spell_id = v3->spellnum; | |
5540 a1.spell_level = v2; | |
5541 a1.spell_skill = v731; | |
5542 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5543 a1.vPosition.y = pParty->vPosition.y; | |
5544 a1.vPosition.x = pParty->vPosition.x; | |
5545 a1.uAttributes = 0; | |
5546 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5547 a1.uSectorID = pIndoor->GetSector( | |
5548 pParty->vPosition.x, | |
5549 pParty->vPosition.y, | |
5550 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
5551 a1.uSpriteFrameID = 0; | |
5552 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5553 a1.spell_target_pid = a2; | |
5554 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5555 a1.uFacing = LOWORD(pParty->sRotationY); | |
5556 a1.uSoundID = LOWORD(v3->sound_id); | |
5557 if ( pParty->bTurnBasedModeOn == 1 ) | |
5558 LOBYTE(a1.uAttributes) |= 4u; | |
5559 | |
5560 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
5561 if ( a1.Create(pParty->sRotationY, pParty->sRotationX, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
5562 ++pTurnEngine->field_1C; | |
5563 LODWORD(v727) = 1; | |
5564 goto play_sound_and_continue; | |
5565 | |
5566 case 43: | |
5567 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5568 { | |
5569 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5570 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5571 v3->spellnum = 0; | |
5572 continue; | |
5573 } | |
5574 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5575 goto play_sound_and_continue; | |
5576 a1.uType = 4090; | |
5577 a1.stru_24.Reset(); | |
5578 a1.spell_id = v3->spellnum; | |
5579 a1.spell_level = v2; | |
5580 a1.spell_skill = v731; | |
5581 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5582 a1.vPosition.x = pParty->vPosition.x; | |
5583 a1.vPosition.y = pParty->vPosition.y; | |
5584 a1.uAttributes = 0; | |
5585 a1.uSectorID = 0; | |
5586 a1.uSpriteFrameID = 0; | |
5587 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5588 a1.field_60_distance_related_prolly_lod = 0; | |
5589 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5590 a1.spell_target_pid = a2; | |
5591 a1.uFacing = LOWORD(pParty->sRotationY); | |
5592 a1.uSoundID = LOWORD(v3->sound_id); | |
5593 if ( pParty->bTurnBasedModeOn == 1 ) | |
5594 a1.uAttributes = 4; | |
5595 | |
5596 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
5597 if ( a1.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
5598 ++pTurnEngine->field_1C; | |
5599 LODWORD(v727) = 1; | |
5600 goto play_sound_and_continue; | |
5601 | |
5602 case SPELL_SPIRIT_DETECT_LIFE: | |
5603 v328 = v731 - 2; | |
5604 if ( v328 ) | |
5605 { | |
5606 v329 = v328 - 1; | |
5607 if ( v329 && v329 != 1 ) | |
5608 v330 = 600 * v2; | |
5609 else | |
5610 v330 = 3600 * v2; | |
5611 } | |
5612 else | |
5613 { | |
5614 v330 = 1800 * v2; | |
5615 } | |
5616 LODWORD(v733) = v330; | |
5617 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5618 goto play_sound_and_continue; | |
5619 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
5620 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
5621 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
5622 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
5623 | |
5624 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
5625 LODWORD(v727) = 1; | |
5626 goto play_sound_and_continue; | |
5627 | |
5628 case SPELL_SPIRIT_FATE: | |
5629 LODWORD(v733) = 300; | |
5630 v339 = v731 - 2; | |
5631 if ( v339 ) | |
5632 { | |
5633 v340 = v339 - 1; | |
5634 if ( v340 ) | |
5635 { | |
5636 if ( v340 != 1 ) | |
5637 { | |
5638 amount = v2; | |
5639 goto LABEL_667; | |
5640 } | |
5641 v341 = 6 * v2; | |
5642 } | |
5643 else | |
5644 { | |
5645 v341 = 4 * v2; | |
5646 } | |
5647 } | |
5648 else | |
5649 { | |
5650 v341 = 2 * v2; | |
5651 } | |
5652 amount = v341; | |
5653 LABEL_667: | |
5654 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5655 goto play_sound_and_continue; | |
5656 v342 = v3->spell_target_pid; | |
5657 if ( v342 == 0 ) | |
5658 { | |
5659 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5660 | |
5661 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
5662 LODWORD(v727) = 1; | |
5663 goto play_sound_and_continue; | |
5664 } | |
5665 if (PID_TYPE(v342) == OBJECT_Actor) | |
5666 { | |
5667 v343 = PID_ID(v342); | |
5668 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5669 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5670 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5671 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5672 v672 = 0; | |
5673 v661 = &pActors[v343]; | |
5674 LABEL_165: | |
5675 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5676 } | |
5677 LODWORD(v727) = 1; | |
5678 goto play_sound_and_continue; | |
5679 | |
5680 case 49: | |
5681 v348 = v731 - 2; | |
5682 if ( !v348 ) | |
5683 goto LABEL_677; | |
5684 v349 = v348 - 1; | |
5685 if ( v349 ) | |
5686 { | |
5687 if ( v349 == 1 ) | |
5688 { | |
5689 amount = 0; | |
5690 goto LABEL_679; | |
5691 } | |
5692 LABEL_677: | |
5693 v350 = 3600 * v2; | |
5694 } | |
5695 else | |
5696 { | |
5697 v350 = 86400 * v2; | |
5698 } | |
5699 amount = v350; | |
5700 LABEL_679: | |
5701 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5702 goto play_sound_and_continue; | |
5703 v351 = &pParty->pPlayers[v3->uPlayerID_2]; | |
5704 if ( !v351->pConditions[0] ) | |
5705 { | |
5706 LODWORD(v727) = 1; | |
5707 goto play_sound_and_continue; | |
5708 } | |
5709 if ( v731 == 4 ) | |
5710 { | |
5711 LODWORD(v351->pConditions[0]) = 0; | |
5712 HIDWORD(v351->pConditions[0]) = 0; | |
5713 } | |
5714 else | |
5715 { | |
5716 v732 = amount << 7; | |
5717 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
5718 if ( HIDWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) ) | |
5719 { | |
5720 LODWORD(v727) = 1; | |
5721 goto play_sound_and_continue; | |
5722 } | |
5723 } | |
5724 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5725 LODWORD(v727) = 1; | |
5726 goto play_sound_and_continue; | |
5727 | |
5728 case SPELL_SPIRIT_PRESERVATION: | |
5729 v354 = v731 - 2; | |
5730 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5731 v356 = 900 * (v2 + 4); | |
5732 else | |
5733 v356 = 300 * (v2 + 12); | |
5734 LODWORD(v733) = v356; | |
5735 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5736 goto play_sound_and_continue; | |
5737 if ( v731 == 1 || v731 == 2 ) | |
5738 { | |
5739 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5740 | |
5741 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
5742 LODWORD(v727) = 1; | |
5743 goto play_sound_and_continue; | |
5744 } | |
5745 a2 = 0; | |
5746 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5747 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5748 do | |
5749 { | |
5750 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
5751 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
5752 ++a2; | |
5753 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5754 } | |
5755 while ( v357 <= &pParty->pPlayers[3] ); | |
5756 LODWORD(v727) = 1; | |
5757 goto play_sound_and_continue; | |
5758 | |
5759 case 48: | |
5760 { | |
5761 v364 = v731 - 2; | |
5762 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5763 v366 = 60 * (v2 + 3); | |
5764 else | |
5765 v366 = 300 * v2 + 180; | |
5766 LODWORD(v733) = v366; | |
5767 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5768 goto play_sound_and_continue; | |
5769 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5770 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
5771 ++a1.uType; | |
5772 a1.stru_24.Reset(); | |
5773 a1.spell_id = v3->spellnum; | |
5774 a1.spell_level = v2; | |
5775 a1.spell_skill = v731; | |
5776 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5777 a1.uAttributes = 0; | |
5778 a1.uSectorID = 0; | |
5779 a1.uSpriteFrameID = 0; | |
5780 a1.field_60_distance_related_prolly_lod = 0; | |
5781 a1.uFacing = 0; | |
5782 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5783 a1.uSoundID = LOWORD(v3->sound_id); | |
5784 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
5785 { | |
5786 v369 = &pActors[dword_50BF30[a2]]; | |
5787 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5788 { | |
5789 a1.vPosition.x = v369->vPosition.x; | |
5790 a1.vPosition.y = v369->vPosition.y; | |
5791 a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5792 | |
5793 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5794 a1.Create(0, 0, 0, 0); | |
5795 v369->pActorBuffs[4].Apply( | |
5796 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
5797 v731, 0, 0, 0); | |
5798 } | |
5799 } | |
5800 LODWORD(v727) = 1; | |
5801 } | |
5802 goto play_sound_and_continue; | |
5803 | |
5804 case 53: | |
5805 v371 = v731 - 2; | |
5806 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5807 amount = 0; | |
5808 else | |
5809 amount = 86400 * v2; | |
5810 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5811 goto play_sound_and_continue; | |
5812 pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); | |
5813 v373 = v3->uPlayerID_2; | |
5814 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
5815 { | |
5816 LODWORD(v727) = 1; | |
5817 goto play_sound_and_continue; | |
5818 } | |
5819 v14 = v731 == 4; | |
5820 pParty->pPlayers[v373].sHealth = 1; | |
5821 if ( v14 ) | |
5822 { | |
5823 v374 = v3->uPlayerID_2; | |
5824 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
5825 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
5826 v376 = v3->uPlayerID_2; | |
5827 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5828 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5829 } | |
5830 else | |
5831 { | |
5832 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5833 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5834 0xEu, | |
5835 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5836 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5837 0xDu, | |
5838 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5839 } | |
5840 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
5841 goto LABEL_720; | |
5842 case 54: | |
5843 v378 = v731 - 2; | |
5844 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5845 v380 = 4 * v2; | |
5846 else | |
5847 v380 = 3 * v2; | |
5848 amount = v380; | |
5849 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5850 goto play_sound_and_continue; | |
5851 v381 = 0; | |
5852 HIDWORD(v733) = amount; | |
5853 v730 = 0; | |
5854 v382 = 1; | |
5855 do | |
5856 { | |
5857 v383 = pPlayers[v382]; | |
5858 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5859 v682[v381++] = v382; | |
5860 ++v382; | |
5861 } | |
5862 while ( v382 <= 4 ); | |
5863 v384 = 0; | |
5864 v730 = v381; | |
5865 if ( v381 > 0 ) | |
5866 { | |
5867 do | |
5868 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5869 while ( v384 < v381 ); | |
5870 } | |
5871 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5872 HIDWORD(v733) = 0; | |
5873 if ( v381 > 0 ) | |
5874 { | |
5875 do | |
5876 { | |
5877 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5878 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5879 v726->sHealth = v732; | |
5880 //v386 = v726->GetMaxHealth(); | |
5881 if ( v726->sHealth > v726->GetMaxHealth()) | |
5882 v726->sHealth = v726->GetMaxHealth(); | |
5883 if ( v726->sHealth > 0 ) | |
5884 { | |
5885 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5886 } | |
5887 v388 = HIDWORD(v733); | |
5888 | |
5889 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); | |
5890 HIDWORD(v733) = v388 + 1; | |
5891 } | |
5892 while ( v388 + 1 < v730 ); | |
5893 } | |
5894 LODWORD(v727) = 1; | |
5895 goto play_sound_and_continue; | |
5896 | |
5897 case 55: | |
5898 v392 = v731 - 1; | |
5899 if ( !v392 ) | |
5900 { | |
5901 v395 = 180 * v2; | |
5902 goto LABEL_750; | |
5903 } | |
5904 v393 = v392 - 1; | |
5905 if ( !v393 ) | |
5906 { | |
5907 v395 = 10800 * v2; | |
5908 goto LABEL_750; | |
5909 } | |
5910 v394 = v393 - 1; | |
5911 if ( !v394 ) | |
5912 { | |
5913 v395 = 259200 * v2; | |
5914 LABEL_750: | |
5915 amount = v395; | |
5916 goto LABEL_751; | |
5917 } | |
5918 if ( v394 == 1 ) | |
5919 amount = 0; | |
5920 LABEL_751: | |
5921 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5922 goto play_sound_and_continue; | |
5923 v396 = v3->uPlayerID_2; | |
5924 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
5925 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5926 { | |
5927 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5928 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5929 if ( v731 == 4 ) | |
5930 { | |
5931 v397 = v3->uPlayerID_2; | |
5932 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
5933 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
5934 v398 = v3->uPlayerID_2; | |
5935 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
5936 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
5937 v399 = v3->uPlayerID_2; | |
5938 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5939 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5940 } | |
5941 else | |
5942 { | |
5943 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5944 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
5945 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5946 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
5947 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5948 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
5949 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5950 } | |
5951 pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); | |
5952 | |
5953 pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; | |
5954 | |
5955 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5956 } | |
5957 LODWORD(v727) = 1; | |
5958 goto play_sound_and_continue; | |
5959 | |
5960 case 61: | |
5961 v405 = v731 - 2; | |
5962 if ( !v405 ) | |
5963 goto LABEL_766; | |
5964 v406 = v405 - 1; | |
5965 if ( v406 ) | |
5966 { | |
5967 if ( v406 == 1 ) | |
5968 { | |
5969 amount = 0; | |
5970 goto LABEL_768; | |
5971 } | |
5972 LABEL_766: | |
5973 v407 = 3600 * v2; | |
5974 } | |
5975 else | |
5976 { | |
5977 v407 = 86400 * v2; | |
5978 } | |
5979 amount = v407; | |
5980 LABEL_768: | |
5981 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5982 goto play_sound_and_continue; | |
5983 | |
5984 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5985 v323 = v3->uPlayerID_2; | |
5986 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
5987 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5988 { | |
5989 LODWORD(v727) = 1; | |
5990 goto play_sound_and_continue; | |
5991 } | |
5992 if ( v731 == 4 ) | |
5993 { | |
5994 *(int *)v324 = 0; | |
5995 *((int *)v324 + 1) = 0; | |
5996 LODWORD(v727) = 1; | |
5997 goto play_sound_and_continue; | |
5998 } | |
5999 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6000 v656 = 12; | |
6001 goto LABEL_640; | |
6002 | |
6003 | |
6004 case 56: | |
6005 v411 = v731 - 2; | |
6006 if ( v411 ) | |
6007 { | |
6008 v412 = v411 - 1; | |
6009 if ( v412 ) | |
6010 { | |
6011 if ( v412 == 1 ) | |
6012 { | |
6013 amount = 0; | |
6014 goto LABEL_780; | |
6015 } | |
6016 v413 = 180 * v2; | |
6017 } | |
6018 else | |
6019 { | |
6020 v413 = 86400 * v2; | |
6021 } | |
6022 } | |
6023 else | |
6024 { | |
6025 v413 = 3600 * v2; | |
6026 } | |
6027 amount = v413; | |
6028 LABEL_780: | |
6029 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6030 goto play_sound_and_continue; | |
6031 | |
6032 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6033 v323 = v3->uPlayerID_2; | |
6034 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
6035 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
6036 { | |
6037 LODWORD(v727) = 1; | |
6038 goto play_sound_and_continue; | |
6039 } | |
6040 if ( v731 == 4 ) | |
6041 { | |
6042 *(int *)v324 = 0; | |
6043 *((int *)v324 + 1) = 0; | |
6044 LODWORD(v727) = 1; | |
6045 goto play_sound_and_continue; | |
6046 } | |
6047 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6048 v656 = 3; | |
6049 goto LABEL_640; | |
6050 | |
6051 case 59: | |
6052 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6053 goto play_sound_and_continue; | |
6054 if (PID_TYPE(a2) != OBJECT_Actor) | |
6055 { | |
6056 LODWORD(v727) = 1; | |
6057 goto play_sound_and_continue; | |
6058 } | |
6059 v417 = (int)&pActors[PID_ID(a2)]; | |
6060 v730 = v417; | |
6061 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6062 { | |
6063 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6064 v417 = v730; | |
6065 } | |
6066 v418 = *(int *)(v417 + 672); | |
6067 HIDWORD(v733) = 0; | |
6068 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6069 HIDWORD(v733) = *(int *)(v417 + 684); | |
6070 | |
6071 //ItemGen::ItemGen(&v683); | |
6072 v683.Reset(); | |
6073 | |
6074 v419 = *(short *)(v730 + 180); | |
6075 if (v419) | |
6076 { | |
6077 v683.uItemID = v419; | |
6078 goto LABEL_799; | |
6079 } | |
6080 v420 = 0; | |
6081 v421 = v730 + 564; | |
6082 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6083 { | |
6084 ++v420; | |
6085 v421 += 36; | |
6086 if ( v420 >= 4 ) | |
6087 goto LABEL_799; | |
6088 } | |
6089 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6090 v2 = v723; | |
6091 //v1 = 0; | |
6092 LABEL_799: | |
6093 if ( HIDWORD(v733) != 0 ) | |
6094 { | |
6095 v675 = (const char *)HIDWORD(v733); | |
6096 if (v683.uItemID) | |
6097 { | |
6098 v422 = v683.GetDisplayName(); | |
6099 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6100 goto LABEL_807; | |
6101 } | |
6102 v664 = "%d gold"; | |
6103 goto LABEL_803; | |
6104 } | |
6105 if (v683.uItemID) | |
6106 { | |
6107 v675 = v683.GetDisplayName(); | |
6108 v664 = "(%s)"; | |
6109 LABEL_803: | |
6110 sprintf(pTmpBuf2, v664, v675); | |
6111 goto LABEL_807; | |
6112 } | |
6113 strcpy(pTmpBuf2, "nothing"); | |
6114 LABEL_807: | |
6115 ShowStatusBarString(pTmpBuf2, 2u); | |
6116 a1.stru_24.Reset(); | |
6117 a1.spell_id = v3->spellnum; | |
6118 a1.spell_level = v2; | |
6119 a1.spell_skill = v731; | |
6120 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6121 a1.vPosition.x = *(short *)(v730 + 142); | |
6122 a1.vPosition.y = *(short *)(v730 + 144); | |
6123 v676 = *(short *)(v730 + 138); | |
6124 v665 = a1.vPosition.y; | |
6125 a1.vPosition.z = *(short *)(v730 + 138); | |
6126 v657 = a1.vPosition.x; | |
6127 goto LABEL_1087; | |
6128 case 62: | |
6129 v423 = v731 - 2; | |
6130 if ( !v423 ) | |
6131 goto LABEL_813; | |
6132 v424 = v423 - 1; | |
6133 if ( v424 ) | |
6134 { | |
6135 if ( v424 == 1 ) | |
6136 v425 = 3600 * v2; | |
6137 else | |
6138 LABEL_813: | |
6139 v425 = 300 * v2; | |
6140 } | |
6141 else | |
6142 { | |
6143 v425 = 600 * v2; | |
6144 } | |
6145 amount = v425; | |
6146 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6147 goto play_sound_and_continue; | |
6148 v426 = PID_ID(a2); | |
6149 if (PID_TYPE(a2) != OBJECT_Actor) | |
6150 { | |
6151 LODWORD(v727) = 1; | |
6152 goto play_sound_and_continue; | |
6153 } | |
6154 v730 = 836 * v426; | |
6155 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6156 { | |
6157 pActors[v426].pActorBuffs[1].Reset(); | |
6158 pActors[v426].pActorBuffs[12].Reset(); | |
6159 pActors[v426].pActorBuffs[9].Apply( | |
6160 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6161 v731, 0, 0, 0); | |
6162 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6163 } | |
6164 a1.stru_24.Reset(); | |
6165 a1.spell_id = v3->spellnum; | |
6166 a1.spell_level = v2; | |
6167 a1.spell_skill = v731; | |
6168 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
6169 v61 = v426; | |
6170 goto LABEL_1086; | |
6171 | |
6172 | |
6173 case 66: | |
6174 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6175 goto play_sound_and_continue; | |
6176 amount = 600 * v2; | |
6177 if (PID_TYPE(a2) != OBJECT_Actor) | |
6178 { | |
6179 LODWORD(v727) = 1; | |
6180 goto play_sound_and_continue; | |
6181 } | |
6182 v730 = 836 * PID_ID(a2); | |
6183 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6184 goto play_sound_and_continue; | |
6185 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6186 { | |
6187 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6188 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6189 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6190 v731, 0, 0, 0); | |
6191 } | |
6192 a1.stru_24.Reset(); | |
6193 a1.spell_id = v3->spellnum; | |
6194 a1.spell_level = v2; | |
6195 a1.spell_skill = v731; | |
6196 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
6197 v61 = PID_ID(a2); | |
6198 goto LABEL_1086; | |
6199 | |
6200 case 63: | |
6201 { | |
6202 v428 = v731 - 2; | |
6203 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6204 v430 = 300 * v2; | |
6205 else | |
6206 v430 = 180 * v2; | |
6207 amount = v430; | |
6208 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6209 goto play_sound_and_continue; | |
6210 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6211 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
6212 ++a1.uType; | |
6213 a1.stru_24.Reset(); | |
6214 a1.spell_id = v3->spellnum; | |
6215 a1.spell_level = v2; | |
6216 a1.spell_skill = v731; | |
6217 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6218 a1.uAttributes = 0; | |
6219 a1.uSectorID = 0; | |
6220 a1.uSpriteFrameID = 0; | |
6221 a1.field_60_distance_related_prolly_lod = 0; | |
6222 a1.uFacing = 0; | |
6223 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6224 a1.uSoundID = LOWORD(v3->sound_id); | |
6225 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
6226 { | |
6227 v433 = &pActors[dword_50BF30[a2]]; | |
6228 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6229 break; | |
6230 a1.vPosition.x = v433->vPosition.x; | |
6231 a1.vPosition.y = v433->vPosition.y; | |
6232 a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6233 | |
6234 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6235 a1.Create(0, 0, 0, 0); | |
6236 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
6237 { | |
6238 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6239 v731, 0, 0, 0); | |
6240 } | |
6241 } | |
6242 LODWORD(v727) = 1; | |
6243 goto play_sound_and_continue; | |
6244 } | |
6245 | |
6246 case 64: | |
6247 v435 = v731 - 2; | |
6248 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6249 amount = 0; | |
6250 else | |
6251 amount = 86400 * v2; | |
6252 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6253 goto play_sound_and_continue; | |
6254 | |
6255 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6256 v440 = v3->uPlayerID_2; | |
6257 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
6258 { | |
6259 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6260 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6261 if ( v731 == 4 ) | |
6262 { | |
6263 v441 = v3->uPlayerID_2; | |
6264 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
6265 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
6266 } | |
6267 else | |
6268 { | |
6269 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
6270 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
6271 } | |
6272 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6273 LABEL_720: | |
6274 v377->SetCondition(1, 0); | |
6275 } | |
6276 LODWORD(v727) = 1; | |
6277 goto play_sound_and_continue; | |
6278 | |
6279 case 42: | |
6280 v442 = v731 - 2; | |
6281 if ( !v442 ) | |
6282 goto LABEL_855; | |
6283 v443 = v442 - 1; | |
6284 if ( v443 ) | |
6285 { | |
6286 if ( v443 == 1 ) | |
6287 v444 = 4 * v2; | |
6288 else | |
6289 LABEL_855: | |
6290 v444 = 2 * v2; | |
6291 } | |
6292 else | |
6293 { | |
6294 v444 = 3 * v2; | |
6295 } | |
6296 amount = v444; | |
6297 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6298 goto play_sound_and_continue; | |
6299 v445 = PID_ID(a2); | |
6300 if (PID_TYPE(a2) == OBJECT_Item) | |
6301 { | |
6302 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6303 v450 = *(int *)v449; | |
6304 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6305 { | |
6306 party_finds_gold(*((int *)v449 + 3), 0); | |
6307 viewparams->bRedrawGameUI = 1; | |
6308 } | |
6309 else | |
6310 { | |
6311 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); | |
6312 ShowStatusBarString(pTmpBuf2, 2u); | |
6313 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6314 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6315 } | |
6316 SpriteObject::OnInteraction(v445); | |
6317 } | |
6318 else | |
6319 { | |
6320 if (PID_TYPE(a2) == OBJECT_Actor) | |
6321 { | |
6322 stru_50C198.LootActor(&pActors[v445]); | |
6323 } | |
6324 else | |
6325 { | |
6326 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6327 { | |
6328 if (PID_TYPE(a2) != OBJECT_BModel) | |
6329 { | |
6330 LODWORD(v727) = 1; | |
6331 goto play_sound_and_continue; | |
6332 } | |
6333 dword_507CD8 = 1; | |
6334 v677 = 1; | |
6335 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6336 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6337 else | |
6338 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6339 | |
6340 EventProcessor(v446, a2, v677); | |
6341 LODWORD(v727) = 1; | |
6342 goto play_sound_and_continue; | |
6343 } | |
6344 v447 = &pLevelDecorations[v445]; | |
6345 dword_507CD8 = 1; | |
6346 v448 = v447->field_16_event_id; | |
6347 if (v448) | |
6348 { | |
6349 v677 = 1; | |
6350 v446 = v448; | |
6351 EventProcessor(v446, a2, v677); | |
6352 LODWORD(v727) = 1; | |
6353 goto play_sound_and_continue; | |
6354 } | |
6355 if ( v447->IsInteractive() ) | |
6356 { | |
6357 activeLevelDecoration = v447; | |
6358 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6359 activeLevelDecoration = NULL; | |
6360 } | |
6361 } | |
6362 } | |
6363 LODWORD(v727) = 1; | |
6364 goto play_sound_and_continue; | |
6365 | |
6366 case 67: | |
6367 v451 = v731 - 2; | |
6368 if ( v451 ) | |
6369 { | |
6370 v452 = v451 - 1; | |
6371 if ( v452 ) | |
6372 { | |
6373 if ( v452 == 1 ) | |
6374 { | |
6375 amount = 0; | |
6376 goto LABEL_883; | |
6377 } | |
6378 v453 = 180 * v2; | |
6379 } | |
6380 else | |
6381 { | |
6382 v453 = 86400 * v2; | |
6383 } | |
6384 } | |
6385 else | |
6386 { | |
6387 v453 = 3600 * v2; | |
6388 } | |
6389 amount = v453; | |
6390 LABEL_883: | |
6391 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6392 goto play_sound_and_continue; | |
6393 | |
6394 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6395 v323 = v3->uPlayerID_2; | |
6396 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
6397 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6398 { | |
6399 LODWORD(v727) = 1; | |
6400 goto play_sound_and_continue; | |
6401 } | |
6402 if ( v731 == 4 ) | |
6403 { | |
6404 *(int *)v324 = 0; | |
6405 *((int *)v324 + 1) = 0; | |
6406 LODWORD(v727) = 1; | |
6407 goto play_sound_and_continue; | |
6408 } | |
6409 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6410 v656 = 1; | |
6411 LABEL_640: | |
6412 v325 = &pParty->pPlayers[v323]; | |
6413 goto LABEL_641; | |
6414 | |
6415 case 68: | |
6416 v457 = v731 - 2; | |
6417 if ( v457 ) | |
6418 { | |
6419 v458 = v457 - 1; | |
6420 if ( v458 ) | |
6421 { | |
6422 if ( v458 == 1 ) | |
6423 v459 = 5 * v2 + 5; | |
6424 else | |
6425 v459 = 2 * v2 + 5; | |
6426 } | |
6427 else | |
6428 { | |
6429 v459 = 4 * v2 + 5; | |
6430 } | |
6431 } | |
6432 else | |
6433 { | |
6434 v459 = 3 * v2 + 5; | |
6435 } | |
6436 amount = v459; | |
6437 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6438 goto play_sound_and_continue; | |
6439 v460 = v3->spell_target_pid; | |
6440 if (!v460) | |
6441 { | |
6442 pParty->pPlayers[v3->uPlayerID_2].Heal(amount); | |
6443 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6444 } | |
6445 else | |
6446 { | |
6447 if (PID_TYPE(v460) == OBJECT_Actor) | |
6448 { | |
6449 v461 = &pActors[PID_ID(v460)]; | |
6450 v462 = v461->uAIState; | |
6451 v463 = v461->pMonsterInfo.uHP; | |
6452 if ( v462 != 5 ) | |
6453 { | |
6454 if ( v462 != 4 ) | |
6455 { | |
6456 if ( v462 != 19 ) | |
6457 { | |
6458 if ( v462 != 11 ) | |
6459 { | |
6460 v461->sCurrentHP += amount; | |
6461 if ( v461->sCurrentHP > v463 ) | |
6462 v461->sCurrentHP = v463; | |
6463 } | |
6464 } | |
6465 } | |
6466 } | |
6467 } | |
6468 } | |
6469 LODWORD(v727) = 1; | |
6470 goto play_sound_and_continue; | |
6471 | |
6472 case 72: | |
6473 v464 = v731 - 2; | |
6474 if ( !v464 ) | |
6475 goto LABEL_910; | |
6476 v465 = v464 - 1; | |
6477 if ( v465 ) | |
6478 { | |
6479 if ( v465 == 1 ) | |
6480 { | |
6481 amount = 0; | |
6482 goto LABEL_912; | |
6483 } | |
6484 LABEL_910: | |
6485 v466 = 3600 * v2; | |
6486 } | |
6487 else | |
6488 { | |
6489 v466 = 86400 * v2; | |
6490 } | |
6491 amount = v466; | |
6492 LABEL_912: | |
6493 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6494 goto play_sound_and_continue; | |
6495 | |
6496 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6497 v470 = v3->uPlayerID_2; | |
6498 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
6499 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6500 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6501 { | |
6502 LODWORD(v727) = 1; | |
6503 goto play_sound_and_continue; | |
6504 } | |
6505 if ( v731 == 4 ) | |
6506 { | |
6507 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6508 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6509 v471 = v3->uPlayerID_2; | |
6510 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
6511 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
6512 v472 = v3->uPlayerID_2; | |
6513 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6514 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6515 LODWORD(v727) = 1; | |
6516 goto play_sound_and_continue; | |
6517 } | |
6518 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6519 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6520 6u, | |
6521 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6522 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6523 8u, | |
6524 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6525 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6526 v656 = 10; | |
6527 goto LABEL_937; | |
6528 | |
6529 | |
6530 case 75: | |
6531 amount = v2; | |
6532 LODWORD(v733) = 3600 * v2; | |
6533 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6534 goto play_sound_and_continue; | |
6535 | |
6536 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6537 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6538 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6539 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6540 | |
6541 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6542 LODWORD(v727) = 1; | |
6543 goto play_sound_and_continue; | |
6544 | |
6545 case 73: | |
6546 LODWORD(v733) = 3600 * v2; | |
6547 amount = v2; | |
6548 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6549 goto play_sound_and_continue; | |
6550 if ( v731 == 4 ) | |
6551 { | |
6552 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6553 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6554 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6555 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6556 v732 = (int)v733 << 7; | |
6557 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6558 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6559 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6560 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6561 | |
6562 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6563 LODWORD(v727) = 1; | |
6564 goto play_sound_and_continue; | |
6565 } | |
6566 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6567 | |
6568 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | |
6569 LODWORD(v727) = 1; | |
6570 goto play_sound_and_continue; | |
6571 | |
6572 case 74: | |
6573 v493 = v731 - 2; | |
6574 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6575 amount = 0; | |
6576 else | |
6577 amount = 86400 * v2; | |
6578 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6579 goto play_sound_and_continue; | |
6580 | |
6581 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6582 v498 = v3->uPlayerID_2; | |
6583 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
6584 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6585 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6586 { | |
6587 LODWORD(v727) = 1; | |
6588 goto play_sound_and_continue; | |
6589 } | |
6590 if ( v731 == 4 ) | |
6591 { | |
6592 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6593 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6594 v499 = v3->uPlayerID_2; | |
6595 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
6596 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
6597 v500 = v3->uPlayerID_2; | |
6598 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6599 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6600 } | |
6601 else | |
6602 { | |
6603 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6604 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6605 7u, | |
6606 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6607 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6608 9u, | |
6609 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6610 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6611 v656 = 11; | |
6612 LABEL_937: | |
6613 v325 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6614 LABEL_641: | |
6615 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6616 } | |
6617 LODWORD(v727) = 1; | |
6618 goto play_sound_and_continue; | |
6619 | |
6620 case 77: | |
6621 { | |
6622 amount = 5 * v2 + 10; | |
6623 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6624 goto play_sound_and_continue; | |
6625 v501 = pParty->pPlayers; | |
6626 int v1 = 0; | |
6627 do | |
6628 { | |
6629 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); | |
6630 v501->Heal(amount); | |
6631 ++v501; | |
6632 ++v1; | |
6633 } | |
6634 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6635 LODWORD(v727) = 1; | |
6636 goto play_sound_and_continue; | |
6637 } | |
6638 case 80: | |
6639 sRecoveryTime -= v2; | |
6640 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6641 goto play_sound_and_continue; | |
6642 | |
6643 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6644 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6645 ++a1.uType; | |
6646 HIDWORD(v733) = v505; | |
6647 v688.x = 0; | |
6648 v688.y = 0; | |
6649 v688.z = 0; | |
6650 a1.stru_24.Reset(); | |
6651 a1.spell_id = v3->spellnum; | |
6652 a1.spell_level = v2; | |
6653 a1.spell_skill = v731; | |
6654 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6655 a1.uAttributes = 0; | |
6656 a1.uSectorID = 0; | |
6657 a1.uSpriteFrameID = 0; | |
6658 a1.field_60_distance_related_prolly_lod = 0; | |
6659 a1.uFacing = 0; | |
6660 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6661 a1.uSoundID = LOWORD(v3->sound_id); | |
6662 a2 = 0; | |
6663 if ( SHIDWORD(v733) > 0 ) | |
6664 { | |
6665 do | |
6666 { | |
6667 v507 = dword_50BF30[a2]; | |
6668 a1.vPosition.x = pActors[v507].vPosition.x; | |
6669 a1.vPosition.y = pActors[v507].vPosition.y; | |
6670 a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6671 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6672 v509 = a1.Create(0, 0, 0, 0); | |
6673 v510 = a2; | |
6674 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6675 a2 = v510 + 1; | |
6676 } | |
6677 while ( v510 + 1 < SHIDWORD(v733) ); | |
6678 } | |
6679 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6680 { | |
6681 v511 = &pActors[dword_50BF30[a2]]; | |
6682 a1.vPosition.x = v511->vPosition.x; | |
6683 a1.vPosition.y = v511->vPosition.y; | |
6684 a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6685 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6686 a1.Create(0, 0, 0, 0); | |
6687 v513 = v511->pActorBuffs; | |
6688 for (int _v726 = 22; _v726 != 0; --_v726) | |
6689 { | |
6690 v513->Reset(); | |
6691 ++v513; | |
6692 } | |
6693 } | |
6694 LODWORD(v727) = 1; | |
6695 goto play_sound_and_continue; | |
6696 | |
6697 case 82: | |
6698 v514 = v731 - 2; | |
6699 if ( !v514 ) | |
6700 goto LABEL_955; | |
6701 v515 = v514 - 1; | |
6702 if ( v515 ) | |
6703 { | |
6704 if ( v515 == 1 ) | |
6705 { | |
6706 v516 = 900 * v2; | |
6707 amount = 5; | |
6708 } | |
6709 else | |
6710 { | |
6711 LABEL_955: | |
6712 v516 = 300 * v2; | |
6713 amount = 1; | |
6714 } | |
6715 } | |
6716 else | |
6717 { | |
6718 v516 = 900 * v2; | |
6719 amount = 3; | |
6720 } | |
6721 v733 = __PAIR__(0, v516); | |
6722 | |
6723 if ( (signed int)uNumActors > 0 ) | |
6724 { | |
6725 v518 = pActors;//[0].uAIState; | |
6726 auto _v726 = uNumActors; | |
6727 do | |
6728 { | |
6729 v519 = v518->uAIState; | |
6730 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) | |
6731 ++HIDWORD(v733); | |
6732 ++v518; | |
6733 --_v726; | |
6734 } | |
6735 while ( _v726 != 0 ); | |
6736 } | |
6737 if ( SHIDWORD(v733) >= amount ) | |
6738 { | |
6739 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6740 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6741 v3->spellnum = 0; | |
6742 continue; | |
6743 } | |
6744 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6745 goto play_sound_and_continue; | |
6746 sub_44FA4C_spawn_light_elemental(v3->uPlayerID, v731, v733); | |
6747 LODWORD(v727) = 1; | |
6748 goto play_sound_and_continue; | |
6749 | |
6750 case 83: | |
6751 v520 = v731 - 2; | |
6752 if ( !v520 ) | |
6753 goto LABEL_973; | |
6754 v521 = v520 - 1; | |
6755 if ( v521 ) | |
6756 { | |
6757 if ( v521 == 1 ) | |
6758 { | |
6759 LODWORD(v733) = 18000 * v2; | |
6760 v522 = 5 * v2 + 10; | |
6761 } | |
6762 else | |
6763 { | |
6764 LABEL_973: | |
6765 LODWORD(v733) = 10800 * v2; | |
6766 v522 = 3 * v2 + 10; | |
6767 } | |
6768 } | |
6769 else | |
6770 { | |
6771 LODWORD(v733) = 14400 * v2; | |
6772 v522 = 4 * v2 + 10; | |
6773 } | |
6774 amount = v522; | |
6775 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6776 goto play_sound_and_continue; | |
6777 | |
6778 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6779 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6780 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6781 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6782 | |
6783 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6784 LODWORD(v727) = 1; | |
6785 goto play_sound_and_continue; | |
6786 | |
6787 case 84: | |
6788 //v67 = 2; | |
6789 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6790 { | |
6791 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6792 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6793 v3->spellnum = 0; | |
6794 continue; | |
6795 } | |
6796 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6797 goto play_sound_and_continue; | |
6798 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6799 ++a1.uType; | |
6800 v694.x = 0; | |
6801 v694.y = 0; | |
6802 v694.z = 0; | |
6803 a1.stru_24.Reset(); | |
6804 a1.spell_id = v3->spellnum; | |
6805 a1.spell_level = v2; | |
6806 a1.spell_skill = v731; | |
6807 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6808 a1.uAttributes = 0; | |
6809 a1.uSectorID = 0; | |
6810 a1.uSpriteFrameID = 0; | |
6811 a1.field_60_distance_related_prolly_lod = 0; | |
6812 a1.uFacing = 0; | |
6813 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6814 a1.uSoundID = LOWORD(v3->sound_id); | |
6815 a2 = 0; | |
6816 if ( (signed int)v531 > 0 ) | |
6817 { | |
6818 do | |
6819 { | |
6820 v533 = dword_50BF30[a2]; | |
6821 a1.vPosition.x = pActors[v533].vPosition.x; | |
6822 a1.vPosition.y = pActors[v533].vPosition.y; | |
6823 a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6824 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6825 v535 = a1.Create(0, 0, 0, 0); | |
6826 v536 = a2; | |
6827 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6828 a2 = v536 + 1; | |
6829 } | |
6830 while ( v536 + 1 < (signed int)v531 ); | |
6831 } | |
6832 v537 = pGame->GetStru6(); | |
6833 pGame->GetStru6()->_4A8BFC(); | |
6834 LODWORD(v727) = 1; | |
6835 goto play_sound_and_continue; | |
6836 | |
6837 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6838 { | |
6839 v538 = v731 - 2; | |
6840 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6841 { | |
6842 amount = 5 * v2; | |
6843 v540 = 18000 * v2; | |
6844 } | |
6845 else | |
6846 { | |
6847 amount = 4 * v2; | |
6848 v540 = 14400 * v2; | |
6849 } | |
6850 v730 = v540; | |
6851 LODWORD(v733) = v540; | |
6852 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6853 goto play_sound_and_continue; | |
6854 | |
6855 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6856 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6857 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6858 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6859 | |
6860 v732 = v730 << 7; | |
6861 v549 = (double)(v730 << 7) * 0.033333335; | |
6862 *((float *)&v733 + 1) = v549; | |
6863 v712 = (signed __int64)v549; | |
6864 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6865 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6866 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6867 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6868 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6869 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6870 v550 = v2 + 5; | |
6871 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6872 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6873 v731, | |
6874 v550, 0, 0); | |
6875 | |
6876 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6877 LODWORD(v727) = 1; | |
6878 goto play_sound_and_continue; | |
6879 } | |
6880 | |
6881 case 86: | |
6882 { | |
6883 v551 = v731 - 2; | |
6884 if ( !v551 ) | |
6885 goto LABEL_998; | |
6886 v552 = v551 - 1; | |
6887 if ( v552 ) | |
6888 { | |
6889 if ( v552 == 1 ) | |
6890 { | |
6891 amount = 15; | |
6892 HIDWORD(v733) = 20; | |
6893 goto LABEL_1000; | |
6894 } | |
6895 LABEL_998: | |
6896 v678 = 4; | |
6897 } | |
6898 else | |
6899 { | |
6900 v678 = 12; | |
6901 } | |
6902 amount = v678; | |
6903 HIDWORD(v733) = v678; | |
6904 LABEL_1000: | |
6905 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6906 goto play_sound_and_continue; | |
6907 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6908 v732 = (300 * amount * v2 + 60) << 7; | |
6909 v730 = v2 + 5; | |
6910 int _v726 = 0; | |
6911 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6912 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6913 do | |
6914 { | |
6915 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6916 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6917 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6918 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6919 | |
6920 //((SpellBuff *)(v553 + 6056))->Apply( | |
6921 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6922 if ( *(_QWORD *)v553 ) | |
6923 _v726 = 1; | |
6924 ++v553; | |
6925 } | |
6926 while ( v553 <= &pParty->pPlayers[3] ); | |
6927 v562 = v731; | |
6928 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6929 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6930 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6931 if (!_v726) | |
6932 { | |
6933 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0); | |
6934 } | |
6935 LODWORD(v727) = 1; | |
6936 goto play_sound_and_continue; | |
6937 } | |
6938 | |
6939 | |
6940 case 88: | |
6941 amount = 3; | |
6942 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6943 { | |
6944 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6945 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6946 v3->spellnum = 0; | |
6947 continue; | |
6948 } | |
6949 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6950 goto play_sound_and_continue; | |
6951 a2 = 0; | |
6952 _this = (ItemGen *)&pPlayers[1]; | |
6953 do | |
6954 { | |
6955 v563 = 0; | |
6956 do | |
6957 { | |
6958 v564 = _this->uItemID; | |
6959 *(int *)(v563 + _this->uItemID) = 0; | |
6960 v563 += 8; | |
6961 *(int *)(v563 + v564 - 4) = 0; | |
6962 } | |
6963 while ( v563 <= 128 ); | |
6964 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6965 v566 = (Player **)_this; | |
6966 *(int *)(_this->uItemID + 6460) = v565; | |
6967 v567 = (*v566)->GetMaxMana(); | |
6968 *(int *)(_this->uItemID + 6464) = v567; | |
6969 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
6970 ++a2; | |
6971 _this = (ItemGen *)((char *)_this + 4); | |
6972 } | |
6973 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6974 v571 = pPlayer; | |
6975 v572 = (char *)&pPlayer->sAgeModifier; | |
6976 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6977 *(short *)v572 = 120; | |
6978 else | |
6979 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6980 sRecoveryTime += -5 * v2; | |
6981 ++v571->uNumDivineInterventionCastsThisDay; | |
6982 LODWORD(v727) = 1; | |
6983 goto play_sound_and_continue; | |
6984 | |
6985 case 89: | |
6986 v573 = v731 - 2; | |
6987 if ( v573 ) | |
6988 { | |
6989 v574 = v573 - 1; | |
6990 if ( v574 ) | |
6991 { | |
6992 if ( v574 == 1 ) | |
6993 v575 = 5 * v2; | |
6994 else | |
6995 v575 = 2 * v2; | |
6996 } | |
6997 else | |
6998 { | |
6999 v575 = 4 * v2; | |
7000 } | |
7001 } | |
7002 else | |
7003 { | |
7004 v575 = 3 * v2; | |
7005 } | |
7006 amount = v575; | |
7007 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7008 goto play_sound_and_continue; | |
7009 v576 = v3->spell_target_pid; | |
7010 if (!v576) | |
7011 { | |
7012 v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
7013 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
7014 if ( *((_QWORD *)v585 + 14) ) | |
7015 { | |
7016 ((Player *)v585)->SetCondition(0x11u, 1); | |
7017 v587 = ((Player *)v585)->GetSexByVoice(); | |
7018 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); | |
7019 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
7020 } | |
7021 goto play_sound_and_continue; | |
7022 } | |
7023 v577 = (Player *)(PID_ID(v576)); | |
7024 //v726 = v577; | |
7025 if ( v577 == (Player *)-1 ) | |
7026 { | |
7027 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7028 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7029 v3->spellnum = 0; | |
7030 continue; | |
7031 } | |
7032 v578 = (int)&pActors[(int)v577]; | |
7033 v721 = v578; | |
7034 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7035 { | |
7036 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7037 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7038 v3->spellnum = 0; | |
7039 continue; | |
7040 } | |
7041 ++a1.uType; | |
7042 a1.stru_24.Reset(); | |
7043 a1.spell_id = v3->spellnum; | |
7044 a1.spell_level = v2; | |
7045 a1.spell_skill = v731; | |
7046 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7047 a1.uAttributes = 0; | |
7048 a1.uSectorID = 0; | |
7049 a1.uSpriteFrameID = 0; | |
7050 a1.field_60_distance_related_prolly_lod = 0; | |
7051 v581 = v721; | |
7052 a1.uFacing = 0; | |
7053 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7054 a1.uSoundID = LOWORD(v3->sound_id); | |
7055 a1.vPosition.x = *(short *)(v721 + 142); | |
7056 a1.vPosition.y = *(short *)(v721 + 144); | |
7057 v732 = *(short *)(v721 + 138); | |
7058 a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
7059 a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7060 a1.Create(0, 0, 0, 0); | |
7061 if ( *(char *)(v581 + 52) > amount ) | |
7062 goto play_sound_and_continue; | |
7063 Actor::Resurrect((unsigned int)v577); | |
7064 *(char *)(v581 + 61) = 0; | |
7065 *(char *)(v581 + 53) = 0; | |
7066 *(char *)(v581 + 54) = 0; | |
7067 *(char *)(v581 + 55) = 0; | |
7068 *(char *)(v581 + 56) = 0; | |
7069 *(char *)(v581 + 57) = 0; | |
7070 *(int *)(v581 + 712) = 9999; | |
7071 *(char *)(v581 + 38) &= 0xF7u; | |
7072 *(int *)(v581 + 708) = 0; | |
7073 ((SpellBuff *)(v581 + 356))->Reset(); | |
7074 ((SpellBuff *)(v581 + 228))->Reset(); | |
7075 ((SpellBuff *)(v581 + 404))->Reset(); | |
7076 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7077 *(short *)(v581 + 40) = 10 * amount; | |
7078 LODWORD(v727) = 1; | |
7079 goto play_sound_and_continue; | |
7080 | |
7081 case 91: | |
7082 v588 = v731 - 1; | |
7083 amount = 16; | |
7084 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7085 { | |
7086 if ( v590 == 1 ) | |
7087 LODWORD(v733) = 0; | |
7088 } | |
7089 else | |
7090 { | |
7091 LODWORD(v733) = 3600 * v2; | |
7092 } | |
7093 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7094 goto play_sound_and_continue; | |
7095 __debugbreak(); | |
7096 HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; | |
7097 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; | |
7098 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7099 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7100 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7101 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7102 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7103 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7104 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7105 { | |
7106 dword_50C9D0 = 113; | |
7107 dword_50C9D4 = 0; | |
7108 dword_50C9D8 = 1; | |
7109 | |
7110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7111 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7112 v3->spellnum = 0; | |
7113 continue; | |
7114 } | |
7115 v592 = HIDWORD(v733); | |
7116 v14 = v731 == 4; | |
7117 *(int *)(HIDWORD(v733) + 12) = 16; | |
7118 if ( !v14 ) | |
7119 { | |
7120 v732 = (int)v733 << 7; | |
7121 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7122 *(int *)(v592 + 20) |= 8u; | |
7123 } | |
7124 *(char *)(v592 + 20) |= 0x80u; | |
7125 dword_50C9A8 = 256; | |
7126 LODWORD(v727) = 1; | |
7127 goto play_sound_and_continue; | |
7128 | |
7129 case 93: | |
7130 { | |
7131 v593 = v731 - 2; | |
7132 if ( !v593 ) | |
7133 goto LABEL_1062; | |
7134 v594 = v593 - 1; | |
7135 if ( v594 ) | |
7136 { | |
7137 if ( v594 == 1 ) | |
7138 amount = 9; | |
7139 else | |
7140 LABEL_1062: | |
7141 amount = 5; | |
7142 } | |
7143 else | |
7144 { | |
7145 amount = 7; | |
7146 } | |
7147 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7148 goto play_sound_and_continue; | |
7149 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
7150 a1.stru_24.Reset(); | |
7151 a1.spell_id = v3->spellnum; | |
7152 a1.spell_level = v2; | |
7153 a1.spell_skill = v731; | |
7154 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7155 a1.vPosition.x = pParty->vPosition.x; | |
7156 a1.vPosition.y = pParty->vPosition.y; | |
7157 a1.uAttributes = 0; | |
7158 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7159 a1.uSectorID = pIndoor->GetSector( | |
7160 pParty->vPosition.x, | |
7161 pParty->vPosition.y, | |
7162 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
7163 a1.uSpriteFrameID = 0; | |
7164 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7165 a1.spell_target_pid = a2; | |
7166 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7167 a1.uSoundID = LOWORD(v3->sound_id); | |
7168 if ( pParty->bTurnBasedModeOn == 1 ) | |
7169 LOBYTE(a1.uAttributes) |= 4u; | |
7170 v596 = (signed int)_v726 / -2; | |
7171 y = (char *)((signed int)_v726 / 2); | |
7172 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7173 { | |
7174 v597 = v715.uYawAngle; | |
7175 do | |
7176 { | |
7177 a1.uFacing = v596 + v597; | |
7178 if ( a1.Create( | |
7179 v596 + v597, | |
7180 v715.uPitchAngle, | |
7181 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
7182 v3->uPlayerID + 1) != -1 | |
7183 && pParty->bTurnBasedModeOn == 1 ) | |
7184 ++pTurnEngine->field_1C; | |
7185 v596 += _v726 / (amount - 1); | |
7186 } | |
7187 while ( v596 <= (signed int)y ); | |
7188 } | |
7189 LODWORD(v727) = 1; | |
7190 goto play_sound_and_continue; | |
7191 } | |
7192 | |
7193 case 94: | |
7194 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7195 goto play_sound_and_continue; | |
7196 if ( v731 == 1 || v731 == 2 ) | |
7197 { | |
7198 v598 = 180 * v2; | |
7199 goto LABEL_1081; | |
7200 } | |
7201 if ( v731 == 3 ) | |
7202 { | |
7203 v598 = 300 * v2; | |
7204 LABEL_1081: | |
7205 LODWORD(v733) = v598; | |
7206 goto LABEL_1082; | |
7207 } | |
7208 if ( v731 == 4 ) | |
7209 LODWORD(v733) = 29030400; | |
7210 LABEL_1082: | |
7211 if (PID_TYPE(a2) != OBJECT_Actor) | |
7212 { | |
7213 LODWORD(v727) = 1; | |
7214 goto play_sound_and_continue; | |
7215 } | |
7216 v730 = 836 * PID_ID(a2); | |
7217 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7218 goto play_sound_and_continue; | |
7219 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7220 { | |
7221 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7222 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7223 v3->spellnum = 0; | |
7224 continue; | |
7225 } | |
7226 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7227 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7228 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7229 v731, 0, 0, 0); | |
7230 a1.stru_24.Reset(); | |
7231 a1.spell_id = v3->spellnum; | |
7232 a1.spell_level = v2; | |
7233 a1.spell_skill = v731; | |
7234 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
7235 v61 = PID_ID(a2); | |
7236 LABEL_1086: | |
7237 v600 = pActors[v61].vPosition.y; | |
7238 v601 = pActors[v61].vPosition.x; | |
7239 a1.uObjectDescID = v60; | |
7240 a1.vPosition.x = v601; | |
7241 v602 = pActors[v61].uActorHeight; | |
7242 v603 = pActors[v61].vPosition.z; | |
7243 a1.vPosition.y = v600; | |
7244 v676 = v603 + v602; | |
7245 v665 = v600; | |
7246 a1.vPosition.z = v603 + v602; | |
7247 v657 = v601; | |
7248 LABEL_1087: | |
7249 a1.uAttributes = 0; | |
7250 a1.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7251 a1.uSpriteFrameID = 0; | |
7252 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7253 a1.spell_target_pid = a2; | |
7254 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7255 a1.uFacing = LOWORD(v715.uYawAngle); | |
7256 LOBYTE(a1.uAttributes) |= 0x80u; | |
7257 a1.uSoundID = LOWORD(v3->sound_id); | |
7258 a1.Create(0, 0, 0, v3->uPlayerID + 1); | |
7259 LODWORD(v727) = 1; | |
7260 goto play_sound_and_continue; | |
7261 | |
7262 case 96: | |
7263 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7264 goto play_sound_and_continue; | |
7265 HIDWORD(v733) = 0; | |
7266 memset(&achievedAwardsIndex, 0, 4000); | |
7267 _this = 0; | |
7268 v605 = (char *)pParty->pHirelings; | |
7269 do | |
7270 { | |
7271 if ( *(int *)v605) | |
7272 { | |
7273 v606 = HIDWORD(v733)++; | |
7274 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); | |
7275 } | |
7276 _this = (ItemGen *)((char *)_this + 1); | |
7277 v605 += 76; | |
7278 } | |
7279 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7280 _this = 0; | |
7281 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7282 { | |
7283 v730 = (int)pNPCStats->pNewNPCData; | |
7284 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7285 do | |
7286 { | |
7287 if ( *(char *)(v730 + 8) & 0x80 | |
7288 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7289 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7290 { | |
7291 v607 = HIDWORD(v733); | |
7292 HIDWORD(v733) += 4; | |
7293 *(int *)v607 = (int)_this + 3; | |
7294 } | |
7295 _this = (ItemGen *)((char *)_this + 1); | |
7296 v730 += 76; | |
7297 } | |
7298 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7299 } | |
7300 v608 = v3->uPlayerID_2; | |
7301 if ( v608 != 4 && v608 != 5 | |
7302 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7303 || v609 >= 3 ) | |
7304 { | |
7305 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7306 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7307 v3->spellnum = 0; | |
7308 continue; | |
7309 } | |
7310 v610 = 76 * v609; | |
7311 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7312 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7313 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7314 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7315 v612 = pParty->pPlayers; | |
7316 do | |
7317 { | |
7318 v612->sHealth = v612->GetMaxHealth(); | |
7319 v612->sMana = v612->GetMaxMana(); | |
7320 ++v612; | |
7321 } | |
7322 while ( v612 <= &pParty->pPlayers[3] ); | |
7323 v613 = &pOutdoor->ddm; | |
7324 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7325 v613 = &pIndoor->dlv; | |
7326 v613->uReputation += 15; | |
7327 if ( v613->uReputation > 10000 ) | |
7328 v613->uReputation = 10000; | |
7329 LODWORD(v727) = 1; | |
7330 goto play_sound_and_continue; | |
7331 case 95: | |
7332 if ( v731 <= 0 ) | |
7333 goto LABEL_1119; | |
7334 if ( v731 <= 3 ) | |
7335 { | |
7336 v614 = 300 * (v2 + 12); | |
7337 } | |
7338 else | |
7339 { | |
7340 if ( v731 != 4 ) | |
7341 goto LABEL_1119; | |
7342 v614 = 900 * (v2 + 4); | |
7343 } | |
7344 LODWORD(v733) = v614; | |
7345 LABEL_1119: | |
7346 v615 = v2 + 5; | |
7347 amount = v615; | |
7348 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7349 goto play_sound_and_continue; | |
7350 if ( v731 != 3 && v731 != 4 ) | |
7351 { | |
7352 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
7353 | |
7354 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); | |
7355 LODWORD(v727) = 1; | |
7356 goto play_sound_and_continue; | |
7357 } | |
7358 a2 = 0; | |
7359 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7360 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7361 do | |
7362 { | |
7363 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
7364 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
7365 ++a2; | |
7366 ++v619; | |
7367 } | |
7368 while ( v619 <= &pParty->pPlayers[3] ); | |
7369 LODWORD(v727) = 1; | |
7370 goto play_sound_and_continue; | |
7371 | |
7372 case 99: | |
7373 { | |
7374 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7375 goto play_sound_and_continue; | |
7376 pGame->GetIndoorCamera(); | |
7377 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7378 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7379 v707.x = 0; | |
7380 v707.y = 0; | |
7381 v707.z = 0; | |
7382 a1.stru_24.Reset(); | |
7383 a1.spell_id = v3->spellnum; | |
7384 a1.spell_level = v2; | |
7385 a1.spell_skill = v731; | |
7386 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7387 a1.uAttributes = 0; | |
7388 a1.uSectorID = 0; | |
7389 a1.uSpriteFrameID = 0; | |
7390 a1.field_60_distance_related_prolly_lod = 0; | |
7391 a1.uFacing = 0; | |
7392 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7393 a1.uSoundID = LOWORD(v3->sound_id); | |
7394 a2 = 0; | |
7395 int _v726 = 0; | |
7396 if ( SHIDWORD(v733) > 0 ) | |
7397 { | |
7398 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
7399 do | |
7400 { | |
7401 v625 = dword_50BF30[a2]; | |
7402 a1.vPosition.x = pActors[v625].vPosition.x; | |
7403 a1.vPosition.y = pActors[v625].vPosition.y; | |
7404 //v732 = pActors[v625].uActorHeight; | |
7405 a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
7406 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7407 v627 = a1.Create(0, 0, 0, 0); | |
7408 v628 = a2; | |
7409 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7410 a2 = v628 + 1; | |
7411 } | |
7412 while ( v628 + 1 < SHIDWORD(v733) ); | |
7413 } | |
7414 v730 = 0; | |
7415 v629 = 1; | |
7416 do | |
7417 { | |
7418 v630 = pPlayers[v629]; | |
7419 if ( !v630->pConditions[2] | |
7420 && !v630->pConditions[12] | |
7421 && !v630->pConditions[13] | |
7422 && !v630->pConditions[14] | |
7423 && !v630->pConditions[15] | |
7424 && !v630->pConditions[16] ) | |
7425 { | |
7426 v631 = v730++; | |
7427 v681[v631] = v629; | |
7428 } | |
7429 ++v629; | |
7430 } | |
7431 while ( v629 <= 4 ); | |
7432 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7433 HIDWORD(v733) = 0; | |
7434 if ( v730 > 0 ) | |
7435 { | |
7436 do | |
7437 { | |
7438 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7439 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7440 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7441 v726->sHealth += v732; | |
7442 //v726 = *(Player **)v632; | |
7443 //v634 = v726->GetMaxHealth(); | |
7444 if ( v726->sHealth > v726->GetMaxHealth()) | |
7445 v726->sHealth = v726->GetMaxHealth(); | |
7446 v635 = HIDWORD(v733); | |
7447 | |
7448 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); | |
7449 HIDWORD(v733) = v635 + 1; | |
7450 } | |
7451 while ( v635 + 1 < v730 ); | |
7452 } | |
7453 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7454 LODWORD(v727) = 1; | |
7455 goto play_sound_and_continue; | |
7456 } | |
7457 | |
7458 case 98: | |
7459 { | |
7460 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7461 { | |
7462 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7463 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7464 v3->spellnum = 0; | |
7465 continue; | |
7466 } | |
7467 v640 = v731 - 2; | |
7468 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7469 amount = 3; | |
7470 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7471 { | |
7472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7474 v3->spellnum = 0; | |
7475 continue; | |
7476 } | |
7477 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7478 goto play_sound_and_continue; | |
7479 pParty->armageddon_timer = 256; | |
7480 pParty->field_16140 = v2; | |
7481 ++pPlayer->uNumArmageddonCasts; | |
7482 if ( pParty->bTurnBasedModeOn == 1 ) | |
7483 ++pTurnEngine->field_1C; | |
7484 auto _v726 = 50; | |
7485 do | |
7486 { | |
7487 v642 = rand() % 4096 - 2048; | |
7488 v643 = rand(); | |
7489 v721 = v642 + pParty->vPosition.x; | |
7490 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7491 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7492 v644 = rand(); | |
7493 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7494 --_v726; | |
7495 } | |
7496 while ( _v726 != 0 ); | |
7497 LODWORD(v727) = 1; | |
7498 goto play_sound_and_continue; | |
7499 } | |
7500 | |
7501 default: | |
7502 goto play_sound_and_continue; | |
7503 } | |
7504 while ( 2 ) | |
7505 { | |
7506 if ( v731 == 4 ) | |
7507 { | |
7508 if ( *((_QWORD *)v222 + 2) ) | |
7509 { | |
7510 *((int *)v222 + 4) = 0; | |
7511 *((int *)v222 + 5) = 0; | |
7512 goto LABEL_439; | |
7513 } | |
7514 } | |
7515 else | |
7516 { | |
7517 v223 = ((Player *)v222)->DiscardConditionIfLastsLongerThan( | |
7518 2u, | |
7519 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
7520 v222 = (char *)HIDWORD(v733); | |
7521 if ( v223 ) | |
7522 LABEL_439: | |
7523 ((Player *)v222)->PlaySound(SPEECH_103, 0); | |
7524 } | |
7525 v222 += 6972; | |
7526 HIDWORD(v733) = (int)v222; | |
7527 if ( (signed int)v222 >= (signed int)pParty->pHirelings ) | |
7528 { | |
7529 LODWORD(v727) = 1; | |
7530 goto play_sound_and_continue; | |
7531 } | |
7532 continue; | |
7533 } | |
7534 } | |
3303 | 7535 |
3304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | 7536 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" |
3305 v3->spellnum = 0; | 7537 v3->spellnum = 0; |
3306 LABEL_1166: | 7538 //LABEL_1166: |
3307 ++n; | 7539 // ++n; |
3308 if ( n >= 10 ) | 7540 // if ( n >= 10 ) |
3309 return; | 7541 // return; |
3310 } | 7542 } |
3311 | 7543 |
3312 v730 = v3->spellnum; | 7544 |
3313 if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW) | |
3314 if (rand() % 100 < 50) | |
3315 { | |
3316 if (!pParty->bTurnBasedModeOn) | |
3317 { | |
3318 //v646 = pPlayer; | |
3319 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
3320 //v647 = n; | |
3321 } | |
3322 else | |
3323 { | |
3324 //v647 = n; | |
3325 //v646 = pPlayer; | |
3326 //v648 = sRecoveryTime; | |
3327 //v649 = pPlayer; | |
3328 pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; | |
3329 pPlayer->SetRecoveryTime(sRecoveryTime); | |
3330 pTurnEngine->_40471C(); | |
3331 } | |
3332 | |
3333 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | |
3334 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3335 v711[n].spellnum = 0; | |
3336 pPlayer->sMana -= uRequiredMana; | |
3337 return; | |
3338 } | |
3339 | |
3340 switch ( v3->spellnum ) | |
3341 { | |
3342 case SPELL_101: | |
3343 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | |
3344 case SPELL_BOW_ARROW: | |
3345 v17 = pPlayer; | |
3346 _this = (ItemGen *)1; | |
3347 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | |
3348 _this = (ItemGen *)2; | |
3349 sRecoveryTime = v17->GetAttackRecoveryTime(true); | |
3350 a1.stru_24.Reset(); | |
3351 a1.spell_level = v2; | |
3352 a1.spell_id = v3->spellnum; | |
3353 a1.spell_skill = v731; | |
3354 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3355 if ( v17->WearsItem(510, 2) ) | |
3356 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | |
3357 a1.vPosition.x = pParty->vPosition.x; | |
3358 a1.vPosition.y = pParty->vPosition.y; | |
3359 a1.uAttributes = 0; | |
3360 a1.uSpriteFrameID = 0; | |
3361 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3362 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3363 a1.spell_target_pid = a2; | |
3364 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3365 a1.uFacing = LOWORD(v715.uYawAngle); | |
3366 a1.uSoundID = LOWORD(v3->sound_id); | |
3367 v20 = &pParty->pPlayers[v3->uPlayerID]; | |
3368 memcpy(&a1.stru_24, &v20[v20->pEquipment.uBow], sizeof(a1.stru_24)); | |
3369 a1.uAttributes = 256; | |
3370 if ( pParty->bTurnBasedModeOn == 1 ) | |
3371 a1.uAttributes = 260; | |
3372 for ( i = 0; i < (signed int)_this; ++i ) | |
3373 { | |
3374 if ( i ) | |
3375 a1.vPosition.z += 32; | |
3376 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3377 if ( a1.Create( | |
3378 v715.uYawAngle, | |
3379 v715.uPitchAngle, | |
3380 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3381 v3->uPlayerID + 1) != -1 | |
3382 && pParty->bTurnBasedModeOn == 1 ) | |
3383 ++pTurnEngine->field_1C; | |
3384 } | |
3385 goto play_sound_and_continue; | |
3386 | |
3387 case SPELL_LASER_PROJECTILE: | |
3388 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3389 a1.stru_24.Reset(); | |
3390 a1.spell_id = v3->spellnum; | |
3391 a1.spell_level = v723; | |
3392 a1.spell_skill = v731; | |
3393 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3394 a1.vPosition.x = pParty->vPosition.x; | |
3395 a1.vPosition.y = pParty->vPosition.y; | |
3396 a1.uAttributes = 0; | |
3397 a1.uSpriteFrameID = 0; | |
3398 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3399 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3400 a1.spell_target_pid = a2; | |
3401 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3402 a1.uFacing = LOWORD(v715.uYawAngle); | |
3403 a1.uSoundID = LOWORD(v3->sound_id); | |
3404 memcpy( | |
3405 &a1.stru_24, | |
3406 &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3407 * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand | |
3408 + 5], | |
3409 sizeof(a1.stru_24)); | |
3410 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); | |
3411 HIBYTE(a1.uAttributes) |= 1u; | |
3412 a1.uSectorID = v23; | |
3413 if ( pParty->bTurnBasedModeOn == 1 ) | |
3414 LOBYTE(a1.uAttributes) |= 4u; | |
3415 if ( a1.Create( | |
3416 v715.uYawAngle, | |
3417 v715.uPitchAngle, | |
3418 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3419 v3->uPlayerID + 1) != -1 | |
3420 && pParty->bTurnBasedModeOn == 1 ) | |
3421 ++pTurnEngine->field_1C; | |
3422 goto play_sound_and_continue; | |
3423 | |
3424 case SPELL_FIRE_TORCH_LIGHT: | |
3425 LODWORD(v733) = 3600 * v2; | |
3426 | |
3427 switch (v731) | |
3428 { | |
3429 case 1: amount = 2; break; | |
3430 case 2: amount = 3; break; | |
3431 case 3: | |
3432 case 4: amount = 4; break; | |
3433 default: | |
3434 assert(false); | |
3435 } | |
3436 | |
3437 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3438 goto play_sound_and_continue; | |
3439 | |
3440 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); | |
3441 LODWORD(v727) = 1; | |
3442 goto play_sound_and_continue; | |
3443 | |
3444 case SPELL_FIRE_FIRE_SPIKE: | |
3445 { | |
3446 v29 = v731 - 2; | |
3447 if ( v29 ) | |
3448 { | |
3449 v30 = v29 - 1; | |
3450 if ( v30 ) | |
3451 { | |
3452 if ( v30 == 1 ) | |
3453 amount = 9; | |
3454 else | |
3455 amount = 3; | |
3456 } | |
3457 else | |
3458 { | |
3459 amount = 7; | |
3460 } | |
3461 } | |
3462 else | |
3463 { | |
3464 amount = 5; | |
3465 } | |
3466 //v31 = v3->uPlayerID; | |
3467 //v32 = 8 * v31; | |
3468 //LOBYTE(v32) = v32 | OBJECT_Player; | |
3469 | |
3470 //if ( (signed int)uNumSpriteObjects > 0 ) | |
3471 int _v733 = 0; | |
3472 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
3473 { | |
3474 auto object = pSpriteObjects + i; | |
3475 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, v3->uPlayerID)) | |
3476 ++_v733; | |
3477 /*v33 = (char *)&pSpriteObjects[0].field_48; | |
3478 v730 = uNumSpriteObjects; | |
3479 do | |
3480 { | |
3481 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) | |
3482 ++HIDWORD(v733); | |
3483 v33 += 112; | |
3484 --v730; | |
3485 } | |
3486 while ( v730 );*/ | |
3487 } | |
3488 if (_v733 > amount) | |
3489 { | |
3490 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3491 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3492 v3->spellnum = 0; | |
3493 goto LABEL_1166; | |
3494 } | |
3495 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3496 goto play_sound_and_continue; | |
3497 | |
3498 a1.stru_24.Reset(); | |
3499 a1.spell_id = v3->spellnum; | |
3500 a1.spell_level = v2; | |
3501 a1.spell_skill = v731; | |
3502 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3503 a1.vPosition.y = pParty->vPosition.y; | |
3504 a1.vPosition.x = pParty->vPosition.x; | |
3505 a1.uAttributes = 0; | |
3506 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3507 a1.uSectorID = pIndoor->GetSector( | |
3508 pParty->vPosition.x, | |
3509 pParty->vPosition.y, | |
3510 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3511 a1.uSpriteFrameID = 0; | |
3512 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3513 a1.spell_target_pid = a2; | |
3514 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3515 a1.uFacing = LOWORD(v715.uYawAngle); | |
3516 a1.uSoundID = LOWORD(v3->sound_id); | |
3517 if ( pParty->bTurnBasedModeOn == 1 ) | |
3518 LOBYTE(a1.uAttributes) |= 4u; | |
3519 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3520 if ( a1.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3521 ++pTurnEngine->field_1C; | |
3522 LODWORD(v727) = 1; | |
3523 goto play_sound_and_continue; | |
3524 } | |
3525 | |
3526 case 20: | |
3527 { | |
3528 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3529 goto play_sound_and_continue; | |
3530 if (!a2) | |
3531 { | |
3532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3533 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3534 v3->spellnum = 0; | |
3535 goto LABEL_1166; | |
3536 } | |
3537 if (PID_TYPE(a2) != OBJECT_Actor) | |
3538 { | |
3539 LODWORD(v727) = 1; | |
3540 goto play_sound_and_continue; | |
3541 } | |
3542 v697.x = 0; | |
3543 v697.y = 0; | |
3544 v697.z = 0; | |
3545 a1.stru_24.Reset(); | |
3546 a1.spell_id = v3->spellnum; | |
3547 a1.spell_level = v2; | |
3548 a1.spell_skill = v731; | |
3549 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3550 a1.uAttributes = 0; | |
3551 a1.uSectorID = 0; | |
3552 a1.uSpriteFrameID = 0; | |
3553 a1.field_60_distance_related_prolly_lod = 0; | |
3554 a1.uFacing = 0; | |
3555 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3556 a1.uSoundID = LOWORD(v3->sound_id); | |
3557 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3558 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3559 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3560 a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | |
3561 auto obj_id = a1.Create(0, 0, 0, 0); | |
3562 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | |
3563 LODWORD(v727) = 1; | |
3564 goto play_sound_and_continue; | |
3565 } | |
3566 | |
3567 case 44: | |
3568 { | |
3569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3570 goto play_sound_and_continue; | |
3571 | |
3572 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | |
3573 { | |
3574 LODWORD(v727) = 1; | |
3575 goto play_sound_and_continue; | |
3576 } | |
3577 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | |
3578 v704.x = 0; | |
3579 v704.y = 0; | |
3580 v704.z = 0; | |
3581 a1.stru_24.Reset(); | |
3582 a1.spell_id = v3->spellnum; | |
3583 a1.spell_level = v2; | |
3584 a1.spell_skill = v731; | |
3585 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3586 a1.uAttributes = 0; | |
3587 a1.uSectorID = 0; | |
3588 a1.uSpriteFrameID = 0; | |
3589 a1.field_60_distance_related_prolly_lod = 0; | |
3590 a1.uFacing = 0; | |
3591 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3592 a1.uSoundID = LOWORD(v3->sound_id); | |
3593 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3594 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3595 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3596 a1.spell_target_pid = PID(OBJECT_Actor, (int)v726); | |
3597 | |
3598 auto obj_id = a1.Create(0, 0, 0, 0); | |
3599 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | |
3600 | |
3601 LODWORD(v727) = 1; | |
3602 goto play_sound_and_continue; | |
3603 } | |
3604 | |
3605 case 79: | |
3606 { | |
3607 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | |
3608 goto play_sound_and_continue; | |
3609 //v730 = a2 >> 3; | |
3610 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | |
3611 v691.x = 0; | |
3612 v691.y = 0; | |
3613 v691.z = 0; | |
3614 a1.stru_24.Reset(); | |
3615 a1.spell_id = v3->spellnum; | |
3616 a1.spell_level = v2; | |
3617 a1.spell_skill = v731; | |
3618 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3619 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | |
3620 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | |
3621 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | |
3622 a1.uAttributes = 0; | |
3623 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3624 a1.uSpriteFrameID = 0; | |
3625 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3626 a1.spell_target_pid = a2; | |
3627 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3628 a1.uFacing = LOWORD(v715.uYawAngle); | |
3629 a1.uAttributes |= 0x80u; | |
3630 a1.uSoundID = LOWORD(v3->sound_id); | |
3631 | |
3632 auto obj_id = a1.Create(0, 0, 0, 0); | |
3633 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) | |
3634 { | |
3635 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3636 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3637 v3->spellnum = 0; | |
3638 goto LABEL_1166; | |
3639 } | |
3640 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | |
3641 LODWORD(v727) = 1; | |
3642 goto play_sound_and_continue; | |
3643 } | |
3644 | |
3645 | |
3646 case SPELL_FIRE_FIRE_BOLT: | |
3647 case SPELL_FIRE_FIREBALL: | |
3648 case SPELL_FIRE_INCINERATE: | |
3649 case SPELL_AIR_LIGHNING_BOLT: | |
3650 case SPELL_WATER_ICE_BOLT: | |
3651 case SPELL_WATER_ICE_BLAST: | |
3652 case SPELL_EARTH_STUN: | |
3653 case SPELL_EARTH_DEADLY_SWARM: | |
3654 case SPELL_MIND_MIND_BLAST: | |
3655 case SPELL_MIND_PSYCHIC_SHOCK: | |
3656 case SPELL_BODY_HARM: | |
3657 case SPELL_LIGHT_LIGHT_BOLT: | |
3658 case SPELL_DARK_DRAGON_BREATH: | |
3659 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3660 goto play_sound_and_continue; | |
3661 a1.stru_24.Reset(); | |
3662 a1.spell_id = v3->spellnum; | |
3663 a1.spell_level = v2; | |
3664 a1.spell_skill = v731; | |
3665 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3666 a1.vPosition.y = pParty->vPosition.y; | |
3667 a1.vPosition.x = pParty->vPosition.x; | |
3668 a1.uAttributes = 0; | |
3669 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3670 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3671 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, | |
3672 pParty->vPosition.y, | |
3673 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3674 else a1.uSectorID = 0; | |
3675 | |
3676 a1.uSpriteFrameID = 0; | |
3677 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3678 a1.spell_target_pid = a2; | |
3679 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3680 a1.uFacing = LOWORD(v715.uYawAngle); | |
3681 a1.uSoundID = LOWORD(v3->sound_id); | |
3682 if ( pParty->bTurnBasedModeOn == 1 ) | |
3683 LOBYTE(a1.uAttributes) |= 4u; | |
3684 if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) | |
3685 LOBYTE(a1.uAttributes) |= 0x40u; | |
3686 | |
3687 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3688 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3689 ++pTurnEngine->field_1C; | |
3690 LODWORD(v727) = 1; | |
3691 goto play_sound_and_continue; | |
3692 | |
3693 | |
3694 | |
3695 case 29: | |
3696 case 39: | |
3697 case 76: | |
3698 case 90: | |
3699 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3700 goto play_sound_and_continue; | |
3701 a1.stru_24.Reset(); | |
3702 a1.spell_id = v3->spellnum; | |
3703 a1.spell_level = v2; | |
3704 a1.spell_skill = v731; | |
3705 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3706 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3707 a1.vPosition.y = pParty->vPosition.y; | |
3708 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3709 v660 = pParty->vPosition.y; | |
3710 goto LABEL_153; | |
3711 case 87: | |
3712 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | |
3713 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | |
3714 { | |
3715 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3716 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3717 v3->spellnum = 0; | |
3718 goto LABEL_1166; | |
3719 } | |
3720 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
3721 goto LABEL_152; | |
3722 goto play_sound_and_continue; | |
3723 | |
3724 | |
3725 case 81: | |
3726 { | |
3727 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3728 goto play_sound_and_continue; | |
3729 | |
3730 if (PID_TYPE(a2) != OBJECT_Actor || | |
3731 (v730 = PID_ID(a2), | |
3732 v721 = (int)&pActors[PID_ID(a2)], | |
3733 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) ) | |
3734 { | |
3735 LODWORD(v727) = 1; | |
3736 goto play_sound_and_continue; | |
3737 } | |
3738 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | |
3739 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3740 v55 = v721; | |
3741 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); | |
3742 *(char *)(v55 + 38) |= 8u; | |
3743 *(short *)(v55 + 148) = 0; | |
3744 v672 = 0; | |
3745 *(short *)(v55 + 150) = 0; | |
3746 v661 = (Actor *)v55; | |
3747 goto LABEL_165; | |
3748 } | |
3749 | |
3750 case 35: | |
3751 if ( v731 == 2 ) | |
3752 { | |
3753 v57 = 300 * v2; | |
3754 } | |
3755 else | |
3756 { | |
3757 if ( v731 == 3 ) | |
3758 { | |
3759 amount = 4; | |
3760 v57 = 300 * v2; | |
3761 goto LABEL_174; | |
3762 } | |
3763 if ( v731 == 4 ) | |
3764 { | |
3765 v57 = 300 * v2; | |
3766 amount = 8; | |
3767 goto LABEL_174; | |
3768 } | |
3769 v57 = 180 * v2; | |
3770 } | |
3771 amount = 2; | |
3772 LABEL_174: | |
3773 LODWORD(v733) = v57; | |
3774 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3775 goto play_sound_and_continue; | |
3776 if (PID_TYPE(a2) != OBJECT_Actor | |
3777 || (v721 = 836 * PID_ID(a2), | |
3778 LODWORD(v718) = (int)&pActors[PID_ID(a2)], | |
3779 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u)) ) | |
3780 { | |
3781 LODWORD(v727) = 1; | |
3782 goto play_sound_and_continue; | |
3783 } | |
3784 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); | |
3785 v59 = v721; | |
3786 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( | |
3787 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, | |
3788 v731, | |
3789 amount, | |
3790 0, | |
3791 0); | |
3792 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | |
3793 v672 = 0; | |
3794 v661 = (Actor *)LODWORD(v718); | |
3795 goto LABEL_165; | |
3796 | |
3797 | |
3798 case 60: | |
3799 { | |
3800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3801 goto play_sound_and_continue; | |
3802 | |
3803 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
3804 { | |
3805 LODWORD(v727) = 1; | |
3806 goto play_sound_and_continue; | |
3807 } | |
3808 | |
3809 uint power = 300 * v2; | |
3810 if ( v731 == 2 ) | |
3811 { | |
3812 power = 600 * v2; | |
3813 } | |
3814 else if ( v731 == 3 ) | |
3815 power = 29030400; | |
3816 | |
3817 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); | |
3818 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
3819 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | |
3820 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | |
3821 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | |
3822 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | |
3823 v731, 0, 0, 0); | |
3824 a1.stru_24.Reset(); | |
3825 a1.spell_id = v3->spellnum; | |
3826 a1.spell_level = v2; | |
3827 a1.spell_skill = v731; | |
3828 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
3829 v61 = PID_ID(a2); | |
3830 goto LABEL_1086; | |
3831 } | |
3832 | |
3833 case 92: | |
3834 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3835 goto play_sound_and_continue; | |
3836 a1.stru_24.Reset(); | |
3837 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3838 a1.vPosition.x = pParty->vPosition.x; | |
3839 a1.vPosition.y = pParty->vPosition.y; | |
3840 a1.uAttributes = 0; | |
3841 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3842 a1.uSectorID = pIndoor->GetSector( | |
3843 pParty->vPosition.x, | |
3844 pParty->vPosition.y, | |
3845 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
3846 a1.uSpriteFrameID = 0; | |
3847 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3848 a1.spell_target_pid = a2; | |
3849 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3850 a1.uFacing = LOWORD(v715.uYawAngle); | |
3851 a1.uSoundID = LOWORD(v3->sound_id); | |
3852 a1.spell_skill = v731; | |
3853 a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | |
3854 a1.spell_level = 300 * v2; | |
3855 if ( pParty->bTurnBasedModeOn == 1 ) | |
3856 LOBYTE(a1.uAttributes) |= 4u; | |
3857 | |
3858 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
3859 | |
3860 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3861 ++pTurnEngine->field_1C; | |
3862 LODWORD(v727) = 1; | |
3863 goto play_sound_and_continue; | |
3864 | |
3865 case 4: | |
3866 { | |
3867 v63 = v731 - 1; | |
3868 if ( !v63 ) | |
3869 { | |
3870 amount = 10; | |
3871 goto LABEL_195; | |
3872 } | |
3873 v64 = v63 - 1; | |
3874 if ( !v64 ) | |
3875 { | |
3876 amount = 11; | |
3877 goto LABEL_195; | |
3878 } | |
3879 v65 = v64 - 1; | |
3880 if ( !v65 ) | |
3881 { | |
3882 amount = 12; | |
3883 LABEL_195: | |
3884 LODWORD(v733) = 3600 * v2; | |
3885 goto LABEL_196; | |
3886 } | |
3887 if ( v65 == 1 ) | |
3888 { | |
3889 LODWORD(v733) = 0; | |
3890 amount = 12; | |
3891 } | |
3892 LABEL_196: | |
3893 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
3894 goto play_sound_and_continue; | |
3895 v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | |
3896 auto _itm = &pItemsTable->pItems[v730c->uItemID]; | |
3897 v730c->UpdateTempBonus(pParty->uTimePlayed); | |
3898 if ( v730c->uItemID < 64 || v730c->uItemID > 65 ) | |
3899 { | |
3900 if (!v730c->Broken()) | |
3901 { | |
3902 if (!v730c->uSpecEnchantmentType) | |
3903 { | |
3904 if (!v730c->uEnchantmentType) | |
3905 { | |
3906 v68 = _itm->uEquipType; | |
3907 if ( !v68 || v68 == 1 || v68 == 2 ) | |
3908 { | |
3909 if ( !pItemsTable->IsMaterialNonCommon(v730c) ) | |
3910 { | |
3911 v69 = v730c; | |
3912 v14 = v731 == 4; | |
3913 *(int *)(v730 + 12) = amount; | |
3914 if ( !v14 ) | |
3915 { | |
3916 *(_QWORD *)(v69 + 28) = pParty->uTimePlayed | |
3917 + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) | |
3918 * 0.033333335); | |
3919 *(int *)(v69 + 20) |= 8u; | |
3920 } | |
3921 *(int *)(v69 + 20) |= 0x10u; | |
3922 dword_50C9A8 = 256; | |
3923 LODWORD(v727) = 1; | |
3924 play_sound_and_continue: | |
3925 if ( v3->field_8 & 0x20 ) | |
3926 { | |
3927 if ( v727 != 0.0 ) | |
3928 pAudioPlayer->PlaySound( | |
3929 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3930 0, | |
3931 0, | |
3932 -1, | |
3933 0, | |
3934 v3->sound_id, | |
3935 0, | |
3936 0); | |
3937 } | |
3938 else | |
3939 { | |
3940 if ( sRecoveryTime < 0 ) | |
3941 sRecoveryTime = 0; | |
3942 if ( pParty->bTurnBasedModeOn ) | |
3943 { | |
3944 v645 = sRecoveryTime; | |
3945 pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; | |
3946 pPlayer->SetRecoveryTime(v645); | |
3947 if ( !some_active_character ) | |
3948 pTurnEngine->_40471C(); | |
3949 } | |
3950 else | |
3951 { | |
3952 pPlayer->SetRecoveryTime( | |
3953 (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
3954 } | |
3955 if ( v727 != 0.0 ) | |
3956 { | |
3957 pPlayer->PlaySound(SPEECH_49, 0); | |
3958 if ( v727 != 0.0 ) | |
3959 pAudioPlayer->PlaySound( | |
3960 (SoundID)word_4EE088_sound_ids[v3->spellnum], | |
3961 0, | |
3962 0, | |
3963 -1, | |
3964 0, | |
3965 v3->sound_id, | |
3966 0, | |
3967 0); | |
3968 | |
3969 v3->spellnum = 0; | |
3970 v2 = v723; | |
3971 goto LABEL_1166; | |
3972 } | |
3973 } | |
3974 v3->spellnum = 0; | |
3975 v2 = v723; | |
3976 goto LABEL_1166; | |
3977 } | |
3978 } | |
3979 } | |
3980 } | |
3981 } | |
3982 } | |
3983 | |
3984 dword_50C9D0 = 113; | |
3985 dword_50C9D4 = 0; | |
3986 dword_50C9D8 = 1; | |
3987 | |
3988 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
3989 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
3990 v3->spellnum = 0; | |
3991 goto LABEL_1166; | |
3992 } | |
3993 | |
3994 case SPELL_BODY_REGENERATION: | |
3995 { | |
3996 v70 = v731 - 1; | |
3997 LODWORD(v733) = 3600 * v2; | |
3998 if ( v70 && (v71 = v70 - 1) != 0 ) | |
3999 { | |
4000 v72 = v71 - 1; | |
4001 if ( v72 ) | |
4002 { | |
4003 if ( v72 == 1 ) | |
4004 amount = 10; | |
4005 } | |
4006 else | |
4007 { | |
4008 amount = 3; | |
4009 } | |
4010 } | |
4011 else | |
4012 { | |
4013 amount = 1; | |
4014 } | |
4015 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4016 goto play_sound_and_continue; | |
4017 | |
4018 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
4019 | |
4020 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | |
4021 LODWORD(v727) = 1; | |
4022 goto play_sound_and_continue; | |
4023 } | |
4024 | |
4025 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4026 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4027 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4028 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4029 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4030 case SPELL_BODY_PROTECTION_FROM_BODY: | |
4031 v76 = v731 - 1; | |
4032 LODWORD(v733) = 3600 * v2; | |
4033 if ( v76 ) | |
4034 { | |
4035 v77 = v76 - 1; | |
4036 if ( v77 ) | |
4037 { | |
4038 v78 = v77 - 1; | |
4039 if ( v78 ) | |
4040 { | |
4041 if ( v78 != 1 ) | |
4042 goto LABEL_232; | |
4043 v79 = 4 * v2; | |
4044 } | |
4045 else | |
4046 { | |
4047 v79 = 3 * v2; | |
4048 } | |
4049 } | |
4050 else | |
4051 { | |
4052 v79 = 2 * v2; | |
4053 } | |
4054 amount = v79; | |
4055 } | |
4056 else | |
4057 { | |
4058 amount = v2; | |
4059 } | |
4060 LABEL_232: | |
4061 //v80 = v3->spellnum; | |
4062 switch (v3->spellnum) | |
4063 { | |
4064 case SPELL_FIRE_PROTECTION_FROM_FIRE: | |
4065 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | |
4066 break; | |
4067 case SPELL_AIR_PROTECTION_FROM_AIR: | |
4068 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | |
4069 break; | |
4070 case SPELL_WATER_PROTECTION_FROM_WATER: | |
4071 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | |
4072 break; | |
4073 case SPELL_EARTH_PROTECTION_FROM_EARTH: | |
4074 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | |
4075 break; | |
4076 case SPELL_MIND_PROTECTION_FROM_MIND: | |
4077 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | |
4078 break; | |
4079 case SPELL_BODY_PROTECTION_FROM_BODY: | |
4080 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | |
4081 break; | |
4082 default: | |
4083 assert(false); | |
4084 goto LABEL_1166; | |
4085 } | |
4086 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4087 goto play_sound_and_continue; | |
4088 | |
4089 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4090 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4091 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4092 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4093 | |
4094 v90 = (double)(signed int)v733 * 4.2666669; | |
4095 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4096 LODWORD(v727) = 1; | |
4097 goto play_sound_and_continue; | |
4098 | |
4099 case SPELL_FIRE_HASTE: | |
4100 if ( v731 <= 0 ) | |
4101 goto LABEL_254; | |
4102 if ( v731 <= 2 ) | |
4103 { | |
4104 v91 = 60 * (v2 + 60); | |
4105 } | |
4106 else | |
4107 { | |
4108 if ( v731 == 3 ) | |
4109 { | |
4110 v91 = 180 * (v2 + 20); | |
4111 } | |
4112 else | |
4113 { | |
4114 if ( v731 != 4 ) | |
4115 goto LABEL_254; | |
4116 v91 = 240 * (v2 + 15); | |
4117 } | |
4118 } | |
4119 LODWORD(v733) = v91; | |
4120 LABEL_254: | |
4121 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4122 { | |
4123 v92 = pParty->pPlayers;//[0].pConditions[1]; | |
4124 LODWORD(v727) = 1; | |
4125 do | |
4126 { | |
4127 if ( v92->pConditions ) | |
4128 LODWORD(v727) = 0; | |
4129 ++v92; | |
4130 } | |
4131 while ( v92 <= &pParty->pPlayers[3] ); | |
4132 if (LODWORD(v727)) | |
4133 { | |
4134 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4135 | |
4136 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4137 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4138 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4139 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4140 } | |
4141 } | |
4142 goto play_sound_and_continue; | |
4143 | |
4144 case SPELL_SPIRIT_BLESS: | |
4145 v101 = v731 - 1; | |
4146 if ( v101 && (v102 = v101 - 1) != 0 ) | |
4147 { | |
4148 v103 = v102 - 1; | |
4149 if ( v103 ) | |
4150 { | |
4151 if ( v103 != 1 ) | |
4152 goto LABEL_269; | |
4153 v104 = 3600 * (v2 + 1); | |
4154 } | |
4155 else | |
4156 { | |
4157 v104 = 900 * (v2 + 4); | |
4158 } | |
4159 } | |
4160 else | |
4161 { | |
4162 v104 = 300 * (v2 + 12); | |
4163 } | |
4164 LODWORD(v733) = v104; | |
4165 LABEL_269: | |
4166 amount = v2 + 5; | |
4167 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4168 goto play_sound_and_continue; | |
4169 if ( v731 == 1 ) | |
4170 { | |
4171 v108 = v3->uPlayerID_2; | |
4172 v109 = v3->spellnum; | |
4173 v110 = pGame->GetStru6(); | |
4174 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | |
4175 v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); | |
4176 //v668 = 0; | |
4177 v716 = v111; | |
4178 //v658 = v111; | |
4179 //v653 = amount; | |
4180 //v651 = 1; | |
4181 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4182 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | |
4183 //LABEL_103: | |
4184 //HIDWORD(v650) = HIDWORD(v28); | |
4185 //LABEL_104: | |
4186 //LODWORD(v650) = v28; | |
4187 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); | |
4188 LODWORD(v727) = 1; | |
4189 goto play_sound_and_continue; | |
4190 } | |
4191 v105 = 0; | |
4192 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
4193 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | |
4194 do | |
4195 { | |
4196 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); | |
4197 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); | |
4198 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
4199 ++v730b; | |
4200 ++v105; | |
4201 } | |
4202 while ( v730b <= &pParty->pPlayers[3] ); | |
4203 LODWORD(v727) = 1; | |
4204 goto play_sound_and_continue; | |
4205 | |
4206 case 52: | |
4207 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) | |
4208 { | |
4209 //v730 = a2 >> 3; | |
4210 v112 = &pActors[PID_ID(a2)]; | |
4211 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); | |
4212 v721 = abs(v112->vPosition.y - pParty->vPosition.y); | |
4213 v113 = abs(v112->vPosition.x - pParty->vPosition.x); | |
4214 _this = (ItemGen *)v113; | |
4215 v114 = v721; | |
4216 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); | |
4217 if ( v113 < v721 ) | |
4218 { | |
4219 v116 = v113; | |
4220 v113 = v721; | |
4221 v114 = v116; | |
4222 } | |
4223 if ( v113 < (signed int)v115 ) | |
4224 { | |
4225 v117 = v113; | |
4226 v113 = (int)v115; | |
4227 v115 = v117; | |
4228 } | |
4229 if ( v114 < (signed int)v115 ) | |
4230 { | |
4231 v118 = v115; | |
4232 v115 = v114; | |
4233 v114 = v118; | |
4234 } | |
4235 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); | |
4236 if ( (double)(signed int)this <= 307.2 ) | |
4237 { | |
4238 v701.x = 0; | |
4239 v701.y = 0; | |
4240 v701.z = 0; | |
4241 a1.stru_24.Reset(); | |
4242 v119 = HIDWORD(v733); | |
4243 a1.spell_id = *(int *)HIDWORD(v733); | |
4244 a1.spell_level = v723; | |
4245 a1.spell_skill = v731; | |
4246 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4247 a1.uAttributes = 0; | |
4248 a1.uSectorID = 0; | |
4249 a1.uSpriteFrameID = 0; | |
4250 a1.field_60_distance_related_prolly_lod = 0; | |
4251 a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | |
4252 a1.uFacing = 0; | |
4253 a1.uSoundID = *(short *)(v119 + 16); | |
4254 a1.vPosition.x = v112->vPosition.x; | |
4255 a1.vPosition.y = v112->vPosition.y; | |
4256 a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | |
4257 a1.spell_target_pid = PID(OBJECT_Actor, a2); | |
4258 v122 = a1.Create(0, 0, 0, 0); | |
4259 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | |
4260 LODWORD(v727) = 1; | |
4261 } | |
4262 else | |
4263 { | |
4264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
4265 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4266 *(int *)HIDWORD(v733) = 0; | |
4267 } | |
4268 v3 = (stru277 *)HIDWORD(v733); | |
4269 } | |
4270 goto play_sound_and_continue; | |
4271 | |
4272 case SPELL_AIR_SHIELD: | |
4273 case SPELL_EARTH_STONESKIN: | |
4274 case SPELL_SPIRIT_HEROISM: | |
4275 v123 = v731 - 1; | |
4276 if ( v123 && (v124 = v123 - 1) != 0 ) | |
4277 { | |
4278 v125 = v124 - 1; | |
4279 if ( v125 ) | |
4280 { | |
4281 if ( v125 != 1 ) | |
4282 goto LABEL_296; | |
4283 v126 = 3600 * (v2 + 1); | |
4284 } | |
4285 else | |
4286 { | |
4287 v126 = 900 * (v2 + 4); | |
4288 } | |
4289 } | |
4290 else | |
4291 { | |
4292 v126 = 300 * (v2 + 12); | |
4293 } | |
4294 LODWORD(v733) = v126; | |
4295 LABEL_296: | |
4296 v127 = v3->spellnum; | |
4297 if ( v127 == 17 ) | |
4298 { | |
4299 amount = 0; | |
4300 LODWORD(v725) = 14; | |
4301 } | |
4302 else | |
4303 { | |
4304 if ( v127 == 38 ) | |
4305 { | |
4306 LODWORD(v725) = 15; | |
4307 amount = v2 + 5; | |
4308 } | |
4309 else | |
4310 { | |
4311 if ( v127 != 51 ) | |
4312 goto LABEL_1166; | |
4313 LODWORD(v725) = 9; | |
4314 amount = v2 + 5; | |
4315 } | |
4316 } | |
4317 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4318 goto play_sound_and_continue; | |
4319 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4320 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4321 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4322 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4323 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; | |
4324 //LABEL_304: | |
4325 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | |
4326 LODWORD(v727) = 1; | |
4327 goto play_sound_and_continue; | |
4328 | |
4329 case SPELL_FIRE_IMMOLATION: | |
4330 v138 = v731 - 2; | |
4331 if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) | |
4332 v140 = 600 * v2; | |
4333 else | |
4334 v140 = 60 * v2; | |
4335 LODWORD(v733) = v140; | |
4336 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4337 goto play_sound_and_continue; | |
4338 | |
4339 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4340 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4341 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4342 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4343 | |
4344 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
4345 LODWORD(v727) = 1; | |
4346 goto play_sound_and_continue; | |
4347 | |
4348 case 9: | |
4349 v149 = v731 - 1; | |
4350 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) | |
4351 { | |
4352 if ( v151 == 1 ) | |
4353 _this = (ItemGen *)20; | |
4354 } | |
4355 else | |
4356 { | |
4357 _this = (ItemGen *)16; | |
4358 } | |
4359 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4360 { | |
4361 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! | |
4362 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4363 v3->spellnum = 0; | |
4364 goto LABEL_1166; | |
4365 } | |
4366 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4367 goto play_sound_and_continue; | |
4368 LODWORD(v725) = PID_TYPE(a2); | |
4369 if (PID_TYPE(a2) == OBJECT_Actor) | |
4370 { | |
4371 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; | |
4372 v153 = pActors[PID_ID(a2)].vPosition.y; | |
4373 v154 = pActors[PID_ID(a2)].vPosition.z; | |
4374 LODWORD(v727) = v153; | |
4375 } | |
4376 else | |
4377 { | |
4378 v155 = stru_5C6E00->Cos(pParty->sRotationY); | |
4379 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); | |
4380 v156 = stru_5C6E00->Sin(pParty->sRotationY); | |
4381 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); | |
4382 v154 = pParty->vPosition.z; | |
4383 } | |
4384 HIDWORD(v733) = v154; | |
4385 v713 = v154 + 2500; | |
4386 v721 = 0; | |
4387 LODWORD(v718) = 0; | |
4388 if ( (signed int)_this > 0 ) | |
4389 { | |
4390 *(float *)&y = (double)SHIDWORD(v733); | |
4391 *(float *)&v732 = (double)v713; | |
4392 v730 = LODWORD(v725) == 3 ? a2 : 0; | |
4393 auto _this_cpy = (int)_this; | |
4394 do | |
4395 { | |
4396 v157 = rand(); | |
4397 v158 = (double)SLODWORD(v718); | |
4398 v718 = v158; | |
4399 v159 = (double)v721; | |
4400 *(float *)&v721 = v159; | |
4401 a2 = v157 % 1000; | |
4402 *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; | |
4403 v725 = v159 * v159; | |
4404 *(float *)&_this = v158 * v158; | |
4405 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | |
4406 { | |
4407 LODWORD(v687) = 0; | |
4408 HIDWORD(v687) = 0; | |
4409 } | |
4410 else | |
4411 { | |
4412 x = (signed __int64)sqrt(*(float *)&_this + v725); | |
4413 v687 = __PAIR__( | |
4414 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | |
4415 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | |
4416 } | |
4417 a1.stru_24.Reset(); | |
4418 a1.spell_id = v3->spellnum; | |
4419 a1.spell_level = v2; | |
4420 a1.spell_skill = v731; | |
4421 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4422 a1.uAttributes = 0; | |
4423 a1.vPosition.x = uRequiredMana; | |
4424 a1.vPosition.y = LODWORD(v727); | |
4425 a1.uSectorID = 0; | |
4426 a1.vPosition.z = a2 + v713; | |
4427 a1.uSpriteFrameID = 0; | |
4428 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4429 a1.spell_target_pid = v730; | |
4430 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | |
4431 a1.uFacing = v687; | |
4432 a1.uSoundID = LOWORD(v3->sound_id); | |
4433 if ( pParty->bTurnBasedModeOn == 1 ) | |
4434 a1.uAttributes = 4; | |
4435 if ( a1.Create( | |
4436 v687, | |
4437 SHIDWORD(v687), | |
4438 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4439 0) != -1 | |
4440 && pParty->bTurnBasedModeOn == 1 ) | |
4441 ++pTurnEngine->field_1C; | |
4442 LODWORD(v718) = rand() % 1024 - 512; | |
4443 v160 = rand(); | |
4444 v14 = _this_cpy-- == 1; | |
4445 v721 = (unsigned __int64)(v160 % 1024) - 512; | |
4446 } | |
4447 while ( !v14 ); | |
4448 } | |
4449 LODWORD(v727) = 1; | |
4450 goto play_sound_and_continue; | |
4451 | |
4452 case 10: | |
4453 { | |
4454 //v67 = 2; | |
4455 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4456 { | |
4457 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | |
4458 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4459 v3->spellnum = 0; | |
4460 goto LABEL_1166; | |
4461 } | |
4462 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4463 goto play_sound_and_continue; | |
4464 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
4465 v700.z = 0; | |
4466 v700.y = 0; | |
4467 v700.x = 0; | |
4468 a1.stru_24.Reset(); | |
4469 a1.spell_id = v3->spellnum; | |
4470 a1.spell_level = v2; | |
4471 a1.spell_skill = v731; | |
4472 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4473 a1.uAttributes = 0; | |
4474 a1.uSectorID = 0; | |
4475 a1.uSpriteFrameID = 0; | |
4476 a1.field_60_distance_related_prolly_lod = 0; | |
4477 a1.uFacing = 0; | |
4478 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4479 a1.uSoundID = LOWORD(v3->sound_id); | |
4480 a2 = 0; | |
4481 if ( (signed int)_v726 > 0 ) | |
4482 { | |
4483 do | |
4484 { | |
4485 v162 = dword_50BF30[a2]; | |
4486 a1.vPosition.x = pActors[v162].vPosition.x; | |
4487 a1.vPosition.y = pActors[v162].vPosition.y; | |
4488 a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | |
4489 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
4490 v164 = a1.Create(0, 0, 0, 0); | |
4491 v165 = a2; | |
4492 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | |
4493 pGame->GetStru6()->_4A81CA(&a1); | |
4494 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | |
4495 a2 = v165 + 1; | |
4496 } | |
4497 while ( v165 + 1 < (signed int)_v726 ); | |
4498 } | |
4499 LODWORD(v727) = 1; | |
4500 goto play_sound_and_continue; | |
4501 } | |
4502 | |
4503 case SPELL_AIR_WIZARD_EYE: | |
4504 LODWORD(v733) = 3600 * v2; | |
4505 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4506 goto play_sound_and_continue; | |
4507 v168 = 0; | |
4508 do | |
4509 { | |
4510 v169 = pOtherOverlayList->_4418B1(2000, v168++ + 100, 0, 65536); | |
4511 v716 = v169; | |
4512 } | |
4513 while ( v168 < 4 ); | |
4514 | |
4515 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
4516 LODWORD(v727) = 1; | |
4517 goto play_sound_and_continue; | |
4518 | |
4519 case SPELL_AIR_FEATHER_FALL: | |
4520 v170 = v731 - 1; | |
4521 if ( !v170 ) | |
4522 { | |
4523 v173 = 300 * v2; | |
4524 goto LABEL_353; | |
4525 } | |
4526 v171 = v170 - 1; | |
4527 if ( !v171 ) | |
4528 { | |
4529 v173 = 600 * v2; | |
4530 goto LABEL_353; | |
4531 } | |
4532 v172 = v171 - 1; | |
4533 if ( !v172 || v172 == 1 ) | |
4534 { | |
4535 v173 = 3600 * v2; | |
4536 LABEL_353: | |
4537 LODWORD(v733) = v173; | |
4538 } | |
4539 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4540 goto play_sound_and_continue; | |
4541 v174 = 0; | |
4542 do | |
4543 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); | |
4544 while ( v174 < 4 ); | |
4545 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4546 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4547 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4548 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4549 | |
4550 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); | |
4551 LODWORD(v727) = 1; | |
4552 goto play_sound_and_continue; | |
4553 | |
4554 case SPELL_AIR_SPARKS: | |
4555 { | |
4556 v184 = v731 - 1; | |
4557 if ( v184 ) | |
4558 { | |
4559 v185 = v184 - 1; | |
4560 if ( v185 ) | |
4561 { | |
4562 v186 = v185 - 1; | |
4563 if ( v186 ) | |
4564 { | |
4565 if ( v186 == 1 ) | |
4566 amount = 9; | |
4567 } | |
4568 else | |
4569 { | |
4570 amount = 7; | |
4571 } | |
4572 } | |
4573 else | |
4574 { | |
4575 amount = 5; | |
4576 } | |
4577 } | |
4578 else | |
4579 { | |
4580 amount = 3; | |
4581 } | |
4582 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4583 goto play_sound_and_continue; | |
4584 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4585 a1.stru_24.Reset(); | |
4586 a1.spell_id = v3->spellnum; | |
4587 a1.spell_level = v2; | |
4588 a1.spell_skill = v731; | |
4589 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4590 a1.vPosition.y = pParty->vPosition.y; | |
4591 a1.vPosition.x = pParty->vPosition.x; | |
4592 a1.uAttributes = 0; | |
4593 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4594 a1.uSectorID = pIndoor->GetSector( | |
4595 pParty->vPosition.x, | |
4596 pParty->vPosition.y, | |
4597 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4598 a1.uSpriteFrameID = 0; | |
4599 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4600 a1.spell_target_pid = a2; | |
4601 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4602 a1.uSoundID = LOWORD(v3->sound_id); | |
4603 if ( pParty->bTurnBasedModeOn == 1 ) | |
4604 LOBYTE(a1.uAttributes) |= 4u; | |
4605 v188 = (signed int)_v726 / -2; | |
4606 v189 = (signed int)_v726 / 2; | |
4607 while ( v188 <= v189 ) | |
4608 { | |
4609 a1.uFacing = v188 + LOWORD(v715.uYawAngle); | |
4610 if ( a1.Create( | |
4611 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | |
4612 v715.uPitchAngle, | |
4613 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4614 v3->uPlayerID + 1) != -1 | |
4615 && pParty->bTurnBasedModeOn == 1 ) | |
4616 ++pTurnEngine->field_1C; | |
4617 v188 += _v726 / (amount - 1); | |
4618 } | |
4619 LODWORD(v727) = 1; | |
4620 goto play_sound_and_continue; | |
4621 } | |
4622 | |
4623 case 16: | |
4624 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) | |
4625 { | |
4626 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! | |
4627 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4628 goto play_sound_and_continue; | |
4629 } | |
4630 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4631 goto play_sound_and_continue; | |
4632 v191 = 0; | |
4633 do | |
4634 pOtherOverlayList->_4418B1(2040, v191++ + 100, 0, 65536); | |
4635 while ( v191 < 4 ); | |
4636 BYTE1(pParty->uFlags) |= 1u; | |
4637 pParty->uFallSpeed = 1000; | |
4638 LODWORD(v727) = 1; | |
4639 goto play_sound_and_continue; | |
4640 | |
4641 case SPELL_AIR_INVISIBILITY: | |
4642 v192 = v731 - 1; | |
4643 if ( !v192 ) | |
4644 { | |
4645 amount = v2; | |
4646 goto LABEL_391; | |
4647 } | |
4648 v193 = v192 - 1; | |
4649 if ( !v193 ) | |
4650 { | |
4651 v196 = 2 * v2; | |
4652 LABEL_389: | |
4653 amount = v196; | |
4654 LABEL_391: | |
4655 v195 = 600 * v2; | |
4656 goto LABEL_392; | |
4657 } | |
4658 v194 = v193 - 1; | |
4659 if ( !v194 ) | |
4660 { | |
4661 v196 = 3 * v2; | |
4662 goto LABEL_389; | |
4663 } | |
4664 if ( v194 != 1 ) | |
4665 goto LABEL_393; | |
4666 amount = 4 * v2; | |
4667 v195 = 3600 * v2; | |
4668 LABEL_392: | |
4669 LODWORD(v733) = v195; | |
4670 LABEL_393: | |
4671 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | |
4672 { | |
4673 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | |
4674 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4675 v3->spellnum = 0; | |
4676 goto LABEL_1166; | |
4677 } | |
4678 if ( pPlayer->CanCastSpell(uRequiredMana) ) | |
4679 { | |
4680 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4681 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4682 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4683 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4684 | |
4685 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
4686 LODWORD(v727) = 1; | |
4687 } | |
4688 goto play_sound_and_continue; | |
4689 | |
4690 case 21: | |
4691 { | |
4692 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4693 { | |
4694 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | |
4695 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4696 goto play_sound_and_continue; | |
4697 } | |
4698 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4699 { | |
4700 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4701 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4702 goto play_sound_and_continue; | |
4703 } | |
4704 LODWORD(v733) = 3600 * v2; | |
4705 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) | |
4706 amount = 1; | |
4707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4708 goto play_sound_and_continue; | |
4709 v205 = 0; | |
4710 do | |
4711 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | |
4712 while ( v205 < 4 ); | |
4713 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
4714 v207 = v3->uPlayerID + 1; | |
4715 v716 = v206; | |
4716 | |
4717 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | |
4718 LODWORD(v727) = 1; | |
4719 goto play_sound_and_continue; | |
4720 } | |
4721 | |
4722 case 22: | |
4723 { | |
4724 //v67 = 2; | |
4725 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4726 { | |
4727 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | |
4728 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4729 v3->spellnum = 0; | |
4730 goto LABEL_1166; | |
4731 } | |
4732 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4733 goto play_sound_and_continue; | |
4734 v208 = PID_TYPE(a2); | |
4735 LODWORD(v725) = PID_TYPE(a2); | |
4736 if ( v208 == 3 ) | |
4737 { | |
4738 v209 = PID_ID(a2); | |
4739 LODWORD(v718) = pActors[v209].vPosition.x; | |
4740 v210 = pActors[v209].vPosition.y; | |
4741 v211 = pActors[v209].vPosition.z; | |
4742 v713 = v210; | |
4743 } | |
4744 else | |
4745 { | |
4746 v212 = stru_5C6E00->Cos(pParty->sRotationY); | |
4747 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); | |
4748 v213 = stru_5C6E00->Sin(pParty->sRotationY); | |
4749 v214 = sub_42EBBE(2048, v213); | |
4750 v211 = pParty->vPosition.z; | |
4751 v713 = pParty->vPosition.y + v214; | |
4752 v208 = LODWORD(v725); | |
4753 } | |
4754 HIDWORD(v733) = 0; | |
4755 *(float *)&v732 = (double)v211; | |
4756 LODWORD(v725) = v211 + 2500; | |
4757 v721 = 0; | |
4758 *(float *)&y = (double)(v211 + 2500); | |
4759 v730 = v208 == 3 ? a2 : 0; | |
4760 a2 = 20; | |
4761 do | |
4762 { | |
4763 v215 = rand(); | |
4764 v216 = (double)v721; | |
4765 v217 = (double)SHIDWORD(v733); | |
4766 *(float *)&uRequiredMana = v217; | |
4767 _this = (ItemGen *)(v215 % 1000); | |
4768 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; | |
4769 *(float *)&v721 = v217 * v217; | |
4770 //*(float *)&v726 = v216 * v216; | |
4771 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) | |
4772 { | |
4773 LODWORD(v685) = 0; | |
4774 HIDWORD(v685) = 0; | |
4775 } | |
4776 else | |
4777 { | |
4778 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); | |
4779 v685 = __PAIR__( | |
4780 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | |
4781 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | |
4782 } | |
4783 a1.stru_24.Reset(); | |
4784 a1.spell_id = v3->spellnum; | |
4785 a1.spell_level = v2; | |
4786 a1.spell_skill = v731; | |
4787 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4788 a1.uAttributes = 0; | |
4789 a1.vPosition.x = LODWORD(v718); | |
4790 a1.vPosition.y = v713; | |
4791 a1.uSectorID = 0; | |
4792 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); | |
4793 a1.uSpriteFrameID = 0; | |
4794 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4795 a1.spell_target_pid = v730; | |
4796 __debugbreak(); | |
4797 a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | |
4798 a1.uFacing = v685; | |
4799 a1.uSoundID = LOWORD(v3->sound_id); | |
4800 if ( pParty->bTurnBasedModeOn == 1 ) | |
4801 a1.uAttributes = 4; | |
4802 if ( a1.Create( | |
4803 v685, | |
4804 SHIDWORD(v685), | |
4805 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4806 0) != -1 | |
4807 && pParty->bTurnBasedModeOn == 1 ) | |
4808 ++pTurnEngine->field_1C; | |
4809 v721 = rand() % 1024 - 512; | |
4810 v218 = rand(); | |
4811 v14 = a2-- == 1; | |
4812 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | |
4813 } | |
4814 while ( !v14 ); | |
4815 LODWORD(v727) = 1; | |
4816 goto play_sound_and_continue; | |
4817 } | |
4818 | |
4819 case 23: | |
4820 v219 = v731 - 2; | |
4821 if ( v219 ) | |
4822 { | |
4823 v220 = v219 - 1; | |
4824 if ( v220 ) | |
4825 { | |
4826 if ( v220 == 1 ) | |
4827 { | |
4828 amount = 0; | |
4829 goto LABEL_433; | |
4830 } | |
4831 v221 = 180 * v2; | |
4832 } | |
4833 else | |
4834 { | |
4835 v221 = 86400 * v2; | |
4836 } | |
4837 } | |
4838 else | |
4839 { | |
4840 v221 = 3600 * v2; | |
4841 } | |
4842 amount = v221; | |
4843 LABEL_433: | |
4844 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4845 goto play_sound_and_continue; | |
4846 v222 = (char *)pParty->pPlayers; | |
4847 HIDWORD(v733) = (int)(char *)&pParty + 2508; | |
4848 break; | |
4849 case 24: | |
4850 v224 = v731 - 2; | |
4851 if ( v224 ) | |
4852 { | |
4853 v225 = v224 - 1; | |
4854 if ( v225 ) | |
4855 { | |
4856 if ( v225 == 1 ) | |
4857 amount = 7; | |
4858 else | |
4859 amount = 1; | |
4860 } | |
4861 else | |
4862 { | |
4863 amount = 5; | |
4864 } | |
4865 } | |
4866 else | |
4867 { | |
4868 amount = 3; | |
4869 } | |
4870 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4871 goto play_sound_and_continue; | |
4872 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
4873 if ( amount == 1 ) | |
4874 { | |
4875 LABEL_152: | |
4876 a1.stru_24.Reset(); | |
4877 a1.spell_id = v3->spellnum; | |
4878 a1.spell_skill = v731; | |
4879 a1.spell_level = v2; | |
4880 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4881 a1.vPosition.y = pParty->vPosition.y; | |
4882 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4883 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4884 v660 = pParty->vPosition.y; | |
4885 LABEL_153: | |
4886 a1.uAttributes = 0; | |
4887 a1.vPosition.x = pParty->vPosition.x; | |
4888 a1.vPosition.z = v51; | |
4889 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | |
4890 a1.uSpriteFrameID = 0; | |
4891 a1.uSectorID = v52; | |
4892 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4893 a1.spell_target_pid = a2; | |
4894 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4895 a1.uFacing = LOWORD(v715.uYawAngle); | |
4896 a1.uSoundID = LOWORD(v3->sound_id); | |
4897 | |
4898 if ( pParty->bTurnBasedModeOn == 1 ) | |
4899 LOBYTE(a1.uAttributes) |= 4u; | |
4900 | |
4901 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
4902 | |
4903 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4904 ++pTurnEngine->field_1C; | |
4905 } | |
4906 else | |
4907 { | |
4908 a1.stru_24.Reset(); | |
4909 a1.spell_id = v3->spellnum; | |
4910 a1.spell_level = v2; | |
4911 a1.spell_skill = v731; | |
4912 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
4913 a1.vPosition.y = pParty->vPosition.y; | |
4914 a1.vPosition.x = pParty->vPosition.x; | |
4915 a1.uAttributes = 0; | |
4916 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
4917 a1.uSectorID = pIndoor->GetSector( | |
4918 pParty->vPosition.x, | |
4919 pParty->vPosition.y, | |
4920 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
4921 a1.uSpriteFrameID = 0; | |
4922 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
4923 a1.spell_target_pid = a2; | |
4924 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4925 a1.uSoundID = LOWORD(v3->sound_id); | |
4926 if ( pParty->bTurnBasedModeOn == 1 ) | |
4927 LOBYTE(a1.uAttributes) |= 4u; | |
4928 v227 = SHIDWORD(v733) / -2; | |
4929 y = (char *)(SHIDWORD(v733) / 2); | |
4930 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | |
4931 { | |
4932 v228 = v715.uYawAngle; | |
4933 do | |
4934 { | |
4935 a1.uFacing = v227 + v228; | |
4936 if ( a1.Create( | |
4937 v227 + v228, | |
4938 v715.uPitchAngle, | |
4939 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4940 v3->uPlayerID + 1) != -1 | |
4941 && pParty->bTurnBasedModeOn == 1 ) | |
4942 ++pTurnEngine->field_1C; | |
4943 v227 += SHIDWORD(v733) / (amount - 1); | |
4944 } | |
4945 while ( v227 <= (signed int)y ); | |
4946 } | |
4947 } | |
4948 LODWORD(v727) = 1; | |
4949 goto play_sound_and_continue; | |
4950 | |
4951 case 27: | |
4952 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | |
4953 { | |
4954 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4955 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4956 goto play_sound_and_continue; | |
4957 } | |
4958 if ( v731 == 2 || v731 != 3 && v731 != 4 ) | |
4959 v229 = 600 * v2; | |
4960 else | |
4961 v229 = 3600 * v2; | |
4962 LODWORD(v733) = v229; | |
4963 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4964 goto play_sound_and_continue; | |
4965 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
4966 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
4967 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
4968 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
4969 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
4970 | |
4971 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | |
4972 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | |
4973 v731, | |
4974 amount, | |
4975 v716, | |
4976 v3->uPlayerID + 1); | |
4977 if ( v731 == 4 ) | |
4978 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | |
4979 LODWORD(v727) = 1; | |
4980 goto play_sound_and_continue; | |
4981 | |
4982 case 28: | |
4983 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
4984 goto play_sound_and_continue; | |
4985 v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | |
4986 y = v240; | |
4987 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | |
4988 { | |
4989 dword_50C9D0 = 113; | |
4990 dword_50C9D4 = 0; | |
4991 dword_50C9D8 = 1; | |
4992 | |
4993 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
4994 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
4995 v3->spellnum = 0; | |
4996 goto LABEL_1166; | |
4997 } | |
4998 if ( v731 == 1 || v731 == 2 ) | |
4999 { | |
5000 v241 = (double)v723 * 0.0099999998 + 0.5; | |
5001 } | |
5002 else | |
5003 { | |
5004 if ( v731 == 3 ) | |
5005 { | |
5006 v241 = (double)v723 * 0.0099999998 + 0.69999999; | |
5007 } | |
5008 else | |
5009 { | |
5010 if ( v731 != 4 ) | |
5011 { | |
5012 v241 = 0.0; | |
5013 goto LABEL_484; | |
5014 } | |
5015 v241 = (double)v723 * 0.0099999998 + 0.80000001; | |
5016 } | |
5017 } | |
5018 if ( v241 > 1.0 ) | |
5019 v241 = 1.0; | |
5020 LABEL_484: | |
5021 v732 = (unsigned __int8)v240[25]; | |
5022 v242 = (signed __int64)((double)v732 * v241); | |
5023 v243 = y; | |
5024 y[25] = v242; | |
5025 *((int *)v243 + 4) = (unsigned __int8)v242; | |
5026 if ( (unsigned __int8)v242 <= 0 ) | |
5027 { | |
5028 *(int *)v243 = 0; | |
5029 dword_50C9D0 = 113; | |
5030 dword_50C9D4 = 0; | |
5031 dword_50C9D8 = 1; | |
5032 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | |
5033 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5034 v3->spellnum = 0; | |
5035 v2 = v723; | |
5036 goto LABEL_1166; | |
5037 } | |
5038 *((int *)v243 + 5) |= 0x40u; | |
5039 dword_50C9A8 = 256; | |
5040 LODWORD(v727) = 1; | |
5041 goto play_sound_and_continue; | |
5042 | |
5043 case 30: | |
5044 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5045 goto play_sound_and_continue; | |
5046 uRequiredMana = 0; | |
5047 HIDWORD(v733) = 10 * v2; | |
5048 v730 = 1; | |
5049 v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
5050 if ( v731 == 1 ) | |
5051 { | |
5052 v245 = (int)&v244[36 * a2 + 532]; | |
5053 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | |
5054 v311 = __OFSUB__(*(int *)v245, 134); | |
5055 v14 = *(int *)v245 == 134; | |
5056 v310 = *(int *)v245 - 134 < 0; | |
5057 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; | |
5058 if ( (unsigned __int8)(v310 ^ v311) | v14 ) | |
5059 { | |
5060 if ( *(int *)&v244[36 * a2 + 544] == 0 ) | |
5061 { | |
5062 if ( *(int *)&v244[36 * a2 + 536] == 0 ) | |
5063 { | |
5064 if ( *(int *)&v244[36 * a2 + 540] == 0 ) | |
5065 { | |
5066 v312 = v309[28]; | |
5067 if ( v312 ) | |
5068 { | |
5069 if ( v312 != 1 ) | |
5070 { | |
5071 if ( v312 != 2 ) | |
5072 { | |
5073 _this = (ItemGen *)&v244[36 * a2 + 552]; | |
5074 if ( !(v244[36 * a2 + 552] & 2) ) | |
5075 { | |
5076 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 ) | |
5077 { | |
5078 uRequiredMana = 1; | |
5079 v730 = 0; | |
5080 } | |
5081 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5082 uRequiredMana = 1; | |
5083 if (!uRequiredMana) | |
5084 { | |
5085 v313 = *(char *)(LODWORD(v725) + 28); | |
5086 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 ) | |
5087 { | |
5088 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5089 *(int *)(v245 + 4) = 0; | |
5090 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5091 + 1]; | |
5092 ; | |
5093 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5094 + 1] ) | |
5095 { | |
5096 ++*(int *)(v245 + 4); | |
5097 if ( j >= v314 ) | |
5098 break; | |
5099 } | |
5100 v254 = rand(); | |
5101 v255 = 10;//pItemsTable->field_116D8[17]; | |
5102 v256 = 10;//pItemsTable->field_116D8[16]; | |
5103 LABEL_611: | |
5104 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); | |
5105 LABEL_612: | |
5106 _this->uItemID |= 0x20u; | |
5107 | |
5108 dword_50C9A8 = 256; | |
5109 LODWORD(v727) = 1; | |
5110 goto play_sound_and_continue; | |
5111 } | |
5112 goto LABEL_615; | |
5113 } | |
5114 LABEL_613: | |
5115 v316 = _this->uItemID; | |
5116 if ( !(BYTE1(v316) & 2) ) | |
5117 { | |
5118 LOBYTE(v316) = v316 | 2; | |
5119 _this->uItemID = v316; | |
5120 } | |
5121 } | |
5122 } | |
5123 } | |
5124 } | |
5125 } | |
5126 } | |
5127 } | |
5128 } | |
5129 LABEL_616: | |
5130 if ( LODWORD(v727) == 0 ) | |
5131 { | |
5132 v317 = pGlobalTXT_LocalizationStrings[428]; | |
5133 if ( v730 == 0 ) | |
5134 v317 = pGlobalTXT_LocalizationStrings[585]; | |
5135 ShowStatusBarString(v317, 2u); | |
5136 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5137 __debugbreak(); // decompilation error; most probably v318 is the caster, filled in case 54 | |
5138 //v318 = v726; | |
5139 v3->spellnum = 0; | |
5140 v318->PlaySound(SPEECH_43, 0); | |
5141 } | |
5142 goto play_sound_and_continue; | |
5143 } | |
5144 if ( v731 != 2 ) | |
5145 { | |
5146 if ( v731 == 3 ) | |
5147 { | |
5148 v245 = (int)&v244[36 * a2 + 532]; | |
5149 v269 = *(int *)v245; | |
5150 if ( *(int *)v245 > 134 | |
5151 || *(int *)(v245 + 12) != 0 | |
5152 || *(int *)(v245 + 4) != 0 | |
5153 || *(int *)(v245 + 8) != 0 | |
5154 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) | |
5155 goto LABEL_616; | |
5156 v270 = (char *)&pItemsTable->pItems[v269].pIconName; | |
5157 LODWORD(v725) = (int)v270; | |
5158 v271 = v270[28]; | |
5159 if ( v271 && v271 != 1 && v271 != 2 ) | |
5160 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; | |
5161 else | |
5162 v272 = ((ItemGen *)v245)->GetValue() < 0xFA; | |
5163 if ( v272 ) | |
5164 { | |
5165 uRequiredMana = 1; | |
5166 v730 = 0; | |
5167 } | |
5168 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5169 uRequiredMana = 1; | |
5170 if (uRequiredMana) | |
5171 goto LABEL_613; | |
5172 v273 = v725; | |
5173 v274 = *(char *)(LODWORD(v725) + 28); | |
5174 if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) | |
5175 { | |
5176 if ( rand() % 100 < 80 | |
5177 && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) | |
5178 { | |
5179 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5180 *(int *)(v245 + 4) = 0; | |
5181 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5182 ; | |
5183 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5184 + 1] ) | |
5185 { | |
5186 ++*(int *)(v245 + 4); | |
5187 if ( k >= v275 ) | |
5188 break; | |
5189 } | |
5190 v254 = rand(); | |
5191 v255 = 10;//pItemsTable->field_116D8[19]; | |
5192 v256 = 10;//pItemsTable->field_116D8[18]; | |
5193 goto LABEL_611; | |
5194 } | |
5195 v277 = pItemsTable->pSpecialEnchantments_count; | |
5196 v278 = 0; | |
5197 v725 = 0.0; | |
5198 HIDWORD(v733) = 0; | |
5199 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5200 { | |
5201 v730 = (int)&v679; | |
5202 do | |
5203 { | |
5204 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); | |
5205 if ( !v279 || v279 == 1 ) | |
5206 { | |
5207 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5208 + 4] | |
5209 + v278 * 28); | |
5210 LODWORD(v725) += v280; | |
5211 if ( v280 ) | |
5212 { | |
5213 v281 = v730; | |
5214 v730 += 4; | |
5215 *(int *)v281 = HIDWORD(v733); | |
5216 } | |
5217 } | |
5218 ++HIDWORD(v733); | |
5219 ++v278; | |
5220 } | |
5221 while ( SHIDWORD(v733) < v277 ); | |
5222 } | |
5223 v282 = rand() % SLODWORD(v725); | |
5224 v283 = v679; | |
5225 *(int *)(v245 + 12) = v679; | |
5226 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5227 v285 = v282 + 1; | |
5228 if ( v284 < v285 ) | |
5229 { | |
5230 for ( l = &v679; ; l = (int *)v732 ) | |
5231 { | |
5232 v287 = (int)(l + 1); | |
5233 v732 = v287; | |
5234 v288 = *(int *)v287; | |
5235 *(int *)(v245 + 12) = v288; | |
5236 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5237 + 4]; | |
5238 if ( v284 >= v285 ) | |
5239 break; | |
5240 } | |
5241 } | |
5242 goto LABEL_525; | |
5243 } | |
5244 } | |
5245 else | |
5246 { | |
5247 __debugbreak(); // v726 is most probably the caster, filled in case 54 | |
5248 if ( v731 != 4 | |
5249 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) | |
5250 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 | |
5251 || v726->pInventoryItems[a2].uEnchantmentType != 0 | |
5252 || v726->pInventoryItems[a2]._bonus_strength != 0 | |
5253 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) | |
5254 goto LABEL_616; | |
5255 v247 = (char *)&pItemsTable->pItems[v246].pIconName; | |
5256 LODWORD(v725) = (int)v247; | |
5257 v248 = v247[28]; | |
5258 if ( v248 && v248 != 1 && v248 != 2 ) | |
5259 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; | |
5260 else | |
5261 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; | |
5262 if ( v249 ) | |
5263 { | |
5264 uRequiredMana = 1; | |
5265 v730 = 0; | |
5266 } | |
5267 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5268 uRequiredMana = 1; | |
5269 if (uRequiredMana) | |
5270 goto LABEL_613; | |
5271 v250 = v725; | |
5272 v251 = *(char *)(LODWORD(v725) + 28); | |
5273 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) | |
5274 { | |
5275 if ( rand() % 100 < 80 | |
5276 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) | |
5277 { | |
5278 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; | |
5279 *(int *)(v245 + 4) = 0; | |
5280 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; | |
5281 ; | |
5282 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType | |
5283 + 1] ) | |
5284 { | |
5285 ++*(int *)(v245 + 4); | |
5286 if ( m >= v252 ) | |
5287 break; | |
5288 } | |
5289 v254 = rand(); | |
5290 v255 = 10;// pItemsTable->field_116D8[21]; | |
5291 v256 = 10;//pItemsTable->field_116D8[20]; | |
5292 goto LABEL_611; | |
5293 } | |
5294 v257 = pItemsTable->pSpecialEnchantments_count; | |
5295 v258 = 0; | |
5296 v725 = 0.0; | |
5297 HIDWORD(v733) = 0; | |
5298 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5299 { | |
5300 v730 = (int)&v679; | |
5301 do | |
5302 { | |
5303 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); | |
5304 if ( !v259 || v259 == 1 ) | |
5305 { | |
5306 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5307 + 4] | |
5308 + v258 * 28); | |
5309 LODWORD(v725) += v260; | |
5310 if ( v260 ) | |
5311 { | |
5312 v261 = v730; | |
5313 v730 += 4; | |
5314 *(int *)v261 = HIDWORD(v733); | |
5315 } | |
5316 } | |
5317 ++HIDWORD(v733); | |
5318 ++v258; | |
5319 } | |
5320 while ( SHIDWORD(v733) < v257 ); | |
5321 } | |
5322 v262 = rand() % SLODWORD(v725); | |
5323 v263 = v679; | |
5324 *(int *)(v245 + 12) = v679; | |
5325 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; | |
5326 v265 = v262 + 1; | |
5327 if ( v264 < v265 ) | |
5328 { | |
5329 for ( ii = &v679; ; ii = (int *)v732 ) | |
5330 { | |
5331 v267 = (int)(ii + 1); | |
5332 v732 = v267; | |
5333 v268 = *(int *)v267; | |
5334 *(int *)(v245 + 12) = v268; | |
5335 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType | |
5336 + 4]; | |
5337 if ( v264 >= v265 ) | |
5338 break; | |
5339 } | |
5340 } | |
5341 LABEL_525: | |
5342 ++*(int *)(v245 + 12); | |
5343 goto LABEL_612; | |
5344 } | |
5345 } | |
5346 LABEL_615: | |
5347 //v1 = 0; | |
5348 goto LABEL_616; | |
5349 } | |
5350 v289 = (ItemGen *)&v244[36 * a2 + 532]; | |
5351 _this = v289; | |
5352 v290 = v289->uItemID; | |
5353 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; | |
5354 if ( v290 > 134 | |
5355 || _this->uSpecEnchantmentType != 0 | |
5356 || _this->uEnchantmentType != 0 | |
5357 || _this->_bonus_strength != 0 | |
5358 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 | |
5359 || v291 == 1 | |
5360 || v291 == 2 | |
5361 || _this->Broken()) | |
5362 goto LABEL_616; | |
5363 if ( _this->GetValue() < 0x1C2 ) | |
5364 uRequiredMana = 1; | |
5365 if ( rand() % 100 >= SHIDWORD(v733) ) | |
5366 uRequiredMana = 1; | |
5367 if ( uRequiredMana != 0 ) | |
5368 { | |
5369 dword_50C9D0 = 113; | |
5370 dword_50C9D4 = 0; | |
5371 dword_50C9D8 = 1; | |
5372 | |
5373 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5374 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5375 v3->spellnum = 0; | |
5376 goto LABEL_1166; | |
5377 } | |
5378 v292 = *(char *)(LODWORD(v725) + 28); | |
5379 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | |
5380 { | |
5381 v2 = v723; | |
5382 //v1 = 0; | |
5383 | |
5384 dword_50C9D0 = 113; | |
5385 dword_50C9D4 = 0; | |
5386 dword_50C9D8 = 1; | |
5387 | |
5388 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5389 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5390 v3->spellnum = 0; | |
5391 goto LABEL_1166; | |
5392 } | |
5393 if ( rand() % 100 >= 80 ) | |
5394 { | |
5395 v297 = pItemsTable->pSpecialEnchantments_count; | |
5396 v294 = _this; | |
5397 v298 = 0; | |
5398 v725 = 0.0; | |
5399 HIDWORD(v733) = 0; | |
5400 if ( pItemsTable->pSpecialEnchantments_count > 0 ) | |
5401 { | |
5402 v730 = (int)&v679; | |
5403 do | |
5404 { | |
5405 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); | |
5406 if ( !v299 || v299 == 1 ) | |
5407 { | |
5408 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] | |
5409 + v298 * 28); | |
5410 LODWORD(v725) += v300; | |
5411 if ( v300 ) | |
5412 { | |
5413 v301 = v730; | |
5414 v730 += 4; | |
5415 *(int *)v301 = HIDWORD(v733); | |
5416 } | |
5417 } | |
5418 ++HIDWORD(v733); | |
5419 ++v298; | |
5420 } | |
5421 while ( SHIDWORD(v733) < v297 ); | |
5422 } | |
5423 v302 = rand() % SLODWORD(v725); | |
5424 v303 = v679; | |
5425 v294->uSpecEnchantmentType = v679; | |
5426 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5427 v305 = v302 + 1; | |
5428 if ( v304 < v305 ) | |
5429 { | |
5430 for ( jj = &v679; ; jj = (int *)v732 ) | |
5431 { | |
5432 v307 = (int)(jj + 1); | |
5433 v732 = v307; | |
5434 v308 = *(int *)v307; | |
5435 v294->uSpecEnchantmentType = v308; | |
5436 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; | |
5437 if ( v304 >= v305 ) | |
5438 break; | |
5439 } | |
5440 } | |
5441 ++v294->uSpecEnchantmentType; | |
5442 } | |
5443 else | |
5444 { | |
5445 v293 = rand(); | |
5446 v294 = _this; | |
5447 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; | |
5448 _this->uEnchantmentType = 0; | |
5449 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; | |
5450 ; | |
5451 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType | |
5452 + 1] ) | |
5453 { | |
5454 ++v294->uEnchantmentType; | |
5455 if ( kk >= v295 ) | |
5456 break; | |
5457 } | |
5458 v294->_bonus_strength = 10//pItemsTable->field_116D8[18] | |
5459 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); | |
5460 } | |
5461 v294->uAttributes |= 0x20u; | |
5462 dword_50C9A8 = 256; | |
5463 LODWORD(v727) = 1; | |
5464 goto play_sound_and_continue; | |
5465 | |
5466 case SPELL_WATER_TOWN_PORTAL: | |
5467 amount = 10 * v2; | |
5468 if ( pPlayer->sMana < (signed int)uRequiredMana ) | |
5469 goto play_sound_and_continue; | |
5470 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | |
5471 { | |
5472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5473 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5474 v3->spellnum = 0; | |
5475 goto LABEL_1166; | |
5476 } | |
5477 town_portal_caster_id = LOBYTE(v3->uPlayerID); | |
5478 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | |
5479 LODWORD(v727) = 1; | |
5480 goto play_sound_and_continue; | |
5481 case 33: | |
5482 LODWORD(v733) = 604800 * v2; | |
5483 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | |
5484 { | |
5485 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5486 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5487 v3->spellnum = 0; | |
5488 goto LABEL_1166; | |
5489 } | |
5490 v319 = uRequiredMana; | |
5491 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | |
5492 { | |
5493 pEventTimer->Pause(); | |
5494 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | |
5495 qword_506350 = (signed int)v733; | |
5496 _506348_current_lloyd_playerid = v3->uPlayerID; | |
5497 ::uRequiredMana = v319; | |
5498 ::sRecoveryTime = sRecoveryTime; | |
5499 dword_50633C = v3->sound_id; | |
5500 dword_506338 = v3->spellnum; | |
5501 LOBYTE(v3->field_8) |= 0x20u; | |
5502 } | |
5503 goto play_sound_and_continue; | |
5504 case 40: | |
5505 v320 = v731 - 2; | |
5506 if ( !v320 ) | |
5507 goto LABEL_632; | |
5508 v321 = v320 - 1; | |
5509 if ( v321 ) | |
5510 { | |
5511 if ( v321 == 1 ) | |
5512 goto LABEL_634; | |
5513 LABEL_632: | |
5514 v322 = 3600 * v2; | |
5515 } | |
5516 else | |
5517 { | |
5518 v322 = 86400 * v2; | |
5519 } | |
5520 amount = v322; | |
5521 LABEL_634: | |
5522 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5523 goto play_sound_and_continue; | |
5524 v323 = v3->uPlayerID_2; | |
5525 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | |
5526 if ( !pParty->pPlayers[v323].pConditions[15] ) | |
5527 { | |
5528 LODWORD(v727) = 1; | |
5529 goto play_sound_and_continue; | |
5530 } | |
5531 if ( v731 == 4 ) | |
5532 { | |
5533 *(int *)v324 = 0; | |
5534 *((int *)v324 + 1) = 0; | |
5535 LODWORD(v727) = 1; | |
5536 goto play_sound_and_continue; | |
5537 } | |
5538 v732 = amount << 7; | |
5539 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
5540 v656 = 15; | |
5541 goto LABEL_640; | |
5542 | |
5543 case 41: | |
5544 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5545 goto play_sound_and_continue; | |
5546 a1.stru_24.Reset(); | |
5547 a1.spell_id = v3->spellnum; | |
5548 a1.spell_level = v2; | |
5549 a1.spell_skill = v731; | |
5550 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5551 a1.vPosition.y = pParty->vPosition.y; | |
5552 a1.vPosition.x = pParty->vPosition.x; | |
5553 a1.uAttributes = 0; | |
5554 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5555 a1.uSectorID = pIndoor->GetSector( | |
5556 pParty->vPosition.x, | |
5557 pParty->vPosition.y, | |
5558 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | |
5559 a1.uSpriteFrameID = 0; | |
5560 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5561 a1.spell_target_pid = a2; | |
5562 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
5563 a1.uFacing = LOWORD(pParty->sRotationY); | |
5564 a1.uSoundID = LOWORD(v3->sound_id); | |
5565 if ( pParty->bTurnBasedModeOn == 1 ) | |
5566 LOBYTE(a1.uAttributes) |= 4u; | |
5567 | |
5568 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
5569 if ( a1.Create(pParty->sRotationY, pParty->sRotationX, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
5570 ++pTurnEngine->field_1C; | |
5571 LODWORD(v727) = 1; | |
5572 goto play_sound_and_continue; | |
5573 | |
5574 case 43: | |
5575 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
5576 { | |
5577 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
5578 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
5579 v3->spellnum = 0; | |
5580 goto LABEL_1166; | |
5581 } | |
5582 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5583 goto play_sound_and_continue; | |
5584 a1.uType = 4090; | |
5585 a1.stru_24.Reset(); | |
5586 a1.spell_id = v3->spellnum; | |
5587 a1.spell_level = v2; | |
5588 a1.spell_skill = v731; | |
5589 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5590 a1.vPosition.x = pParty->vPosition.x; | |
5591 a1.vPosition.y = pParty->vPosition.y; | |
5592 a1.uAttributes = 0; | |
5593 a1.uSectorID = 0; | |
5594 a1.uSpriteFrameID = 0; | |
5595 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
5596 a1.field_60_distance_related_prolly_lod = 0; | |
5597 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5598 a1.spell_target_pid = a2; | |
5599 a1.uFacing = LOWORD(pParty->sRotationY); | |
5600 a1.uSoundID = LOWORD(v3->sound_id); | |
5601 if ( pParty->bTurnBasedModeOn == 1 ) | |
5602 a1.uAttributes = 4; | |
5603 | |
5604 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
5605 if ( a1.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
5606 ++pTurnEngine->field_1C; | |
5607 LODWORD(v727) = 1; | |
5608 goto play_sound_and_continue; | |
5609 | |
5610 case SPELL_SPIRIT_DETECT_LIFE: | |
5611 v328 = v731 - 2; | |
5612 if ( v328 ) | |
5613 { | |
5614 v329 = v328 - 1; | |
5615 if ( v329 && v329 != 1 ) | |
5616 v330 = 600 * v2; | |
5617 else | |
5618 v330 = 3600 * v2; | |
5619 } | |
5620 else | |
5621 { | |
5622 v330 = 1800 * v2; | |
5623 } | |
5624 LODWORD(v733) = v330; | |
5625 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5626 goto play_sound_and_continue; | |
5627 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
5628 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
5629 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
5630 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
5631 | |
5632 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
5633 LODWORD(v727) = 1; | |
5634 goto play_sound_and_continue; | |
5635 | |
5636 case SPELL_SPIRIT_FATE: | |
5637 LODWORD(v733) = 300; | |
5638 v339 = v731 - 2; | |
5639 if ( v339 ) | |
5640 { | |
5641 v340 = v339 - 1; | |
5642 if ( v340 ) | |
5643 { | |
5644 if ( v340 != 1 ) | |
5645 { | |
5646 amount = v2; | |
5647 goto LABEL_667; | |
5648 } | |
5649 v341 = 6 * v2; | |
5650 } | |
5651 else | |
5652 { | |
5653 v341 = 4 * v2; | |
5654 } | |
5655 } | |
5656 else | |
5657 { | |
5658 v341 = 2 * v2; | |
5659 } | |
5660 amount = v341; | |
5661 LABEL_667: | |
5662 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5663 goto play_sound_and_continue; | |
5664 v342 = v3->spell_target_pid; | |
5665 if ( v342 == 0 ) | |
5666 { | |
5667 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5668 | |
5669 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | |
5670 LODWORD(v727) = 1; | |
5671 goto play_sound_and_continue; | |
5672 } | |
5673 if (PID_TYPE(v342) == OBJECT_Actor) | |
5674 { | |
5675 v343 = PID_ID(v342); | |
5676 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); | |
5677 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; | |
5678 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); | |
5679 BYTE2(pActors[v343].uAttributes) |= 8u; | |
5680 v672 = 0; | |
5681 v661 = &pActors[v343]; | |
5682 LABEL_165: | |
5683 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); | |
5684 } | |
5685 LODWORD(v727) = 1; | |
5686 goto play_sound_and_continue; | |
5687 | |
5688 case 49: | |
5689 v348 = v731 - 2; | |
5690 if ( !v348 ) | |
5691 goto LABEL_677; | |
5692 v349 = v348 - 1; | |
5693 if ( v349 ) | |
5694 { | |
5695 if ( v349 == 1 ) | |
5696 { | |
5697 amount = 0; | |
5698 goto LABEL_679; | |
5699 } | |
5700 LABEL_677: | |
5701 v350 = 3600 * v2; | |
5702 } | |
5703 else | |
5704 { | |
5705 v350 = 86400 * v2; | |
5706 } | |
5707 amount = v350; | |
5708 LABEL_679: | |
5709 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5710 goto play_sound_and_continue; | |
5711 v351 = &pParty->pPlayers[v3->uPlayerID_2]; | |
5712 if ( !v351->pConditions[0] ) | |
5713 { | |
5714 LODWORD(v727) = 1; | |
5715 goto play_sound_and_continue; | |
5716 } | |
5717 if ( v731 == 4 ) | |
5718 { | |
5719 LODWORD(v351->pConditions[0]) = 0; | |
5720 HIDWORD(v351->pConditions[0]) = 0; | |
5721 } | |
5722 else | |
5723 { | |
5724 v732 = amount << 7; | |
5725 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
5726 if ( HIDWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) ) | |
5727 { | |
5728 LODWORD(v727) = 1; | |
5729 goto play_sound_and_continue; | |
5730 } | |
5731 } | |
5732 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5733 LODWORD(v727) = 1; | |
5734 goto play_sound_and_continue; | |
5735 | |
5736 case SPELL_SPIRIT_PRESERVATION: | |
5737 v354 = v731 - 2; | |
5738 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) | |
5739 v356 = 900 * (v2 + 4); | |
5740 else | |
5741 v356 = 300 * (v2 + 12); | |
5742 LODWORD(v733) = v356; | |
5743 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5744 goto play_sound_and_continue; | |
5745 if ( v731 == 1 || v731 == 2 ) | |
5746 { | |
5747 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5748 | |
5749 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | |
5750 LODWORD(v727) = 1; | |
5751 goto play_sound_and_continue; | |
5752 } | |
5753 a2 = 0; | |
5754 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
5755 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | |
5756 do | |
5757 { | |
5758 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
5759 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | |
5760 ++a2; | |
5761 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | |
5762 } | |
5763 while ( v357 <= &pParty->pPlayers[3] ); | |
5764 LODWORD(v727) = 1; | |
5765 goto play_sound_and_continue; | |
5766 | |
5767 case 48: | |
5768 { | |
5769 v364 = v731 - 2; | |
5770 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 ) | |
5771 v366 = 60 * (v2 + 3); | |
5772 else | |
5773 v366 = 300 * v2 + 180; | |
5774 LODWORD(v733) = v366; | |
5775 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5776 goto play_sound_and_continue; | |
5777 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
5778 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | |
5779 ++a1.uType; | |
5780 a1.stru_24.Reset(); | |
5781 a1.spell_id = v3->spellnum; | |
5782 a1.spell_level = v2; | |
5783 a1.spell_skill = v731; | |
5784 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
5785 a1.uAttributes = 0; | |
5786 a1.uSectorID = 0; | |
5787 a1.uSpriteFrameID = 0; | |
5788 a1.field_60_distance_related_prolly_lod = 0; | |
5789 a1.uFacing = 0; | |
5790 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
5791 a1.uSoundID = LOWORD(v3->sound_id); | |
5792 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
5793 { | |
5794 v369 = &pActors[dword_50BF30[a2]]; | |
5795 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5796 { | |
5797 a1.vPosition.x = v369->vPosition.x; | |
5798 a1.vPosition.y = v369->vPosition.y; | |
5799 a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | |
5800 | |
5801 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
5802 a1.Create(0, 0, 0, 0); | |
5803 v369->pActorBuffs[4].Apply( | |
5804 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
5805 v731, 0, 0, 0); | |
5806 } | |
5807 } | |
5808 LODWORD(v727) = 1; | |
5809 } | |
5810 goto play_sound_and_continue; | |
5811 | |
5812 case 53: | |
5813 v371 = v731 - 2; | |
5814 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 ) | |
5815 amount = 0; | |
5816 else | |
5817 amount = 86400 * v2; | |
5818 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5819 goto play_sound_and_continue; | |
5820 pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); | |
5821 v373 = v3->uPlayerID_2; | |
5822 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | |
5823 { | |
5824 LODWORD(v727) = 1; | |
5825 goto play_sound_and_continue; | |
5826 } | |
5827 v14 = v731 == 4; | |
5828 pParty->pPlayers[v373].sHealth = 1; | |
5829 if ( v14 ) | |
5830 { | |
5831 v374 = v3->uPlayerID_2; | |
5832 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
5833 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | |
5834 v376 = v3->uPlayerID_2; | |
5835 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5836 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | |
5837 } | |
5838 else | |
5839 { | |
5840 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5841 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5842 0xEu, | |
5843 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5844 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
5845 0xDu, | |
5846 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5847 } | |
5848 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
5849 goto LABEL_720; | |
5850 case 54: | |
5851 v378 = v731 - 2; | |
5852 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 ) | |
5853 v380 = 4 * v2; | |
5854 else | |
5855 v380 = 3 * v2; | |
5856 amount = v380; | |
5857 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5858 goto play_sound_and_continue; | |
5859 v381 = 0; | |
5860 HIDWORD(v733) = amount; | |
5861 v730 = 0; | |
5862 v382 = 1; | |
5863 do | |
5864 { | |
5865 v383 = pPlayers[v382]; | |
5866 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] ) | |
5867 v682[v381++] = v382; | |
5868 ++v382; | |
5869 } | |
5870 while ( v382 <= 4 ); | |
5871 v384 = 0; | |
5872 v730 = v381; | |
5873 if ( v381 > 0 ) | |
5874 { | |
5875 do | |
5876 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth; | |
5877 while ( v384 < v381 ); | |
5878 } | |
5879 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730); | |
5880 HIDWORD(v733) = 0; | |
5881 if ( v381 > 0 ) | |
5882 { | |
5883 do | |
5884 { | |
5885 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]]; | |
5886 v726 = pPlayers[v682[HIDWORD(v733)]]; | |
5887 v726->sHealth = v732; | |
5888 //v386 = v726->GetMaxHealth(); | |
5889 if ( v726->sHealth > v726->GetMaxHealth()) | |
5890 v726->sHealth = v726->GetMaxHealth(); | |
5891 if ( v726->sHealth > 0 ) | |
5892 { | |
5893 v726->pConditions[Player::Condition_Unconcious] = 0; | |
5894 } | |
5895 v388 = HIDWORD(v733); | |
5896 | |
5897 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); | |
5898 HIDWORD(v733) = v388 + 1; | |
5899 } | |
5900 while ( v388 + 1 < v730 ); | |
5901 } | |
5902 LODWORD(v727) = 1; | |
5903 goto play_sound_and_continue; | |
5904 | |
5905 case 55: | |
5906 v392 = v731 - 1; | |
5907 if ( !v392 ) | |
5908 { | |
5909 v395 = 180 * v2; | |
5910 goto LABEL_750; | |
5911 } | |
5912 v393 = v392 - 1; | |
5913 if ( !v393 ) | |
5914 { | |
5915 v395 = 10800 * v2; | |
5916 goto LABEL_750; | |
5917 } | |
5918 v394 = v393 - 1; | |
5919 if ( !v394 ) | |
5920 { | |
5921 v395 = 259200 * v2; | |
5922 LABEL_750: | |
5923 amount = v395; | |
5924 goto LABEL_751; | |
5925 } | |
5926 if ( v394 == 1 ) | |
5927 amount = 0; | |
5928 LABEL_751: | |
5929 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5930 goto play_sound_and_continue; | |
5931 v396 = v3->uPlayerID_2; | |
5932 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | |
5933 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | |
5934 { | |
5935 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | |
5936 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | |
5937 if ( v731 == 4 ) | |
5938 { | |
5939 v397 = v3->uPlayerID_2; | |
5940 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
5941 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | |
5942 v398 = v3->uPlayerID_2; | |
5943 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
5944 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | |
5945 v399 = v3->uPlayerID_2; | |
5946 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5947 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | |
5948 } | |
5949 else | |
5950 { | |
5951 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
5952 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | |
5953 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5954 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | |
5955 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5956 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | |
5957 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
5958 } | |
5959 pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); | |
5960 | |
5961 pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; | |
5962 | |
5963 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5964 } | |
5965 LODWORD(v727) = 1; | |
5966 goto play_sound_and_continue; | |
5967 | |
5968 case 61: | |
5969 v405 = v731 - 2; | |
5970 if ( !v405 ) | |
5971 goto LABEL_766; | |
5972 v406 = v405 - 1; | |
5973 if ( v406 ) | |
5974 { | |
5975 if ( v406 == 1 ) | |
5976 { | |
5977 amount = 0; | |
5978 goto LABEL_768; | |
5979 } | |
5980 LABEL_766: | |
5981 v407 = 3600 * v2; | |
5982 } | |
5983 else | |
5984 { | |
5985 v407 = 86400 * v2; | |
5986 } | |
5987 amount = v407; | |
5988 LABEL_768: | |
5989 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
5990 goto play_sound_and_continue; | |
5991 | |
5992 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
5993 v323 = v3->uPlayerID_2; | |
5994 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | |
5995 if ( !pParty->pPlayers[v323].pConditions[12] ) | |
5996 { | |
5997 LODWORD(v727) = 1; | |
5998 goto play_sound_and_continue; | |
5999 } | |
6000 if ( v731 == 4 ) | |
6001 { | |
6002 *(int *)v324 = 0; | |
6003 *((int *)v324 + 1) = 0; | |
6004 LODWORD(v727) = 1; | |
6005 goto play_sound_and_continue; | |
6006 } | |
6007 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6008 v656 = 12; | |
6009 goto LABEL_640; | |
6010 | |
6011 | |
6012 case 56: | |
6013 v411 = v731 - 2; | |
6014 if ( v411 ) | |
6015 { | |
6016 v412 = v411 - 1; | |
6017 if ( v412 ) | |
6018 { | |
6019 if ( v412 == 1 ) | |
6020 { | |
6021 amount = 0; | |
6022 goto LABEL_780; | |
6023 } | |
6024 v413 = 180 * v2; | |
6025 } | |
6026 else | |
6027 { | |
6028 v413 = 86400 * v2; | |
6029 } | |
6030 } | |
6031 else | |
6032 { | |
6033 v413 = 3600 * v2; | |
6034 } | |
6035 amount = v413; | |
6036 LABEL_780: | |
6037 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6038 goto play_sound_and_continue; | |
6039 | |
6040 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6041 v323 = v3->uPlayerID_2; | |
6042 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | |
6043 if ( !pParty->pPlayers[v323].pConditions[3] ) | |
6044 { | |
6045 LODWORD(v727) = 1; | |
6046 goto play_sound_and_continue; | |
6047 } | |
6048 if ( v731 == 4 ) | |
6049 { | |
6050 *(int *)v324 = 0; | |
6051 *((int *)v324 + 1) = 0; | |
6052 LODWORD(v727) = 1; | |
6053 goto play_sound_and_continue; | |
6054 } | |
6055 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6056 v656 = 3; | |
6057 goto LABEL_640; | |
6058 | |
6059 case 59: | |
6060 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6061 goto play_sound_and_continue; | |
6062 if (PID_TYPE(a2) != OBJECT_Actor) | |
6063 { | |
6064 LODWORD(v727) = 1; | |
6065 goto play_sound_and_continue; | |
6066 } | |
6067 v417 = (int)&pActors[PID_ID(a2)]; | |
6068 v730 = v417; | |
6069 if ( !(*(char *)(v417 + 38) & 0x80) ) | |
6070 { | |
6071 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); | |
6072 v417 = v730; | |
6073 } | |
6074 v418 = *(int *)(v417 + 672); | |
6075 HIDWORD(v733) = 0; | |
6076 if ( pItemsTable->pItems[v418].uEquipType == 18 ) | |
6077 HIDWORD(v733) = *(int *)(v417 + 684); | |
6078 | |
6079 //ItemGen::ItemGen(&v683); | |
6080 v683.Reset(); | |
6081 | |
6082 v419 = *(short *)(v730 + 180); | |
6083 if (v419) | |
6084 { | |
6085 v683.uItemID = v419; | |
6086 goto LABEL_799; | |
6087 } | |
6088 v420 = 0; | |
6089 v421 = v730 + 564; | |
6090 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) | |
6091 { | |
6092 ++v420; | |
6093 v421 += 36; | |
6094 if ( v420 >= 4 ) | |
6095 goto LABEL_799; | |
6096 } | |
6097 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); | |
6098 v2 = v723; | |
6099 //v1 = 0; | |
6100 LABEL_799: | |
6101 if ( HIDWORD(v733) != 0 ) | |
6102 { | |
6103 v675 = (const char *)HIDWORD(v733); | |
6104 if (v683.uItemID) | |
6105 { | |
6106 v422 = v683.GetDisplayName(); | |
6107 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | |
6108 goto LABEL_807; | |
6109 } | |
6110 v664 = "%d gold"; | |
6111 goto LABEL_803; | |
6112 } | |
6113 if (v683.uItemID) | |
6114 { | |
6115 v675 = v683.GetDisplayName(); | |
6116 v664 = "(%s)"; | |
6117 LABEL_803: | |
6118 sprintf(pTmpBuf2, v664, v675); | |
6119 goto LABEL_807; | |
6120 } | |
6121 strcpy(pTmpBuf2, "nothing"); | |
6122 LABEL_807: | |
6123 ShowStatusBarString(pTmpBuf2, 2u); | |
6124 a1.stru_24.Reset(); | |
6125 a1.spell_id = v3->spellnum; | |
6126 a1.spell_level = v2; | |
6127 a1.spell_skill = v731; | |
6128 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6129 a1.vPosition.x = *(short *)(v730 + 142); | |
6130 a1.vPosition.y = *(short *)(v730 + 144); | |
6131 v676 = *(short *)(v730 + 138); | |
6132 v665 = a1.vPosition.y; | |
6133 a1.vPosition.z = *(short *)(v730 + 138); | |
6134 v657 = a1.vPosition.x; | |
6135 goto LABEL_1087; | |
6136 case 62: | |
6137 v423 = v731 - 2; | |
6138 if ( !v423 ) | |
6139 goto LABEL_813; | |
6140 v424 = v423 - 1; | |
6141 if ( v424 ) | |
6142 { | |
6143 if ( v424 == 1 ) | |
6144 v425 = 3600 * v2; | |
6145 else | |
6146 LABEL_813: | |
6147 v425 = 300 * v2; | |
6148 } | |
6149 else | |
6150 { | |
6151 v425 = 600 * v2; | |
6152 } | |
6153 amount = v425; | |
6154 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6155 goto play_sound_and_continue; | |
6156 v426 = PID_ID(a2); | |
6157 if (PID_TYPE(a2) != OBJECT_Actor) | |
6158 { | |
6159 LODWORD(v727) = 1; | |
6160 goto play_sound_and_continue; | |
6161 } | |
6162 v730 = 836 * v426; | |
6163 if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) | |
6164 { | |
6165 pActors[v426].pActorBuffs[1].Reset(); | |
6166 pActors[v426].pActorBuffs[12].Reset(); | |
6167 pActors[v426].pActorBuffs[9].Apply( | |
6168 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6169 v731, 0, 0, 0); | |
6170 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6171 } | |
6172 a1.stru_24.Reset(); | |
6173 a1.spell_id = v3->spellnum; | |
6174 a1.spell_level = v2; | |
6175 a1.spell_skill = v731; | |
6176 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
6177 v61 = v426; | |
6178 goto LABEL_1086; | |
6179 | |
6180 | |
6181 case 66: | |
6182 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6183 goto play_sound_and_continue; | |
6184 amount = 600 * v2; | |
6185 if (PID_TYPE(a2) != OBJECT_Actor) | |
6186 { | |
6187 LODWORD(v727) = 1; | |
6188 goto play_sound_and_continue; | |
6189 } | |
6190 v730 = 836 * PID_ID(a2); | |
6191 if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6192 goto play_sound_and_continue; | |
6193 if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | |
6194 { | |
6195 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
6196 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
6197 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6198 v731, 0, 0, 0); | |
6199 } | |
6200 a1.stru_24.Reset(); | |
6201 a1.spell_id = v3->spellnum; | |
6202 a1.spell_level = v2; | |
6203 a1.spell_skill = v731; | |
6204 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
6205 v61 = PID_ID(a2); | |
6206 goto LABEL_1086; | |
6207 | |
6208 case 63: | |
6209 { | |
6210 v428 = v731 - 2; | |
6211 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) | |
6212 v430 = 300 * v2; | |
6213 else | |
6214 v430 = 180 * v2; | |
6215 amount = v430; | |
6216 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6217 goto play_sound_and_continue; | |
6218 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6219 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | |
6220 ++a1.uType; | |
6221 a1.stru_24.Reset(); | |
6222 a1.spell_id = v3->spellnum; | |
6223 a1.spell_level = v2; | |
6224 a1.spell_skill = v731; | |
6225 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6226 a1.uAttributes = 0; | |
6227 a1.uSectorID = 0; | |
6228 a1.uSpriteFrameID = 0; | |
6229 a1.field_60_distance_related_prolly_lod = 0; | |
6230 a1.uFacing = 0; | |
6231 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6232 a1.uSoundID = LOWORD(v3->sound_id); | |
6233 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | |
6234 { | |
6235 v433 = &pActors[dword_50BF30[a2]]; | |
6236 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
6237 break; | |
6238 a1.vPosition.x = v433->vPosition.x; | |
6239 a1.vPosition.y = v433->vPosition.y; | |
6240 a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | |
6241 | |
6242 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6243 a1.Create(0, 0, 0, 0); | |
6244 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | |
6245 { | |
6246 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | |
6247 v731, 0, 0, 0); | |
6248 } | |
6249 } | |
6250 LODWORD(v727) = 1; | |
6251 goto play_sound_and_continue; | |
6252 } | |
6253 | |
6254 case 64: | |
6255 v435 = v731 - 2; | |
6256 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 ) | |
6257 amount = 0; | |
6258 else | |
6259 amount = 86400 * v2; | |
6260 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6261 goto play_sound_and_continue; | |
6262 | |
6263 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6264 v440 = v3->uPlayerID_2; | |
6265 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | |
6266 { | |
6267 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | |
6268 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | |
6269 if ( v731 == 4 ) | |
6270 { | |
6271 v441 = v3->uPlayerID_2; | |
6272 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
6273 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | |
6274 } | |
6275 else | |
6276 { | |
6277 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | |
6278 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | |
6279 } | |
6280 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6281 LABEL_720: | |
6282 v377->SetCondition(1, 0); | |
6283 } | |
6284 LODWORD(v727) = 1; | |
6285 goto play_sound_and_continue; | |
6286 | |
6287 case 42: | |
6288 v442 = v731 - 2; | |
6289 if ( !v442 ) | |
6290 goto LABEL_855; | |
6291 v443 = v442 - 1; | |
6292 if ( v443 ) | |
6293 { | |
6294 if ( v443 == 1 ) | |
6295 v444 = 4 * v2; | |
6296 else | |
6297 LABEL_855: | |
6298 v444 = 2 * v2; | |
6299 } | |
6300 else | |
6301 { | |
6302 v444 = 3 * v2; | |
6303 } | |
6304 amount = v444; | |
6305 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6306 goto play_sound_and_continue; | |
6307 v445 = PID_ID(a2); | |
6308 if (PID_TYPE(a2) == OBJECT_Item) | |
6309 { | |
6310 v449 = (char *)&pSpriteObjects[v445].stru_24; | |
6311 v450 = *(int *)v449; | |
6312 if ( pItemsTable->pItems[v450].uEquipType == 18 ) | |
6313 { | |
6314 party_finds_gold(*((int *)v449 + 3), 0); | |
6315 viewparams->bRedrawGameUI = 1; | |
6316 } | |
6317 else | |
6318 { | |
6319 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); | |
6320 ShowStatusBarString(pTmpBuf2, 2u); | |
6321 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) ) | |
6322 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); | |
6323 } | |
6324 SpriteObject::OnInteraction(v445); | |
6325 } | |
6326 else | |
6327 { | |
6328 if (PID_TYPE(a2) == OBJECT_Actor) | |
6329 { | |
6330 stru_50C198.LootActor(&pActors[v445]); | |
6331 } | |
6332 else | |
6333 { | |
6334 if (PID_TYPE(a2) != OBJECT_Decoration) | |
6335 { | |
6336 if (PID_TYPE(a2) != OBJECT_BModel) | |
6337 { | |
6338 LODWORD(v727) = 1; | |
6339 goto play_sound_and_continue; | |
6340 } | |
6341 dword_507CD8 = 1; | |
6342 v677 = 1; | |
6343 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6344 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; | |
6345 else | |
6346 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; | |
6347 | |
6348 EventProcessor(v446, a2, v677); | |
6349 LODWORD(v727) = 1; | |
6350 goto play_sound_and_continue; | |
6351 } | |
6352 v447 = &pLevelDecorations[v445]; | |
6353 dword_507CD8 = 1; | |
6354 v448 = v447->field_16_event_id; | |
6355 if (v448) | |
6356 { | |
6357 v677 = 1; | |
6358 v446 = v448; | |
6359 EventProcessor(v446, a2, v677); | |
6360 LODWORD(v727) = 1; | |
6361 goto play_sound_and_continue; | |
6362 } | |
6363 if ( v447->IsInteractive() ) | |
6364 { | |
6365 activeLevelDecoration = v447; | |
6366 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); | |
6367 activeLevelDecoration = NULL; | |
6368 } | |
6369 } | |
6370 } | |
6371 LODWORD(v727) = 1; | |
6372 goto play_sound_and_continue; | |
6373 | |
6374 case 67: | |
6375 v451 = v731 - 2; | |
6376 if ( v451 ) | |
6377 { | |
6378 v452 = v451 - 1; | |
6379 if ( v452 ) | |
6380 { | |
6381 if ( v452 == 1 ) | |
6382 { | |
6383 amount = 0; | |
6384 goto LABEL_883; | |
6385 } | |
6386 v453 = 180 * v2; | |
6387 } | |
6388 else | |
6389 { | |
6390 v453 = 86400 * v2; | |
6391 } | |
6392 } | |
6393 else | |
6394 { | |
6395 v453 = 3600 * v2; | |
6396 } | |
6397 amount = v453; | |
6398 LABEL_883: | |
6399 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6400 goto play_sound_and_continue; | |
6401 | |
6402 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6403 v323 = v3->uPlayerID_2; | |
6404 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | |
6405 if ( !pParty->pPlayers[v323].pConditions[1] ) | |
6406 { | |
6407 LODWORD(v727) = 1; | |
6408 goto play_sound_and_continue; | |
6409 } | |
6410 if ( v731 == 4 ) | |
6411 { | |
6412 *(int *)v324 = 0; | |
6413 *((int *)v324 + 1) = 0; | |
6414 LODWORD(v727) = 1; | |
6415 goto play_sound_and_continue; | |
6416 } | |
6417 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | |
6418 v656 = 1; | |
6419 LABEL_640: | |
6420 v325 = &pParty->pPlayers[v323]; | |
6421 goto LABEL_641; | |
6422 | |
6423 case 68: | |
6424 v457 = v731 - 2; | |
6425 if ( v457 ) | |
6426 { | |
6427 v458 = v457 - 1; | |
6428 if ( v458 ) | |
6429 { | |
6430 if ( v458 == 1 ) | |
6431 v459 = 5 * v2 + 5; | |
6432 else | |
6433 v459 = 2 * v2 + 5; | |
6434 } | |
6435 else | |
6436 { | |
6437 v459 = 4 * v2 + 5; | |
6438 } | |
6439 } | |
6440 else | |
6441 { | |
6442 v459 = 3 * v2 + 5; | |
6443 } | |
6444 amount = v459; | |
6445 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6446 goto play_sound_and_continue; | |
6447 v460 = v3->spell_target_pid; | |
6448 if (!v460) | |
6449 { | |
6450 pParty->pPlayers[v3->uPlayerID_2].Heal(amount); | |
6451 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6452 } | |
6453 else | |
6454 { | |
6455 if (PID_TYPE(v460) == OBJECT_Actor) | |
6456 { | |
6457 v461 = &pActors[PID_ID(v460)]; | |
6458 v462 = v461->uAIState; | |
6459 v463 = v461->pMonsterInfo.uHP; | |
6460 if ( v462 != 5 ) | |
6461 { | |
6462 if ( v462 != 4 ) | |
6463 { | |
6464 if ( v462 != 19 ) | |
6465 { | |
6466 if ( v462 != 11 ) | |
6467 { | |
6468 v461->sCurrentHP += amount; | |
6469 if ( v461->sCurrentHP > v463 ) | |
6470 v461->sCurrentHP = v463; | |
6471 } | |
6472 } | |
6473 } | |
6474 } | |
6475 } | |
6476 } | |
6477 LODWORD(v727) = 1; | |
6478 goto play_sound_and_continue; | |
6479 | |
6480 case 72: | |
6481 v464 = v731 - 2; | |
6482 if ( !v464 ) | |
6483 goto LABEL_910; | |
6484 v465 = v464 - 1; | |
6485 if ( v465 ) | |
6486 { | |
6487 if ( v465 == 1 ) | |
6488 { | |
6489 amount = 0; | |
6490 goto LABEL_912; | |
6491 } | |
6492 LABEL_910: | |
6493 v466 = 3600 * v2; | |
6494 } | |
6495 else | |
6496 { | |
6497 v466 = 86400 * v2; | |
6498 } | |
6499 amount = v466; | |
6500 LABEL_912: | |
6501 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6502 goto play_sound_and_continue; | |
6503 | |
6504 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6505 v470 = v3->uPlayerID_2; | |
6506 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | |
6507 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | |
6508 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | |
6509 { | |
6510 LODWORD(v727) = 1; | |
6511 goto play_sound_and_continue; | |
6512 } | |
6513 if ( v731 == 4 ) | |
6514 { | |
6515 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6516 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | |
6517 v471 = v3->uPlayerID_2; | |
6518 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
6519 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | |
6520 v472 = v3->uPlayerID_2; | |
6521 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6522 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | |
6523 LODWORD(v727) = 1; | |
6524 goto play_sound_and_continue; | |
6525 } | |
6526 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6527 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | |
6528 6u, | |
6529 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6530 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6531 8u, | |
6532 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6533 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6534 v656 = 10; | |
6535 goto LABEL_937; | |
6536 | |
6537 | |
6538 case 75: | |
6539 amount = v2; | |
6540 LODWORD(v733) = 3600 * v2; | |
6541 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6542 goto play_sound_and_continue; | |
6543 | |
6544 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6545 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6546 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6547 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6548 | |
6549 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | |
6550 LODWORD(v727) = 1; | |
6551 goto play_sound_and_continue; | |
6552 | |
6553 case 73: | |
6554 LODWORD(v733) = 3600 * v2; | |
6555 amount = v2; | |
6556 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6557 goto play_sound_and_continue; | |
6558 if ( v731 == 4 ) | |
6559 { | |
6560 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6561 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6562 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6563 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6564 v732 = (int)v733 << 7; | |
6565 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
6566 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6567 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6568 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | |
6569 | |
6570 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | |
6571 LODWORD(v727) = 1; | |
6572 goto play_sound_and_continue; | |
6573 } | |
6574 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6575 | |
6576 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | |
6577 LODWORD(v727) = 1; | |
6578 goto play_sound_and_continue; | |
6579 | |
6580 case 74: | |
6581 v493 = v731 - 2; | |
6582 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) | |
6583 amount = 0; | |
6584 else | |
6585 amount = 86400 * v2; | |
6586 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6587 goto play_sound_and_continue; | |
6588 | |
6589 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
6590 v498 = v3->uPlayerID_2; | |
6591 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | |
6592 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | |
6593 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | |
6594 { | |
6595 LODWORD(v727) = 1; | |
6596 goto play_sound_and_continue; | |
6597 } | |
6598 if ( v731 == 4 ) | |
6599 { | |
6600 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6601 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | |
6602 v499 = v3->uPlayerID_2; | |
6603 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
6604 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | |
6605 v500 = v3->uPlayerID_2; | |
6606 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6607 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | |
6608 } | |
6609 else | |
6610 { | |
6611 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | |
6612 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | |
6613 7u, | |
6614 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6615 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | |
6616 9u, | |
6617 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | |
6618 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | |
6619 v656 = 11; | |
6620 LABEL_937: | |
6621 v325 = &pParty->pPlayers[v3->uPlayerID_2]; | |
6622 LABEL_641: | |
6623 v325->DiscardConditionIfLastsLongerThan(v656, v663); | |
6624 } | |
6625 LODWORD(v727) = 1; | |
6626 goto play_sound_and_continue; | |
6627 | |
6628 case 77: | |
6629 { | |
6630 amount = 5 * v2 + 10; | |
6631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6632 goto play_sound_and_continue; | |
6633 v501 = pParty->pPlayers; | |
6634 int v1 = 0; | |
6635 do | |
6636 { | |
6637 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); | |
6638 v501->Heal(amount); | |
6639 ++v501; | |
6640 ++v1; | |
6641 } | |
6642 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | |
6643 LODWORD(v727) = 1; | |
6644 goto play_sound_and_continue; | |
6645 } | |
6646 case 80: | |
6647 sRecoveryTime -= v2; | |
6648 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6649 goto play_sound_and_continue; | |
6650 | |
6651 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | |
6652 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6653 ++a1.uType; | |
6654 HIDWORD(v733) = v505; | |
6655 v688.x = 0; | |
6656 v688.y = 0; | |
6657 v688.z = 0; | |
6658 a1.stru_24.Reset(); | |
6659 a1.spell_id = v3->spellnum; | |
6660 a1.spell_level = v2; | |
6661 a1.spell_skill = v731; | |
6662 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6663 a1.uAttributes = 0; | |
6664 a1.uSectorID = 0; | |
6665 a1.uSpriteFrameID = 0; | |
6666 a1.field_60_distance_related_prolly_lod = 0; | |
6667 a1.uFacing = 0; | |
6668 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6669 a1.uSoundID = LOWORD(v3->sound_id); | |
6670 a2 = 0; | |
6671 if ( SHIDWORD(v733) > 0 ) | |
6672 { | |
6673 do | |
6674 { | |
6675 v507 = dword_50BF30[a2]; | |
6676 a1.vPosition.x = pActors[v507].vPosition.x; | |
6677 a1.vPosition.y = pActors[v507].vPosition.y; | |
6678 a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | |
6679 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6680 v509 = a1.Create(0, 0, 0, 0); | |
6681 v510 = a2; | |
6682 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | |
6683 a2 = v510 + 1; | |
6684 } | |
6685 while ( v510 + 1 < SHIDWORD(v733) ); | |
6686 } | |
6687 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | |
6688 { | |
6689 v511 = &pActors[dword_50BF30[a2]]; | |
6690 a1.vPosition.x = v511->vPosition.x; | |
6691 a1.vPosition.y = v511->vPosition.y; | |
6692 a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | |
6693 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6694 a1.Create(0, 0, 0, 0); | |
6695 v513 = v511->pActorBuffs; | |
6696 for (int _v726 = 22; _v726 != 0; --_v726) | |
6697 { | |
6698 v513->Reset(); | |
6699 ++v513; | |
6700 } | |
6701 } | |
6702 LODWORD(v727) = 1; | |
6703 goto play_sound_and_continue; | |
6704 | |
6705 case 82: | |
6706 v514 = v731 - 2; | |
6707 if ( !v514 ) | |
6708 goto LABEL_955; | |
6709 v515 = v514 - 1; | |
6710 if ( v515 ) | |
6711 { | |
6712 if ( v515 == 1 ) | |
6713 { | |
6714 v516 = 900 * v2; | |
6715 amount = 5; | |
6716 } | |
6717 else | |
6718 { | |
6719 LABEL_955: | |
6720 v516 = 300 * v2; | |
6721 amount = 1; | |
6722 } | |
6723 } | |
6724 else | |
6725 { | |
6726 v516 = 900 * v2; | |
6727 amount = 3; | |
6728 } | |
6729 v733 = __PAIR__(0, v516); | |
6730 | |
6731 if ( (signed int)uNumActors > 0 ) | |
6732 { | |
6733 v518 = pActors;//[0].uAIState; | |
6734 auto _v726 = uNumActors; | |
6735 do | |
6736 { | |
6737 v519 = v518->uAIState; | |
6738 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) | |
6739 ++HIDWORD(v733); | |
6740 ++v518; | |
6741 --_v726; | |
6742 } | |
6743 while ( _v726 != 0 ); | |
6744 } | |
6745 if ( SHIDWORD(v733) >= amount ) | |
6746 { | |
6747 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | |
6748 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6749 v3->spellnum = 0; | |
6750 goto LABEL_1166; | |
6751 } | |
6752 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6753 goto play_sound_and_continue; | |
6754 sub_44FA4C_spawn_light_elemental(v3->uPlayerID, v731, v733); | |
6755 LODWORD(v727) = 1; | |
6756 goto play_sound_and_continue; | |
6757 | |
6758 case 83: | |
6759 v520 = v731 - 2; | |
6760 if ( !v520 ) | |
6761 goto LABEL_973; | |
6762 v521 = v520 - 1; | |
6763 if ( v521 ) | |
6764 { | |
6765 if ( v521 == 1 ) | |
6766 { | |
6767 LODWORD(v733) = 18000 * v2; | |
6768 v522 = 5 * v2 + 10; | |
6769 } | |
6770 else | |
6771 { | |
6772 LABEL_973: | |
6773 LODWORD(v733) = 10800 * v2; | |
6774 v522 = 3 * v2 + 10; | |
6775 } | |
6776 } | |
6777 else | |
6778 { | |
6779 LODWORD(v733) = 14400 * v2; | |
6780 v522 = 4 * v2 + 10; | |
6781 } | |
6782 amount = v522; | |
6783 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6784 goto play_sound_and_continue; | |
6785 | |
6786 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6787 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6788 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6789 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6790 | |
6791 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | |
6792 LODWORD(v727) = 1; | |
6793 goto play_sound_and_continue; | |
6794 | |
6795 case 84: | |
6796 //v67 = 2; | |
6797 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6798 { | |
6799 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | |
6800 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6801 v3->spellnum = 0; | |
6802 goto LABEL_1166; | |
6803 } | |
6804 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6805 goto play_sound_and_continue; | |
6806 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | |
6807 ++a1.uType; | |
6808 v694.x = 0; | |
6809 v694.y = 0; | |
6810 v694.z = 0; | |
6811 a1.stru_24.Reset(); | |
6812 a1.spell_id = v3->spellnum; | |
6813 a1.spell_level = v2; | |
6814 a1.spell_skill = v731; | |
6815 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
6816 a1.uAttributes = 0; | |
6817 a1.uSectorID = 0; | |
6818 a1.uSpriteFrameID = 0; | |
6819 a1.field_60_distance_related_prolly_lod = 0; | |
6820 a1.uFacing = 0; | |
6821 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
6822 a1.uSoundID = LOWORD(v3->sound_id); | |
6823 a2 = 0; | |
6824 if ( (signed int)v531 > 0 ) | |
6825 { | |
6826 do | |
6827 { | |
6828 v533 = dword_50BF30[a2]; | |
6829 a1.vPosition.x = pActors[v533].vPosition.x; | |
6830 a1.vPosition.y = pActors[v533].vPosition.y; | |
6831 a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | |
6832 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
6833 v535 = a1.Create(0, 0, 0, 0); | |
6834 v536 = a2; | |
6835 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | |
6836 a2 = v536 + 1; | |
6837 } | |
6838 while ( v536 + 1 < (signed int)v531 ); | |
6839 } | |
6840 v537 = pGame->GetStru6(); | |
6841 pGame->GetStru6()->_4A8BFC(); | |
6842 LODWORD(v727) = 1; | |
6843 goto play_sound_and_continue; | |
6844 | |
6845 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
6846 { | |
6847 v538 = v731 - 2; | |
6848 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 ) | |
6849 { | |
6850 amount = 5 * v2; | |
6851 v540 = 18000 * v2; | |
6852 } | |
6853 else | |
6854 { | |
6855 amount = 4 * v2; | |
6856 v540 = 14400 * v2; | |
6857 } | |
6858 v730 = v540; | |
6859 LODWORD(v733) = v540; | |
6860 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6861 goto play_sound_and_continue; | |
6862 | |
6863 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6864 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6865 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6866 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6867 | |
6868 v732 = v730 << 7; | |
6869 v549 = (double)(v730 << 7) * 0.033333335; | |
6870 *((float *)&v733 + 1) = v549; | |
6871 v712 = (signed __int64)v549; | |
6872 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0); | |
6873 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6874 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6875 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6876 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6877 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0); | |
6878 v550 = v2 + 5; | |
6879 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply( | |
6880 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), | |
6881 v731, | |
6882 v550, 0, 0); | |
6883 | |
6884 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0); | |
6885 LODWORD(v727) = 1; | |
6886 goto play_sound_and_continue; | |
6887 } | |
6888 | |
6889 case 86: | |
6890 { | |
6891 v551 = v731 - 2; | |
6892 if ( !v551 ) | |
6893 goto LABEL_998; | |
6894 v552 = v551 - 1; | |
6895 if ( v552 ) | |
6896 { | |
6897 if ( v552 == 1 ) | |
6898 { | |
6899 amount = 15; | |
6900 HIDWORD(v733) = 20; | |
6901 goto LABEL_1000; | |
6902 } | |
6903 LABEL_998: | |
6904 v678 = 4; | |
6905 } | |
6906 else | |
6907 { | |
6908 v678 = 12; | |
6909 } | |
6910 amount = v678; | |
6911 HIDWORD(v733) = v678; | |
6912 LABEL_1000: | |
6913 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6914 goto play_sound_and_continue; | |
6915 y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); | |
6916 v732 = (300 * amount * v2 + 60) << 7; | |
6917 v730 = v2 + 5; | |
6918 int _v726 = 0; | |
6919 v553 = pParty->pPlayers;//[0].pConditions[1]; | |
6920 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | |
6921 do | |
6922 { | |
6923 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | |
6924 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | |
6925 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | |
6926 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | |
6927 | |
6928 //((SpellBuff *)(v553 + 6056))->Apply( | |
6929 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6930 if ( *(_QWORD *)v553 ) | |
6931 _v726 = 1; | |
6932 ++v553; | |
6933 } | |
6934 while ( v553 <= &pParty->pPlayers[3] ); | |
6935 v562 = v731; | |
6936 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | |
6937 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0); | |
6938 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0); | |
6939 if (!_v726) | |
6940 { | |
6941 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0); | |
6942 } | |
6943 LODWORD(v727) = 1; | |
6944 goto play_sound_and_continue; | |
6945 } | |
6946 | |
6947 | |
6948 case 88: | |
6949 amount = 3; | |
6950 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | |
6951 { | |
6952 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
6953 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
6954 v3->spellnum = 0; | |
6955 goto LABEL_1166; | |
6956 } | |
6957 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
6958 goto play_sound_and_continue; | |
6959 a2 = 0; | |
6960 _this = (ItemGen *)&pPlayers[1]; | |
6961 do | |
6962 { | |
6963 v563 = 0; | |
6964 do | |
6965 { | |
6966 v564 = _this->uItemID; | |
6967 *(int *)(v563 + _this->uItemID) = 0; | |
6968 v563 += 8; | |
6969 *(int *)(v563 + v564 - 4) = 0; | |
6970 } | |
6971 while ( v563 <= 128 ); | |
6972 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | |
6973 v566 = (Player **)_this; | |
6974 *(int *)(_this->uItemID + 6460) = v565; | |
6975 v567 = (*v566)->GetMaxMana(); | |
6976 *(int *)(_this->uItemID + 6464) = v567; | |
6977 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
6978 ++a2; | |
6979 _this = (ItemGen *)((char *)_this + 4); | |
6980 } | |
6981 while ( (signed int)this < (signed int)&qword_A750D8 ); | |
6982 v571 = pPlayer; | |
6983 v572 = (char *)&pPlayer->sAgeModifier; | |
6984 if ( pPlayer->sAgeModifier + 10 >= 120 ) | |
6985 *(short *)v572 = 120; | |
6986 else | |
6987 *(short *)v572 = pPlayer->sAgeModifier + 10; | |
6988 sRecoveryTime += -5 * v2; | |
6989 ++v571->uNumDivineInterventionCastsThisDay; | |
6990 LODWORD(v727) = 1; | |
6991 goto play_sound_and_continue; | |
6992 | |
6993 case 89: | |
6994 v573 = v731 - 2; | |
6995 if ( v573 ) | |
6996 { | |
6997 v574 = v573 - 1; | |
6998 if ( v574 ) | |
6999 { | |
7000 if ( v574 == 1 ) | |
7001 v575 = 5 * v2; | |
7002 else | |
7003 v575 = 2 * v2; | |
7004 } | |
7005 else | |
7006 { | |
7007 v575 = 4 * v2; | |
7008 } | |
7009 } | |
7010 else | |
7011 { | |
7012 v575 = 3 * v2; | |
7013 } | |
7014 amount = v575; | |
7015 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7016 goto play_sound_and_continue; | |
7017 v576 = v3->spell_target_pid; | |
7018 if (!v576) | |
7019 { | |
7020 v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | |
7021 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
7022 if ( *((_QWORD *)v585 + 14) ) | |
7023 { | |
7024 ((Player *)v585)->SetCondition(0x11u, 1); | |
7025 v587 = ((Player *)v585)->GetSexByVoice(); | |
7026 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); | |
7027 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | |
7028 } | |
7029 goto play_sound_and_continue; | |
7030 } | |
7031 v577 = (Player *)(PID_ID(v576)); | |
7032 //v726 = v577; | |
7033 if ( v577 == (Player *)-1 ) | |
7034 { | |
7035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | |
7036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7037 v3->spellnum = 0; | |
7038 goto LABEL_1166; | |
7039 } | |
7040 v578 = (int)&pActors[(int)v577]; | |
7041 v721 = v578; | |
7042 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | |
7043 { | |
7044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7045 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7046 v3->spellnum = 0; | |
7047 goto LABEL_1166; | |
7048 } | |
7049 ++a1.uType; | |
7050 a1.stru_24.Reset(); | |
7051 a1.spell_id = v3->spellnum; | |
7052 a1.spell_level = v2; | |
7053 a1.spell_skill = v731; | |
7054 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7055 a1.uAttributes = 0; | |
7056 a1.uSectorID = 0; | |
7057 a1.uSpriteFrameID = 0; | |
7058 a1.field_60_distance_related_prolly_lod = 0; | |
7059 v581 = v721; | |
7060 a1.uFacing = 0; | |
7061 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7062 a1.uSoundID = LOWORD(v3->sound_id); | |
7063 a1.vPosition.x = *(short *)(v721 + 142); | |
7064 a1.vPosition.y = *(short *)(v721 + 144); | |
7065 v732 = *(short *)(v721 + 138); | |
7066 a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | |
7067 a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); | |
7068 a1.Create(0, 0, 0, 0); | |
7069 if ( *(char *)(v581 + 52) > amount ) | |
7070 goto play_sound_and_continue; | |
7071 Actor::Resurrect((unsigned int)v577); | |
7072 *(char *)(v581 + 61) = 0; | |
7073 *(char *)(v581 + 53) = 0; | |
7074 *(char *)(v581 + 54) = 0; | |
7075 *(char *)(v581 + 55) = 0; | |
7076 *(char *)(v581 + 56) = 0; | |
7077 *(char *)(v581 + 57) = 0; | |
7078 *(int *)(v581 + 712) = 9999; | |
7079 *(char *)(v581 + 38) &= 0xF7u; | |
7080 *(int *)(v581 + 708) = 0; | |
7081 ((SpellBuff *)(v581 + 356))->Reset(); | |
7082 ((SpellBuff *)(v581 + 228))->Reset(); | |
7083 ((SpellBuff *)(v581 + 404))->Reset(); | |
7084 if ( *(short *)(v581 + 40) > 10 * amount ) | |
7085 *(short *)(v581 + 40) = 10 * amount; | |
7086 LODWORD(v727) = 1; | |
7087 goto play_sound_and_continue; | |
7088 | |
7089 case 91: | |
7090 v588 = v731 - 1; | |
7091 amount = 16; | |
7092 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) | |
7093 { | |
7094 if ( v590 == 1 ) | |
7095 LODWORD(v733) = 0; | |
7096 } | |
7097 else | |
7098 { | |
7099 LODWORD(v733) = 3600 * v2; | |
7100 } | |
7101 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7102 goto play_sound_and_continue; | |
7103 __debugbreak(); | |
7104 HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; | |
7105 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; | |
7106 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | |
7107 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | |
7108 || *(char *)(HIDWORD(v733) + 20) & 2 | |
7109 || *(int *)(HIDWORD(v733) + 12) != 0 | |
7110 || *(int *)(HIDWORD(v733) + 4) != 0 | |
7111 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2 | |
7112 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) ) | |
7113 { | |
7114 dword_50C9D0 = 113; | |
7115 dword_50C9D4 = 0; | |
7116 dword_50C9D8 = 1; | |
7117 | |
7118 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7119 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7120 v3->spellnum = 0; | |
7121 goto LABEL_1166; | |
7122 } | |
7123 v592 = HIDWORD(v733); | |
7124 v14 = v731 == 4; | |
7125 *(int *)(HIDWORD(v733) + 12) = 16; | |
7126 if ( !v14 ) | |
7127 { | |
7128 v732 = (int)v733 << 7; | |
7129 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7130 *(int *)(v592 + 20) |= 8u; | |
7131 } | |
7132 *(char *)(v592 + 20) |= 0x80u; | |
7133 dword_50C9A8 = 256; | |
7134 LODWORD(v727) = 1; | |
7135 goto play_sound_and_continue; | |
7136 | |
7137 case 93: | |
7138 { | |
7139 v593 = v731 - 2; | |
7140 if ( !v593 ) | |
7141 goto LABEL_1062; | |
7142 v594 = v593 - 1; | |
7143 if ( v594 ) | |
7144 { | |
7145 if ( v594 == 1 ) | |
7146 amount = 9; | |
7147 else | |
7148 LABEL_1062: | |
7149 amount = 5; | |
7150 } | |
7151 else | |
7152 { | |
7153 amount = 7; | |
7154 } | |
7155 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7156 goto play_sound_and_continue; | |
7157 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | |
7158 a1.stru_24.Reset(); | |
7159 a1.spell_id = v3->spellnum; | |
7160 a1.spell_level = v2; | |
7161 a1.spell_skill = v731; | |
7162 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7163 a1.vPosition.x = pParty->vPosition.x; | |
7164 a1.vPosition.y = pParty->vPosition.y; | |
7165 a1.uAttributes = 0; | |
7166 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
7167 a1.uSectorID = pIndoor->GetSector( | |
7168 pParty->vPosition.x, | |
7169 pParty->vPosition.y, | |
7170 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | |
7171 a1.uSpriteFrameID = 0; | |
7172 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7173 a1.spell_target_pid = a2; | |
7174 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7175 a1.uSoundID = LOWORD(v3->sound_id); | |
7176 if ( pParty->bTurnBasedModeOn == 1 ) | |
7177 LOBYTE(a1.uAttributes) |= 4u; | |
7178 v596 = (signed int)_v726 / -2; | |
7179 y = (char *)((signed int)_v726 / 2); | |
7180 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | |
7181 { | |
7182 v597 = v715.uYawAngle; | |
7183 do | |
7184 { | |
7185 a1.uFacing = v596 + v597; | |
7186 if ( a1.Create( | |
7187 v596 + v597, | |
7188 v715.uPitchAngle, | |
7189 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
7190 v3->uPlayerID + 1) != -1 | |
7191 && pParty->bTurnBasedModeOn == 1 ) | |
7192 ++pTurnEngine->field_1C; | |
7193 v596 += _v726 / (amount - 1); | |
7194 } | |
7195 while ( v596 <= (signed int)y ); | |
7196 } | |
7197 LODWORD(v727) = 1; | |
7198 goto play_sound_and_continue; | |
7199 } | |
7200 | |
7201 case 94: | |
7202 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7203 goto play_sound_and_continue; | |
7204 if ( v731 == 1 || v731 == 2 ) | |
7205 { | |
7206 v598 = 180 * v2; | |
7207 goto LABEL_1081; | |
7208 } | |
7209 if ( v731 == 3 ) | |
7210 { | |
7211 v598 = 300 * v2; | |
7212 LABEL_1081: | |
7213 LODWORD(v733) = v598; | |
7214 goto LABEL_1082; | |
7215 } | |
7216 if ( v731 == 4 ) | |
7217 LODWORD(v733) = 29030400; | |
7218 LABEL_1082: | |
7219 if (PID_TYPE(a2) != OBJECT_Actor) | |
7220 { | |
7221 LODWORD(v727) = 1; | |
7222 goto play_sound_and_continue; | |
7223 } | |
7224 v730 = 836 * PID_ID(a2); | |
7225 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
7226 goto play_sound_and_continue; | |
7227 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | |
7228 { | |
7229 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7231 v3->spellnum = 0; | |
7232 goto LABEL_1166; | |
7233 } | |
7234 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | |
7235 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | |
7236 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | |
7237 v731, 0, 0, 0); | |
7238 a1.stru_24.Reset(); | |
7239 a1.spell_id = v3->spellnum; | |
7240 a1.spell_level = v2; | |
7241 a1.spell_skill = v731; | |
7242 v60 = pObjectList->ObjectIDByItemID(a1.uType); | |
7243 v61 = PID_ID(a2); | |
7244 LABEL_1086: | |
7245 v600 = pActors[v61].vPosition.y; | |
7246 v601 = pActors[v61].vPosition.x; | |
7247 a1.uObjectDescID = v60; | |
7248 a1.vPosition.x = v601; | |
7249 v602 = pActors[v61].uActorHeight; | |
7250 v603 = pActors[v61].vPosition.z; | |
7251 a1.vPosition.y = v600; | |
7252 v676 = v603 + v602; | |
7253 v665 = v600; | |
7254 a1.vPosition.z = v603 + v602; | |
7255 v657 = v601; | |
7256 LABEL_1087: | |
7257 a1.uAttributes = 0; | |
7258 a1.uSectorID = pIndoor->GetSector(v657, v665, v676); | |
7259 a1.uSpriteFrameID = 0; | |
7260 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7261 a1.spell_target_pid = a2; | |
7262 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
7263 a1.uFacing = LOWORD(v715.uYawAngle); | |
7264 LOBYTE(a1.uAttributes) |= 0x80u; | |
7265 a1.uSoundID = LOWORD(v3->sound_id); | |
7266 a1.Create(0, 0, 0, v3->uPlayerID + 1); | |
7267 LODWORD(v727) = 1; | |
7268 goto play_sound_and_continue; | |
7269 | |
7270 case 96: | |
7271 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7272 goto play_sound_and_continue; | |
7273 HIDWORD(v733) = 0; | |
7274 memset(&achievedAwardsIndex, 0, 4000); | |
7275 _this = 0; | |
7276 v605 = (char *)pParty->pHirelings; | |
7277 do | |
7278 { | |
7279 if ( *(int *)v605) | |
7280 { | |
7281 v606 = HIDWORD(v733)++; | |
7282 achievedAwardsIndex[v606] = (int)((char *)&_this->uItemID + 1); | |
7283 } | |
7284 _this = (ItemGen *)((char *)_this + 1); | |
7285 v605 += 76; | |
7286 } | |
7287 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); | |
7288 _this = 0; | |
7289 if ( (signed int)pNPCStats->uNumNewNPCs > 0) | |
7290 { | |
7291 v730 = (int)pNPCStats->pNewNPCData; | |
7292 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; | |
7293 do | |
7294 { | |
7295 if ( *(char *)(v730 + 8) & 0x80 | |
7296 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) | |
7297 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) | |
7298 { | |
7299 v607 = HIDWORD(v733); | |
7300 HIDWORD(v733) += 4; | |
7301 *(int *)v607 = (int)_this + 3; | |
7302 } | |
7303 _this = (ItemGen *)((char *)_this + 1); | |
7304 v730 += 76; | |
7305 } | |
7306 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | |
7307 } | |
7308 v608 = v3->uPlayerID_2; | |
7309 if ( v608 != 4 && v608 != 5 | |
7310 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | |
7311 || v609 >= 3 ) | |
7312 { | |
7313 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7314 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7315 v3->spellnum = 0; | |
7316 goto LABEL_1166; | |
7317 } | |
7318 v610 = 76 * v609; | |
7319 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | |
7320 v611 = pIconsFrameTable->FindIcon("spell96"); | |
7321 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); | |
7322 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; | |
7323 v612 = pParty->pPlayers; | |
7324 do | |
7325 { | |
7326 v612->sHealth = v612->GetMaxHealth(); | |
7327 v612->sMana = v612->GetMaxMana(); | |
7328 ++v612; | |
7329 } | |
7330 while ( v612 <= &pParty->pPlayers[3] ); | |
7331 v613 = &pOutdoor->ddm; | |
7332 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
7333 v613 = &pIndoor->dlv; | |
7334 v613->uReputation += 15; | |
7335 if ( v613->uReputation > 10000 ) | |
7336 v613->uReputation = 10000; | |
7337 LODWORD(v727) = 1; | |
7338 goto play_sound_and_continue; | |
7339 case 95: | |
7340 if ( v731 <= 0 ) | |
7341 goto LABEL_1119; | |
7342 if ( v731 <= 3 ) | |
7343 { | |
7344 v614 = 300 * (v2 + 12); | |
7345 } | |
7346 else | |
7347 { | |
7348 if ( v731 != 4 ) | |
7349 goto LABEL_1119; | |
7350 v614 = 900 * (v2 + 4); | |
7351 } | |
7352 LODWORD(v733) = v614; | |
7353 LABEL_1119: | |
7354 v615 = v2 + 5; | |
7355 amount = v615; | |
7356 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7357 goto play_sound_and_continue; | |
7358 if ( v731 != 3 && v731 != 4 ) | |
7359 { | |
7360 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | |
7361 | |
7362 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); | |
7363 LODWORD(v727) = 1; | |
7364 goto play_sound_and_continue; | |
7365 } | |
7366 a2 = 0; | |
7367 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | |
7368 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | |
7369 do | |
7370 { | |
7371 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | |
7372 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | |
7373 ++a2; | |
7374 ++v619; | |
7375 } | |
7376 while ( v619 <= &pParty->pPlayers[3] ); | |
7377 LODWORD(v727) = 1; | |
7378 goto play_sound_and_continue; | |
7379 | |
7380 case 99: | |
7381 { | |
7382 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7383 goto play_sound_and_continue; | |
7384 pGame->GetIndoorCamera(); | |
7385 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | |
7386 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | |
7387 v707.x = 0; | |
7388 v707.y = 0; | |
7389 v707.z = 0; | |
7390 a1.stru_24.Reset(); | |
7391 a1.spell_id = v3->spellnum; | |
7392 a1.spell_level = v2; | |
7393 a1.spell_skill = v731; | |
7394 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
7395 a1.uAttributes = 0; | |
7396 a1.uSectorID = 0; | |
7397 a1.uSpriteFrameID = 0; | |
7398 a1.field_60_distance_related_prolly_lod = 0; | |
7399 a1.uFacing = 0; | |
7400 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
7401 a1.uSoundID = LOWORD(v3->sound_id); | |
7402 a2 = 0; | |
7403 int _v726 = 0; | |
7404 if ( SHIDWORD(v733) > 0 ) | |
7405 { | |
7406 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | |
7407 do | |
7408 { | |
7409 v625 = dword_50BF30[a2]; | |
7410 a1.vPosition.x = pActors[v625].vPosition.x; | |
7411 a1.vPosition.y = pActors[v625].vPosition.y; | |
7412 //v732 = pActors[v625].uActorHeight; | |
7413 a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | |
7414 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | |
7415 v627 = a1.Create(0, 0, 0, 0); | |
7416 v628 = a2; | |
7417 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | |
7418 a2 = v628 + 1; | |
7419 } | |
7420 while ( v628 + 1 < SHIDWORD(v733) ); | |
7421 } | |
7422 v730 = 0; | |
7423 v629 = 1; | |
7424 do | |
7425 { | |
7426 v630 = pPlayers[v629]; | |
7427 if ( !v630->pConditions[2] | |
7428 && !v630->pConditions[12] | |
7429 && !v630->pConditions[13] | |
7430 && !v630->pConditions[14] | |
7431 && !v630->pConditions[15] | |
7432 && !v630->pConditions[16] ) | |
7433 { | |
7434 v631 = v730++; | |
7435 v681[v631] = v629; | |
7436 } | |
7437 ++v629; | |
7438 } | |
7439 while ( v629 <= 4 ); | |
7440 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); | |
7441 HIDWORD(v733) = 0; | |
7442 if ( v730 > 0 ) | |
7443 { | |
7444 do | |
7445 { | |
7446 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; | |
7447 v726 = pPlayers[v681[HIDWORD(v733)]]; | |
7448 //v633 = pPlayers[v681[HIDWORD(v733)]]; | |
7449 v726->sHealth += v732; | |
7450 //v726 = *(Player **)v632; | |
7451 //v634 = v726->GetMaxHealth(); | |
7452 if ( v726->sHealth > v726->GetMaxHealth()) | |
7453 v726->sHealth = v726->GetMaxHealth(); | |
7454 v635 = HIDWORD(v733); | |
7455 | |
7456 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); | |
7457 HIDWORD(v733) = v635 + 1; | |
7458 } | |
7459 while ( v635 + 1 < v730 ); | |
7460 } | |
7461 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | |
7462 LODWORD(v727) = 1; | |
7463 goto play_sound_and_continue; | |
7464 } | |
7465 | |
7466 case 98: | |
7467 { | |
7468 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
7469 { | |
7470 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | |
7471 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7472 v3->spellnum = 0; | |
7473 goto LABEL_1166; | |
7474 } | |
7475 v640 = v731 - 2; | |
7476 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | |
7477 amount = 3; | |
7478 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | |
7479 { | |
7480 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | |
7481 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
7482 v3->spellnum = 0; | |
7483 goto LABEL_1166; | |
7484 } | |
7485 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | |
7486 goto play_sound_and_continue; | |
7487 pParty->armageddon_timer = 256; | |
7488 pParty->field_16140 = v2; | |
7489 ++pPlayer->uNumArmageddonCasts; | |
7490 if ( pParty->bTurnBasedModeOn == 1 ) | |
7491 ++pTurnEngine->field_1C; | |
7492 auto _v726 = 50; | |
7493 do | |
7494 { | |
7495 v642 = rand() % 4096 - 2048; | |
7496 v643 = rand(); | |
7497 v721 = v642 + pParty->vPosition.x; | |
7498 y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); | |
7499 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); | |
7500 v644 = rand(); | |
7501 sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); | |
7502 --_v726; | |
7503 } | |
7504 while ( _v726 != 0 ); | |
7505 LODWORD(v727) = 1; | |
7506 goto play_sound_and_continue; | |
7507 } | |
7508 | |
7509 default: | |
7510 goto play_sound_and_continue; | |
7511 } | |
7512 while ( 2 ) | |
7513 { | |
7514 if ( v731 == 4 ) | |
7515 { | |
7516 if ( *((_QWORD *)v222 + 2) ) | |
7517 { | |
7518 *((int *)v222 + 4) = 0; | |
7519 *((int *)v222 + 5) = 0; | |
7520 goto LABEL_439; | |
7521 } | |
7522 } | |
7523 else | |
7524 { | |
7525 v223 = ((Player *)v222)->DiscardConditionIfLastsLongerThan( | |
7526 2u, | |
7527 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); | |
7528 v222 = (char *)HIDWORD(v733); | |
7529 if ( v223 ) | |
7530 LABEL_439: | |
7531 ((Player *)v222)->PlaySound(SPEECH_103, 0); | |
7532 } | |
7533 v222 += 6972; | |
7534 HIDWORD(v733) = (int)v222; | |
7535 if ( (signed int)v222 >= (signed int)pParty->pHirelings ) | |
7536 { | |
7537 LODWORD(v727) = 1; | |
7538 goto play_sound_and_continue; | |
7539 } | |
7540 continue; | |
7541 } | |
7542 } | 7545 } |
7543 //----- (0042EB42) -------------------------------------------------------- | 7546 //----- (0042EB42) -------------------------------------------------------- |
7544 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) | 7547 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) |
7545 { | 7548 { |
7546 unsigned int v2; // edx@1 | 7549 unsigned int v2; // edx@1 |