Mercurial > mm7
comparison mm7_3.cpp @ 1060:b79139c3b5c8
some AI cleaning
author | zipi |
---|---|
date | Thu, 23 May 2013 20:51:27 +0100 |
parents | 1c10b24a4159 |
children | 89422dd58318 |
comparison
equal
deleted
inserted
replaced
1059:0e0f1192aa57 | 1060:b79139c3b5c8 |
---|---|
1176 //v34 = 0; | 1176 //v34 = 0; |
1177 if ( v0->pMonsterInfo.uHostilityType ) | 1177 if ( v0->pMonsterInfo.uHostilityType ) |
1178 { | 1178 { |
1179 if ( v71 == 0 ) | 1179 if ( v71 == 0 ) |
1180 { | 1180 { |
1181 Actor::Flee(v75, v38, 0, (AIDirection *)0); | 1181 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
1182 } | 1182 } |
1183 else | 1183 else |
1184 { | 1184 { |
1185 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | 1185 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); |
1186 } | 1186 } |
1189 { | 1189 { |
1190 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | 1190 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); |
1191 } | 1191 } |
1192 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | 1192 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) |
1193 { | 1193 { |
1194 Actor::Flee(v75, v38, 0, (AIDirection *)0); | 1194 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
1195 } | 1195 } |
1196 else | 1196 else |
1197 { | 1197 { |
1198 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); | 1198 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
1199 } | 1199 } |
1200 } | 1200 } |
1201 break; | 1201 break; |
1202 case OBJECT_Player: | 1202 case OBJECT_Player: |
1203 if ( !v0->GetActorsRelation(0) ) | 1203 if ( !v0->GetActorsRelation(0) ) |
1204 { | 1204 { |
1205 v38 = stru_721530.uFaceID; | 1205 v38 = stru_721530.uFaceID; |
1206 Actor::FaceObject(v75, v38, 0, (AIDirection *)0); | 1206 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
1207 break; | 1207 break; |
1208 } | 1208 } |
1209 //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; | 1209 //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; |
1210 //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; | 1210 //v53 = SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) < 0; |
1211 v0->vVelocity.y = 0; | 1211 v0->vVelocity.y = 0; |
14383 //----- (00401A91) -------------------------------------------------------- | 14383 //----- (00401A91) -------------------------------------------------------- |
14384 void __cdecl UpdateActorAI() | 14384 void __cdecl UpdateActorAI() |
14385 { | 14385 { |
14386 //unsigned int v0; // esi@4 | 14386 //unsigned int v0; // esi@4 |
14387 int v1; // eax@7 | 14387 int v1; // eax@7 |
14388 int v2; // ecx@7 | 14388 //int v2; // ecx@7 |
14389 int v3; // eax@7 | 14389 //int v3; // eax@7 |
14390 signed int v4; // edi@10 | 14390 signed int v4; // edi@10 |
14391 Actor *v5; // esi@12 | 14391 Actor *v5; // esi@12 |
14392 signed int v6; // eax@14 | 14392 signed int sDmg; // eax@14 |
14393 __int16 v7; // cx@14 | 14393 __int16 v7; // cx@14 |
14394 Player **v8; // esi@20 | 14394 //Player **v8; // esi@20 |
14395 Player *pPlayer; // ecx@21 | 14395 Player *pPlayer; // ecx@21 |
14396 //Actor *pActor; // esi@34 | 14396 Actor *pActor; // esi@34 |
14397 //__int16 v11; // ax@34 | 14397 //__int16 v11; // ax@34 |
14398 //unsigned int v12; // eax@47 | 14398 //unsigned int v12; // eax@47 |
14399 //signed int v13; // edi@47 | 14399 //signed int v13; // edi@47 |
14400 //SpellBuff *v14; // ebx@47 | 14400 //SpellBuff *v14; // ebx@47 |
14401 //unsigned int v15; // edi@67 | 14401 //unsigned int v15; // edi@67 |
14402 //char *v16; // eax@67 | 14402 //char *v16; // eax@67 |
14403 //unsigned int v17; // edx@67 | 14403 //unsigned int v17; // edx@67 |
14404 //unsigned int v18; // ecx@67 | 14404 //unsigned int v18; // ecx@67 |
14405 //unsigned __int16 v19; // ax@72 | 14405 //unsigned __int16 v19; // ax@72 |
14406 //int *v20; // esi@80 | 14406 //int *v20; // esi@80 |
14407 Actor *v21; // ebx@80 | 14407 //Actor *v21; // ebx@80 |
14408 unsigned __int16 v22; // ax@86 | 14408 unsigned __int16 v22; // ax@86 |
14409 //signed int v23; // eax@94 | 14409 //signed int v23; // eax@94 |
14410 //unsigned int v24; // eax@102 | 14410 //unsigned int v24; // eax@102 |
14411 //signed int v25; // edi@102 | 14411 //signed int v25; // edi@102 |
14412 //SpellBuff *v26; // esi@102 | 14412 //SpellBuff *v26; // esi@102 |
14485 pParty->armageddon_timer = 0; | 14485 pParty->armageddon_timer = 0; |
14486 } | 14486 } |
14487 else | 14487 else |
14488 { | 14488 { |
14489 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); | 14489 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); |
14490 v1 = rand(); | 14490 pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8; |
14491 v2 = 128; | 14491 if ( pParty->sRotationX > 128) |
14492 v3 = pParty->sRotationX + v1 % 16 - 8; | 14492 pParty->sRotationX = 128; |
14493 pParty->sRotationX = v3; | 14493 else if ( pParty->sRotationX < -128 ) |
14494 if ( v3 > 128 || (v2 = -128, v3 < -128) ) | 14494 pParty->sRotationX = -128; |
14495 pParty->sRotationX = v2; | 14495 |
14496 pParty->uFlags |= 2u; | 14496 pParty->uFlags |= 2u; |
14497 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | 14497 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; |
14498 v4 = pParty->field_16140 + 50; | 14498 v4 = pParty->field_16140 + 50; |
14499 if ( pParty->armageddon_timer <= 0 ) | 14499 if ( pParty->armageddon_timer <= 0 ) |
14500 { | 14500 { |
14501 pParty->armageddon_timer = 0; | 14501 pParty->armageddon_timer = 0; |
14502 v84 = 0; | 14502 for(int i = 0; i < uNumActors; i++) |
14503 if ( (signed int)uNumActors > 0 ) | |
14504 { | 14503 { |
14505 v5 = pActors;//[0].sCurrentHP; | 14504 pActor=&pActors[i]; |
14506 do | 14505 if ( pActor->CanAct() ) |
14507 { | 14506 { |
14508 if ( v5->CanAct() ) | 14507 sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); |
14508 pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); | |
14509 if ( sDmg ) | |
14509 { | 14510 { |
14510 v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); | 14511 if ( pActor->sCurrentHP >= 0 ) |
14511 v7 = v5->sCurrentHP - v6; | |
14512 v5->sCurrentHP = v7; | |
14513 if ( v6 ) | |
14514 { | 14512 { |
14515 if ( v7 >= 0 ) | 14513 Actor::AI_Stun(i, 4, 0); |
14516 { | 14514 } |
14517 Actor::Stun(v84, 4, 0); | 14515 else |
14518 } | 14516 { |
14519 else | 14517 Actor::Die(i); |
14520 { | 14518 if ( pActor->pMonsterInfo.uExp ) |
14521 Actor::Die(v84); | 14519 GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp); |
14522 if ( v5->pMonsterInfo.uExp ) | |
14523 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); | |
14524 } | |
14525 } | 14520 } |
14526 } | 14521 } |
14527 ++v84; | |
14528 ++v5; | |
14529 } | 14522 } |
14530 while ( (signed int)v84 < (signed int)uNumActors ); | 14523 ++v84; |
14524 ++v5; | |
14531 } | 14525 } |
14532 v8 = &pPlayers[1]; | 14526 for(int i = 1; i <= 4; i++) |
14533 do | |
14534 { | 14527 { |
14535 pPlayer = *v8; | 14528 pPlayer = pPlayers[i]; |
14536 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | 14529 if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) |
14537 pPlayer->ReceiveDamage(v4, DMGT_5); | 14530 pPlayer->ReceiveDamage(v4, DMGT_5); |
14538 ++v8; | |
14539 } | 14531 } |
14540 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
14541 //v0 = 0; | |
14542 } | 14532 } |
14543 if (pTurnEngine->field_1C) | 14533 if (pTurnEngine->field_1C) |
14544 --pTurnEngine->field_1C; | 14534 --pTurnEngine->field_1C; |
14545 } | 14535 } |
14546 } | 14536 } |
14553 | 14543 |
14554 | 14544 |
14555 //uActorID = v0; | 14545 //uActorID = v0; |
14556 for (uint i = 0; i < uNumActors; ++i) | 14546 for (uint i = 0; i < uNumActors; ++i) |
14557 { | 14547 { |
14558 auto actor = pActors + i; | 14548 pActor = &pActors[i]; |
14559 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState | 14549 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState |
14560 //do | 14550 //do |
14561 //{ | 14551 //{ |
14562 //pActor = (Actor *)(LODWORD(v80) - 176); | 14552 //pActor = (Actor *)(LODWORD(v80) - 176); |
14563 //v11 = *(unsigned int *)LODWORD(v80); | 14553 //v11 = *(unsigned int *)LODWORD(v80); |
14564 //v49 = *(unsigned int *)LODWORD(v80) == 5; | 14554 //v49 = *(unsigned int *)LODWORD(v80) == 5; |
14565 ai_near_actors_targets_pid[i] = OBJECT_Player; | 14555 ai_near_actors_targets_pid[i] = OBJECT_Player; |
14566 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) | 14556 if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) |
14567 continue; | 14557 continue; |
14568 | 14558 |
14569 if (!actor->sCurrentHP && actor->uAIState != Dying) | 14559 if (!pActor->sCurrentHP && pActor->uAIState != Dying) |
14570 Actor::Die(i); | 14560 Actor::Die(i); |
14571 | 14561 |
14572 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | 14562 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; |
14573 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | 14563 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; |
14574 //v12 = 0; | 14564 //v12 = 0; |
14575 //v13 = 0; | 14565 //v13 = 0; |
14576 //v14 = (SpellBuff *)(LODWORD(v80) + 36); | 14566 //v14 = (SpellBuff *)(LODWORD(v80) + 36); |
14577 for (uint j = 0; j < 22; ++j) | 14567 for (uint j = 0; j < 22; ++j) |
14578 { | 14568 { |
14579 if (j != 10) | 14569 if (j != 10) |
14580 actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); | 14570 pActor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); |
14581 } | 14571 } |
14582 /*do | 14572 /*do |
14583 { | 14573 { |
14584 if ( v13 != 10 ) | 14574 if ( v13 != 10 ) |
14585 { | 14575 { |
14588 } | 14578 } |
14589 ++v13; | 14579 ++v13; |
14590 ++v14; | 14580 ++v14; |
14591 } | 14581 } |
14592 while ( v13 < 22 );*/ | 14582 while ( v13 < 22 );*/ |
14593 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | 14583 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) |
14594 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 | 14584 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 |
14595 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | 14585 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) |
14596 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; | 14586 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; |
14597 if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | 14587 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
14598 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 14588 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
14599 // not sure | 14589 // not sure |
14600 else if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | 14590 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) |
14601 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; | 14591 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; |
14602 | 14592 |
14603 if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 | 14593 if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 |
14604 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) | 14594 || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) |
14605 continue; | 14595 continue; |
14606 | 14596 |
14607 //v15 = pMiscTimer->uTimeElapsed; | 14597 //v15 = pMiscTimer->uTimeElapsed; |
14608 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | 14598 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; |
14609 //v17 = pActor->uCurrentActionTime; | 14599 //v17 = pActor->uCurrentActionTime; |
14610 //v18 = pActor->pMonsterInfo.uRecoveryTime; | 14600 //v18 = pActor->pMonsterInfo.uRecoveryTime; |
14611 if (actor->pMonsterInfo.uRecoveryTime) | 14601 if (pActor->pMonsterInfo.uRecoveryTime) |
14612 { | 14602 { |
14613 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | 14603 if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) |
14614 actor->pMonsterInfo.uRecoveryTime = 0; | 14604 pActor->pMonsterInfo.uRecoveryTime = 0; |
14615 else | 14605 else |
14616 actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | 14606 pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; |
14617 } | 14607 } |
14618 | 14608 |
14619 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 14609 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
14620 if (actor->uCurrentActionTime < actor->uCurrentActionLength) | 14610 if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) |
14621 continue; | 14611 continue; |
14622 | 14612 |
14623 //v19 = actor->uAIState; | 14613 //v19 = actor->uAIState; |
14624 if (actor->uAIState == Dying) | 14614 if (pActor->uAIState == Dying) |
14625 actor->uAIState = Dead; | 14615 pActor->uAIState = Dead; |
14626 else | 14616 else |
14627 { | 14617 { |
14628 if (actor->uAIState != Summoned) | 14618 if (pActor->uAIState != Summoned) |
14629 { | 14619 { |
14630 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | 14620 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); |
14631 continue; | 14621 continue; |
14632 } | 14622 } |
14633 actor->uAIState = Standing; | 14623 pActor->uAIState = Standing; |
14634 } | 14624 } |
14635 | 14625 |
14636 actor->uCurrentActionTime = 0; | 14626 pActor->uCurrentActionTime = 0; |
14637 actor->uCurrentActionLength = 0; | 14627 pActor->uCurrentActionLength = 0; |
14638 actor->UpdateAnimation(); | 14628 pActor->UpdateAnimation(); |
14639 //LABEL_78: | 14629 //LABEL_78: |
14640 //++uActorID; | 14630 //++uActorID; |
14641 //LODWORD(v80) += 836; | 14631 //LODWORD(v80) += 836; |
14642 //} | 14632 //} |
14643 //while ( (signed int)uActorID < (signed int)uNumActors ); | 14633 //while ( (signed int)uActorID < (signed int)uNumActors ); |
14653 { | 14643 { |
14654 actor_id = ai_near_actors_ids[v78]; | 14644 actor_id = ai_near_actors_ids[v78]; |
14655 assert(actor_id < uNumActors); | 14645 assert(actor_id < uNumActors); |
14656 | 14646 |
14657 //v20 = &ai_near_actors_targets_pid[actor_id]; | 14647 //v20 = &ai_near_actors_targets_pid[actor_id]; |
14658 v21 = &pActors[actor_id]; | 14648 pActor = &pActors[actor_id]; |
14659 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | 14649 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); |
14660 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | 14650 if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) |
14661 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 14651 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
14662 target_pid = ai_near_actors_targets_pid[actor_id]; | 14652 target_pid = ai_near_actors_targets_pid[actor_id]; |
14663 target_pid_type = PID_TYPE(target_pid); | 14653 target_pid_type = PID_TYPE(target_pid); |
14664 if ( target_pid_type == OBJECT_Actor) | 14654 if ( target_pid_type == OBJECT_Actor) |
14665 v80 = 0.5; | 14655 v80 = 0.5; |
14666 else | 14656 else |
14667 v80 = 1.0; | 14657 v80 = 1.0; |
14668 v22 = v21->uAIState; | 14658 v22 = pActor->uAIState; |
14669 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | 14659 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) |
14670 { | 14660 { |
14671 continue; | 14661 continue; |
14672 } | 14662 } |
14673 if ( !v21->sCurrentHP ) | 14663 if ( !pActor->sCurrentHP ) |
14674 Actor::Die(actor_id); | 14664 Actor::Die(actor_id); |
14675 for(int i=0;i<22;i++) | 14665 for(int i=0;i<22;i++) |
14676 { | 14666 { |
14677 if ( i != 10 ) | 14667 if ( i != 10 ) |
14678 { | 14668 { |
14679 v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); | 14669 pActor->pActorBuffs[i]._4585CA(pParty->uTimePlayed); |
14680 } | 14670 } |
14681 } | 14671 } |
14682 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | 14672 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) |
14683 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | 14673 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; |
14684 if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | 14674 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) |
14685 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 14675 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
14686 // not sure | 14676 // not sure |
14687 else if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | 14677 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) |
14688 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | 14678 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; |
14689 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) | 14679 if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 ) |
14690 { | 14680 { |
14691 v21->uAIState = Removed; | 14681 pActor->uAIState = Removed; |
14692 continue; | 14682 continue; |
14693 } | 14683 } |
14694 if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 | 14684 if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 |
14695 || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) | 14685 || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) |
14696 { | 14686 { |
14697 continue; | 14687 continue; |
14698 } | 14688 } |
14699 v27 = pMiscTimer->uTimeElapsed; | 14689 v27 = pMiscTimer->uTimeElapsed; |
14700 v28 = v21->pMonsterInfo.uRecoveryTime; | 14690 v28 = pActor->pMonsterInfo.uRecoveryTime; |
14701 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 14691 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
14702 if ( (signed int)v28 > 0 ) | 14692 if ( (signed int)v28 > 0 ) |
14703 v21->pMonsterInfo.uRecoveryTime = v28 - v27; | 14693 pActor->pMonsterInfo.uRecoveryTime = v28 - v27; |
14704 if ( v21->pMonsterInfo.uRecoveryTime < 0 ) | 14694 if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) |
14705 v21->pMonsterInfo.uRecoveryTime = 0; | 14695 pActor->pMonsterInfo.uRecoveryTime = 0; |
14706 if ( !(v21->uAttributes & 0x8000) ) | 14696 if ( !(pActor->uAttributes & 0x8000) ) |
14707 v21->uAttributes |= 0x8000; | 14697 pActor->uAttributes |= 0x8000; |
14708 a1 = PID(OBJECT_Actor,actor_id); | 14698 a1 = PID(OBJECT_Actor,actor_id); |
14709 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); | 14699 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); |
14710 memcpy(&v75, v30, sizeof(v75)); | 14700 memcpy(&v75, v30, sizeof(v75)); |
14711 memcpy(&pDir, &v75, sizeof(pDir)); | 14701 memcpy(&pDir, &v75, sizeof(pDir)); |
14712 uAIState = v21->uAIState; | 14702 uAIState = pActor->uAIState; |
14713 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly | 14703 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly |
14714 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 | 14704 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 |
14715 && v80 * 307.2 >= (double)(signed int)v75.uDistance | 14705 && v80 * 307.2 >= (double)(signed int)v75.uDistance |
14716 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) | 14706 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) |
14717 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) | 14707 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) |
14718 { | 14708 { |
14719 v32 = actor_id; | 14709 v32 = actor_id; |
14720 } | 14710 } |
14721 else | 14711 else |
14722 */ | 14712 */ |
14723 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly | 14713 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly |
14724 || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 | 14714 || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 |
14725 || v80 * 307.2 < (double)(signed int)v75.uDistance | 14715 || v80 * 307.2 < (double)(signed int)v75.uDistance |
14726 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting | 14716 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting |
14727 && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) | 14717 && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) |
14728 { | 14718 { |
14729 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) | 14719 if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) |
14730 { | 14720 { |
14731 continue; | 14721 continue; |
14732 } | 14722 } |
14733 else if ( v21->uAIState == AttackingMelee ) | 14723 else if ( pActor->uAIState == AttackingMelee ) |
14734 { | 14724 { |
14735 v35 = stru_50C198.special_ability_use_check(v21, actor_id); | 14725 v35 = stru_50C198.special_ability_use_check(pActor, actor_id); |
14736 stru_50FE08.Add( | 14726 stru_50FE08.Add( |
14737 a1, | 14727 a1, |
14738 5120, | 14728 5120, |
14739 v21->vPosition.x, | 14729 pActor->vPosition.x, |
14740 v21->vPosition.y, | 14730 pActor->vPosition.y, |
14741 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), | 14731 pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), |
14742 v35, | 14732 v35, |
14743 1 | 14733 1 |
14744 ); | 14734 ); |
14745 } | 14735 } |
14746 else if ( v21->uAIState == AttackingRanged1 ) | 14736 else if ( pActor->uAIState == AttackingRanged1 ) |
14747 { | 14737 { |
14748 v34 = v21->pMonsterInfo.uMissleAttack1Type; | 14738 v34 = pActor->pMonsterInfo.uMissleAttack1Type; |
14749 Actor::RangedAttack(actor_id, &pDir, v34, 0); | 14739 Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); |
14750 } | 14740 } |
14751 else if ( v21->uAIState == AttackingRanged2 ) | 14741 else if ( pActor->uAIState == AttackingRanged2 ) |
14752 { | 14742 { |
14753 v34 = v21->pMonsterInfo.uMissleAttack2Type; | 14743 v34 = pActor->pMonsterInfo.uMissleAttack2Type; |
14754 Actor::RangedAttack(actor_id, &pDir, v34, 1); | 14744 Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); |
14755 } | 14745 } |
14756 else if ( v21->uAIState == AttackingRanged3 ) | 14746 else if ( pActor->uAIState == AttackingRanged3 ) |
14757 { | 14747 { |
14758 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; | 14748 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; |
14759 v33 = v21->pMonsterInfo.uSpell1ID; | 14749 v33 = pActor->pMonsterInfo.uSpell1ID; |
14760 Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); | 14750 Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); |
14761 } | 14751 } |
14762 else if ( v21->uAIState == AttackingRanged4 ) | 14752 else if ( pActor->uAIState == AttackingRanged4 ) |
14763 { | 14753 { |
14764 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; | 14754 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; |
14765 v33 = v21->pMonsterInfo.uSpell2ID; | 14755 v33 = pActor->pMonsterInfo.uSpell2ID; |
14766 Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); | 14756 Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); |
14767 } | 14757 } |
14768 } | 14758 } |
14769 | 14759 |
14770 v36 = v75.uDistance; | 14760 v36 = v75.uDistance; |
14771 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) | 14761 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) |
14772 { | 14762 { |
14773 if ( target_pid_type == OBJECT_Actor ) | 14763 if ( target_pid_type == OBJECT_Actor ) |
14774 { | 14764 { |
14775 v36 = v75.uDistance; | 14765 v36 = v75.uDistance; |
14776 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] | 14766 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] |
14777 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); | 14767 + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); |
14778 } | 14768 } |
14779 else | 14769 else |
14780 { | 14770 { |
14781 v37 = 4; | 14771 v37 = 4; |
14798 //v39 = __OFSUB__(v36, 5120); | 14788 //v39 = __OFSUB__(v36, 5120); |
14799 //v38 = ((v36 - 5120) & 0x80000000u) != 0; | 14789 //v38 = ((v36 - 5120) & 0x80000000u) != 0; |
14800 v38 = 5120; | 14790 v38 = 5120; |
14801 } | 14791 } |
14802 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) | 14792 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) |
14803 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | 14793 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
14804 } | 14794 } |
14805 | 14795 |
14806 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) | 14796 if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 ) |
14807 { | 14797 { |
14808 if ( (signed int)v36 >= 10240 ) | 14798 if ( (signed int)v36 >= 10240 ) |
14809 { | 14799 { |
14810 Actor::_4032B2(actor_id, target_pid, 1024, 0); | 14800 Actor::AI_4032B2(actor_id, target_pid, 1024, 0); |
14811 } | 14801 } |
14812 else | 14802 else |
14813 { | 14803 { |
14814 //peasents after attacked | 14804 //peasents after attacked |
14815 //guard after attacked | 14805 //guard after attacked |
14816 Actor::Flee(actor_id, target_pid, 0, &pDir); | 14806 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); |
14817 } | 14807 } |
14818 continue; | 14808 continue; |
14819 } | 14809 } |
14820 | 14810 |
14821 if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) | 14811 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) |
14822 { | 14812 { |
14823 | 14813 |
14824 if ( v21->pMonsterInfo.uAIType == 1 ) | 14814 if ( pActor->pMonsterInfo.uAIType == 1 ) |
14825 { | 14815 { |
14826 if ( v21->pMonsterInfo.uMovementType == 5 ) | 14816 if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14827 { | 14817 { |
14828 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); | 14818 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); |
14829 } | 14819 } |
14830 else | 14820 else |
14831 { | 14821 { |
14832 Actor::Flee(actor_id, target_pid, 0, &pDir); | 14822 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); |
14833 continue; | 14823 continue; |
14834 } | 14824 } |
14835 | 14825 |
14836 } | 14826 } |
14837 if ( !(v21->uAttributes & 0x020000) ) | 14827 if ( !(pActor->uAttributes & 0x020000) ) |
14838 { | 14828 { |
14839 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3) | 14829 if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) |
14840 { | 14830 { |
14841 if ( v21->pMonsterInfo.uAIType == 2 ) | 14831 if ( pActor->pMonsterInfo.uAIType == 2 ) |
14842 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; | 14832 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; |
14843 if ( v21->pMonsterInfo.uAIType == 3 ) | 14833 if ( pActor->pMonsterInfo.uAIType == 3 ) |
14844 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; | 14834 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; |
14845 v84 = v21->sCurrentHP; | 14835 v84 = pActor->sCurrentHP; |
14846 v42 = (double)(signed int)v84; | 14836 v42 = (double)(signed int)v84; |
14847 if ( v43 > v42 && (signed int)v36 < 10240 ) | 14837 if ( v43 > v42 && (signed int)v36 < 10240 ) |
14848 { | 14838 { |
14849 Actor::Flee(actor_id, target_pid, 0, &pDir); | 14839 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); |
14850 continue; | 14840 continue; |
14851 } | 14841 } |
14852 } | 14842 } |
14853 } | 14843 } |
14854 | 14844 |
14855 v81 = v36 - v21->uActorRadius; | 14845 v81 = v36 - pActor->uActorRadius; |
14856 if ( target_pid_type == OBJECT_Actor ) | 14846 if ( target_pid_type == OBJECT_Actor ) |
14857 v81 -= pActors[PID_ID(target_pid)].uActorRadius; | 14847 v81 -= pActors[PID_ID(target_pid)].uActorRadius; |
14858 if ( v81 < 0 ) | 14848 if ( v81 < 0 ) |
14859 v81 = 0; | 14849 v81 = 0; |
14860 rand(); | 14850 rand(); |
14861 v21->uAttributes &= 0xFBFFFF; | 14851 pActor->uAttributes &= 0xFBFFFF; |
14862 if ( v81 < 5120 ) | 14852 if ( v81 < 5120 ) |
14863 { | 14853 { |
14864 v45 = stru_50C198.special_ability_use_check(v21, actor_id); | 14854 v45 = stru_50C198.special_ability_use_check(pActor, actor_id); |
14865 if ( v45 == 0 ) | 14855 if ( v45 == 0 ) |
14866 { | 14856 { |
14867 if ( v21->pMonsterInfo.uMissleAttack1Type ) | 14857 if ( pActor->pMonsterInfo.uMissleAttack1Type ) |
14868 { | 14858 { |
14869 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) | 14859 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) |
14870 { | 14860 { |
14871 Actor::MissileAttack1(actor_id, target_pid, &pDir); | 14861 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); |
14872 } | 14862 } |
14873 else if ( v21->pMonsterInfo.uMovementType == 5 ) | 14863 else if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14874 { | 14864 { |
14875 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14865 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14876 v64 = (signed __int64)v47; | 14866 v64 = (signed __int64)v47; |
14877 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14867 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14878 } | 14868 } |
14879 else | 14869 else |
14880 { | 14870 { |
14881 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14871 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14882 if ( v80 * 307.2 > (double)v81 ) | 14872 if ( v80 * 307.2 > (double)v81 ) |
14883 { | 14873 { |
14884 v64 = (signed __int64)v47; | 14874 v64 = (signed __int64)v47; |
14885 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14875 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14886 } | 14876 } |
14887 else | 14877 else |
14888 { | 14878 { |
14889 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | 14879 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
14890 } | 14880 } |
14891 } | 14881 } |
14892 } | 14882 } |
14893 else | 14883 else |
14894 { | 14884 { |
14895 if ( (double)v81 >= v80 * 307.2 ) | 14885 if ( (double)v81 >= v80 * 307.2 ) |
14896 { | 14886 { |
14897 if ( v81 >= 1024 ) | 14887 if ( v81 >= 1024 ) |
14898 { | 14888 { |
14899 if ( v21->pMonsterInfo.uMovementType == 5 ) | 14889 if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14900 { | 14890 { |
14901 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14891 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14902 v64 = (signed __int64)v47; | 14892 v64 = (signed __int64)v47; |
14903 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14893 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14904 } | 14894 } |
14905 else | 14895 else |
14906 { | 14896 { |
14907 //monsters | 14897 //monsters |
14908 Actor::Pursue3(actor_id, target_pid, 0, &pDir); | 14898 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); |
14909 } | 14899 } |
14910 } | 14900 } |
14911 else if ( v21->pMonsterInfo.uMovementType == 5 ) | 14901 else if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14912 { | 14902 { |
14913 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14903 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14914 v64 = (signed __int64)v47; | 14904 v64 = (signed __int64)v47; |
14915 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14905 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14916 } | 14906 } |
14917 else | 14907 else |
14918 { | 14908 { |
14919 v70 = (signed __int64)v80 * 307.2; | 14909 v70 = (signed __int64)v80 * 307.2; |
14920 //monsters | 14910 //monsters |
14921 //guard after player runs away | 14911 //guard after player runs away |
14922 // follow player | 14912 // follow player |
14923 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); | 14913 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); |
14924 } | 14914 } |
14925 } | 14915 } |
14926 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) | 14916 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) |
14927 { | 14917 { |
14928 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14918 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14929 v64 = (signed __int64)v47; | 14919 v64 = (signed __int64)v47; |
14930 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14920 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14931 } | 14921 } |
14932 else | 14922 else |
14933 { | 14923 { |
14934 //monsters | 14924 //monsters |
14935 Actor::MeleeAttack(actor_id, target_pid, &pDir); | 14925 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); |
14936 } | 14926 } |
14937 } | 14927 } |
14938 continue; | 14928 continue; |
14939 } | 14929 } |
14940 else if ( v45 == 2 || v45 == 3 ) | 14930 else if ( v45 == 2 || v45 == 3 ) |
14941 { | 14931 { |
14942 if ( v45 == 2 ) | 14932 if ( v45 == 2 ) |
14943 v46 = v21->pMonsterInfo.uSpell1ID; | 14933 v46 = pActor->pMonsterInfo.uSpell1ID; |
14944 else | 14934 else |
14945 v46 = v21->pMonsterInfo.uSpell2ID; | 14935 v46 = pActor->pMonsterInfo.uSpell2ID; |
14946 if ( v46 ) | 14936 if ( v46 ) |
14947 { | 14937 { |
14948 if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) | 14938 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) |
14949 { | 14939 { |
14950 if ( v45 == 2 ) | 14940 if ( v45 == 2 ) |
14951 Actor::SpellAttack1(actor_id, target_pid, &pDir); | 14941 Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); |
14952 else | 14942 else |
14953 Actor::SpellAttack2(actor_id, target_pid, &pDir); | 14943 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); |
14954 } | 14944 } |
14955 else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) | 14945 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) |
14956 { | 14946 { |
14957 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14947 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14958 v64 = (signed __int64)v47; | 14948 v64 = (signed __int64)v47; |
14959 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14949 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14960 } | 14950 } |
14961 else | 14951 else |
14962 { | 14952 { |
14963 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14953 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14964 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | 14954 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
14965 } | 14955 } |
14966 } | 14956 } |
14967 else | 14957 else |
14968 { | 14958 { |
14969 if ( (double)v81 >= v80 * 307.2 ) | 14959 if ( (double)v81 >= v80 * 307.2 ) |
14970 { | 14960 { |
14971 if ( v81 >= 1024 ) | 14961 if ( v81 >= 1024 ) |
14972 { | 14962 { |
14973 if ( v21->pMonsterInfo.uMovementType == 5 ) | 14963 if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14974 { | 14964 { |
14975 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14965 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14976 v64 = (signed __int64)v47; | 14966 v64 = (signed __int64)v47; |
14977 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14967 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14978 } | 14968 } |
14979 else | 14969 else |
14980 { | 14970 { |
14981 Actor::Pursue3(actor_id, target_pid, 256, &pDir); | 14971 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); |
14982 } | 14972 } |
14983 } | 14973 } |
14984 else if ( v21->pMonsterInfo.uMovementType == 5 ) | 14974 else if ( pActor->pMonsterInfo.uMovementType == 5 ) |
14985 { | 14975 { |
14986 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14976 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14987 v64 = (signed __int64)v47; | 14977 v64 = (signed __int64)v47; |
14988 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14978 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
14989 } | 14979 } |
14990 else | 14980 else |
14991 { | 14981 { |
14992 v70 = (signed __int64)v80 * 307.2; | 14982 v70 = (signed __int64)v80 * 307.2; |
14993 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); | 14983 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); |
14994 } | 14984 } |
14995 } | 14985 } |
14996 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) | 14986 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) |
14997 { | 14987 { |
14998 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 14988 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
14999 v64 = (signed __int64)v47; | 14989 v64 = (signed __int64)v47; |
15000 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 14990 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15001 } | 14991 } |
15002 else | 14992 else |
15003 { | 14993 { |
15004 Actor::MeleeAttack(actor_id, target_pid, &pDir); | 14994 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); |
15005 } | 14995 } |
15006 } | 14996 } |
15007 continue; | 14997 continue; |
15008 } | 14998 } |
15009 } | 14999 } |
15010 } | 15000 } |
15011 | 15001 |
15012 if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) | 15002 if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) |
15013 { | 15003 { |
15014 if ( !v21->pMonsterInfo.uMovementType ) | 15004 if ( !pActor->pMonsterInfo.uMovementType ) |
15015 { | 15005 { |
15016 Actor::_4032B2(actor_id, 4, 1024, 0); | 15006 Actor::AI_4032B2(actor_id, 4, 1024, 0); |
15017 } | 15007 } |
15018 else if ( v21->pMonsterInfo.uMovementType == 1 ) | 15008 else if ( pActor->pMonsterInfo.uMovementType == 1 ) |
15019 { | 15009 { |
15020 Actor::_4032B2(actor_id, 4, 2560, 0); | 15010 Actor::AI_4032B2(actor_id, 4, 2560, 0); |
15021 } | 15011 } |
15022 else if ( v21->pMonsterInfo.uMovementType == 2 ) | 15012 else if ( pActor->pMonsterInfo.uMovementType == 2 ) |
15023 { | 15013 { |
15024 Actor::_4032B2(actor_id, 4, 5120, 0); | 15014 Actor::AI_4032B2(actor_id, 4, 5120, 0); |
15025 } | 15015 } |
15026 else if ( v21->pMonsterInfo.uMovementType == 4 ) | 15016 else if ( pActor->pMonsterInfo.uMovementType == 4 ) |
15027 { | 15017 { |
15028 Actor::_4032B2(actor_id, 4, 10240, 0); | 15018 Actor::AI_4032B2(actor_id, 4, 10240, 0); |
15029 } | 15019 } |
15030 else if ( v21->pMonsterInfo.uMovementType == 5 ) | 15020 else if ( pActor->pMonsterInfo.uMovementType == 5 ) |
15031 { | 15021 { |
15032 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | 15022 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); |
15033 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15023 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15034 memcpy(&v74, v57, sizeof(v74)); | 15024 memcpy(&v74, v57, sizeof(v74)); |
15035 memcpy(&pDir, &v74, sizeof(pDir)); | 15025 memcpy(&pDir, &v74, sizeof(pDir)); |
15036 v64 = (signed __int64)v58; | 15026 v64 = (signed __int64)v58; |
15037 Actor::AI_Stand(actor_id, 4, v64, &pDir); | 15027 Actor::AI_Stand(actor_id, 4, v64, &pDir); |
15038 } | 15028 } |
15039 } | 15029 } |
15040 else if ( !v21->pMonsterInfo.uMissleAttack2Type ) | 15030 else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) |
15041 { | 15031 { |
15042 if ( (double)v81 >= v80 * 307.2 ) | 15032 if ( (double)v81 >= v80 * 307.2 ) |
15043 { | 15033 { |
15044 if ( v81 >= 1024 ) | 15034 if ( v81 >= 1024 ) |
15045 { | 15035 { |
15046 if ( v21->pMonsterInfo.uMovementType == 5 ) | 15036 if ( pActor->pMonsterInfo.uMovementType == 5 ) |
15047 { | 15037 { |
15048 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15038 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15049 v64 = (signed __int64)v47; | 15039 v64 = (signed __int64)v47; |
15050 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 15040 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15051 } | 15041 } |
15052 else | 15042 else |
15053 { | 15043 { |
15054 Actor::Pursue3(actor_id, target_pid, 256, &pDir); | 15044 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); |
15055 } | 15045 } |
15056 } | 15046 } |
15057 else if ( v21->pMonsterInfo.uMovementType == 5 ) | 15047 else if ( pActor->pMonsterInfo.uMovementType == 5 ) |
15058 { | 15048 { |
15059 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15049 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15060 v64 = (signed __int64)v47; | 15050 v64 = (signed __int64)v47; |
15061 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 15051 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15062 } | 15052 } |
15063 else | 15053 else |
15064 { | 15054 { |
15065 v70 = (signed __int64)v80 * 307.2; | 15055 v70 = (signed __int64)v80 * 307.2; |
15066 Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); | 15056 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); |
15067 } | 15057 } |
15068 } | 15058 } |
15069 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) | 15059 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) |
15070 { | 15060 { |
15071 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15061 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15072 v64 = (signed __int64)v47; | 15062 v64 = (signed __int64)v47; |
15073 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 15063 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15074 } | 15064 } |
15075 else | 15065 else |
15076 { | 15066 { |
15077 Actor::MeleeAttack(actor_id, target_pid, &pDir); | 15067 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); |
15078 } | 15068 } |
15079 } | 15069 } |
15080 else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) | 15070 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) |
15081 { | 15071 { |
15082 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15072 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15083 if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) | 15073 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) |
15084 { | 15074 { |
15085 v64 = (signed __int64)v47; | 15075 v64 = (signed __int64)v47; |
15086 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | 15076 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); |
15087 } | 15077 } |
15088 else | 15078 else |
15089 { | 15079 { |
15090 Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | 15080 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); |
15091 } | 15081 } |
15092 } | 15082 } |
15093 else | 15083 else |
15094 { | 15084 { |
15095 Actor::MissileAttack2(actor_id, target_pid, &pDir); | 15085 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); |
15096 } | 15086 } |
15097 } | 15087 } |
15098 } | 15088 } |
15099 } | 15089 } |
15100 | 15090 |
15101 //----- (0040261D) -------------------------------------------------------- | 15091 //----- (0040261D) -------------------------------------------------------- |