comparison Engine/Objects/Actor.cpp @ 2566:30eb6dcac768

big spell fx overhaul
author a.parshin
date Wed, 20 May 2015 21:05:07 +0200
parents b8a56afc6ba1
children d569340b05ff
comparison
equal deleted inserted replaced
2565:117c219bf913 2566:30eb6dcac768
276 case SPELL_MIND_PSYCHIC_SHOCK: 276 case SPELL_MIND_PSYCHIC_SHOCK:
277 case SPELL_BODY_HARM: 277 case SPELL_BODY_HARM:
278 case SPELL_LIGHT_LIGHT_BOLT: 278 case SPELL_LIGHT_LIGHT_BOLT:
279 case SPELL_DARK_TOXIC_CLOUD: 279 case SPELL_DARK_TOXIC_CLOUD:
280 case SPELL_DARK_DRAGON_BREATH: 280 case SPELL_DARK_DRAGON_BREATH:
281 a1.uType = stru_4E3ACC[uSpellID].uType; 281 a1.uType = spell_sprite_mapping[uSpellID].uSpriteType;
282 a1.uObjectDescID = GetObjDescId(uSpellID); 282 a1.uObjectDescID = GetObjDescId(uSpellID);
283 a1.stru_24.Reset(); 283 a1.containing_item.Reset();
284 a1.spell_id = uSpellID; 284 a1.spell_id = uSpellID;
285 a1.spell_level = uSkillLevel; 285 a1.spell_level = uSkillLevel;
286 a1.vPosition.x = actorPtr->vPosition.x; 286 a1.vPosition.x = actorPtr->vPosition.x;
287 a1.spell_skill = 0; 287 a1.spell_skill = 0;
288 a1.vPosition.y = actorPtr->vPosition.y; 288 a1.vPosition.y = actorPtr->vPosition.y;
356 { 356 {
357 v31 = (signed __int64)sqrt((float)(v119 + v120)); 357 v31 = (signed __int64)sqrt((float)(v119 + v120));
358 v32 = stru_5C6E00->Atan2(spellnumb, (int)v28); 358 v32 = stru_5C6E00->Atan2(spellnumb, (int)v28);
359 pitch = stru_5C6E00->Atan2(v31, (int)spellnumc); 359 pitch = stru_5C6E00->Atan2(v31, (int)spellnumc);
360 } 360 }
361 a1.stru_24.Reset(); 361 a1.containing_item.Reset();
362 a1.uType = stru_4E3ACC[uSpellID].uType; 362 a1.uType = spell_sprite_mapping[uSpellID].uSpriteType;
363 a1.uObjectDescID = GetObjDescId(uSpellID); 363 a1.uObjectDescID = GetObjDescId(uSpellID);
364 a1.spell_level = uSkillLevel; 364 a1.spell_level = uSkillLevel;
365 a1.vPosition.x = pParty->vPosition.x; 365 a1.vPosition.x = pParty->vPosition.x;
366 a1.vPosition.y = pParty->vPosition.y; 366 a1.vPosition.y = pParty->vPosition.y;
367 a1.vPosition.z = v30 + v114; 367 a1.vPosition.z = v30 + v114;
401 else if (masteryLevel == 4 ) 401 else if (masteryLevel == 4 )
402 v10 = 9; 402 v10 = 9;
403 else 403 else
404 v10 = 3; 404 v10 = 3;
405 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 405 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
406 a1.uType = stru_4E3ACC[uSpellID].uType; 406 a1.uType = spell_sprite_mapping[uSpellID].uSpriteType;
407 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1); 407 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1);
408 a1.uObjectDescID = GetObjDescId(uSpellID); 408 a1.uObjectDescID = GetObjDescId(uSpellID);
409 409
410 a1.stru_24.Reset(); 410 a1.containing_item.Reset();
411 a1.spell_id = SPELL_AIR_SPARKS; 411 a1.spell_id = SPELL_AIR_SPARKS;
412 a1.spell_level = uSkillLevel; 412 a1.spell_level = uSkillLevel;
413 a1.vPosition.x = actorPtr->vPosition.x; 413 a1.vPosition.x = actorPtr->vPosition.x;
414 a1.spell_skill = 0; 414 a1.spell_skill = 0;
415 a1.vPosition.y = actorPtr->vPosition.y; 415 a1.vPosition.y = actorPtr->vPosition.y;
613 v70 = 9; 613 v70 = 9;
614 else 614 else
615 v70 = 3; 615 v70 = 3;
616 616
617 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 617 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
618 a1.uType = stru_4E3ACC[uSpellID].uType; 618 a1.uType = spell_sprite_mapping[uSpellID].uSpriteType;
619 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1); 619 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1);
620 a1.uObjectDescID = GetObjDescId(uSpellID); 620 a1.uObjectDescID = GetObjDescId(uSpellID);
621 a1.stru_24.Reset(); 621 a1.containing_item.Reset();
622 a1.spell_id = uSpellID; 622 a1.spell_id = uSpellID;
623 a1.spell_level = uSkillLevel; 623 a1.spell_level = uSkillLevel;
624 a1.vPosition.x = actorPtr->vPosition.x; 624 a1.vPosition.x = actorPtr->vPosition.x;
625 a1.spell_skill = 0; 625 a1.spell_skill = 0;
626 a1.vPosition.y = actorPtr->vPosition.y; 626 a1.vPosition.y = actorPtr->vPosition.y;
675 //----- (new func) -------------------------------------------------------- 675 //----- (new func) --------------------------------------------------------
676 unsigned short Actor::GetObjDescId( int spellId ) 676 unsigned short Actor::GetObjDescId( int spellId )
677 { 677 {
678 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++) 678 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++)
679 { 679 {
680 if (stru_4E3ACC[spellId].uType == pObjectList->pObjects[i].uObjectID) 680 if (spell_sprite_mapping[spellId].uSpriteType == pObjectList->pObjects[i].uObjectID)
681 { 681 {
682 return i; 682 return i;
683 break; 683 break;
684 } 684 }
685 } 685 }
756 SpriteObject a1; // [sp+Ch] [bp-74h]@1 756 SpriteObject a1; // [sp+Ch] [bp-74h]@1
757 757
758 switch ( type ) 758 switch ( type )
759 { 759 {
760 case 1: 760 case 1:
761 a1.uType = 545; 761 a1.uType = SPRITE_PROJECTILE_545;
762 break; 762 break;
763 case 2: 763 case 2:
764 a1.uType = 550; 764 a1.uType = SPRITE_PROJECTILE_550;
765 break; 765 break;
766 case 3: 766 case 3:
767 a1.uType = 510; 767 a1.uType = SPRITE_PROJECTILE_510;
768 break; 768 break;
769 case 4: 769 case 4:
770 a1.uType = 500; 770 a1.uType = SPRITE_PROJECTILE_500;
771 break; 771 break;
772 case 5: 772 case 5:
773 a1.uType = 515; 773 a1.uType = SPRITE_PROJECTILE_515;
774 break; 774 break;
775 case 6: 775 case 6:
776 a1.uType = 505; 776 a1.uType = SPRITE_PROJECTILE_505;
777 break; 777 break;
778 case 7: 778 case 7:
779 a1.uType = 530; 779 a1.uType = SPRITE_PROJECTILE_530;
780 break; 780 break;
781 case 8: 781 case 8:
782 a1.uType = 525; 782 a1.uType = SPRITE_PROJECTILE_525;
783 break; 783 break;
784 case 9: 784 case 9:
785 a1.uType = 520; 785 a1.uType = SPRITE_PROJECTILE_520;
786 break; 786 break;
787 case 10: 787 case 10:
788 a1.uType = 535; 788 a1.uType = SPRITE_PROJECTILE_535;
789 break; 789 break;
790 case 11: 790 case 11:
791 a1.uType = 540; 791 a1.uType = SPRITE_PROJECTILE_540;
792 break; 792 break;
793 case 13: 793 case 13:
794 a1.uType = 555; 794 a1.uType = SPRITE_PROJECTILE_555;
795 break; 795 break;
796 default: 796 default:
797 return; 797 return;
798 } 798 }
799 bool found = false; 799 bool found = false;
809 if (!found) 809 if (!found)
810 { 810 {
811 Error("Item not found"); 811 Error("Item not found");
812 return; 812 return;
813 } 813 }
814 a1.stru_24.Reset(); 814 a1.containing_item.Reset();
815 a1.spell_id = 0; 815 a1.spell_id = 0;
816 a1.vPosition.x = pActors[uActorID].vPosition.x; 816 a1.vPosition.x = pActors[uActorID].vPosition.x;
817 a1.vPosition.y = pActors[uActorID].vPosition.y; 817 a1.vPosition.y = pActors[uActorID].vPosition.y;
818 a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75); 818 a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75);
819 a1.spell_level = 0; 819 a1.spell_level = 0;
860 //----- (00404736) -------------------------------------------------------- 860 //----- (00404736) --------------------------------------------------------
861 void Actor::Explode( unsigned int uActorID ) 861 void Actor::Explode( unsigned int uActorID )
862 { 862 {
863 SpriteObject a1; // [sp+Ch] [bp-78h]@1 863 SpriteObject a1; // [sp+Ch] [bp-78h]@1
864 864
865 a1.uType = 600; 865 a1.uType = SPRITE_600;
866 a1.uObjectDescID = GetObjDescId(a1.uType); 866 a1.uObjectDescID = GetObjDescId(a1.uType);
867 a1.stru_24.Reset(); 867 a1.containing_item.Reset();
868 a1.spell_id = 0; 868 a1.spell_id = 0;
869 a1.spell_level = 0; 869 a1.spell_level = 0;
870 a1.spell_skill = 0; 870 a1.spell_skill = 0;
871 a1.vPosition.x = pActors[uActorID].vPosition.x; 871 a1.vPosition.x = pActors[uActorID].vPosition.x;
872 a1.vPosition.y = pActors[uActorID].vPosition.y; 872 a1.vPosition.y = pActors[uActorID].vPosition.y;
1984 break; 1984 break;
1985 } 1985 }
1986 1986
1987 if (rand() % 100 < 20 && drop.uItemID != 0) 1987 if (rand() % 100 < 20 && drop.uItemID != 0)
1988 { 1988 {
1989 SpriteObject::sub_42F7EB_DropItemAt(pItemsTable->pItems[drop.uItemID].uSpriteID, 1989 SpriteObject::sub_42F7EB_DropItemAt(
1990 actor->vPosition.x, 1990 (SPRITE_OBJECT_TYPE)pItemsTable->pItems[drop.uItemID].uSpriteID,
1991 actor->vPosition.y, 1991 actor->vPosition.x,
1992 actor->vPosition.z + 16, 1992 actor->vPosition.y,
1993 rand() % 200 + 200, 1993 actor->vPosition.z + 16,
1994 1, 1994 rand() % 200 + 200,
1995 1, 1995 1,
1996 0, 1996 1,
1997 &drop); 1997 0,
1998 &drop
1999 );
1998 } 2000 }
1999 2001
2000 if (actor->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE) 2002 if (actor->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE)
2001 Actor::Explode(uActorID); 2003 Actor::Explode(uActorID);
2002 } 2004 }
3606 attackElement = DMGT_PHISYCAL; 3608 attackElement = DMGT_PHISYCAL;
3607 uDamageAmount = player->CalculateRangedDamageTo(pMonster->word_000086_some_monster_id); 3609 uDamageAmount = player->CalculateRangedDamageTo(pMonster->word_000086_some_monster_id);
3608 if ( pMonster->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime > 0 ) 3610 if ( pMonster->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime > 0 )
3609 uDamageAmount /= 2; 3611 uDamageAmount /= 2;
3610 IsAdditionalDamagePossible = true; 3612 IsAdditionalDamagePossible = true;
3611 if ( projectileSprite->stru_24.uItemID != 0 && projectileSprite->stru_24.uSpecEnchantmentType == 3 ) //of carnage 3613 if (projectileSprite->containing_item.uItemID != 0 && projectileSprite->containing_item.uSpecEnchantmentType == 3) //of carnage
3612 { 3614 {
3613 attackElement = DMGT_FIRE; 3615 attackElement = DMGT_FIRE;
3614 } 3616 }
3615 else if ( !player->PlayerHitOrMiss( pMonster, v61, a4) ) 3617 else if ( !player->PlayerHitOrMiss( pMonster, v61, a4) )
3616 { 3618 {
3639 uDamageAmount = v61; 3641 uDamageAmount = v61;
3640 if ( IsAdditionalDamagePossible ) 3642 if ( IsAdditionalDamagePossible )
3641 { 3643 {
3642 if ( projectileSprite ) 3644 if ( projectileSprite )
3643 { 3645 {
3644 a4 = projectileSprite->stru_24._439DF3_get_additional_damage((int*)&attackElement, &isLifeStealing); 3646 a4 = projectileSprite->containing_item._439DF3_get_additional_damage((int*)&attackElement, &isLifeStealing);
3645 if ( isLifeStealing && pMonster->sCurrentHP > 0 ) 3647 if ( isLifeStealing && pMonster->sCurrentHP > 0 )
3646 { 3648 {
3647 player->sHealth += v61 / 5; 3649 player->sHealth += v61 / 5;
3648 if ( player->sHealth > player->GetMaxHealth() ) 3650 if ( player->sHealth > player->GetMaxHealth() )
3649 player->sHealth = player->GetMaxHealth(); 3651 player->sHealth = player->GetMaxHealth();