Mercurial > mm7
comparison mm7_5.cpp @ 1332:1e35cfed7928
turn engine file added
author | Gloval |
---|---|
date | Fri, 05 Jul 2013 01:46:44 +0400 |
parents | f0be1fecd642 |
children | 8bfdc44cebfd |
comparison
equal
deleted
inserted
replaced
1331:f0be1fecd642 | 1332:1e35cfed7928 |
---|---|
2427 Actor::StealFrom(uMessageParam); | 2427 Actor::StealFrom(uMessageParam); |
2428 continue; | 2428 continue; |
2429 } | 2429 } |
2430 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) | 2430 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
2431 continue; | 2431 continue; |
2432 if ( !(pTurnEngine->field_18 & 2) ) | 2432 if ( !(pTurnEngine->field_18 & TE_FLAG_2) ) |
2433 { | 2433 { |
2434 if ( pActors[uMessageParam].uAIState == 5 ) | 2434 if ( pActors[uMessageParam].uAIState == 5 ) |
2435 stru_50C198.LootActor(&pActors[uMessageParam]); | 2435 stru_50C198.LootActor(&pActors[uMessageParam]); |
2436 else | 2436 else |
2437 Actor::StealFrom(uMessageParam); | 2437 Actor::StealFrom(uMessageParam); |
2446 _42ECB5_PlayerAttacksActor(); | 2446 _42ECB5_PlayerAttacksActor(); |
2447 continue; | 2447 continue; |
2448 } | 2448 } |
2449 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) | 2449 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
2450 continue; | 2450 continue; |
2451 if ( !(pTurnEngine->field_18 & 2) ) | 2451 if ( !(pTurnEngine->field_18 & TE_FLAG_2) ) |
2452 _42ECB5_PlayerAttacksActor(); | 2452 _42ECB5_PlayerAttacksActor(); |
2453 continue; | 2453 continue; |
2454 case UIMSG_ExitRest: | 2454 case UIMSG_ExitRest: |
2455 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" | 2455 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
2456 continue; | 2456 continue; |
4775 v6 = 31; | 4775 v6 = 31; |
4776 } | 4776 } |
4777 return v6; | 4777 return v6; |
4778 } | 4778 } |
4779 | 4779 |
4780 //----- (00406051) -------------------------------------------------------- | |
4781 __int16 stru262_TurnBased::StartTurn() | |
4782 { | |
4783 stru262_TurnBased *v1; // esi@1 | |
4784 int v2; // ecx@1 | |
4785 int v3; // ebx@1 | |
4786 char *v4; // edi@1 | |
4787 int v5; // eax@4 | |
4788 int v6; // eax@12 | |
4789 char *v7; // eax@15 | |
4790 TurnBased_QueueElem *v8; // edi@17 | |
4791 unsigned int v9; // edx@23 | |
4792 char *v10; // eax@26 | |
4793 int v11; // eax@30 | |
4794 int v12; // ebx@30 | |
4795 char *v13; // edi@31 | |
4796 int v15; // [sp+Ch] [bp-10h]@5 | |
4797 TurnBased_QueueElem *v16; // [sp+10h] [bp-Ch]@3 | |
4798 int v17; // [sp+14h] [bp-8h]@2 | |
4799 int v18; // [sp+14h] [bp-8h]@16 | |
4800 signed int v19; // [sp+18h] [bp-4h]@1 | |
4801 int v20; // [sp+18h] [bp-4h]@14 | |
4802 | |
4803 v1 = this; | |
4804 v2 = 0; | |
4805 v19 = 0; | |
4806 v3 = v1->uActorQueueSize; | |
4807 v1->field_1C = 0; | |
4808 v4 = (char *)&v1->pQueue[v3].field_4; | |
4809 do | |
4810 { | |
4811 v17 = v2; | |
4812 if ( v1->uActorQueueSize <= v2 ) | |
4813 goto LABEL_11; | |
4814 v16 = v1->pQueue; | |
4815 while ( 1 ) | |
4816 { | |
4817 v5 = v16->uPackedID; | |
4818 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) | |
4819 break; | |
4820 LABEL_8: | |
4821 ++v17; | |
4822 ++v16; | |
4823 if ( v17 >= v1->uActorQueueSize ) | |
4824 goto LABEL_11; | |
4825 } | |
4826 v15 = PID_ID(v5); | |
4827 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) | |
4828 { | |
4829 v2 = 0; | |
4830 goto LABEL_8; | |
4831 } | |
4832 v2 = 0; | |
4833 LABEL_11: | |
4834 if ( v17 == v1->uActorQueueSize ) | |
4835 { | |
4836 *(int *)v4 = 100; | |
4837 v6 = 8 * v19; | |
4838 LOBYTE(v6) = PID(OBJECT_Player,v19); | |
4839 *((int *)v4 + 2) = v2; | |
4840 *((int *)v4 - 1) = v6; | |
4841 *((int *)v4 + 1) = v2; | |
4842 ++v3; | |
4843 v4 += 16; | |
4844 } | |
4845 ++v19; | |
4846 } | |
4847 while ( v19 < 4 ); | |
4848 v1->uActorQueueSize = v3; | |
4849 v20 = v2; | |
4850 if ( ai_arrays_size > v2 ) | |
4851 { | |
4852 v7 = (char *)&v1->pQueue[v3].field_4; | |
4853 do | |
4854 { | |
4855 v18 = v2; | |
4856 if ( v1->uActorQueueSize > v2 ) | |
4857 { | |
4858 v8 = v1->pQueue; | |
4859 do | |
4860 { | |
4861 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) | |
4862 break; | |
4863 ++v18; | |
4864 ++v8; | |
4865 } | |
4866 while ( v18 < v1->uActorQueueSize ); | |
4867 v2 = 0; | |
4868 } | |
4869 if ( v18 == v1->uActorQueueSize ) | |
4870 { | |
4871 v9 = ai_near_actors_ids[v20]; | |
4872 *(int *)v7 = 1; | |
4873 *((int *)v7 + 2) = v2; | |
4874 *((int *)v7 - 1) = PID(OBJECT_Actor,v9); | |
4875 *((int *)v7 + 1) = v2; | |
4876 ++v3; | |
4877 v7 += 16; | |
4878 } | |
4879 ++v20; | |
4880 } | |
4881 while ( v20 < ai_arrays_size ); | |
4882 } | |
4883 ++v1->field_0; | |
4884 v1->uActorQueueSize = v3; | |
4885 v1->field_10 = 100; | |
4886 if ( v3 > 0 ) | |
4887 { | |
4888 v10 = (char *)&v1->pQueue[0].field_4; | |
4889 do | |
4890 { | |
4891 if ( *(int *)v10 <= 0 ) | |
4892 *(int *)v10 = 100; | |
4893 ++v2; | |
4894 v10 += 16; | |
4895 } | |
4896 while ( v2 < v1->uActorQueueSize ); | |
4897 } | |
4898 LOWORD(v11) = v1->_4063A1(); | |
4899 v12 = 0; | |
4900 if ( v1->uActorQueueSize > 0 ) | |
4901 { | |
4902 v13 = (char *)&v1->pQueue[0].field_4; | |
4903 do | |
4904 { | |
4905 v11 = PID_TYPE(*((int *)v13 - 1)); | |
4906 if ( (char)v11 == 4 ) | |
4907 break; | |
4908 if ( *(int *)v13 > 0 ) | |
4909 break; | |
4910 LOWORD(v11) = v1->_40680F(v12++); | |
4911 v13 += 16; | |
4912 } | |
4913 while ( v12 < v1->uActorQueueSize ); | |
4914 } | |
4915 return v11; | |
4916 } | |
4917 // 4F75D8: using guessed type int ai_arrays_size; | |
4918 | |
4919 //----- (004061CA) -------------------------------------------------------- | |
4920 void stru262_TurnBased::NextTurn() | |
4921 { | |
4922 stru262_TurnBased *v1; // esi@1 | |
4923 TurnBased_QueueElem *v2; // ebp@1 | |
4924 int v3; // ebx@1 | |
4925 int v4; // edi@7 | |
4926 Actor *v5; // eax@9 | |
4927 int v6; // ecx@9 | |
4928 signed int v7; // ebx@17 | |
4929 int v8; // ebp@27 | |
4930 TurnBased_QueueElem *v9; // edi@28 | |
4931 int v10; // ecx@30 | |
4932 unsigned __int16 v11; // ax@30 | |
4933 signed int v12; // edx@35 | |
4934 signed int v13; // [sp+10h] [bp-4h]@7 | |
4935 | |
4936 v1 = this; | |
4937 _404544(); | |
4938 v2 = v1->pQueue; | |
4939 v3 = 0; | |
4940 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) | |
4941 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1; | |
4942 else | |
4943 uActiveCharacter = 0; | |
4944 viewparams->bRedrawGameUI = 1; | |
4945 if ( v1->field_1C ) | |
4946 { | |
4947 pTurnEngine->field_18 |= 2u; | |
4948 return; | |
4949 } | |
4950 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
4951 if ( v1->pQueue[0].field_4 <= 0 ) | |
4952 return; | |
4953 v4 = 0; | |
4954 v13 = 0; | |
4955 if ( v1->uActorQueueSize <= 0 ) | |
4956 goto LABEL_27; | |
4957 do | |
4958 { | |
4959 if (PID_TYPE(v2->uPackedID) != OBJECT_Player) | |
4960 { | |
4961 v5 = &pActors[PID_ID(v2->uPackedID)]; | |
4962 LOWORD(v6) = v5->uAIState; | |
4963 if ( (short)v6 == 4 | |
4964 || (short)v6 == 8 | |
4965 || (short)v6 == 2 | |
4966 || (short)v6 == 3 | |
4967 || (short)v6 == 12 | |
4968 || (short)v6 == 13 | |
4969 || (short)v6 == 18 | |
4970 || (short)v6 == 17 ) | |
4971 { | |
4972 v7 = v5->uCurrentActionLength; | |
4973 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
4974 if ( (signed int)v5->uCurrentActionTime < v7 ) | |
4975 { | |
4976 v13 = 1; | |
4977 LABEL_19: | |
4978 v3 = 0; | |
4979 goto LABEL_20; | |
4980 } | |
4981 v6 = (signed __int16)v6; | |
4982 if ( (signed __int16)v6 == 4 ) | |
4983 { | |
4984 v3 = 0; | |
4985 v5->uAIState = Dead; | |
4986 v5->uCurrentActionTime = 0; | |
4987 v5->uCurrentActionLength = 0; | |
4988 v5->UpdateAnimation(); | |
4989 } | |
4990 else | |
4991 { | |
4992 if ( v6 != 8 ) | |
4993 goto LABEL_19; | |
4994 v3 = 0; | |
4995 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); | |
4996 } | |
4997 } | |
4998 } | |
4999 LABEL_20: | |
5000 ++v4; | |
5001 ++v2; | |
5002 } | |
5003 while ( v4 < v1->uActorQueueSize ); | |
5004 if ( v13 != v3 ) | |
5005 { | |
5006 v1->field_18 |= 1u; | |
5007 return; | |
5008 } | |
5009 LABEL_27: | |
5010 v1->field_18 &= 0xFFFFFFFEu; | |
5011 v8 = 0; | |
5012 if ( v1->uActorQueueSize > v3 ) | |
5013 { | |
5014 v9 = v1->pQueue; | |
5015 do | |
5016 { | |
5017 if (PID_TYPE(v9->uPackedID) != OBJECT_Player) | |
5018 { | |
5019 v10 = PID_ID(v9->uPackedID); | |
5020 v11 = pActors[v10].uAIState; | |
5021 if ( v11 != 5 ) | |
5022 { | |
5023 if ( v11 != 4 && v11 != 11 && v11 != 19 ) | |
5024 { | |
5025 if ( v11 != 17 ) | |
5026 { | |
5027 v12 = ai_near_actors_targets_pid[v10]; | |
5028 v9->uActionLength = v3; | |
5029 Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3); | |
5030 } | |
5031 } | |
5032 } | |
5033 } | |
5034 ++v8; | |
5035 ++v9; | |
5036 } | |
5037 while ( v8 < v1->uActorQueueSize ); | |
5038 } | |
5039 v1->field_4 = 3; | |
5040 pParty->uTimePlayed += __PAIR__(v3, 213); | |
5041 _494035_timed_effects__water_walking_damage__etc(); | |
5042 v1->uActionPointsLeft = 130; | |
5043 } | |
5044 | |
5045 //----- (004063A1) -------------------------------------------------------- | |
5046 int stru262_TurnBased::_4063A1() | |
5047 { | |
5048 stru262_TurnBased *v1; // esi@1 | |
5049 int v2; // ebp@1 | |
5050 signed int result; // eax@1 | |
5051 int v4; // edx@1 | |
5052 int v5; // edx@3 | |
5053 int v6; // edi@4 | |
5054 int v7; // ecx@5 | |
5055 Actor *v8; // ecx@11 | |
5056 unsigned __int16 v9; // dx@12 | |
5057 int v10; // edi@16 | |
5058 int v11; // edx@17 | |
5059 char v12; // zf@18 | |
5060 | |
5061 v1 = this; | |
5062 _404544(); | |
5063 v2 = (int)&v1->pQueue[0].field_4; | |
5064 result = 1; | |
5065 viewparams->bRedrawGameUI = 1; | |
5066 v4 = v1->pQueue[0].field_4; | |
5067 if ( v4 ) | |
5068 { | |
5069 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) | |
5070 { | |
5071 v5 = v1->uActorQueueSize; | |
5072 while ( 1 ) | |
5073 { | |
5074 v6 = 0; | |
5075 if ( v5 > 0 ) | |
5076 { | |
5077 v7 = (int)&v1->pQueue[0].field_4; | |
5078 do | |
5079 { | |
5080 --*(int *)v7; | |
5081 v5 = v1->uActorQueueSize; | |
5082 ++v6; | |
5083 v7 += 16; | |
5084 } | |
5085 while ( v6 < v5 ); | |
5086 } | |
5087 --v1->field_10; | |
5088 if ( v1->field_10 <= 0 ) | |
5089 break; | |
5090 if ( !*(int *)v2 ) | |
5091 goto LABEL_9; | |
5092 } | |
5093 LABEL_24: | |
5094 result = 1; | |
5095 } | |
5096 else | |
5097 { | |
5098 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; | |
5099 if ( v4 > 0 ) | |
5100 { | |
5101 do | |
5102 { | |
5103 v9 = v8->uAIState; | |
5104 if ( v9 == 5 ) | |
5105 break; | |
5106 if ( v9 == 4 || v9 == 19 || v9 == 11 ) | |
5107 break; | |
5108 v10 = 0; | |
5109 if ( v1->uActorQueueSize > 0 ) | |
5110 { | |
5111 v11 = (int)&v1->pQueue[0].field_4; | |
5112 do | |
5113 { | |
5114 v12 = (*(int *)v11)-- == 1; | |
5115 if ( v12 ) | |
5116 *(int *)(v11 + 4) = 0; | |
5117 ++v10; | |
5118 v11 += 16; | |
5119 } | |
5120 while ( v10 < v1->uActorQueueSize ); | |
5121 } | |
5122 --v1->field_10; | |
5123 if ( v1->field_10 <= 0 ) | |
5124 goto LABEL_24; | |
5125 } | |
5126 while ( *(int *)v2 > 0 ); | |
5127 } | |
5128 LABEL_9: | |
5129 result = 0; | |
5130 } | |
5131 } | |
5132 return result; | |
5133 } | |
5134 | |
5135 //----- (00406457) -------------------------------------------------------- | |
5136 int stru262_TurnBased::_406457(int a2) | |
5137 { | |
5138 stru262_TurnBased *v2; // esi@1 | |
5139 signed int v3; // eax@1 | |
5140 signed int v4; // ecx@2 | |
5141 char *v5; // edx@2 | |
5142 signed int v6; // eax@2 | |
5143 int result; // eax@11 | |
5144 int v8; // edx@13 | |
5145 int v9; // ecx@14 | |
5146 char v10; // zf@15 | |
5147 | |
5148 v2 = this; | |
5149 v3 = *(&this->field_0 + 4 * (a2 + 2)); | |
5150 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) | |
5151 { | |
5152 v4 = PID_ID(v3); | |
5153 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; | |
5154 v6 = *(int *)v5; | |
5155 if ( *(int *)v5 ) | |
5156 *(int *)v5 = 0; | |
5157 else | |
5158 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | |
5159 if ( v6 < 30 ) | |
5160 v6 = 30; | |
5161 } | |
5162 else | |
5163 { | |
5164 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; | |
5165 } | |
5166 v2->pQueue[a2].field_4 = v6; | |
5167 v2->_404544(); | |
5168 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) | |
5169 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; | |
5170 else | |
5171 uActiveCharacter = 0; | |
5172 result = (int)&v2->pQueue[0].field_4; | |
5173 viewparams->bRedrawGameUI = 1; | |
5174 while ( *(int *)result > 0 ) | |
5175 { | |
5176 if ( v2->field_10 <= 0 ) | |
5177 break; | |
5178 v8 = 0; | |
5179 if ( v2->uActorQueueSize > 0 ) | |
5180 { | |
5181 v9 = (int)&v2->pQueue[0].field_4; | |
5182 do | |
5183 { | |
5184 v10 = (*(int *)v9)-- == 1; | |
5185 if ( v10 ) | |
5186 *(int *)(v9 + 4) = 0; | |
5187 ++v8; | |
5188 v9 += 16; | |
5189 } | |
5190 while ( v8 < v2->uActorQueueSize ); | |
5191 } | |
5192 --v2->field_10; | |
5193 if ( v2->field_10 <= 0 ) | |
5194 break; | |
5195 } | |
5196 return result; | |
5197 } | |
5198 | |
5199 //----- (0040652A) -------------------------------------------------------- | |
5200 void stru262_TurnBased::_40652A() | |
5201 { | |
5202 int *v1; // edx@2 | |
5203 Actor *v2; // eax@5 | |
5204 unsigned __int16 v3; // si@5 | |
5205 unsigned int v4; // esi@8 | |
5206 int v5; // [sp+Ch] [bp-4h]@1 | |
5207 | |
5208 v5 = 0; | |
5209 if ( this->uActorQueueSize > 0 ) | |
5210 { | |
5211 v1 = &this->pQueue[0].field_4; | |
5212 do | |
5213 { | |
5214 if ( !*(int *)v1 ) | |
5215 { | |
5216 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) | |
5217 return; | |
5218 v2 = &pActors[PID_ID(*(v1 - 1))]; | |
5219 v3 = v2->uAIState; | |
5220 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) | |
5221 { | |
5222 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | |
5223 *(int *)v1 = v4; | |
5224 if ( (signed __int64)v2->pActorBuffs[7].uExpireTime > 0 ) | |
5225 *(int *)v1 = 2 * v4; | |
5226 } | |
5227 } | |
5228 ++v5; | |
5229 v1 += 16; | |
5230 } | |
5231 while ( v5 < this->uActorQueueSize ); | |
5232 } | |
5233 } | |
5234 | |
5235 //----- (004065B0) -------------------------------------------------------- | |
5236 void stru262_TurnBased::_4065B0() | |
5237 { | |
5238 stru262_TurnBased *v1; // esi@1 | |
5239 signed int v2; // eax@1 | |
5240 int v3; // ebx@6 | |
5241 int v4; // edi@7 | |
5242 unsigned int v5; // edi@14 | |
5243 | |
5244 v1 = this; | |
5245 _404544(); | |
5246 if ( v1->pQueue[0].field_4 <= 0 | |
5247 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), | |
5248 viewparams->bRedrawGameUI = 1, | |
5249 v1->pQueue[0].field_4 <= 0) ) | |
5250 { | |
5251 v3 = 0; | |
5252 if ( v1->uActorQueueSize > 0 ) | |
5253 { | |
5254 v4 = (int)v1->pQueue; | |
5255 do | |
5256 { | |
5257 v2 = *(int *)v4; | |
5258 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) | |
5259 break; | |
5260 if ( *(int *)(v4 + 8) <= 0 ) | |
5261 { | |
5262 LOWORD(v2) = v2 & 3; | |
5263 if ( (char)v2 == 3 ) | |
5264 LOWORD(v2) = v1->_40680F(v3); | |
5265 } | |
5266 ++v3; | |
5267 v4 += 16; | |
5268 } | |
5269 while ( v3 < v1->uActorQueueSize ); | |
5270 } | |
5271 } | |
5272 v5 = 0; | |
5273 if ( v1->uActorQueueSize > 0 ) | |
5274 { | |
5275 do | |
5276 v1->_406648(v5++); | |
5277 while ( (signed int)v5 < v1->uActorQueueSize ); | |
5278 } | |
5279 } | |
5280 | |
5281 //----- (00406648) -------------------------------------------------------- | |
5282 void stru262_TurnBased::_406648(unsigned int a2) | |
5283 { | |
5284 TurnBased_QueueElem *v1; // ecx@1 | |
5285 int v3; // eax@1 | |
5286 unsigned int v4; // ebx@2 | |
5287 Actor *v5; // esi@2 | |
5288 signed int v6; // edi@5 | |
5289 int v7; // ecx@6 | |
5290 int v8; // eax@6 | |
5291 int v9; // eax@7 | |
5292 int v10; // eax@8 | |
5293 int v11; // eax@9 | |
5294 int v12; // eax@10 | |
5295 int v13; // eax@11 | |
5296 int v14; // eax@14 | |
5297 unsigned int v15; // ecx@14 | |
5298 unsigned int v16; // edx@14 | |
5299 int v17; // eax@17 | |
5300 int v18; // eax@20 | |
5301 char v19; // al@24 | |
5302 unsigned int v21; // [sp-8h] [bp-50h]@16 | |
5303 int v22; // [sp-8h] [bp-50h]@17 | |
5304 AIDirection *v23; // [sp-4h] [bp-4Ch]@14 | |
5305 unsigned int v24; // [sp-4h] [bp-4Ch]@17 | |
5306 char v25; // [sp-4h] [bp-4Ch]@20 | |
5307 AIDirection a3; // [sp+Ch] [bp-3Ch]@2 | |
5308 AIDirection a4; // [sp+28h] [bp-20h]@2 | |
5309 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1 | |
5310 unsigned int a2a; // [sp+50h] [bp+8h]@2 | |
5311 | |
5312 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
5313 v28 = v1; | |
5314 v3 = v1->uPackedID; | |
5315 if (PID_TYPE(v1->uPackedID) != OBJECT_Player) | |
5316 { | |
5317 v4 = PID_ID(v3); | |
5318 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; | |
5319 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); | |
5320 memcpy(&a4, &a3, sizeof(a4)); | |
5321 v5 = &pActors[PID_ID(v3)]; | |
5322 LOWORD(v3) = v5->uAIState; | |
5323 if ( (short)v3 != Dead ) | |
5324 { | |
5325 if ( (short)v3 != Disabled ) | |
5326 { | |
5327 if ( (short)v3 != Removed ) | |
5328 { | |
5329 v6 = v5->uCurrentActionLength; | |
5330 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
5331 if ( (signed int)v5->uCurrentActionTime >= v6 ) | |
5332 { | |
5333 v7 = (signed __int16)v3; | |
5334 v8 = (signed __int16)v3 - 2; | |
5335 if ( !v8 ) | |
5336 { | |
5337 v19 = stru_50C198.special_ability_use_check(&pActors[v4], v4); | |
5338 stru_50FE08.Add( | |
5339 v28->uPackedID, | |
5340 5120, | |
5341 v5->vPosition.x, | |
5342 v5->vPosition.y, | |
5343 v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), | |
5344 v19, | |
5345 1); | |
5346 goto LABEL_25; | |
5347 } | |
5348 v9 = v8 - 1; | |
5349 if ( v9 ) | |
5350 { | |
5351 v10 = v9 - 1; | |
5352 if ( !v10 ) | |
5353 goto LABEL_21; | |
5354 v11 = v10 - 4; | |
5355 if ( !v11 ) | |
5356 goto LABEL_25; | |
5357 v12 = v11 - 4; | |
5358 if ( v12 ) | |
5359 { | |
5360 v13 = v12 - 1; | |
5361 if ( v13 ) | |
5362 { | |
5363 if ( v13 != Dead ) | |
5364 { | |
5365 if ( v7 != 4 ) | |
5366 { | |
5367 v14 = rand(); | |
5368 v15 = v4; | |
5369 v23 = &a4; | |
5370 v16 = a2a; | |
5371 if ( !(v14 % 2) ) | |
5372 { | |
5373 Actor::AI_Bored(v4, a2a, &a4); | |
5374 return; | |
5375 } | |
5376 v21 = 64; | |
5377 LABEL_26: | |
5378 Actor::AI_Stand(v15, v16, v21, v23); | |
5379 return; | |
5380 } | |
5381 LABEL_21: | |
5382 v5->uCurrentActionTime = 0; | |
5383 v5->uCurrentActionLength = 0; | |
5384 v5->uAIState = Dead; | |
5385 pActors[v4].UpdateAnimation(); | |
5386 return; | |
5387 } | |
5388 v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; | |
5389 v22 = 3; | |
5390 v17 = v5->pMonsterInfo.uSpell2ID; | |
5391 } | |
5392 else | |
5393 { | |
5394 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; | |
5395 v22 = 2; | |
5396 v17 = v5->pMonsterInfo.uSpell1ID; | |
5397 } | |
5398 Actor::AI_SpellAttack(v4, &a4, v17, v22, v24); | |
5399 LABEL_25: | |
5400 v16 = a2a; | |
5401 v23 = &a4; | |
5402 v21 = 0; | |
5403 v15 = v4; | |
5404 goto LABEL_26; | |
5405 } | |
5406 v18 = v5->pMonsterInfo.uMissleAttack2Type; | |
5407 v25 = 1; | |
5408 } | |
5409 else | |
5410 { | |
5411 v18 = v5->pMonsterInfo.uMissleAttack1Type; | |
5412 v25 = 0; | |
5413 } | |
5414 Actor::AI_RangedAttack(v4, &a4, v18, v25); | |
5415 goto LABEL_25; | |
5416 } | |
5417 } | |
5418 } | |
5419 } | |
5420 } | |
5421 } | |
5422 // 50FE08: using guessed type stru298 stru_50FE08; | |
5423 | |
5424 //----- (0040680F) -------------------------------------------------------- | |
5425 __int16 stru262_TurnBased::_40680F(int a2) | |
5426 { | |
5427 TurnBased_QueueElem *v2; // eax@1 | |
5428 unsigned int v3; // eax@1 | |
5429 unsigned int v4; // edi@2 | |
5430 Actor *v5; // ebx@2 | |
5431 unsigned int *v6; // esi@7 | |
5432 AIDirection *v7; // esi@10 | |
5433 int v8; // eax@10 | |
5434 unsigned int v9; // ecx@10 | |
5435 signed int v10; // eax@13 | |
5436 unsigned __int8 v11; // sf@19 | |
5437 unsigned __int8 v12; // of@19 | |
5438 int v13; // esi@29 | |
5439 bool v14; // eax@29 | |
5440 unsigned __int8 v15; // cl@33 | |
5441 AIDirection a3; // [sp+Ch] [bp-44h]@10 | |
5442 AIDirection v18; // [sp+28h] [bp-28h]@10 | |
5443 int a2a; // [sp+44h] [bp-Ch]@2 | |
5444 unsigned int v20; // [sp+48h] [bp-8h]@10 | |
5445 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
5446 signed int v22; // [sp+58h] [bp+8h]@10 | |
5447 | |
5448 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
5449 v21 = v2; | |
5450 v2->uActionLength = 0; | |
5451 v3 = v2->uPackedID; | |
5452 if ( (unsigned __int8)v3 & 3 ) | |
5453 { | |
5454 v3 = PID_ID(v3); | |
5455 v4 = v3; | |
5456 a2a = v3; | |
5457 v5 = &pActors[v3]; | |
5458 LOWORD(v3) = v5->uAIState; | |
5459 if ( (short)v3 != 5 ) | |
5460 { | |
5461 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | |
5462 { | |
5463 v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4]; | |
5464 Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true); | |
5465 if ( v5->pMonsterInfo.uHostilityType && !*v6 ) | |
5466 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
5467 v22 = *v6; | |
5468 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); | |
5469 v8 = v5->uActorRadius; | |
5470 memcpy(&a3, v7, sizeof(a3)); | |
5471 memcpy(&v18, &a3, sizeof(v18)); | |
5472 v9 = a3.uDistance - v8; | |
5473 v20 = a3.uDistance - v8; | |
5474 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) | |
5475 { | |
5476 v9 = 0; | |
5477 v20 = 0; | |
5478 } | |
5479 if (PID_TYPE(v22) == OBJECT_Actor) | |
5480 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); | |
5481 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(v5->pMonsterInfo.uID - 1) / 3 + 1]; | |
5482 else | |
5483 v10 = 4; | |
5484 if ( v10 == 1 ) | |
5485 { | |
5486 if ( (double)(signed int)v20 < 307.2 ) | |
5487 goto LABEL_25; | |
5488 } | |
5489 else | |
5490 { | |
5491 if ( v10 == 2 ) | |
5492 { | |
5493 v12 = __OFSUB__(v9, 1024); | |
5494 v11 = ((v9 - 1024) & 0x80000000u) != 0; | |
5495 } | |
5496 else | |
5497 { | |
5498 if ( v10 == 3 ) | |
5499 { | |
5500 v12 = __OFSUB__(v9, 2560); | |
5501 v11 = ((v9 - 2560) & 0x80000000u) != 0; | |
5502 } | |
5503 else | |
5504 { | |
5505 if ( v10 != 4 ) | |
5506 goto LABEL_26; | |
5507 v12 = __OFSUB__(v9, 5120); | |
5508 v11 = ((v9 - 5120) & 0x80000000u) != 0; | |
5509 } | |
5510 } | |
5511 if ( v11 ^ v12 ) | |
5512 { | |
5513 LABEL_25: | |
5514 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5515 goto LABEL_26; | |
5516 } | |
5517 } | |
5518 LABEL_26: | |
5519 if ( v5->pMonsterInfo.uHostilityType != 4 || !v22 || (signed int)v9 >= 5120 ) | |
5520 { | |
5521 v13 = a2a; | |
5522 goto LABEL_47; | |
5523 } | |
5524 v13 = a2a; | |
5525 v14 = stru_50C198.special_ability_use_check(v5, a2a); | |
5526 if ( v14 == 1 ) | |
5527 { | |
5528 if ( v5->pMonsterInfo.uMissleAttack2Type ) | |
5529 { | |
5530 Actor::AI_MissileAttack2(v13, v22, &v18); | |
5531 goto LABEL_43; | |
5532 } | |
5533 } | |
5534 else | |
5535 { | |
5536 if ( v14 > 1 && v14 <= 3 ) | |
5537 { | |
5538 if ( v14 == 2 ) | |
5539 v15 = v5->pMonsterInfo.uSpell1ID; | |
5540 else | |
5541 v15 = v5->pMonsterInfo.uSpell2ID; | |
5542 if ( v15 ) | |
5543 { | |
5544 if ( v14 == 2 ) | |
5545 Actor::AI_SpellAttack1(v13, v22, &v18); | |
5546 else | |
5547 Actor::AI_SpellAttack2(v13, v22, &v18); | |
5548 goto LABEL_43; | |
5549 } | |
5550 goto LABEL_44; | |
5551 } | |
5552 if ( v5->pMonsterInfo.uMissleAttack1Type ) | |
5553 { | |
5554 Actor::AI_MissileAttack1(v13, v22, &v18); | |
5555 LABEL_43: | |
5556 //v3 = v21; | |
5557 v21->field_C = 1; | |
5558 LABEL_48: | |
5559 v21->uActionLength = v5->uCurrentActionLength; | |
5560 //return (signed __int16)v3; | |
5561 return (signed __int16)&v21; | |
5562 } | |
5563 } | |
5564 LABEL_44: | |
5565 if ( (double)(signed int)v20 < 307.2 ) | |
5566 { | |
5567 Actor::AI_MeleeAttack(v13, v22, &v18); | |
5568 //v3 = v21; | |
5569 v21->field_C = 3; | |
5570 goto LABEL_48; | |
5571 } | |
5572 LABEL_47: | |
5573 Actor::AI_Stand(v13, v22, 0x40u, &v18); | |
5574 //v3 = v21; | |
5575 v21->field_C = 0; | |
5576 goto LABEL_48; | |
5577 } | |
5578 } | |
5579 } | |
5580 return (signed __int16)v3; | |
5581 } | |
5582 | |
5583 //----- (00406A63) -------------------------------------------------------- | |
5584 void stru262_TurnBased::_406A63() | |
5585 { | |
5586 stru262_TurnBased *v1; // ebx@1 | |
5587 int v2; // esi@1 | |
5588 unsigned __int8 v3; // zf@1 | |
5589 unsigned __int8 v4; // sf@1 | |
5590 signed int v5; // ecx@4 | |
5591 AIDirection a3; // [sp+8h] [bp-44h]@5 | |
5592 AIDirection v7; // [sp+24h] [bp-28h]@5 | |
5593 unsigned int v8; // [sp+40h] [bp-Ch]@5 | |
5594 signed int a2; // [sp+44h] [bp-8h]@1 | |
5595 TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2 | |
5596 | |
5597 v1 = this; | |
5598 v2 = 0; | |
5599 this->field_8 = 64; | |
5600 dword_50C994 = 0; | |
5601 uActiveCharacter = 0; | |
5602 v3 = this->uActorQueueSize == 0; | |
5603 v4 = this->uActorQueueSize < 0; | |
5604 a2 = 0; | |
5605 if ( !(v4 | v3) ) | |
5606 { | |
5607 v10 = this->pQueue; | |
5608 while ( 1 ) | |
5609 { | |
5610 v5 = v10->uPackedID; | |
5611 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) | |
5612 { | |
5613 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; | |
5614 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); | |
5615 if ( !v1->_406D10(a2) ) | |
5616 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); | |
5617 } | |
5618 ++a2; | |
5619 ++v10; | |
5620 if ( a2 >= v1->uActorQueueSize ) | |
5621 break; | |
5622 v2 = 0; | |
5623 } | |
5624 } | |
5625 } | |
5626 // 50C994: using guessed type int dword_50C994; | |
5627 | |
5628 //----- (00406AFE) -------------------------------------------------------- | |
5629 void stru262_TurnBased::_406AFE() | |
5630 { | |
5631 stru262_TurnBased *v1; // edi@1 | |
5632 TurnBased_QueueElem *v2; // ebx@2 | |
5633 int v3; // esi@4 | |
5634 int v4; // ecx@5 | |
5635 AIDirection a3; // [sp+4h] [bp-48h]@5 | |
5636 AIDirection v6; // [sp+20h] [bp-2Ch]@5 | |
5637 stru262_TurnBased *v7; // [sp+3Ch] [bp-10h]@1 | |
5638 unsigned int v8; // [sp+40h] [bp-Ch]@4 | |
5639 unsigned int v9; // [sp+44h] [bp-8h]@5 | |
5640 int v10; // [sp+48h] [bp-4h]@1 | |
5641 | |
5642 v10 = 0; | |
5643 v1 = this; | |
5644 v7 = this; | |
5645 if ( this->uActorQueueSize > 0 ) | |
5646 { | |
5647 v2 = this->pQueue; | |
5648 do | |
5649 { | |
5650 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor) | |
5651 { | |
5652 v3 = PID_ID(v2->uPackedID); | |
5653 v8 = v3; | |
5654 if ( pActors[v3].CanAct() ) | |
5655 { | |
5656 v4 = v2->uPackedID; | |
5657 v9 = ai_near_actors_targets_pid[v3]; | |
5658 memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6)); | |
5659 Actor::AI_Stand(v8, v9, 0x20u, &v6); | |
5660 v2->field_C = 0; | |
5661 v2->uActionLength = 0; | |
5662 v1 = v7; | |
5663 } | |
5664 } | |
5665 ++v10; | |
5666 ++v2; | |
5667 } | |
5668 while ( v10 < v1->uActorQueueSize ); | |
5669 } | |
5670 v1->field_4 = 2; | |
5671 v1->field_8 = 100; | |
5672 } | |
5673 | |
5674 //----- (00406B9F) -------------------------------------------------------- | |
5675 int stru262_TurnBased::_406B9F() | |
5676 { | |
5677 signed int result; // eax@1 | |
5678 unsigned __int8 v2; // zf@1 | |
5679 unsigned __int8 v3; // sf@1 | |
5680 int v4; // esi@4 | |
5681 unsigned int v5; // esi@5 | |
5682 Actor *v6; // ebx@5 | |
5683 unsigned __int16 v7; // cx@15 | |
5684 AIDirection a3; // [sp+0h] [bp-50h]@15 | |
5685 AIDirection v9; // [sp+1Ch] [bp-34h]@15 | |
5686 signed int a1; // [sp+38h] [bp-18h]@4 | |
5687 stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1 | |
5688 unsigned int v12; // [sp+40h] [bp-10h]@5 | |
5689 unsigned int v13; // [sp+44h] [bp-Ch]@8 | |
5690 TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2 | |
5691 signed int a2; // [sp+4Ch] [bp-4h]@1 | |
5692 | |
5693 result = 0; | |
5694 thisa = this; | |
5695 v2 = this->uActorQueueSize == 0; | |
5696 v3 = this->uActorQueueSize < 0; | |
5697 a2 = 0; | |
5698 if ( !(v3 | v2) ) | |
5699 { | |
5700 v14 = this->pQueue; | |
5701 while ( 1 ) | |
5702 { | |
5703 v4 = v14->uPackedID; | |
5704 a1 = v14->uPackedID; | |
5705 if (PID_TYPE(a1) != OBJECT_Player) | |
5706 { | |
5707 v5 = PID_ID(v4); | |
5708 v12 = v5; | |
5709 v6 = &pActors[v5]; | |
5710 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | |
5711 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | |
5712 v13 = result; | |
5713 else | |
5714 v13 = 1; | |
5715 if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result | |
5716 && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) ) | |
5717 result = 1; | |
5718 if ( !(v13 != 0 || result || v6->uAIState == 5 || v6->uAIState == 11 || v6->uAIState == 19) ) | |
5719 { | |
5720 v13 = ai_near_actors_targets_pid[v5]; | |
5721 memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9)); | |
5722 v7 = v6->uAIState; | |
5723 if ( v7 == 6 || v7 == 1 ) | |
5724 { | |
5725 if ( (double)(signed int)v9.uDistance < 307.2 ) | |
5726 goto LABEL_26; | |
5727 } | |
5728 v6->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
5729 if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength ) | |
5730 { | |
5731 if ( v7 == 4 ) | |
5732 { | |
5733 v6->uCurrentActionTime = 0; | |
5734 v6->uCurrentActionLength = 0; | |
5735 v6->uAIState = Dead; | |
5736 v6->UpdateAnimation(); | |
5737 } | |
5738 if ( !thisa->_406D10(a2) ) | |
5739 LABEL_26: | |
5740 Actor::AI_Stand(v12, v13, 0x20u, &v9); | |
5741 } | |
5742 } | |
5743 } | |
5744 ++a2; | |
5745 result = (signed int)thisa; | |
5746 ++v14; | |
5747 if ( a2 >= thisa->uActorQueueSize ) | |
5748 break; | |
5749 result = 0; | |
5750 } | |
5751 } | |
5752 return result; | |
5753 } | |
5754 | |
5755 //----- (00406D10) -------------------------------------------------------- | |
5756 bool stru262_TurnBased::_406D10(signed int a2) | |
5757 { | |
5758 int v2; // ecx@1 | |
5759 //int v3; // ecx@2 | |
5760 Actor *actor; // ebx@2 | |
5761 //unsigned __int16 v5; // dx@2 | |
5762 int *v6; // esi@7 | |
5763 TurnBased_QueueElem *v7; // edi@7 | |
5764 int v8; // eax@7 | |
5765 AIDirection *v9; // esi@10 | |
5766 int v10; // eax@10 | |
5767 unsigned int v11; // ecx@10 | |
5768 unsigned __int8 pHostileType; // al@12 | |
5769 unsigned __int8 v13; // sf@16 | |
5770 unsigned __int8 v14; // of@16 | |
5771 unsigned int v15; // edx@22 | |
5772 unsigned int v16; // ecx@23 | |
5773 TurnBased_QueueElem *v17; // eax@25 | |
5774 double v18; // st7@33 | |
5775 double v19; // st6@33 | |
5776 int v21; // [sp-8h] [bp-5Ch]@23 | |
5777 int v22; // [sp-8h] [bp-5Ch]@26 | |
5778 AIDirection *v23; // [sp-4h] [bp-58h]@23 | |
5779 int v24; // [sp-4h] [bp-58h]@26 | |
5780 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
5781 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | |
5782 int v27; // [sp+44h] [bp-10h]@33 | |
5783 unsigned int v28; // [sp+48h] [bp-Ch]@10 | |
5784 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | |
5785 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | |
5786 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | |
5787 | |
5788 // __debugbreak();//срабатывает при пошаговом режиме после пяти шагов | |
5789 v2 = *(&this->field_0 + 4 * (a2 + 2)); | |
5790 if (PID_TYPE(v2) == OBJECT_Player) | |
5791 return 0; | |
5792 uActorID = PID_ID(v2); | |
5793 //uActorID = v3; | |
5794 actor = &pActors[uActorID]; | |
5795 //v5 = v4->uAIState; | |
5796 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) | |
5797 return 1; | |
5798 v6 = &ai_near_actors_targets_pid[uActorID]; | |
5799 v7 = &pTurnEngine->pQueue[a2]; | |
5800 v8 = *v6; | |
5801 v29 = &pTurnEngine->pQueue[a2]; | |
5802 a2a = v8; | |
5803 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); | |
5804 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) | |
5805 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
5806 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); | |
5807 v10 = actor->uActorRadius; | |
5808 memcpy(&a3, v9, sizeof(a3)); | |
5809 memcpy(&pDir, &a3, sizeof(pDir)); | |
5810 v11 = a3.uDistance - v10; | |
5811 v28 = a3.uDistance - v10; | |
5812 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | |
5813 { | |
5814 v11 = 0; | |
5815 v28 = 0; | |
5816 } | |
5817 pHostileType = actor->pMonsterInfo.uHostilityType; | |
5818 if ( pHostileType == 1 ) | |
5819 { | |
5820 if ( (double)(signed int)v28 >= 307.2 ) | |
5821 goto LABEL_21; | |
5822 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5823 goto LABEL_21; | |
5824 } | |
5825 if ( pHostileType == 2 ) | |
5826 { | |
5827 v14 = __OFSUB__(v11, 1024); | |
5828 v13 = ((v11 - 1024) & 0x80000000u) != 0; | |
5829 } | |
5830 else | |
5831 { | |
5832 if ( pHostileType != 3 ) | |
5833 goto LABEL_21; | |
5834 v14 = __OFSUB__(v11, 2560); | |
5835 v13 = ((v11 - 2560) & 0x80000000u) != 0; | |
5836 } | |
5837 if ( v13 ^ v14 ) | |
5838 { | |
5839 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5840 } | |
5841 LABEL_21: | |
5842 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) | |
5843 { | |
5844 if ( (signed int)v11 < 10240 ) | |
5845 { | |
5846 Actor::AI_Flee(uActorID, a2a, 0, &pDir); | |
5847 v29->field_C = 4; | |
5848 v29->uActionLength = actor->uCurrentActionLength; | |
5849 return 1; | |
5850 } | |
5851 Actor::AI_4032B2(uActorID, a2a, 1024, 0); | |
5852 v29->field_C = 2; | |
5853 v29->uActionLength = actor->uCurrentActionLength; | |
5854 return 1; | |
5855 } | |
5856 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
5857 goto LABEL_46; | |
5858 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) | |
5859 { | |
5860 if ( actor->pMonsterInfo.uAIType == 1 ) | |
5861 { | |
5862 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5863 { | |
5864 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5865 v29->field_C = 4; | |
5866 v29->uActionLength = actor->uCurrentActionLength; | |
5867 return 1; | |
5868 } | |
5869 Actor::AI_Flee(uActorID, a2a, 32, 0); | |
5870 v29->field_C = 4; | |
5871 v29->uActionLength = actor->uCurrentActionLength; | |
5872 return 1; | |
5873 } | |
5874 if ( actor->pMonsterInfo.uAIType == 2 ) | |
5875 { | |
5876 v27 = actor->sCurrentHP; | |
5877 v18 = (double)v27; | |
5878 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; | |
5879 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
5880 { | |
5881 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5882 { | |
5883 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5884 v29->field_C = 4; | |
5885 v29->uActionLength = actor->uCurrentActionLength; | |
5886 return 1; | |
5887 } | |
5888 Actor::AI_Flee(uActorID, a2a, 32, 0); | |
5889 v29->field_C = 4; | |
5890 v29->uActionLength = actor->uCurrentActionLength; | |
5891 return 1; | |
5892 } | |
5893 goto LABEL_39; | |
5894 } | |
5895 if ( actor->pMonsterInfo.uAIType == 3 ) | |
5896 { | |
5897 v27 = actor->sCurrentHP; | |
5898 v18 = (double)v27; | |
5899 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; | |
5900 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
5901 { | |
5902 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5903 { | |
5904 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5905 v29->field_C = 4; | |
5906 v29->uActionLength = actor->uCurrentActionLength; | |
5907 return 1; | |
5908 } | |
5909 Actor::AI_Flee(uActorID, a2a, 32, 0); | |
5910 v29->field_C = 4; | |
5911 v29->uActionLength = actor->uCurrentActionLength; | |
5912 return 1; | |
5913 } | |
5914 goto LABEL_39; | |
5915 } | |
5916 } | |
5917 LABEL_39: | |
5918 if ( (double)(signed int)v28 < 307.2 ) | |
5919 return 0; | |
5920 if ( (signed int)v11 < 5120 ) | |
5921 { | |
5922 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) | |
5923 Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); | |
5924 else | |
5925 Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); | |
5926 v29->field_C = 2; | |
5927 v29->uActionLength = actor->uCurrentActionLength; | |
5928 return 1; | |
5929 } | |
5930 LABEL_46: | |
5931 if ( !actor->pMonsterInfo.uMovementType ) | |
5932 { | |
5933 Actor::AI_4032B2(uActorID, a2a, 1024, 32); | |
5934 v29->field_C = 2; | |
5935 v29->uActionLength = actor->uCurrentActionLength; | |
5936 return 1; | |
5937 } | |
5938 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
5939 { | |
5940 Actor::AI_4032B2(uActorID, a2a, 2560, 32); | |
5941 v29->field_C = 2; | |
5942 v29->uActionLength = actor->uCurrentActionLength; | |
5943 return 1; | |
5944 } | |
5945 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
5946 { | |
5947 Actor::AI_4032B2(uActorID, a2a, 5120, 32); | |
5948 v29->field_C = 2; | |
5949 v29->uActionLength = actor->uCurrentActionLength; | |
5950 return 1; | |
5951 } | |
5952 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
5953 { | |
5954 Actor::AI_4032B2(uActorID, a2a, 10240, 32); | |
5955 v29->field_C = 2; | |
5956 v29->uActionLength = actor->uCurrentActionLength; | |
5957 return 1; | |
5958 } | |
5959 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5960 { | |
5961 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5962 v29->field_C = 2; | |
5963 v29->uActionLength = actor->uCurrentActionLength; | |
5964 return 1; | |
5965 } | |
5966 return 1; | |
5967 } | |
5968 | |
5969 //----- (00406FA8) -------------------------------------------------------- | |
5970 void stru262_TurnBased::_406FA8() | |
5971 { | |
5972 unsigned __int8 v1; // zf@1 | |
5973 unsigned __int8 v2; // sf@1 | |
5974 TurnBased_QueueElem *v3; // edi@2 | |
5975 int v4; // eax@4 | |
5976 Actor *v5; // ebx@4 | |
5977 unsigned __int16 v6; // cx@4 | |
5978 unsigned int *v7; // edx@8 | |
5979 unsigned int v8; // esi@8 | |
5980 unsigned __int8 v9; // of@13 | |
5981 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 | |
5982 AIDirection v11; // [sp+28h] [bp-50h]@8 | |
5983 AIDirection a4; // [sp+44h] [bp-34h]@8 | |
5984 stru262_TurnBased *v13; // [sp+60h] [bp-18h]@1 | |
5985 TurnBased_QueueElem *v14; // [sp+64h] [bp-14h]@2 | |
5986 int uActorID; // [sp+68h] [bp-10h]@4 | |
5987 unsigned int a2; // [sp+6Ch] [bp-Ch]@8 | |
5988 int v17; // [sp+70h] [bp-8h]@1 | |
5989 unsigned int v18; // [sp+74h] [bp-4h]@2 | |
5990 | |
5991 v17 = 0; | |
5992 v1 = this->uActorQueueSize == 0; | |
5993 v2 = this->uActorQueueSize < 0; | |
5994 v13 = this; | |
5995 if ( !(v2 | v1) ) | |
5996 { | |
5997 v3 = this->pQueue; | |
5998 v18 = (char *)&pTurnEngine - (char *)this; | |
5999 v14 = this->pQueue; | |
6000 do | |
6001 { | |
6002 if (PID_TYPE(v3->uPackedID) != OBJECT_Player) | |
6003 { | |
6004 v4 = PID_ID(v3->uPackedID); | |
6005 uActorID = v4; | |
6006 v5 = &pActors[v4]; | |
6007 v6 = v5->uAIState; | |
6008 if ( v6 != 5 ) | |
6009 { | |
6010 if ( v6 != 11 ) | |
6011 { | |
6012 if ( v6 != 19 ) | |
6013 { | |
6014 if ( v6 != 17 ) | |
6015 { | |
6016 v7 = (unsigned int *)&ai_near_actors_targets_pid[v4]; | |
6017 a2 = *v7; | |
6018 v8 = a2; | |
6019 Actor::_SelectTarget(v4, (int *)v7, true); | |
6020 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11)); | |
6021 memcpy(&a4, &v11, sizeof(a4)); | |
6022 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
6023 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) | |
6024 { | |
6025 if (v5->uAIState == Dying) | |
6026 { | |
6027 v5->uCurrentActionTime = 0; | |
6028 v5->uCurrentActionLength = 0; | |
6029 v5->uAIState = Dead; | |
6030 v5->UpdateAnimation(); | |
6031 return; | |
6032 } | |
6033 if ( rand() % 2 ) | |
6034 Actor::AI_Stand(uActorID, a2, 0x40u, &a4); | |
6035 else | |
6036 Actor::AI_Bored(uActorID, a2, &a4); | |
6037 } | |
6038 } | |
6039 } | |
6040 } | |
6041 } | |
6042 } | |
6043 ++v17; | |
6044 v3 = v14 + 1; | |
6045 v9 = __OFSUB__(v17, v13->uActorQueueSize); | |
6046 v2 = v17 - v13->uActorQueueSize < 0; | |
6047 ++v14; | |
6048 } | |
6049 while ( v2 ^ v9 ); | |
6050 } | |
6051 } | |
6052 | 4780 |
6053 //----- (004070EF) -------------------------------------------------------- | 4781 //----- (004070EF) -------------------------------------------------------- |
6054 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) | 4782 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) |
6055 { | 4783 { |
6056 signed int v2; // eax@1 | 4784 signed int v2; // eax@1 |