Mercurial > mm7
comparison TurnEngine.cpp @ 1910:8d3723ca71e6
Actor::GetDirectionInfo changed the signature to a less confusing one
author | Grumpy7 |
---|---|
date | Tue, 22 Oct 2013 00:39:04 -0700 |
parents | a86c60679949 |
children | 431d3da6e945 |
comparison
equal
deleted
inserted
replaced
1909:18dacb49efe9 | 1910:8d3723ca71e6 |
---|---|
166 { | 166 { |
167 if ( pActors[actor_id].uAttributes & 0x8000 ) | 167 if ( pActors[actor_id].uAttributes & 0x8000 ) |
168 { | 168 { |
169 v8 = ai_near_actors_targets_pid[actor_id]; | 169 v8 = ai_near_actors_targets_pid[actor_id]; |
170 pActors[actor_id].uAttributes |= 0x80; | 170 pActors[actor_id].uAttributes |= 0x80; |
171 memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v8, &a3, 0), sizeof(AIDirection)); | 171 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v8, &v31, 0); |
172 memcpy(&v30, &v31, sizeof(AIDirection)); | 172 memcpy(&v30, &v31, sizeof(AIDirection)); |
173 Actor::AI_StandOrBored(actor_id, 4, 32, &v30); | 173 Actor::AI_StandOrBored(actor_id, 4, 32, &v30); |
174 this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Actor,actor_id); | 174 this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Actor,actor_id); |
175 this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE; | 175 this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE; |
176 this->pQueue[this->uActorQueueSize].uActionLength = 0; | 176 this->pQueue[this->uActorQueueSize].uActionLength = 0; |
290 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | 290 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; |
291 | 291 |
292 //----- (00405E14) -------------------------------------------------------- | 292 //----- (00405E14) -------------------------------------------------------- |
293 void stru262_TurnBased::AITurnBasedAction() | 293 void stru262_TurnBased::AITurnBasedAction() |
294 { | 294 { |
295 AIDirection *v6; // esi@21 | 295 AIDirection v6; // esi@21 |
296 int v7; // eax@21 | 296 int v7; // eax@21 |
297 AIDirection a3; // [sp+4h] [bp-68h]@21 | 297 AIDirection a3; // [sp+4h] [bp-68h]@21 |
298 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | 298 AIDirection v14; // [sp+20h] [bp-4Ch]@21 |
299 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | 299 AIDirection v15; // [sp+3Ch] [bp-30h]@21 |
300 Actor *curr_actor; // [sp+58h] [bp-14h]@2 | 300 Actor *curr_actor; // [sp+58h] [bp-14h]@2 |
321 { | 321 { |
322 curr_actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 322 curr_actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
323 if (curr_actor->uCurrentActionTime>=curr_actor->uCurrentActionLength) | 323 if (curr_actor->uCurrentActionTime>=curr_actor->uCurrentActionLength) |
324 { | 324 { |
325 target_pid = ai_near_actors_targets_pid[i]; | 325 target_pid = ai_near_actors_targets_pid[i]; |
326 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,i), target_pid, &a3, 0); | 326 Actor::GetDirectionInfo(PID(OBJECT_Actor,i), target_pid, &v6, 0); |
327 memcpy(&v15, v6, sizeof(AIDirection)); | 327 memcpy(&v15, &v6, sizeof(AIDirection)); |
328 memcpy(&v14, &v15, sizeof(AIDirection)); | 328 memcpy(&v14, &v15, sizeof(AIDirection)); |
329 v7 = curr_actor->uAIState; | 329 v7 = curr_actor->uAIState; |
330 if(v7==Dying) | 330 if(v7==Dying) |
331 { | 331 { |
332 curr_actor->uCurrentActionTime = 0; | 332 curr_actor->uCurrentActionTime = 0; |
713 v3 = v1->uPackedID; | 713 v3 = v1->uPackedID; |
714 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor) | 714 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor) |
715 { | 715 { |
716 v4 = PID_ID(v3); | 716 v4 = PID_ID(v3); |
717 a2a = ai_near_actors_targets_pid[PID_ID(pQueue[queue_index].uPackedID)]; | 717 a2a = ai_near_actors_targets_pid[PID_ID(pQueue[queue_index].uPackedID)]; |
718 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); | 718 Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0); |
719 memcpy(&a4, &a3, sizeof(a4)); | 719 memcpy(&a4, &a3, sizeof(a4)); |
720 v5 = &pActors[PID_ID(v3)]; | 720 v5 = &pActors[PID_ID(v3)]; |
721 LOWORD(v3) = v5->uAIState; | 721 LOWORD(v3) = v5->uAIState; |
722 if (( (short)v3 != AIState::Dead )&& ( (short)v3 != AIState::Disabled )&&( (short)v3 != AIState::Removed )) | 722 if (( (short)v3 != AIState::Dead )&& ( (short)v3 != AIState::Disabled )&&( (short)v3 != AIState::Removed )) |
723 { | 723 { |
775 { | 775 { |
776 TurnBased_QueueElem *v2; // eax@1 | 776 TurnBased_QueueElem *v2; // eax@1 |
777 unsigned int v3; // eax@1 | 777 unsigned int v3; // eax@1 |
778 unsigned int actor_id; // edi@2 | 778 unsigned int actor_id; // edi@2 |
779 Actor *v5; // ebx@2 | 779 Actor *v5; // ebx@2 |
780 AIDirection *v7; // esi@10 | 780 AIDirection v7; // esi@10 |
781 int v8; // eax@10 | 781 int v8; // eax@10 |
782 int v9; // ecx@10 | 782 int v9; // ecx@10 |
783 signed int v10; // eax@13 | 783 signed int v10; // eax@13 |
784 int v14; // eax@29 | 784 int v14; // eax@29 |
785 AIDirection a3; // [sp+Ch] [bp-44h]@10 | 785 AIDirection a3; // [sp+Ch] [bp-44h]@10 |
806 | 806 |
807 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | 807 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); |
808 v22 = ai_near_actors_targets_pid[actor_id]; | 808 v22 = ai_near_actors_targets_pid[actor_id]; |
809 if ( v5->pMonsterInfo.uHostilityType && !v22) | 809 if ( v5->pMonsterInfo.uHostilityType && !v22) |
810 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 810 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
811 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &a3, 0); | 811 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &v7, 0); |
812 v8 = v5->uActorRadius; | 812 v8 = v5->uActorRadius; |
813 memcpy(&a3, v7, sizeof(AIDirection)); | 813 memcpy(&a3, &v7, sizeof(AIDirection)); |
814 memcpy(&v18, &a3, sizeof(AIDirection)); | 814 memcpy(&v18, &a3, sizeof(AIDirection)); |
815 v9 = a3.uDistance - v8; | 815 v9 = a3.uDistance - v8; |
816 v20 = a3.uDistance - v8; | 816 v20 = a3.uDistance - v8; |
817 if ( v20 < 0 ) | 817 if ( v20 < 0 ) |
818 { | 818 { |
918 for (i=0; i<uActorQueueSize; ++i ) | 918 for (i=0; i<uActorQueueSize; ++i ) |
919 { | 919 { |
920 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor) | 920 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor) |
921 { | 921 { |
922 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; | 922 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; |
923 memcpy(&v7, Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &a3, 0), sizeof(AIDirection)); | 923 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v7, 0); |
924 if ( !ActorMove(i) ) | 924 if ( !ActorMove(i) ) |
925 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7); | 925 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7); |
926 } | 926 } |
927 } | 927 } |
928 } | 928 } |
939 for (i=0; i<uActorQueueSize; ++i ) | 939 for (i=0; i<uActorQueueSize; ++i ) |
940 { | 940 { |
941 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor) | 941 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor) |
942 { | 942 { |
943 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; | 943 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; |
944 memcpy(&v7, Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &a3, 0), sizeof(AIDirection)); | 944 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v7, 0); |
945 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7); | 945 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7); |
946 pQueue[i].AI_action_type = TE_AI_STAND; | 946 pQueue[i].AI_action_type = TE_AI_STAND; |
947 pQueue[i].uActionLength = 0; | 947 pQueue[i].uActionLength = 0; |
948 } | 948 } |
949 } | 949 } |
968 v6 = &pActors[PID_ID(pQueue[i].uPackedID)]; | 968 v6 = &pActors[PID_ID(pQueue[i].uPackedID)]; |
969 if ( !(v6->pActorBuffs[5].uExpireTime > 0|| (v6->pActorBuffs[6].uExpireTime > 0) || | 969 if ( !(v6->pActorBuffs[5].uExpireTime > 0|| (v6->pActorBuffs[6].uExpireTime > 0) || |
970 v6->uAIState == AIState::Dead || v6->uAIState == AIState::Removed || v6->uAIState == AIState::Disabled) ) | 970 v6->uAIState == AIState::Dead || v6->uAIState == AIState::Removed || v6->uAIState == AIState::Disabled) ) |
971 { | 971 { |
972 v13 = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; | 972 v13 = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)]; |
973 memcpy(&v9, Actor::GetDirectionInfo(pQueue[i].uPackedID, v13, &a3, 0), sizeof(AIDirection)); | 973 Actor::GetDirectionInfo(pQueue[i].uPackedID, v13, &v9, 0); |
974 if ( v6->uAIState == AIState::Pursuing || v6->uAIState == AIState::Tethered ) | 974 if ( v6->uAIState == AIState::Pursuing || v6->uAIState == AIState::Tethered ) |
975 { | 975 { |
976 if ( (double)(signed int)v9.uDistance < 307.2 ) | 976 if ( (double)(signed int)v9.uDistance < 307.2 ) |
977 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9); | 977 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9); |
978 } | 978 } |
1002 { | 1002 { |
1003 int v2; // ecx@1 | 1003 int v2; // ecx@1 |
1004 //int v3; // ecx@2 | 1004 //int v3; // ecx@2 |
1005 Actor *actor; // ebx@2 | 1005 Actor *actor; // ebx@2 |
1006 | 1006 |
1007 AIDirection *v9; // esi@10 | 1007 AIDirection v9; // esi@10 |
1008 int v10; // eax@10 | 1008 int v10; // eax@10 |
1009 int v11; // ecx@10 | 1009 int v11; // ecx@10 |
1010 unsigned __int8 pHostileType; // al@12 | 1010 unsigned __int8 pHostileType; // al@12 |
1011 AIDirection a3; // [sp+Ch] [bp-48h]@10 | 1011 AIDirection a3; // [sp+Ch] [bp-48h]@10 |
1012 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | 1012 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 |
1030 v29 = &pTurnEngine->pQueue[queue_position]; | 1030 v29 = &pTurnEngine->pQueue[queue_position]; |
1031 a2a = ai_near_actors_targets_pid[uActorID]; | 1031 a2a = ai_near_actors_targets_pid[uActorID]; |
1032 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); | 1032 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
1033 if ( actor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[uActorID] ) | 1033 if ( actor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[uActorID] ) |
1034 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 1034 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
1035 v9 = Actor::GetDirectionInfo(pQueue[queue_position].uPackedID, ai_near_actors_targets_pid[uActorID], &a3, 0); | 1035 Actor::GetDirectionInfo(pQueue[queue_position].uPackedID, ai_near_actors_targets_pid[uActorID], &v9, 0); |
1036 v10 = actor->uActorRadius; | 1036 v10 = actor->uActorRadius; |
1037 memcpy(&a3, v9, sizeof(AIDirection)); | 1037 memcpy(&a3, &v9, sizeof(AIDirection)); |
1038 memcpy(&pDir, &a3, sizeof(AIDirection)); | 1038 memcpy(&pDir, &a3, sizeof(AIDirection)); |
1039 v11 = a3.uDistance - v10; | 1039 v11 = a3.uDistance - v10; |
1040 v28 = a3.uDistance - v10; | 1040 v28 = a3.uDistance - v10; |
1041 if ( v28 < 0 ) | 1041 if ( v28 < 0 ) |
1042 { | 1042 { |
1181 if ( !( curr_acror->uAIState == AIState::Summoned|| curr_acror->uAIState == AIState::Dead || | 1181 if ( !( curr_acror->uAIState == AIState::Summoned|| curr_acror->uAIState == AIState::Dead || |
1182 curr_acror->uAIState == AIState::Removed || curr_acror->uAIState == AIState::Disabled) ) | 1182 curr_acror->uAIState == AIState::Removed || curr_acror->uAIState == AIState::Disabled) ) |
1183 { | 1183 { |
1184 target_pid = ai_near_actors_targets_pid[uActorID]; | 1184 target_pid = ai_near_actors_targets_pid[uActorID]; |
1185 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); | 1185 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
1186 memcpy(&v9, Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &a3, 0), sizeof(AIDirection)); | 1186 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v9, 0); |
1187 memcpy(&a4, &v9, sizeof(AIDirection)); | 1187 memcpy(&a4, &v9, sizeof(AIDirection)); |
1188 curr_acror->uCurrentActionTime += pEventTimer->uTimeElapsed; | 1188 curr_acror->uCurrentActionTime += pEventTimer->uTimeElapsed; |
1189 if ( curr_acror->uCurrentActionTime > curr_acror->uCurrentActionLength ) | 1189 if ( curr_acror->uCurrentActionTime > curr_acror->uCurrentActionLength ) |
1190 { | 1190 { |
1191 if ( curr_acror->uAIState == AIState::Dying ) | 1191 if ( curr_acror->uAIState == AIState::Dying ) |