comparison mm7_6.cpp @ 848:ceef50611567

* AI fixed (temporary) * PID_ID, PID_TYPE replaces * >> 7 error in AudioPlayer
author zipi
date Sun, 31 Mar 2013 10:44:43 +0100
parents dfd683c4f538
children 2db21a810d48
comparison
equal deleted inserted replaced
847:e398541aee60 848:ceef50611567
3555 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); 3555 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID);
3556 a1.uSoundID = LOWORD(v3->sound_id); 3556 a1.uSoundID = LOWORD(v3->sound_id);
3557 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; 3557 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
3558 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; 3558 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
3559 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; 3559 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
3560 a1.spell_target_pid = PID(OBJECT_Actor, a2 >> 3); 3560 a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
3561 auto obj_id = a1.Create(0, 0, 0, 0); 3561 auto obj_id = a1.Create(0, 0, 0, 0);
3562 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); 3562 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697);
3563 LODWORD(v727) = 1; 3563 LODWORD(v727) = 1;
3564 goto play_sound_and_continue; 3564 goto play_sound_and_continue;
3565 } 3565 }
3567 case 44: 3567 case 44:
3568 { 3568 {
3569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3569 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3570 goto play_sound_and_continue; 3570 goto play_sound_and_continue;
3571 3571
3572 if ( !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u) ) 3572 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) )
3573 { 3573 {
3574 LODWORD(v727) = 1; 3574 LODWORD(v727) = 1;
3575 goto play_sound_and_continue; 3575 goto play_sound_and_continue;
3576 } 3576 }
3577 pActors[a2 >> 3].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); 3577 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
3578 v704.x = 0; 3578 v704.x = 0;
3579 v704.y = 0; 3579 v704.y = 0;
3580 v704.z = 0; 3580 v704.z = 0;
3581 a1.stru_24.Reset(); 3581 a1.stru_24.Reset();
3582 a1.spell_id = v3->spellnum; 3582 a1.spell_id = v3->spellnum;
3728 goto play_sound_and_continue; 3728 goto play_sound_and_continue;
3729 3729
3730 if (PID_TYPE(a2) != OBJECT_Actor || 3730 if (PID_TYPE(a2) != OBJECT_Actor ||
3731 (v730 = PID_ID(a2), 3731 (v730 = PID_ID(a2),
3732 v721 = (int)&pActors[PID_ID(a2)], 3732 v721 = (int)&pActors[PID_ID(a2)],
3733 !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) ) 3733 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) )
3734 { 3734 {
3735 LODWORD(v727) = 1; 3735 LODWORD(v727) = 1;
3736 goto play_sound_and_continue; 3736 goto play_sound_and_continue;
3737 } 3737 }
3738 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); 3738 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0);
3782 goto play_sound_and_continue; 3782 goto play_sound_and_continue;
3783 } 3783 }
3784 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); 3784 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335);
3785 v59 = v721; 3785 v59 = v721;
3786 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( 3786 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
3787 pActors[a2 >> 3].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, 3787 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58,
3788 v731, 3788 v731,
3789 amount, 3789 amount,
3790 0, 3790 0,
3791 0); 3791 0);
3792 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; 3792 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u;
3824 a1.stru_24.Reset(); 3824 a1.stru_24.Reset();
3825 a1.spell_id = v3->spellnum; 3825 a1.spell_id = v3->spellnum;
3826 a1.spell_level = v2; 3826 a1.spell_level = v2;
3827 a1.spell_skill = v731; 3827 a1.spell_skill = v731;
3828 v60 = pObjectList->ObjectIDByItemID(a1.uType); 3828 v60 = pObjectList->ObjectIDByItemID(a1.uType);
3829 v61 = a2 >> 3; 3829 v61 = PID_ID(a2);
3830 goto LABEL_1086; 3830 goto LABEL_1086;
3831 } 3831 }
3832 3832
3833 case 92: 3833 case 92:
3834 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3834 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4363 v3->spellnum = 0; 4363 v3->spellnum = 0;
4364 goto LABEL_1166; 4364 goto LABEL_1166;
4365 } 4365 }
4366 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4366 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4367 goto play_sound_and_continue; 4367 goto play_sound_and_continue;
4368 LODWORD(v725) = a2 & 7; 4368 LODWORD(v725) = PID_TYPE(a2);
4369 if (PID_TYPE(a2) == OBJECT_Actor) 4369 if (PID_TYPE(a2) == OBJECT_Actor)
4370 { 4370 {
4371 uRequiredMana = pActors[PID_ID(a2)].vPosition.x; 4371 uRequiredMana = pActors[PID_ID(a2)].vPosition.x;
4372 v153 = pActors[PID_ID(a2)].vPosition.y; 4372 v153 = pActors[PID_ID(a2)].vPosition.y;
4373 v154 = pActors[PID_ID(a2)].vPosition.z; 4373 v154 = pActors[PID_ID(a2)].vPosition.z;
4729 v3->spellnum = 0; 4729 v3->spellnum = 0;
4730 goto LABEL_1166; 4730 goto LABEL_1166;
4731 } 4731 }
4732 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4732 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4733 goto play_sound_and_continue; 4733 goto play_sound_and_continue;
4734 v208 = a2 & 7; 4734 v208 = PID_TYPE(a2);
4735 LODWORD(v725) = a2 & 7; 4735 LODWORD(v725) = PID_TYPE(a2);
4736 if ( v208 == 3 ) 4736 if ( v208 == 3 )
4737 { 4737 {
4738 v209 = a2 >> 3; 4738 v209 = PID_ID(a2);
4739 LODWORD(v718) = pActors[v209].vPosition.x; 4739 LODWORD(v718) = pActors[v209].vPosition.x;
4740 v210 = pActors[v209].vPosition.y; 4740 v210 = pActors[v209].vPosition.y;
4741 v211 = pActors[v209].vPosition.z; 4741 v211 = pActors[v209].vPosition.z;
4742 v713 = v210; 4742 v713 = v210;
4743 } 4743 }
5670 LODWORD(v727) = 1; 5670 LODWORD(v727) = 1;
5671 goto play_sound_and_continue; 5671 goto play_sound_and_continue;
5672 } 5672 }
5673 if (PID_TYPE(v342) == OBJECT_Actor) 5673 if (PID_TYPE(v342) == OBJECT_Actor)
5674 { 5674 {
5675 v343 = v342 >> 3; 5675 v343 = PID_ID(v342);
5676 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); 5676 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
5677 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; 5677 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
5678 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); 5678 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
5679 BYTE2(pActors[v343].uAttributes) |= 8u; 5679 BYTE2(pActors[v343].uAttributes) |= 8u;
5680 v672 = 0; 5680 v672 = 0;
7026 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); 7026 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23);
7027 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; 7027 *((_QWORD *)v585 + 17) = pParty->uTimePlayed;
7028 } 7028 }
7029 goto play_sound_and_continue; 7029 goto play_sound_and_continue;
7030 } 7030 }
7031 v577 = (Player *)(v576 >> 3); 7031 v577 = (Player *)(PID_ID(v576));
7032 //v726 = v577; 7032 //v726 = v577;
7033 if ( v577 == (Player *)-1 ) 7033 if ( v577 == (Player *)-1 )
7034 { 7034 {
7035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! 7035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
7036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 7036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7789 //v29 = 0; 7789 //v29 = 0;
7790 //v28 = 0; 7790 //v28 = 0;
7791 //v7 = pMouse->uPointingObjectID; 7791 //v7 = pMouse->uPointingObjectID;
7792 7792
7793 int target_pid = pMouse->uPointingObjectID; 7793 int target_pid = pMouse->uPointingObjectID;
7794 int target_type = target_pid & 7, 7794 int target_type = PID_TYPE(target_pid),
7795 target_id = target_pid >> 3; 7795 target_id = PID_ID(target_pid);
7796 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) 7796 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
7797 { 7797 {
7798 target_pid = stru_50C198.FindClosestActor(5120, 0, 0); 7798 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
7799 target_type = target_pid & 7; 7799 target_type = PID_TYPE(target_pid);
7800 target_id = target_pid >> 3; 7800 target_id = PID_ID(target_pid);
7801 } 7801 }
7802 7802
7803 auto actor = &pActors[target_id]; 7803 auto actor = &pActors[target_id];
7804 int actor_distance = 0; 7804 int actor_distance = 0;
7805 if (target_type == OBJECT_Actor) 7805 if (target_type == OBJECT_Actor)