Mercurial > mm7
comparison TurnEngine.cpp @ 2244:66c509997062
TE monster attack
author | Ritor1 |
---|---|
date | Mon, 24 Feb 2014 16:54:21 +0600 |
parents | c4f87fb3cfee |
children | 8817c398b792 |
comparison
equal
deleted
inserted
replaced
2243:9e1bd714d1d2 | 2244:66c509997062 |
---|---|
712 // 50FE08: using guessed type stru298 AttackerInfo; | 712 // 50FE08: using guessed type stru298 AttackerInfo; |
713 | 713 |
714 //----- (0040680F) -------------------------------------------------------- | 714 //----- (0040680F) -------------------------------------------------------- |
715 void stru262_TurnBased::AI_Action_( int queue_index ) | 715 void stru262_TurnBased::AI_Action_( int queue_index ) |
716 { | 716 { |
717 //TurnBased_QueueElem *v2; // eax@1 | |
718 //unsigned int v3; // eax@1 | |
719 unsigned int actor_id; // edi@2 | 717 unsigned int actor_id; // edi@2 |
720 //Actor *v5; // ebx@2 | |
721 AIDirection v7; // esi@10 | 718 AIDirection v7; // esi@10 |
722 //int v8; // eax@10 | |
723 int v9; // ecx@10 | 719 int v9; // ecx@10 |
724 signed int v10; // eax@13 | 720 signed int v10; // eax@13 |
725 int v14; // eax@29 | 721 int v14; // eax@29 |
726 AIDirection a3; // [sp+Ch] [bp-44h]@10 | 722 AIDirection a3; // [sp+Ch] [bp-44h]@10 |
727 AIDirection v18; // [sp+28h] [bp-28h]@10 | 723 AIDirection v18; // [sp+28h] [bp-28h]@10 |
728 //int a2a; // [sp+44h] [bp-Ch]@2 | |
729 //int v20; // [sp+48h] [bp-8h]@10 | |
730 //TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
731 signed int v22; // [sp+58h] [bp+8h]@10 | 724 signed int v22; // [sp+58h] [bp+8h]@10 |
732 | 725 |
733 //v2 = &pQueue[queue_index]; | |
734 //v21 = v2; | |
735 pQueue[queue_index].uActionLength = 0; | 726 pQueue[queue_index].uActionLength = 0; |
736 //v3 = pQueue[queue_index].uPackedID; | |
737 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor) | 727 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor) |
738 { | 728 { |
739 actor_id = PID_ID(pQueue[queue_index].uPackedID); | 729 actor_id = PID_ID(pQueue[queue_index].uPackedID); |
740 //a2a = pQueue[queue_index].uPackedID; | |
741 //v5 = &pActors[actor_id]; | |
742 //v3 = v5->uAIState; | |
743 if (!(pActors[actor_id].uAIState == AIState::Dying || pActors[actor_id].uAIState == AIState::Dead || pActors[actor_id].uAIState == AIState::Summoned || | 730 if (!(pActors[actor_id].uAIState == AIState::Dying || pActors[actor_id].uAIState == AIState::Dead || pActors[actor_id].uAIState == AIState::Summoned || |
744 pActors[actor_id].uAIState == AIState::Disabled || pActors[actor_id].uAIState == AIState::Removed)) | 731 pActors[actor_id].uAIState == AIState::Disabled || pActors[actor_id].uAIState == AIState::Removed)) |
745 { | 732 { |
746 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | 733 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); |
747 v22 = ai_near_actors_targets_pid[actor_id]; | 734 v22 = ai_near_actors_targets_pid[actor_id]; |
748 if ( pActors[actor_id].pMonsterInfo.uHostilityType && !v22) | 735 if ( pActors[actor_id].pMonsterInfo.uHostilityType && !v22) |
749 pActors[actor_id].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 736 pActors[actor_id].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
750 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &v7, 0); | 737 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &v7, 0); |
751 //v8 = pActors[actor_id].uActorRadius; | |
752 memcpy(&a3, &v7, sizeof(AIDirection)); | 738 memcpy(&a3, &v7, sizeof(AIDirection)); |
753 memcpy(&v18, &a3, sizeof(AIDirection)); | 739 memcpy(&v18, &a3, sizeof(AIDirection)); |
754 v9 = a3.uDistance - pActors[actor_id].uActorRadius; | 740 v9 = a3.uDistance - pActors[actor_id].uActorRadius; |
755 //v20 = a3.uDistance - pActors[actor_id].uActorRadius; | |
756 if ( v9 < 0 ) | 741 if ( v9 < 0 ) |
757 { | |
758 v9 = 0; | 742 v9 = 0; |
759 //v20 = 0; | |
760 } | |
761 if (PID_TYPE(v22) == OBJECT_Actor) | 743 if (PID_TYPE(v22) == OBJECT_Actor) |
762 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); | 744 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
763 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(pActors[actor_id].pMonsterInfo.uID - 1) / 3 + 1]; | 745 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(pActors[actor_id].pMonsterInfo.uID - 1) / 3 + 1]; |
764 else | 746 else |
765 v10 = 4; | 747 v10 = 4; |
814 { | 796 { |
815 Actor::AI_MissileAttack1(actor_id, v22, &v18); | 797 Actor::AI_MissileAttack1(actor_id, v22, &v18); |
816 pQueue[queue_index].AI_action_type = TE_AI_RANGED_ATTACK; | 798 pQueue[queue_index].AI_action_type = TE_AI_RANGED_ATTACK; |
817 } | 799 } |
818 } | 800 } |
819 if (!pQueue[queue_index].AI_action_type) | 801 //if (!pQueue[queue_index].AI_action_type) |
820 if ( (double)v9 < 307.2) | 802 if ( (double)v9 < 307.2) |
821 { | 803 { |
822 Actor::AI_MeleeAttack(actor_id, v22, &v18); | 804 Actor::AI_MeleeAttack(actor_id, v22, &v18); |
823 pQueue[queue_index].AI_action_type = TE_AI_MELEE_ATTACK; | 805 pQueue[queue_index].AI_action_type = TE_AI_MELEE_ATTACK; |
806 pQueue[queue_index].uActionLength = pActors[actor_id].uCurrentActionLength; | |
807 return; | |
824 } | 808 } |
825 else | 809 else |
826 { | 810 { |
827 Actor::AI_Stand(actor_id, v22, 64, &v18); | 811 Actor::AI_Stand(actor_id, v22, 64, &v18); |
828 pQueue[queue_index].AI_action_type = TE_AI_STAND; | 812 pQueue[queue_index].AI_action_type = TE_AI_STAND; |
813 pQueue[queue_index].uActionLength = pActors[actor_id].uCurrentActionLength; | |
814 return; | |
829 } | 815 } |
830 } | 816 } |
831 else | 817 else |
832 { | 818 { |
833 Actor::AI_Stand(actor_id, v22, 64, &v18); | 819 Actor::AI_Stand(actor_id, v22, 64, &v18); |