comparison mm7_3.cpp @ 843:292c6288204d

more UpdateActorAI cleaning
author zipi
date Fri, 29 Mar 2013 13:52:55 +0000
parents 2825b5a9b562
children d593ca75c366
comparison
equal deleted inserted replaced
842:2825b5a9b562 843:292c6288204d
15116 unsigned int v27; // ecx@123 15116 unsigned int v27; // ecx@123
15117 unsigned int v28; // eax@123 15117 unsigned int v28; // eax@123
15118 unsigned int v29; // eax@127 15118 unsigned int v29; // eax@127
15119 AIDirection *v30; // eax@129 15119 AIDirection *v30; // eax@129
15120 unsigned __int16 v31; // ax@132 15120 unsigned __int16 v31; // ax@132
15121 unsigned int v32; // esi@142 15121 //unsigned int v32; // esi@142
15122 int v33; // eax@144 15122 int v33; // eax@144
15123 int v34; // eax@147 15123 int v34; // eax@147
15124 char v35; // al@150 15124 char v35; // al@150
15125 unsigned int v36; // edi@152 15125 unsigned int v36; // edi@152
15126 signed int v37; // eax@154 15126 signed int v37; // eax@154
15127 unsigned __int8 v38; // sf@158 15127 unsigned __int8 v38; // sf@158
15128 unsigned __int8 v39; // of@158 15128 unsigned __int8 v39; // of@158
15129 signed int v40; // edx@166 15129 //signed int v40; // edx@166
15130 unsigned int v41; // ecx@166 15130 //unsigned int v41; // ecx@166
15131 double v42; // st7@176 15131 double v42; // st7@176
15132 double v43; // st6@176 15132 double v43; // st6@176
15133 bool v44; // eax@189 15133 //bool v44; // eax@189
15134 bool v45; // eax@192 15134 bool v45; // eax@192
15135 unsigned __int8 v46; // cl@197 15135 unsigned __int8 v46; // cl@197
15136 double v47; // st7@206 15136 double v47; // st7@206
15137 double v48; // st7@207 15137 double v48; // st7@207
15138 char v49; // zf@208 15138 //char v49; // zf@208
15139 char v50; // zf@214 15139 //char v50; // zf@214
15140 signed int v51; // edx@219 15140 //signed int v51; // edx@219
15141 unsigned int v52; // ecx@219 15141 //unsigned int v52; // ecx@219
15142 __int16 v53; // fps@224 15142 __int16 v53; // fps@224
15143 unsigned __int8 v54; // c0@224 15143 unsigned __int8 v54; // c0@224
15144 unsigned __int8 v55; // c3@224 15144 unsigned __int8 v55; // c3@224
15145 double v56; // st7@226 15145 double v56; // st7@226
15146 AIDirection *v57; // eax@246 15146 AIDirection *v57; // eax@246
15147 double v58; // st7@246 15147 double v58; // st7@246
15148 signed int v59; // [sp-18h] [bp-C8h]@213 15148 signed int v59; // [sp-18h] [bp-C8h]@213
15149 int v60; // [sp-14h] [bp-C4h]@144 15149 //int v60; // [sp-14h] [bp-C4h]@144
15150 int v61; // [sp-14h] [bp-C4h]@168 15150 //int v61; // [sp-14h] [bp-C4h]@168
15151 AIDirection *v62; // [sp-14h] [bp-C4h]@213 15151 AIDirection *v62; // [sp-14h] [bp-C4h]@213
15152 signed int v63; // [sp-14h] [bp-C4h]@216 15152 signed int v63; // [sp-14h] [bp-C4h]@216
15153 unsigned int v64; // [sp-14h] [bp-C4h]@219 15153 unsigned int v64; // [sp-14h] [bp-C4h]@219
15154 unsigned int v65; // [sp-10h] [bp-C0h]@144 15154 unsigned int v65; // [sp-10h] [bp-C0h]@144
15155 char v66; // [sp-10h] [bp-C0h]@147 15155 char v66; // [sp-10h] [bp-C0h]@147
15156 AIDirection *v67; // [sp-10h] [bp-C0h]@167 15156 //AIDirection *v67; // [sp-10h] [bp-C0h]@167
15157 int v68; // [sp-10h] [bp-C0h]@168 15157 //int v68; // [sp-10h] [bp-C0h]@168
15158 AIDirection *v69; // [sp-10h] [bp-C0h]@206 15158 //AIDirection *v69; // [sp-10h] [bp-C0h]@206
15159 int v70; // [sp-10h] [bp-C0h]@213 15159 int v70; // [sp-10h] [bp-C0h]@213
15160 AIDirection *v71; // [sp-10h] [bp-C0h]@216 15160 //AIDirection *v71; // [sp-10h] [bp-C0h]@216
15161 AIDirection v72; // [sp+0h] [bp-B0h]@246 15161 AIDirection v72; // [sp+0h] [bp-B0h]@246
15162 AIDirection a3; // [sp+1Ch] [bp-94h]@129 15162 AIDirection a3; // [sp+1Ch] [bp-94h]@129
15163 AIDirection v74; // [sp+38h] [bp-78h]@246 15163 AIDirection v74; // [sp+38h] [bp-78h]@246
15164 AIDirection v75; // [sp+54h] [bp-5Ch]@129 15164 AIDirection v75; // [sp+54h] [bp-5Ch]@129
15165 int v76; // [sp+70h] [bp-40h]@83 15165 int actor_pid_type; // [sp+70h] [bp-40h]@83
15166 signed int a1; // [sp+74h] [bp-3Ch]@129 15166 signed int a1; // [sp+74h] [bp-3Ch]@129
15167 int v78; // [sp+78h] [bp-38h]@79 15167 int v78; // [sp+78h] [bp-38h]@79
15168 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 15168 AIDirection pDir; // [sp+7Ch] [bp-34h]@129
15169 float v80; // [sp+98h] [bp-18h]@33 15169 float v80; // [sp+98h] [bp-18h]@33
15170 int v81; // [sp+9Ch] [bp-14h]@100 15170 int v81; // [sp+9Ch] [bp-14h]@100
15171 int v82; // [sp+A0h] [bp-10h]@45 15171 //int v82; // [sp+A0h] [bp-10h]@45
15172 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 15172 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32
15173 unsigned int v84; // [sp+A8h] [bp-8h]@11 15173 unsigned int v84; // [sp+A8h] [bp-8h]@11
15174 signed int a2; // [sp+ACh] [bp-4h]@83 15174 signed int actor_pid; // [sp+ACh] [bp-4h]@83
15175 AIState uAIState;
15175 15176
15176 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 15177 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
15177 MakeActorAIList_ODM(); 15178 MakeActorAIList_ODM();
15178 else 15179 else
15179 MakeActorAIList_BLV(); 15180 MakeActorAIList_BLV();
15180 15181
15181 //v0 = 0; 15182 //v0 = 0;
15182 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) 15183 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 )
15183 { 15184 {
15184 if ( pParty->armageddon_timer > 417 ) 15185 if ( pParty->armageddon_timer > 417 )
15191 v1 = rand(); 15192 v1 = rand();
15192 v2 = 128; 15193 v2 = 128;
15193 v3 = pParty->sRotationX + v1 % 16 - 8; 15194 v3 = pParty->sRotationX + v1 % 16 - 8;
15194 pParty->sRotationX = v3; 15195 pParty->sRotationX = v3;
15195 if ( v3 > 128 || (v2 = -128, v3 < -128) ) 15196 if ( v3 > 128 || (v2 = -128, v3 < -128) )
15196 pParty->sRotationX = v2; 15197 pParty->sRotationX = v2;
15197 pParty->uFlags |= 2u; 15198 pParty->uFlags |= 2u;
15198 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; 15199 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed;
15199 v4 = pParty->field_16140 + 50; 15200 v4 = pParty->field_16140 + 50;
15200 if ( pParty->armageddon_timer <= 0 ) 15201 if ( pParty->armageddon_timer <= 0 )
15201 { 15202 {
15219 } 15220 }
15220 else 15221 else
15221 { 15222 {
15222 Actor::Die(v84); 15223 Actor::Die(v84);
15223 if ( v5->pMonsterInfo.uExp ) 15224 if ( v5->pMonsterInfo.uExp )
15224 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); 15225 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp);
15225 } 15226 }
15226 } 15227 }
15227 } 15228 }
15228 ++v84; 15229 ++v84;
15229 ++v5; 15230 ++v5;
15233 v8 = &pPlayers[1]; 15234 v8 = &pPlayers[1];
15234 do 15235 do
15235 { 15236 {
15236 pPlayer = *v8; 15237 pPlayer = *v8;
15237 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) 15238 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] )
15238 pPlayer->ReceiveDamage(v4, 5); 15239 pPlayer->ReceiveDamage(v4, 5);
15239 ++v8; 15240 ++v8;
15240 } 15241 }
15241 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); 15242 while ( (signed int)v8 <= (signed int)&pPlayers[4] );
15242 //v0 = 0; 15243 //v0 = 0;
15243 } 15244 }
15244 if (pTurnEngine->field_1C) 15245 if (pTurnEngine->field_1C)
15245 --pTurnEngine->field_1C; 15246 --pTurnEngine->field_1C;
15246 } 15247 }
15247 } 15248 }
15248 15249
15249 if (pParty->bTurnBasedModeOn) 15250 if (pParty->bTurnBasedModeOn)
15250 { 15251 {
15263 //pActor = (Actor *)(LODWORD(v80) - 176); 15264 //pActor = (Actor *)(LODWORD(v80) - 176);
15264 //v11 = *(unsigned int *)LODWORD(v80); 15265 //v11 = *(unsigned int *)LODWORD(v80);
15265 //v49 = *(unsigned int *)LODWORD(v80) == 5; 15266 //v49 = *(unsigned int *)LODWORD(v80) == 5;
15266 ai_near_actors_targets_pid[i] = OBJECT_Player; 15267 ai_near_actors_targets_pid[i] = OBJECT_Player;
15267 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) 15268 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400)
15268 continue; 15269 continue;
15269 15270
15270 if (!actor->sCurrentHP && actor->uAIState != Dying) 15271 if (!actor->sCurrentHP && actor->uAIState != Dying)
15271 Actor::Die(i); 15272 Actor::Die(i);
15272 15273
15273 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; 15274 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1;
15274 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; 15275 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1;
15275 //v12 = 0; 15276 //v12 = 0;
15276 //v13 = 0; 15277 //v13 = 0;
15289 } 15290 }
15290 ++v13; 15291 ++v13;
15291 ++v14; 15292 ++v14;
15292 } 15293 }
15293 while ( v13 < 22 );*/ 15294 while ( v13 < 22 );*/
15294 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) 15295 if ( actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
15295 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 15296 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
15296 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) 15297 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
15297 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; 15298 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight;
15298 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) 15299 if ( actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
15299 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15300 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15300 else 15301 // not sure
15301 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; 15302 else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
15303 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType;
15302 15304
15303 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || 15305 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)
15304 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) 15306 continue;
15305 continue;
15306 15307
15307 //v15 = pMiscTimer->uTimeElapsed; 15308 //v15 = pMiscTimer->uTimeElapsed;
15308 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; 15309 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
15309 //v17 = pActor->uCurrentActionTime; 15310 //v17 = pActor->uCurrentActionTime;
15310 //v18 = pActor->pMonsterInfo.uRecoveryTime; 15311 //v18 = pActor->pMonsterInfo.uRecoveryTime;
15311 if (actor->pMonsterInfo.uRecoveryTime) 15312 if (actor->pMonsterInfo.uRecoveryTime)
15312 { 15313 {
15313 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) 15314 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed)
15314 actor->pMonsterInfo.uRecoveryTime = 0; 15315 actor->pMonsterInfo.uRecoveryTime = 0;
15315 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; 15316 else
15317 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed;
15316 } 15318 }
15317 15319
15318 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; 15320 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15319 if (actor->uCurrentActionTime < actor->uCurrentActionLength) 15321 if (actor->uCurrentActionTime < actor->uCurrentActionLength)
15320 continue; 15322 continue;
15321 15323
15322 //v19 = actor->uAIState; 15324 //v19 = actor->uAIState;
15323 if (actor->uAIState == Dying) 15325 if (actor->uAIState == Dying)
15324 actor->uAIState = Dead; 15326 actor->uAIState = Dead;
15325 else 15327 else
15326 { 15328 {
15327 if (actor->uAIState != Summoned) 15329 if (actor->uAIState != Summoned)
15328 { 15330 {
15329 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); 15331 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr);
15355 15357
15356 //v20 = &ai_near_actors_targets_pid[actor_id]; 15358 //v20 = &ai_near_actors_targets_pid[actor_id];
15357 v21 = &pActors[actor_id]; 15359 v21 = &pActors[actor_id];
15358 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); 15360 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true);
15359 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) 15361 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id])
15360 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15362 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15361 a2 = ai_near_actors_targets_pid[actor_id]; 15363 actor_pid = ai_near_actors_targets_pid[actor_id];
15362 v76 = a2 & 7; 15364 actor_pid_type = PID_TYPE(actor_pid);
15363 if ( (a2 & 7) == OBJECT_Actor) 15365 if ( actor_pid_type == OBJECT_Actor)
15364 v80 = 0.5; 15366 v80 = 0.5;
15365 else 15367 else
15366 v80 = 1.0; 15368 v80 = 1.0;
15367 v22 = v21->uAIState; 15369 v22 = v21->uAIState;
15368 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) 15370 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
15369 { 15371 {
15370 continue; 15372 continue;
15371 } 15373 }
15372 else 15374 if ( !v21->sCurrentHP )
15375 Actor::Die(actor_id);
15376 v25 = 0;
15377 v26 = v21->pActorBuffs;
15378 do
15373 { 15379 {
15374 if ( !v21->sCurrentHP ) 15380 if ( v25 != 10 )
15375 Actor::Die(actor_id);
15376 v25 = 0;
15377 v26 = v21->pActorBuffs;
15378 do
15379 { 15381 {
15380 if ( v25 != 10 ) 15382 v26->_4585CA(pParty->uTimePlayed);
15381 { 15383 //v24 = 0;
15382 v26->_4585CA(pParty->uTimePlayed);
15383 //v24 = 0;
15384 }
15385 ++v25;
15386 ++v26;
15387 } 15384 }
15388 while ( v25 < 22 ); 15385 ++v25;
15389 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 15386 ++v26;
15390 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0 15387 }
15391 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0 15388 while ( v25 < 22 );
15392 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) ) 15389 if ( v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 )
15393 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; 15390 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight;
15394 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) 15391 if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
15395 { 15392 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
15396 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 15393 // not sure
15397 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) 15394 else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 )
15398 { 15395 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType;
15399 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 15396 if ( v21->pActorBuffs[2].uExpireTime < 0 )
15400 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) 15397 {
15401 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; 15398 v21->uAIState = Removed;
15402 } 15399 continue;
15403 } 15400 }
15404 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 15401 if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime )
15405 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 15402 {
15406 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 15403 continue;
15407 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) 15404 }
15408 { 15405 v27 = pMiscTimer->uTimeElapsed;
15409 v21->uAIState = Removed; 15406 v28 = v21->pMonsterInfo.uRecoveryTime;
15410 continue; 15407 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15411 } 15408 if ( (signed int)v28 > 0 )
15412 else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) 15409 v21->pMonsterInfo.uRecoveryTime = v28 - v27;
15410 if ( v21->pMonsterInfo.uRecoveryTime< 0 )
15411 v21->pMonsterInfo.uRecoveryTime = 0;
15412 v29 = v21->uAttributes;
15413 if ( !(v29 & 0x8000) )
15414 v21->uAttributes = v29 | 0x8000;
15415 a1 = 8 * actor_id | OBJECT_Actor;
15416 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, actor_pid, &a3, 0);
15417 memcpy(&v75, v30, sizeof(v75));
15418 memcpy(&pDir, &v75, sizeof(pDir));
15419 uAIState = v21->uAIState;
15420 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly
15421 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0
15422 && v80 * 307.2 >= (double)(signed int)v75.uDistance
15423 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting)
15424 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) )
15425 {
15426 v32 = actor_id;
15427 }*/
15428 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly
15429 || (signed int)v21->pMonsterInfo.uRecoveryTime > 0
15430 || v80 * 307.2 < (double)(signed int)v75.uDistance
15431 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting
15432 && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned )
15433 //else
15434 {
15435 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength )
15413 { 15436 {
15414 continue; 15437 continue;
15415 } 15438 }
15439 else if ( v21->uAIState == AttackingMelee )
15440 {
15441 v35 = stru_50C198.special_ability_use_check(v21, actor_id);
15442 stru_50FE08.Add(
15443 a1,
15444 5120,
15445 v21->vPosition.x,
15446 v21->vPosition.y,
15447 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1),
15448 v35,
15449 1
15450 );
15451 }
15452 else if ( v21->uAIState == AttackingRanged1 )
15453 {
15454 v34 = v21->pMonsterInfo.uMissleAttack1Type;
15455 Actor::_404874(actor_id, &pDir, v34, 0);
15456 }
15457 else if ( v21->uAIState == AttackingRanged2 )
15458 {
15459 v34 = v21->pMonsterInfo.uMissleAttack2Type;
15460 Actor::_404874(actor_id, &pDir, v34, 1);
15461 }
15416 else 15462 else
15417 { 15463 {
15418 v27 = pMiscTimer->uTimeElapsed; 15464 if ( v21->uAIState == AttackingRanged3 )
15419 v28 = v21->pMonsterInfo.uRecoveryTime;
15420 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed;
15421 if ( (signed int)v28 > 0 )
15422 v21->pMonsterInfo.uRecoveryTime = v28 - v27;
15423 if ( v21->pMonsterInfo.uRecoveryTime< 0 )
15424 v21->pMonsterInfo.uRecoveryTime = 0;
15425 v29 = v21->uAttributes;
15426 if ( !(v29 & 0x8000) )
15427 v21->uAttributes = v29 | 0x8000;
15428 a1 = 8 * actor_id | OBJECT_Actor;
15429 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0);
15430 v49 = v21->pMonsterInfo.uHostilityType == 0;
15431 memcpy(&v75, v30, sizeof(v75));
15432 memcpy(&pDir, &v75, sizeof(pDir));
15433 if ( !v49
15434 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0
15435 && v80 * 307.2 >= (double)(signed int)v75.uDistance
15436 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9)
15437 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 )
15438 { 15465 {
15439 v32 = actor_id; 15466 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1;
15467 v33 = v21->pMonsterInfo.uSpell1ID;
15468 Actor::_404AC7(actor_id, &pDir, v33, 2, v65);
15440 } 15469 }
15441 else 15470 else if ( v21->uAIState == AttackingRanged4 )
15442 { 15471 {
15443 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) 15472 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2;
15444 { 15473 v33 = v21->pMonsterInfo.uSpell2ID;
15445 continue; 15474 Actor::_404AC7(actor_id, &pDir, v33, 3, v65);
15446 }
15447 else if ( v21->uAIState == 2 )
15448 {
15449 v32 = actor_id;
15450 v35 = stru_50C198.special_ability_use_check(v21, actor_id);
15451 stru_50FE08.Add(
15452 a1,
15453 5120,
15454 v21->vPosition.x,
15455 v21->vPosition.y,
15456 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1),
15457 v35,
15458 1
15459 );
15460 }
15461 else if ( v21->uAIState == 3 )
15462 {
15463 v34 = v21->pMonsterInfo.uMissleAttack1Type;
15464 v66 = 0;
15465 v32 = actor_id;
15466 Actor::_404874(actor_id, &pDir, v34, v66);
15467 }
15468 else if ( v21->uAIState == 12 )
15469 {
15470 v34 = v21->pMonsterInfo.uMissleAttack2Type;
15471 v66 = 1;
15472 v32 = actor_id;
15473 Actor::_404874(actor_id, &pDir, v34, v66);
15474 }
15475 else
15476 {
15477 v32 = actor_id;
15478 if ( v21->uAIState == 13 )
15479 {
15480 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1;
15481 v60 = 2;
15482 v33 = v21->pMonsterInfo.uSpell1ID;
15483 Actor::_404AC7(actor_id, &pDir, v33, v60, v65);
15484 }
15485 else if ( v21->uAIState == 18 )
15486 {
15487 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2;
15488 v60 = 3;
15489 v33 = v21->pMonsterInfo.uSpell2ID;
15490 Actor::_404AC7(actor_id, &pDir, v33, v60, v65);
15491 }
15492 }
15493 } 15475 }
15494 } 15476 }
15495 } 15477 }
15478
15496 v36 = v75.uDistance; 15479 v36 = v75.uDistance;
15497 if ( !v21->pMonsterInfo.uHostilityType ) 15480 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly)
15498 { 15481 {
15499 if ( v76 == 3 ) 15482 if ( actor_pid_type == OBJECT_Actor )
15500 { 15483 {
15501 v36 = v75.uDistance; 15484 v36 = v75.uDistance;
15502 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] 15485 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3]
15503 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); 15486 + (pActors[actor_pid >> 3].pMonsterInfo.uID - 1) / 3);
15504 } 15487 }
15505 else 15488 else
15506 { 15489 {
15507 v37 = 4; 15490 v37 = 4;
15508 } 15491 }
15520 { 15503 {
15521 v39 = __OFSUB__(v36, 5120); 15504 v39 = __OFSUB__(v36, 5120);
15522 v38 = ((v36 - 5120) & 0x80000000u) != 0; 15505 v38 = ((v36 - 5120) & 0x80000000u) != 0;
15523 } 15506 }
15524 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) 15507 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 )
15525 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; 15508 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
15526 } 15509 }
15527 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) 15510 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 )
15528 { 15511 {
15529 v40 = a2;
15530 v41 = v32;
15531 if ( (signed int)v36 >= 10240 ) 15512 if ( (signed int)v36 >= 10240 )
15532 { 15513 {
15533 v68 = 0; 15514 Actor::_4032B2(actor_id, actor_pid, 1024, 0);
15534 v61 = 1024;
15535 Actor::_4032B2(v41, v40, v61, v68);
15536 continue;
15537 } 15515 }
15538 v67 = &pDir; 15516 else
15539 Actor::_402968(v41, v40, 0, v67); 15517 {
15518 //peasents after attacked
15519 //guard after attacked
15520 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15521 }
15540 continue; 15522 continue;
15541 } 15523 }
15542 if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) 15524 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && actor_pid )
15543 { 15525 {
15544 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) 15526 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 )
15545 { 15527 {
15546 if ( v21->pMonsterInfo.uAIType == 1 ) 15528 if ( v21->pMonsterInfo.uAIType == 1 )
15547 { 15529 {
15548 v67 = &pDir; 15530 if ( v21->pMonsterInfo.uMovementType == 5 )
15549 if ( v21->pMonsterInfo.uMovementType != 5 )
15550 { 15531 {
15551 v40 = a2; 15532 Actor::AI_Stand(actor_id, actor_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir);
15552 v41 = v32; 15533 }
15553 Actor::_402968(v41, v40, 0, v67); 15534 else
15535 {
15536 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15554 continue; 15537 continue;
15555 } 15538 }
15556 Actor::AI_Stand( 15539
15557 v32,
15558 a2,
15559 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333),
15560 &pDir);
15561 } 15540 }
15562 else 15541 else
15563 { 15542 {
15543 v84 = v21->sCurrentHP;
15544 v42 = (double)(signed int)v84;
15564 if ( v21->pMonsterInfo.uAIType == 2 ) 15545 if ( v21->pMonsterInfo.uAIType == 2 )
15565 { 15546 {
15566 v84 = v21->sCurrentHP; 15547
15567 v42 = (double)(signed int)v84;
15568 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; 15548 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2;
15569 } 15549 }
15570 else 15550 else
15571 { 15551 {
15572 v84 = v21->sCurrentHP;
15573 v42 = (double)(signed int)v84;
15574 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; 15552 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1;
15575 } 15553 }
15576 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) 15554 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 && v43 > v42 && (signed int)v36 < 10240 )
15577 if ( v43 > v42 && (signed int)v36 < 10240 )
15578 { 15555 {
15579 v67 = &pDir; 15556 Actor::_402968(actor_id, actor_pid, 0, &pDir);
15580 v40 = a2;
15581 v41 = v32;
15582 Actor::_402968(v41, v40, 0, v67);
15583 continue; 15557 continue;
15584 } 15558 }
15585 } 15559 }
15586 } 15560 }
15587 v81 = v36 - v21->uActorRadius; 15561 v81 = v36 - v21->uActorRadius;
15588 if ( v76 == 3 ) 15562 if ( actor_pid_type == OBJECT_Actor )
15589 v81 -= pActors[a2 >> 3].uActorRadius; 15563 v81 -= pActors[actor_pid >> 3].uActorRadius;
15590 if ( v81 < 0 ) 15564 if ( v81 < 0 )
15591 v81 = 0; 15565 v81 = 0;
15592 rand(); 15566 rand();
15593 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0;
15594 v21->uAttributes &= 0xFBFFFF; 15567 v21->uAttributes &= 0xFBFFFF;
15595 v82 = 0;
15596 v49 = v21->pMonsterInfo.uMovementType == 5;
15597 v84 = v44;
15598 if ( v49 )
15599 v82 = 1;
15600 if ( v81 < 5120 ) 15568 if ( v81 < 5120 )
15601 { 15569 {
15602 v45 = stru_50C198.special_ability_use_check(v21, v32); 15570 v45 = stru_50C198.special_ability_use_check(v21, actor_id);
15603 if ( !v45 ) 15571 if ( !v45 )
15604 { 15572 {
15605 if ( v21->pMonsterInfo.uMissleAttack1Type ) 15573 if ( v21->pMonsterInfo.uMissleAttack1Type )
15606 { 15574 {
15607 if ( v84 ) 15575 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
15608 { 15576 {
15609 Actor::_403476(v32, a2, &pDir); 15577 Actor::_403476(actor_id, actor_pid, &pDir);
15610 continue; 15578 continue;
15611 15579
15612 } 15580 }
15613 if ( v82 ) 15581 if ( v21->pMonsterInfo.uMovementType == 5 )
15614 { 15582 {
15615 v69 = &pDir;
15616 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15583 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15617 v51 = a2;
15618 v64 = (signed __int64)v47; 15584 v64 = (signed __int64)v47;
15619 v52 = v32; 15585 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15620 Actor::AI_Stand(v52, v51, v64, v69);
15621 continue; 15586 continue;
15622 } 15587 }
15623 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15588 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15624 //UNDEF(v53);
15625 v69 = &pDir;
15626 if ( !(v54 | v55) ) 15589 if ( !(v54 | v55) )
15627 { 15590 {
15628 v51 = a2;
15629 v64 = (signed __int64)v47; 15591 v64 = (signed __int64)v47;
15630 v52 = v32; 15592 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15631 Actor::AI_Stand(v52, v51, v64, v69);
15632 continue; 15593 continue;
15633 } 15594 }
15634 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); 15595 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15635 continue; 15596 continue;
15636 } 15597 }
15637 v56 = v80 * 307.2; 15598 v56 = v80 * 307.2;
15638 if ( (double)v81 >= v56 ) 15599 if ( (double)v81 >= v56 )
15639 { 15600 {
15640 if ( v81 >= 1024 ) 15601 if ( v81 >= 1024 )
15641 { 15602 {
15642 if ( v82 ) 15603 if ( v21->pMonsterInfo.uMovementType == 5 )
15643 { 15604 {
15644 v69 = &pDir;
15645 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15605 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15646 v51 = a2;
15647 v64 = (signed __int64)v47; 15606 v64 = (signed __int64)v47;
15648 v52 = v32; 15607 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15649 Actor::AI_Stand(v52, v51, v64, v69);
15650 continue; 15608 continue;
15651 } 15609 }
15652 v71 = &pDir;
15653 v63 = 0; 15610 v63 = 0;
15654 15611 //monsters
15655 Actor::_402686(v32, a2, v63, v71); 15612 Actor::_402686(actor_id, actor_pid, v63, &pDir);
15656 continue; 15613 continue;
15657 } 15614 }
15658 if ( v82 ) 15615 if ( v21->pMonsterInfo.uMovementType == 5 )
15659 { 15616 {
15660 v69 = &pDir;
15661 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15617 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15662 v51 = a2;
15663 v64 = (signed __int64)v47; 15618 v64 = (signed __int64)v47;
15664 v52 = v32; 15619 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15665 Actor::AI_Stand(v52, v51, v64, v69);
15666 continue; 15620 continue;
15667 } 15621 }
15668 v70 = (signed __int64)v56; 15622 v70 = (signed __int64)v56;
15669 v62 = &pDir; 15623 v62 = &pDir;
15670 v59 = 0; 15624 v59 = 0;
15671 Actor::_40281C(v32, a2, v59, v62, v70); 15625 //monsters
15626 //guard after player runs away
15627 // follow player
15628 Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
15672 continue; 15629 continue;
15673 } 15630 }
15674 v49 = v84 == 0; 15631 if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15675 v69 = &pDir;
15676 if ( v49 )
15677 { 15632 {
15678 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15633 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15679 v51 = a2;
15680 v64 = (signed __int64)v47; 15634 v64 = (signed __int64)v47;
15681 v52 = v32; 15635 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15682 Actor::AI_Stand(v52, v51, v64, v69);
15683 continue; 15636 continue;
15684 } 15637 }
15685 Actor::_403C6C(v32, a2, &pDir); 15638 //monsters
15639 Actor::_403C6C(actor_id, actor_pid, &pDir);
15686 continue; 15640 continue;
15687 } 15641 }
15688 if ( v45 != 1 ) 15642 if ( v45 != 1 )
15689 { 15643 {
15690 if ( v45 > 1 && v45 <= 3 ) 15644 if ( v45 > 1 && v45 <= 3 )
15691 { 15645 {
15692 if ( v45 == 2 ) 15646 if ( v45 == 2 )
15693 v46 = v21->pMonsterInfo.uSpell1ID; 15647 v46 = v21->pMonsterInfo.uSpell1ID;
15694 else 15648 else
15695 v46 = v21->pMonsterInfo.uSpell2ID; 15649 v46 = v21->pMonsterInfo.uSpell2ID;
15696 if ( v46 ) 15650 if ( v46 )
15697 { 15651 {
15698 if ( v84 ) 15652 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 )
15699 { 15653 {
15700 if ( v45 == 2 ) 15654 if ( v45 == 2 )
15701 Actor::_403854(v32, a2, &pDir); 15655 Actor::_403854(actor_id, actor_pid, &pDir);
15702 else 15656 else
15703 Actor::_403A60(v32, a2, &pDir); 15657 Actor::_403A60(actor_id, actor_pid, &pDir);
15704 continue; 15658 continue;
15705 } 15659 }
15706 if ( v80 * 307.2 > (double)v81 || v82 ) 15660 if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 )
15707 { 15661 {
15708 v69 = &pDir;
15709 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15662 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15710 v51 = a2;
15711 v64 = (signed __int64)v47; 15663 v64 = (signed __int64)v47;
15712 v52 = v32; 15664 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15713 Actor::AI_Stand(v52, v51, v64, v69);
15714 continue; 15665 continue;
15715 15666
15716 } 15667 }
15717 v69 = &pDir;
15718 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15668 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15719 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); 15669 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15720 continue; 15670 continue;
15721 } 15671 }
15722 v48 = v80 * 307.2; 15672 v48 = v80 * 307.2;
15723 if ( (double)v81 >= v48 ) 15673 if ( (double)v81 >= v48 )
15724 { 15674 {
15725 if ( v81 >= 1024 ) 15675 if ( v81 >= 1024 )
15726 { 15676 {
15727 v50 = v82 == 0; 15677 if ( v21->pMonsterInfo.uMovementType == 5 )
15728 if ( !v50 )
15729 { 15678 {
15730 v69 = &pDir;
15731 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15679 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15732 v51 = a2;
15733 v64 = (signed __int64)v47; 15680 v64 = (signed __int64)v47;
15734 v52 = v32; 15681 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15735 Actor::AI_Stand(v52, v51, v64, v69);
15736 continue;
15737 } 15682 }
15738 v71 = &pDir; 15683 else
15739 v63 = 256; 15684 {
15740 Actor::_402686(v32, a2, v63, v71); 15685 Actor::_402686(actor_id, actor_pid, 256, &pDir);
15686 }
15741 continue; 15687 continue;
15742 15688
15743 } 15689 }
15744 if ( v82 ) 15690 if ( v21->pMonsterInfo.uMovementType == 5 )
15745 { 15691 {
15746 v69 = &pDir;
15747 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15692 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15748 v51 = a2;
15749 v64 = (signed __int64)v47; 15693 v64 = (signed __int64)v47;
15750 v52 = v32; 15694 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15751 Actor::AI_Stand(v52, v51, v64, v69);
15752 continue; 15695 continue;
15753 } 15696 }
15754 v70 = (signed __int64)v48; 15697 v70 = (signed __int64)v48;
15755 v62 = &pDir; 15698 v62 = &pDir;
15756 v59 = 0; 15699 v59 = 0;
15757 Actor::_40281C(v32, a2, v59, v62, v70); 15700 Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
15758 continue; 15701 continue;
15759 } 15702 }
15760 v49 = v84 == 0; 15703 if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15761 v69 = &pDir;
15762 if ( v49 )
15763 { 15704 {
15764 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15705 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15765 v51 = a2;
15766 v64 = (signed __int64)v47; 15706 v64 = (signed __int64)v47;
15767 v52 = v32; 15707 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15768 Actor::AI_Stand(v52, v51, v64, v69);
15769 continue; 15708 continue;
15770 } 15709 }
15771 Actor::_403C6C(v32, a2, &pDir); 15710 Actor::_403C6C(actor_id, actor_pid, &pDir);
15772 continue; 15711 continue;
15773 } 15712 }
15774 } 15713 }
15775 } 15714 }
15776 } 15715 }
15777 if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 || v81 >= 5120 || v45 != 1 ) 15716 if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !actor_pid || v81 >= 5120 || v45 != 1 )
15778 { 15717 {
15779 if ( !v21->pMonsterInfo.uMovementType ) 15718 if ( !v21->pMonsterInfo.uMovementType )
15780 { 15719 {
15781 v68 = 0; 15720 Actor::_4032B2(actor_id, 4, 1024, 0);
15782 v61 = 1024;
15783 v41 = v32;
15784 v40 = 4;
15785 Actor::_4032B2(v41, v40, v61, v68);
15786 continue; 15721 continue;
15787 15722
15788 } 15723 }
15789 if ( v21->pMonsterInfo.uMovementType == 1 ) 15724 if ( v21->pMonsterInfo.uMovementType == 1 )
15790 { 15725 {
15791 v68 = 0; 15726 Actor::_4032B2(actor_id, 4, 2560, 0);
15792 v61 = 2560;
15793 v41 = v32;
15794 v40 = 4;
15795 Actor::_4032B2(v41, v40, v61, v68);
15796 continue; 15727 continue;
15797 } 15728 }
15798 if ( v21->pMonsterInfo.uMovementType == 2 ) 15729 if ( v21->pMonsterInfo.uMovementType == 2 )
15799 { 15730 {
15800 v68 = 0; 15731 Actor::_4032B2(actor_id, 4, 5120, 0);
15801 v61 = 5120;
15802 v41 = v32;
15803 v40 = 4;
15804 Actor::_4032B2(v41, v40, v61, v68);
15805 continue; 15732 continue;
15806 } 15733 }
15807 if ( v21->pMonsterInfo.uMovementType == 4 ) 15734 if ( v21->pMonsterInfo.uMovementType == 4 )
15808 { 15735 {
15809 v68 = 0; 15736 Actor::_4032B2(actor_id, 4, 10240, 0);
15810 v61 = 10240;
15811 v41 = v32;
15812 v40 = 4;
15813 Actor::_4032B2(v41, v40, v61, v68);
15814 continue; 15737 continue;
15815 } 15738 }
15816 if ( v21->pMonsterInfo.uMovementType == 5 ) 15739 if ( v21->pMonsterInfo.uMovementType == 5 )
15817 { 15740 {
15818 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); 15741 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0);
15819 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15742 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15820 memcpy(&v74, v57, sizeof(v74)); 15743 memcpy(&v74, v57, sizeof(v74));
15821 memcpy(&pDir, &v74, sizeof(pDir)); 15744 memcpy(&pDir, &v74, sizeof(pDir));
15822 v69 = &pDir;
15823 v52 = actor_id;
15824 v64 = (signed __int64)v58; 15745 v64 = (signed __int64)v58;
15825 v51 = 4; 15746 Actor::AI_Stand(actor_id, 4, v64, &pDir);
15826 Actor::AI_Stand(v52, v51, v64, v69);
15827 continue; 15747 continue;
15828 } 15748 }
15829 continue; 15749 continue;
15830 15750
15831 } 15751 }
15834 v56 = v80 * 307.2; 15754 v56 = v80 * 307.2;
15835 if ( (double)v81 >= v56 ) 15755 if ( (double)v81 >= v56 )
15836 { 15756 {
15837 if ( v81 >= 1024 ) 15757 if ( v81 >= 1024 )
15838 { 15758 {
15839 v50 = v82 == 0; 15759 if ( v21->pMonsterInfo.uMovementType == 5 )
15840 if ( !v50 )
15841 { 15760 {
15842 v69 = &pDir;
15843 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15761 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15844 v51 = a2;
15845 v64 = (signed __int64)v47; 15762 v64 = (signed __int64)v47;
15846 v52 = v32; 15763 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15847 Actor::AI_Stand(v52, v51, v64, v69);
15848 continue; 15764 continue;
15849 } 15765 }
15850 v71 = &pDir;
15851 v63 = 256; 15766 v63 = 256;
15852 Actor::_402686(v32, a2, v63, v71); 15767 Actor::_402686(actor_id, actor_pid, v63, &pDir);
15853 continue; 15768 continue;
15854 } 15769 }
15855 if ( v82 ) 15770 if ( v21->pMonsterInfo.uMovementType == 5 )
15856 { 15771 {
15857 v69 = &pDir;
15858 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15772 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15859 v51 = a2;
15860 v64 = (signed __int64)v47; 15773 v64 = (signed __int64)v47;
15861 v52 = v32; 15774 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15862 Actor::AI_Stand(v52, v51, v64, v69);
15863 continue; 15775 continue;
15864 } 15776 }
15865 v70 = (signed __int64)v56; 15777 v70 = (signed __int64)v56;
15866 v62 = &pDir; 15778 v62 = &pDir;
15867 v59 = 0; 15779 v59 = 0;
15868 Actor::_40281C(v32, a2, v59, v62, v70); 15780 Actor::_40281C(actor_id, actor_pid, v59, v62, v70);
15869 continue; 15781 continue;
15870 15782
15871 } 15783 }
15872 v49 = v84 == 0; 15784 if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15873 v69 = &pDir;
15874 if ( v49 )
15875 { 15785 {
15876 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15786 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15877 v51 = a2;
15878 v64 = (signed __int64)v47; 15787 v64 = (signed __int64)v47;
15879 v52 = v32; 15788 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15880 Actor::AI_Stand(v52, v51, v64, v69);
15881 continue; 15789 continue;
15882 } 15790 }
15883 Actor::_403C6C(v32, a2, &pDir); 15791 Actor::_403C6C(actor_id, actor_pid, &pDir);
15884 continue; 15792 continue;
15885 } 15793 }
15886 if ( !v84 ) 15794 if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
15887 { 15795 {
15888 if ( v82 ) 15796 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15797 if ( !(v54 | v55) || v21->pMonsterInfo.uMovementType == 5 )
15889 { 15798 {
15890 v69 = &pDir;
15891 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
15892 v51 = a2;
15893 v64 = (signed __int64)v47; 15799 v64 = (signed __int64)v47;
15894 v52 = v32; 15800 Actor::AI_Stand(actor_id, actor_pid, v64, &pDir);
15895 Actor::AI_Stand(v52, v51, v64, v69);
15896 continue; 15801 continue;
15897 } 15802 }
15898 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; 15803 Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir);
15899 //UNDEF(v53);
15900 v69 = &pDir;
15901 if ( !(v54 | v55) )
15902 {
15903 v51 = a2;
15904 v64 = (signed __int64)v47;
15905 v52 = v32;
15906 Actor::AI_Stand(v52, v51, v64, v69);
15907 continue;
15908 }
15909 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69);
15910 continue; 15804 continue;
15911 } 15805 }
15912 Actor::_40368B(v32, a2, &pDir); 15806 Actor::_40368B(actor_id, actor_pid, &pDir);
15913 } 15807 }
15914 } 15808 }
15915 } 15809 }
15916 15810
15917 //----- (0040261D) -------------------------------------------------------- 15811 //----- (0040261D) --------------------------------------------------------