Mercurial > mm7
diff mm7_3.cpp @ 843:292c6288204d
more UpdateActorAI cleaning
author | zipi |
---|---|
date | Fri, 29 Mar 2013 13:52:55 +0000 |
parents | 2825b5a9b562 |
children | d593ca75c366 |
line wrap: on
line diff
--- a/mm7_3.cpp Fri Mar 29 10:44:18 2013 +0600 +++ b/mm7_3.cpp Fri Mar 29 13:52:55 2013 +0000 @@ -15118,7 +15118,7 @@ unsigned int v29; // eax@127 AIDirection *v30; // eax@129 unsigned __int16 v31; // ax@132 - unsigned int v32; // esi@142 + //unsigned int v32; // esi@142 int v33; // eax@144 int v34; // eax@147 char v35; // al@150 @@ -15126,19 +15126,19 @@ signed int v37; // eax@154 unsigned __int8 v38; // sf@158 unsigned __int8 v39; // of@158 - signed int v40; // edx@166 - unsigned int v41; // ecx@166 + //signed int v40; // edx@166 + //unsigned int v41; // ecx@166 double v42; // st7@176 double v43; // st6@176 - bool v44; // eax@189 + //bool v44; // eax@189 bool v45; // eax@192 unsigned __int8 v46; // cl@197 double v47; // st7@206 double v48; // st7@207 - char v49; // zf@208 - char v50; // zf@214 - signed int v51; // edx@219 - unsigned int v52; // ecx@219 + //char v49; // zf@208 + //char v50; // zf@214 + //signed int v51; // edx@219 + //unsigned int v52; // ecx@219 __int16 v53; // fps@224 unsigned __int8 v54; // c0@224 unsigned __int8 v55; // c3@224 @@ -15146,37 +15146,38 @@ AIDirection *v57; // eax@246 double v58; // st7@246 signed int v59; // [sp-18h] [bp-C8h]@213 - int v60; // [sp-14h] [bp-C4h]@144 - int v61; // [sp-14h] [bp-C4h]@168 + //int v60; // [sp-14h] [bp-C4h]@144 + //int v61; // [sp-14h] [bp-C4h]@168 AIDirection *v62; // [sp-14h] [bp-C4h]@213 signed int v63; // [sp-14h] [bp-C4h]@216 unsigned int v64; // [sp-14h] [bp-C4h]@219 unsigned int v65; // [sp-10h] [bp-C0h]@144 char v66; // [sp-10h] [bp-C0h]@147 - AIDirection *v67; // [sp-10h] [bp-C0h]@167 - int v68; // [sp-10h] [bp-C0h]@168 - AIDirection *v69; // [sp-10h] [bp-C0h]@206 + //AIDirection *v67; // [sp-10h] [bp-C0h]@167 + //int v68; // [sp-10h] [bp-C0h]@168 + //AIDirection *v69; // [sp-10h] [bp-C0h]@206 int v70; // [sp-10h] [bp-C0h]@213 - AIDirection *v71; // [sp-10h] [bp-C0h]@216 + //AIDirection *v71; // [sp-10h] [bp-C0h]@216 AIDirection v72; // [sp+0h] [bp-B0h]@246 AIDirection a3; // [sp+1Ch] [bp-94h]@129 AIDirection v74; // [sp+38h] [bp-78h]@246 AIDirection v75; // [sp+54h] [bp-5Ch]@129 - int v76; // [sp+70h] [bp-40h]@83 + int actor_pid_type; // [sp+70h] [bp-40h]@83 signed int a1; // [sp+74h] [bp-3Ch]@129 int v78; // [sp+78h] [bp-38h]@79 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 float v80; // [sp+98h] [bp-18h]@33 int v81; // [sp+9Ch] [bp-14h]@100 - int v82; // [sp+A0h] [bp-10h]@45 + //int v82; // [sp+A0h] [bp-10h]@45 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 unsigned int v84; // [sp+A8h] [bp-8h]@11 - signed int a2; // [sp+ACh] [bp-4h]@83 + signed int actor_pid; // [sp+ACh] [bp-4h]@83 + AIState uAIState; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - MakeActorAIList_ODM(); + MakeActorAIList_ODM(); else - MakeActorAIList_BLV(); + MakeActorAIList_BLV(); //v0 = 0; if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) @@ -15193,7 +15194,7 @@ v3 = pParty->sRotationX + v1 % 16 - 8; pParty->sRotationX = v3; if ( v3 > 128 || (v2 = -128, v3 < -128) ) - pParty->sRotationX = v2; + pParty->sRotationX = v2; pParty->uFlags |= 2u; pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; v4 = pParty->field_16140 + 50; @@ -15221,7 +15222,7 @@ { Actor::Die(v84); if ( v5->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); + GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); } } } @@ -15235,14 +15236,14 @@ { pPlayer = *v8; if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) - pPlayer->ReceiveDamage(v4, 5); + pPlayer->ReceiveDamage(v4, 5); ++v8; } while ( (signed int)v8 <= (signed int)&pPlayers[4] ); //v0 = 0; } if (pTurnEngine->field_1C) - --pTurnEngine->field_1C; + --pTurnEngine->field_1C; } } @@ -15265,10 +15266,10 @@ //v49 = *(unsigned int *)LODWORD(v80) == 5; ai_near_actors_targets_pid[i] = OBJECT_Player; if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) - continue; + continue; if (!actor->sCurrentHP && actor->uAIState != Dying) - Actor::Die(i); + Actor::Die(i); //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; @@ -15291,18 +15292,18 @@ ++v14; } while ( v13 < 22 );*/ - if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) + if ( actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) - actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; - if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) - actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - else - actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; + actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; + if ( actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) + actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + // not sure + else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; - if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || - actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) - continue; + if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) + continue; //v15 = pMiscTimer->uTimeElapsed; //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; @@ -15311,17 +15312,18 @@ if (actor->pMonsterInfo.uRecoveryTime) { if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) - actor->pMonsterInfo.uRecoveryTime = 0; - else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; + actor->pMonsterInfo.uRecoveryTime = 0; + else + actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; } actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; if (actor->uCurrentActionTime < actor->uCurrentActionLength) - continue; + continue; //v19 = actor->uAIState; if (actor->uAIState == Dying) - actor->uAIState = Dead; + actor->uAIState = Dead; else { if (actor->uAIState != Summoned) @@ -15357,150 +15359,131 @@ v21 = &pActors[actor_id]; Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - a2 = ai_near_actors_targets_pid[actor_id]; - v76 = a2 & 7; - if ( (a2 & 7) == OBJECT_Actor) - v80 = 0.5; + v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + actor_pid = ai_near_actors_targets_pid[actor_id]; + actor_pid_type = PID_TYPE(actor_pid); + if ( actor_pid_type == OBJECT_Actor) + v80 = 0.5; else - v80 = 1.0; + v80 = 1.0; v22 = v21->uAIState; if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) { continue; } - else - { - if ( !v21->sCurrentHP ) + if ( !v21->sCurrentHP ) Actor::Die(actor_id); - v25 = 0; - v26 = v21->pActorBuffs; - do + v25 = 0; + v26 = v21->pActorBuffs; + do + { + if ( v25 != 10 ) { - if ( v25 != 10 ) - { - v26->_4585CA(pParty->uTimePlayed); - //v24 = 0; - } - ++v25; - ++v26; + v26->_4585CA(pParty->uTimePlayed); + //v24 = 0; } - while ( v25 < 22 ); - if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 - && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0 - && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0 - || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) ) + ++v25; + ++v26; + } + while ( v25 < 22 ); + if ( v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) + if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) + v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + // not sure + else // if ( v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; + if ( v21->pActorBuffs[2].uExpireTime < 0 ) + { + v21->uAIState = Removed; + continue; + } + if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) + { + continue; + } + v27 = pMiscTimer->uTimeElapsed; + v28 = v21->pMonsterInfo.uRecoveryTime; + v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; + if ( (signed int)v28 > 0 ) + v21->pMonsterInfo.uRecoveryTime = v28 - v27; + if ( v21->pMonsterInfo.uRecoveryTime< 0 ) + v21->pMonsterInfo.uRecoveryTime = 0; + v29 = v21->uAttributes; + if ( !(v29 & 0x8000) ) + v21->uAttributes = v29 | 0x8000; + a1 = 8 * actor_id | OBJECT_Actor; + v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, actor_pid, &a3, 0); + memcpy(&v75, v30, sizeof(v75)); + memcpy(&pDir, &v75, sizeof(pDir)); + uAIState = v21->uAIState; + /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly + && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 + && v80 * 307.2 >= (double)(signed int)v75.uDistance + && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) + || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) + { + v32 = actor_id; + }*/ + if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly + || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 + || v80 * 307.2 < (double)(signed int)v75.uDistance + || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting + && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) + //else + { + if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) { - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) - { - if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 - || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) - v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; - } - } - if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 - && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 - && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 - || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) - { - v21->uAIState = Removed; continue; } - else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) + else if ( v21->uAIState == AttackingMelee ) { - continue; + v35 = stru_50C198.special_ability_use_check(v21, actor_id); + stru_50FE08.Add( + a1, + 5120, + v21->vPosition.x, + v21->vPosition.y, + v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), + v35, + 1 + ); + } + else if ( v21->uAIState == AttackingRanged1 ) + { + v34 = v21->pMonsterInfo.uMissleAttack1Type; + Actor::_404874(actor_id, &pDir, v34, 0); + } + else if ( v21->uAIState == AttackingRanged2 ) + { + v34 = v21->pMonsterInfo.uMissleAttack2Type; + Actor::_404874(actor_id, &pDir, v34, 1); } else { - v27 = pMiscTimer->uTimeElapsed; - v28 = v21->pMonsterInfo.uRecoveryTime; - v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; - if ( (signed int)v28 > 0 ) - v21->pMonsterInfo.uRecoveryTime = v28 - v27; - if ( v21->pMonsterInfo.uRecoveryTime< 0 ) - v21->pMonsterInfo.uRecoveryTime = 0; - v29 = v21->uAttributes; - if ( !(v29 & 0x8000) ) - v21->uAttributes = v29 | 0x8000; - a1 = 8 * actor_id | OBJECT_Actor; - v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0); - v49 = v21->pMonsterInfo.uHostilityType == 0; - memcpy(&v75, v30, sizeof(v75)); - memcpy(&pDir, &v75, sizeof(pDir)); - if ( !v49 - && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 - && v80 * 307.2 >= (double)(signed int)v75.uDistance - && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9) - || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 ) - { - v32 = actor_id; - } - else + if ( v21->uAIState == AttackingRanged3 ) { - if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) - { - continue; - } - else if ( v21->uAIState == 2 ) - { - v32 = actor_id; - v35 = stru_50C198.special_ability_use_check(v21, actor_id); - stru_50FE08.Add( - a1, - 5120, - v21->vPosition.x, - v21->vPosition.y, - v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), - v35, - 1 - ); - } - else if ( v21->uAIState == 3 ) - { - v34 = v21->pMonsterInfo.uMissleAttack1Type; - v66 = 0; - v32 = actor_id; - Actor::_404874(actor_id, &pDir, v34, v66); - } - else if ( v21->uAIState == 12 ) - { - v34 = v21->pMonsterInfo.uMissleAttack2Type; - v66 = 1; - v32 = actor_id; - Actor::_404874(actor_id, &pDir, v34, v66); - } - else - { - v32 = actor_id; - if ( v21->uAIState == 13 ) - { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; - v60 = 2; - v33 = v21->pMonsterInfo.uSpell1ID; - Actor::_404AC7(actor_id, &pDir, v33, v60, v65); - } - else if ( v21->uAIState == 18 ) - { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; - v60 = 3; - v33 = v21->pMonsterInfo.uSpell2ID; - Actor::_404AC7(actor_id, &pDir, v33, v60, v65); - } - } + v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; + v33 = v21->pMonsterInfo.uSpell1ID; + Actor::_404AC7(actor_id, &pDir, v33, 2, v65); + } + else if ( v21->uAIState == AttackingRanged4 ) + { + v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; + v33 = v21->pMonsterInfo.uSpell2ID; + Actor::_404AC7(actor_id, &pDir, v33, 3, v65); } } } + v36 = v75.uDistance; - if ( !v21->pMonsterInfo.uHostilityType ) + if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) { - if ( v76 == 3 ) + if ( actor_pid_type == OBJECT_Actor ) { v36 = v75.uDistance; v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] - + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); + + (pActors[actor_pid >> 3].pMonsterInfo.uID - 1) / 3); } else { @@ -15522,116 +15505,94 @@ v38 = ((v36 - 5120) & 0x80000000u) != 0; } if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) { - v40 = a2; - v41 = v32; if ( (signed int)v36 >= 10240 ) { - v68 = 0; - v61 = 1024; - Actor::_4032B2(v41, v40, v61, v68); - continue; + Actor::_4032B2(actor_id, actor_pid, 1024, 0); } - v67 = &pDir; - Actor::_402968(v41, v40, 0, v67); + else + { + //peasents after attacked + //guard after attacked + Actor::_402968(actor_id, actor_pid, 0, &pDir); + } continue; } - if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) + if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && actor_pid ) { if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) { if ( v21->pMonsterInfo.uAIType == 1 ) { - v67 = &pDir; - if ( v21->pMonsterInfo.uMovementType != 5 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v40 = a2; - v41 = v32; - Actor::_402968(v41, v40, 0, v67); + Actor::AI_Stand(actor_id, actor_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); + } + else + { + Actor::_402968(actor_id, actor_pid, 0, &pDir); continue; } - Actor::AI_Stand( - v32, - a2, - (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), - &pDir); + } else { + v84 = v21->sCurrentHP; + v42 = (double)(signed int)v84; if ( v21->pMonsterInfo.uAIType == 2 ) { - v84 = v21->sCurrentHP; - v42 = (double)(signed int)v84; + v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; } else { - v84 = v21->sCurrentHP; - v42 = (double)(signed int)v84; v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; } - if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) - if ( v43 > v42 && (signed int)v36 < 10240 ) + if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 && v43 > v42 && (signed int)v36 < 10240 ) { - v67 = &pDir; - v40 = a2; - v41 = v32; - Actor::_402968(v41, v40, 0, v67); + Actor::_402968(actor_id, actor_pid, 0, &pDir); continue; } } } v81 = v36 - v21->uActorRadius; - if ( v76 == 3 ) - v81 -= pActors[a2 >> 3].uActorRadius; + if ( actor_pid_type == OBJECT_Actor ) + v81 -= pActors[actor_pid >> 3].uActorRadius; if ( v81 < 0 ) - v81 = 0; + v81 = 0; rand(); - v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0; v21->uAttributes &= 0xFBFFFF; - v82 = 0; - v49 = v21->pMonsterInfo.uMovementType == 5; - v84 = v44; - if ( v49 ) - v82 = 1; if ( v81 < 5120 ) { - v45 = stru_50C198.special_ability_use_check(v21, v32); + v45 = stru_50C198.special_ability_use_check(v21, actor_id); if ( !v45 ) { if ( v21->pMonsterInfo.uMissleAttack1Type ) { - if ( v84 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) { - Actor::_403476(v32, a2, &pDir); + Actor::_403476(actor_id, actor_pid, &pDir); continue; } - if ( v82 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - //UNDEF(v53); - v69 = &pDir; if ( !(v54 | v55) ) { - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); + Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir); continue; } v56 = v80 * 307.2; @@ -15639,50 +15600,43 @@ { if ( v81 >= 1024 ) { - if ( v82 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - v71 = &pDir; v63 = 0; - - Actor::_402686(v32, a2, v63, v71); + //monsters + Actor::_402686(actor_id, actor_pid, v63, &pDir); continue; } - if ( v82 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } v70 = (signed __int64)v56; v62 = &pDir; v59 = 0; - Actor::_40281C(v32, a2, v59, v62, v70); + //monsters + //guard after player runs away + // follow player + Actor::_40281C(actor_id, actor_pid, v59, v62, v70); continue; } - v49 = v84 == 0; - v69 = &pDir; - if ( v49 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) { v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - Actor::_403C6C(v32, a2, &pDir); + //monsters + Actor::_403C6C(actor_id, actor_pid, &pDir); continue; } if ( v45 != 1 ) @@ -15690,33 +15644,29 @@ if ( v45 > 1 && v45 <= 3 ) { if ( v45 == 2 ) - v46 = v21->pMonsterInfo.uSpell1ID; + v46 = v21->pMonsterInfo.uSpell1ID; else - v46 = v21->pMonsterInfo.uSpell2ID; + v46 = v21->pMonsterInfo.uSpell2ID; if ( v46 ) { - if ( v84 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) { if ( v45 == 2 ) - Actor::_403854(v32, a2, &pDir); + Actor::_403854(actor_id, actor_pid, &pDir); else - Actor::_403A60(v32, a2, &pDir); + Actor::_403A60(actor_id, actor_pid, &pDir); continue; } - if ( v80 * 307.2 > (double)v81 || v82 ) + if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); + Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir); continue; } v48 = v80 * 307.2; @@ -15724,93 +15674,66 @@ { if ( v81 >= 1024 ) { - v50 = v82 == 0; - if ( !v50 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); - continue; + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); } - v71 = &pDir; - v63 = 256; - Actor::_402686(v32, a2, v63, v71); + else + { + Actor::_402686(actor_id, actor_pid, 256, &pDir); + } continue; } - if ( v82 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } v70 = (signed __int64)v48; v62 = &pDir; v59 = 0; - Actor::_40281C(v32, a2, v59, v62, v70); + Actor::_40281C(actor_id, actor_pid, v59, v62, v70); continue; } - v49 = v84 == 0; - v69 = &pDir; - if ( v49 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) { v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - Actor::_403C6C(v32, a2, &pDir); + Actor::_403C6C(actor_id, actor_pid, &pDir); continue; } } } } - if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 || v81 >= 5120 || v45 != 1 ) + if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !actor_pid || v81 >= 5120 || v45 != 1 ) { if ( !v21->pMonsterInfo.uMovementType ) { - v68 = 0; - v61 = 1024; - v41 = v32; - v40 = 4; - Actor::_4032B2(v41, v40, v61, v68); + Actor::_4032B2(actor_id, 4, 1024, 0); continue; } if ( v21->pMonsterInfo.uMovementType == 1 ) { - v68 = 0; - v61 = 2560; - v41 = v32; - v40 = 4; - Actor::_4032B2(v41, v40, v61, v68); + Actor::_4032B2(actor_id, 4, 2560, 0); continue; } if ( v21->pMonsterInfo.uMovementType == 2 ) { - v68 = 0; - v61 = 5120; - v41 = v32; - v40 = 4; - Actor::_4032B2(v41, v40, v61, v68); + Actor::_4032B2(actor_id, 4, 5120, 0); continue; } if ( v21->pMonsterInfo.uMovementType == 4 ) { - v68 = 0; - v61 = 10240; - v41 = v32; - v40 = 4; - Actor::_4032B2(v41, v40, v61, v68); + Actor::_4032B2(actor_id, 4, 10240, 0); continue; } if ( v21->pMonsterInfo.uMovementType == 5 ) @@ -15819,11 +15742,8 @@ v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; memcpy(&v74, v57, sizeof(v74)); memcpy(&pDir, &v74, sizeof(pDir)); - v69 = &pDir; - v52 = actor_id; v64 = (signed __int64)v58; - v51 = 4; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, 4, v64, &pDir); continue; } continue; @@ -15836,80 +15756,54 @@ { if ( v81 >= 1024 ) { - v50 = v82 == 0; - if ( !v50 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - v71 = &pDir; v63 = 256; - Actor::_402686(v32, a2, v63, v71); + Actor::_402686(actor_id, actor_pid, v63, &pDir); continue; } - if ( v82 ) + if ( v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } v70 = (signed __int64)v56; v62 = &pDir; v59 = 0; - Actor::_40281C(v32, a2, v59, v62, v70); + Actor::_40281C(actor_id, actor_pid, v59, v62, v70); continue; } - v49 = v84 == 0; - v69 = &pDir; - if ( v49 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) { v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - Actor::_403C6C(v32, a2, &pDir); + Actor::_403C6C(actor_id, actor_pid, &pDir); continue; } - if ( !v84 ) + if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) { - if ( v82 ) + v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + if ( !(v54 | v55) || v21->pMonsterInfo.uMovementType == 5 ) { - v69 = &pDir; - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - v51 = a2; v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); + Actor::AI_Stand(actor_id, actor_pid, v64, &pDir); continue; } - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - //UNDEF(v53); - v69 = &pDir; - if ( !(v54 | v55) ) - { - v51 = a2; - v64 = (signed __int64)v47; - v52 = v32; - Actor::AI_Stand(v52, v51, v64, v69); - continue; - } - Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); + Actor::_402AD7(actor_id, actor_pid, actor_id, (signed __int64)v47, &pDir); continue; } - Actor::_40368B(v32, a2, &pDir); + Actor::_40368B(actor_id, actor_pid, &pDir); } } }