Mercurial > mm7
changeset 1908:cb1cbb969fce
Merge
author | Grumpy7 |
---|---|
date | Mon, 21 Oct 2013 23:20:29 -0700 |
parents | 1eb0515ff54b (diff) 4cae2d58cfb4 (current diff) |
children | 18dacb49efe9 |
files | |
diffstat | 3 files changed, 334 insertions(+), 495 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Oct 21 17:24:10 2013 +0600 +++ b/Actor.cpp Mon Oct 21 23:20:29 2013 -0700 @@ -2843,101 +2843,44 @@ //----- (00401A91) -------------------------------------------------------- void UpdateActorAI() { - //unsigned int v0; // esi@4 - int v1; // eax@7 - //int v2; // ecx@7 - //int v3; // eax@7 signed int v4; // edi@10 - Actor *v5; // esi@12 signed int sDmg; // eax@14 - __int16 v7; // cx@14 - //Player **v8; // esi@20 Player *pPlayer; // ecx@21 Actor *pActor; // esi@34 - //__int16 v11; // ax@34 - //unsigned int v12; // eax@47 - //signed int v13; // edi@47 - //SpellBuff *v14; // ebx@47 - //unsigned int v15; // edi@67 - //char *v16; // eax@67 - //unsigned int v17; // edx@67 - //unsigned int v18; // ecx@67 - //unsigned __int16 v19; // ax@72 - //int *v20; // esi@80 - //Actor *v21; // ebx@80 unsigned __int16 v22; // ax@86 - //signed int v23; // eax@94 - //unsigned int v24; // eax@102 - //signed int v25; // edi@102 - //SpellBuff *v26; // esi@102 unsigned int v27; // ecx@123 unsigned int v28; // eax@123 - //unsigned int v29; // eax@127 - AIDirection *v30; // eax@129 - unsigned __int16 v31; // ax@132 - //unsigned int v32; // esi@142 int v33; // eax@144 int v34; // eax@147 char v35; // al@150 unsigned int v36; // edi@152 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 double v42; // st7@176 double v43; // st6@176 - //bool v44; // eax@189 int 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 - __int16 v53; // fps@224 - //unsigned __int8 v54; // c0@224 - //unsigned __int8 v55; // c3@224 - //double v56; // st7@226 + signed int v47; // st7@206 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 - //AIDirection *v62; // [sp-14h] [bp-C4h]@213 - //signed int v63; // [sp-14h] [bp-C4h]@216 - //unsigned int v64; // [sp-14h] [bp-C4h]@219 + uint v58; // st7@246 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 int v70; // [sp-10h] [bp-C0h]@213 - //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 target_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 + AIDirection* pDir; // [sp+7Ch] [bp-34h]@129 + float radiusMultiplier; // [sp+98h] [bp-18h]@33 int v81; // [sp+9Ch] [bp-14h]@100 - //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 target_pid; // [sp+ACh] [bp-4h]@83 AIState uAIState; - int v38; + uint v38; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) MakeActorAIList_ODM(); else MakeActorAIList_BLV(); - //v0 = 0; if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) { if ( pParty->armageddon_timer > 417 ) @@ -2955,11 +2898,11 @@ pParty->uFlags |= 2u; pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; - v4 = pParty->field_16140 + 50; + v4 = pParty->armageddonDamage + 50; if ( pParty->armageddon_timer <= 0 ) { pParty->armageddon_timer = 0; - for(int i = 0; i < uNumActors; i++) + for(size_t i = 0; i < uNumActors; i++) { pActor=&pActors[i]; if ( pActor->CanAct() ) @@ -2984,7 +2927,7 @@ for(int i = 1; i <= 4; i++) { pPlayer = pPlayers[i]; - if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) + if ( !pPlayer->pConditions[Condition_Dead] && !pPlayer->pConditions[Condition_Pertified] && !pPlayer->pConditions[Condition_Eradicated] ) pPlayer->ReceiveDamage(v4, DMGT_5); } } @@ -3000,16 +2943,9 @@ } - //uActorID = v0; for (uint i = 0; i < uNumActors; ++i) { pActor = &pActors[i]; - //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState - //do - //{ - //pActor = (Actor *)(LODWORD(v80) - 176); - //v11 = *(unsigned int *)LODWORD(v80); - //v49 = *(unsigned int *)LODWORD(v80) == 5; ai_near_actors_targets_pid[i] = OBJECT_Player; if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) continue; @@ -3017,58 +2953,28 @@ if (!pActor->sCurrentHP && pActor->uAIState != Dying) Actor::Die(i); - //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; - //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; - //v12 = 0; - //v13 = 0; - //v14 = (SpellBuff *)(LODWORD(v80) + 36); for (uint j = 0; j < 22; ++j) { if (j != 10) pActor->pActorBuffs[j].IsBuffExpiredToTime(pParty->uTimePlayed); } - /*do - { - if ( v13 != 10 ) - { - v14->_4585CA(pParty->uTimePlayed); - v12 = 0; - } - ++v13; - ++v14; - } - while ( v13 < 22 );*/ if (pActor->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) ) pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0) pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - // not sure - else if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0) + else pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; if (pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 || pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) continue; - //v15 = pMiscTimer->uTimeElapsed; - //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; - //v17 = pActor->uCurrentActionTime; - //v18 = pActor->pMonsterInfo.uRecoveryTime; - if (pActor->pMonsterInfo.uRecoveryTime) - { - if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) - pActor->pMonsterInfo.uRecoveryTime = 0; - else - pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; - } + pActor->pMonsterInfo.uRecoveryTime = max(pActor->pMonsterInfo.uRecoveryTime - pMiscTimer->uTimeElapsed, 0); pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) continue; - //v19 = actor->uAIState; if (pActor->uAIState == Dying) pActor->uAIState = Dead; else @@ -3084,448 +2990,381 @@ pActor->uCurrentActionTime = 0; pActor->uCurrentActionLength = 0; pActor->UpdateAnimation(); - //LABEL_78: - //++uActorID; - //LODWORD(v80) += 836; - //} - //while ( (signed int)uActorID < (signed int)uNumActors ); } - v78 = 0; - int actor_id = -1; - if ( ai_arrays_size > 0 ) + for(v78 = 0; v78 < ai_arrays_size; ++v78) { - //while ( 1 ) - for(v78 = 0; v78 < ai_arrays_size; ++v78) - { - actor_id = ai_near_actors_ids[v78]; - assert(actor_id < uNumActors); + uint actor_id = ai_near_actors_ids[v78]; + assert(actor_id < uNumActors); - //v20 = &ai_near_actors_targets_pid[actor_id]; - pActor = &pActors[actor_id]; - Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); - if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) - pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - target_pid = ai_near_actors_targets_pid[actor_id]; - target_pid_type = PID_TYPE(target_pid); - if ( target_pid_type == OBJECT_Actor) - v80 = 0.5; - else - v80 = 1.0; - v22 = pActor->uAIState; - if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) + pActor = &pActors[actor_id]; + + v47 = (signed int)(pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333); + + Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); + if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + target_pid = ai_near_actors_targets_pid[actor_id]; + target_pid_type = PID_TYPE(target_pid); + if ( target_pid_type == OBJECT_Actor) + radiusMultiplier = 0.5; + else + radiusMultiplier = 1.0; + v22 = pActor->uAIState; + if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) + { + continue; + } + if ( !pActor->sCurrentHP ) + Actor::Die(actor_id); + for(int i=0;i<22;i++) + { + if ( i != 10 ) { - continue; - } - if ( !pActor->sCurrentHP ) - Actor::Die(actor_id); - for(int i=0;i<22;i++) - { - if ( i != 10 ) - { - pActor->pActorBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed); - } + pActor->pActorBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed); } - if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) - pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) - pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; - // not sure - else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) - pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; - if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 ) - { - pActor->uAIState = Removed; - continue; - } - if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 - || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) + } + if ( pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) + pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; + if ( pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + // not sure + else if ( pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; + if ( pActor->pActorBuffs[2].uExpireTime < 0 ) + { + pActor->uAIState = Removed; + continue; + } + if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 + || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) + { + continue; + } + v27 = pMiscTimer->uTimeElapsed; + v28 = pActor->pMonsterInfo.uRecoveryTime; + pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; + if ( (signed int)v28 > 0 ) + pActor->pMonsterInfo.uRecoveryTime = v28 - v27; + if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) + pActor->pMonsterInfo.uRecoveryTime = 0; + if ( !(pActor->uAttributes & 0x8000) ) + pActor->uAttributes |= 0x8000; + a1 = PID(OBJECT_Actor,actor_id); + pDir = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); + uAIState = pActor->uAIState; + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly + || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 + || radiusMultiplier * 307.2 < pDir->uDistance + || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting + && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) + { + if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) { continue; } - v27 = pMiscTimer->uTimeElapsed; - v28 = pActor->pMonsterInfo.uRecoveryTime; - pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; - if ( (signed int)v28 > 0 ) - pActor->pMonsterInfo.uRecoveryTime = v28 - v27; - if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) - pActor->pMonsterInfo.uRecoveryTime = 0; - if ( !(pActor->uAttributes & 0x8000) ) - pActor->uAttributes |= 0x8000; - a1 = PID(OBJECT_Actor,actor_id); - v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); - memcpy(&v75, v30, sizeof(v75)); - memcpy(&pDir, &v75, sizeof(pDir)); - uAIState = pActor->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 ) ) + else if ( pActor->uAIState == AttackingMelee ) + { + v35 = stru_50C198.special_ability_use_check(pActor, actor_id); + stru_50FE08.Add( + a1, + 5120, + pActor->vPosition.x, + pActor->vPosition.y, + pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), + v35, + 1 + ); + } + else if ( pActor->uAIState == AttackingRanged1 ) + { + v34 = pActor->pMonsterInfo.uMissleAttack1Type; + Actor::AI_RangedAttack(actor_id, pDir, v34, 0); + } + else if ( pActor->uAIState == AttackingRanged2 ) { - v32 = actor_id; + v34 = pActor->pMonsterInfo.uMissleAttack2Type; + Actor::AI_RangedAttack(actor_id, pDir, v34, 1); + } + else if ( pActor->uAIState == AttackingRanged3 ) + { + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; + v33 = pActor->pMonsterInfo.uSpell1ID; + Actor::AI_SpellAttack(actor_id, pDir, v33, 2, v65); + } + else if ( pActor->uAIState == AttackingRanged4 ) + { + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; + v33 = pActor->pMonsterInfo.uSpell2ID; + Actor::AI_SpellAttack(actor_id, pDir, v33, 3, v65); + } + } + + v36 = pDir->uDistance; + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) + { + if ( target_pid_type == OBJECT_Actor ) + { + v36 = pDir->uDistance; + v37 =pFactionTable->relations[(pActor->pMonsterInfo.uID-1) / 3 + 1][(pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3 + 1]; } else - */ - if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly - || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 - || v80 * 307.2 < (double)(signed int)v75.uDistance - || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting - && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) + { + v37 = 4; + } + v38=0; + if ( v37 == 2 ) + { + v38 = 1024; + } + else if ( v37 == 3 ) + { + v38 = 2560; + } + else if ( v37 == 4 ) { - if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) - { - continue; - } - else if ( pActor->uAIState == AttackingMelee ) - { - v35 = stru_50C198.special_ability_use_check(pActor, actor_id); - stru_50FE08.Add( - a1, - 5120, - pActor->vPosition.x, - pActor->vPosition.y, - pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), - v35, - 1 - ); - } - else if ( pActor->uAIState == AttackingRanged1 ) - { - v34 = pActor->pMonsterInfo.uMissleAttack1Type; - Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); - } - else if ( pActor->uAIState == AttackingRanged2 ) - { - v34 = pActor->pMonsterInfo.uMissleAttack2Type; - Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); - } - else if ( pActor->uAIState == AttackingRanged3 ) - { - v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; - v33 = pActor->pMonsterInfo.uSpell1ID; - Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); - } - else if ( pActor->uAIState == AttackingRanged4 ) + v38 = 5120; + } + if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + } + + if (pActor->pActorBuffs[4].uExpireTime > 0) + { + if ( (signed int)v36 >= 10240 ) + { + Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); + } + else + { + //peasents after attacked + //guard after attacked + Actor::AI_Flee(actor_id, target_pid, 0, pDir); + } + continue; + } + + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) + { + + if ( pActor->pMonsterInfo.uAIType == 1 ) + { + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) { - v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; - v33 = pActor->pMonsterInfo.uSpell2ID; - Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); - } - } - - v36 = v75.uDistance; - if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) - { - if ( target_pid_type == OBJECT_Actor ) - { - v36 = v75.uDistance; - //v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] - // + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); - v37 =pFactionTable->relations[(pActor->pMonsterInfo.uID-1) / 3 + 1][(pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3 + 1]; - } - else - { - v37 = 4; - } - v38=0; - if ( v37 == 2 ) - { - //v39 = __OFSUB__(v36, 1024); - //v38 = ((v36 - 1024) & 0x80000000u) != 0; - v38 = 1024; - } - else if ( v37 == 3 ) - { - //v39 = __OFSUB__(v36, 2560); - //v38 = ((v36 - 2560) & 0x80000000u) != 0; - v38 = 2560; - } - else if ( v37 == 4 ) - { - //v39 = __OFSUB__(v36, 5120); - //v38 = ((v36 - 5120) & 0x80000000u) != 0; - v38 = 5120; - } - if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) - pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - } - - if (pActor->pActorBuffs[4].uExpireTime > 0) - { - if ( (signed int)v36 >= 10240 ) - { - Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); + Actor::AI_Stand(actor_id, target_pid, (uint)(pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), pDir); } else { - //peasents after attacked - //guard after attacked - Actor::AI_Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, pDir); + continue; } - continue; + } - - if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) + if ( !(pActor->uAttributes & 0x020000) ) { - - if ( pActor->pMonsterInfo.uAIType == 1 ) - { - if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - Actor::AI_Stand(actor_id, target_pid, pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333, &pDir); - } - else - { - Actor::AI_Flee(actor_id, target_pid, 0, &pDir); - continue; - } - - } - if ( !(pActor->uAttributes & 0x020000) ) + if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) { - if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) - { - if ( pActor->pMonsterInfo.uAIType == 2 ) - v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; - if ( pActor->pMonsterInfo.uAIType == 3 ) - v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; - v84 = pActor->sCurrentHP; - v42 = (double)(signed int)v84; - if ( v43 > v42 && (signed int)v36 < 10240 ) - { - Actor::AI_Flee(actor_id, target_pid, 0, &pDir); - continue; - } - } - } - - v81 = v36 - pActor->uActorRadius; - if ( target_pid_type == OBJECT_Actor ) - v81 -= pActors[PID_ID(target_pid)].uActorRadius; - if ( v81 < 0 ) - v81 = 0; - rand(); - pActor->uAttributes &= 0xFFFBFFFF; - if ( v81 < 5120 ) - { - v45 = stru_50C198.special_ability_use_check(pActor, actor_id); - if ( v45 == 0 ) + if ( pActor->pMonsterInfo.uAIType == 2 ) + v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; + if ( pActor->pMonsterInfo.uAIType == 3 ) + v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; + v42 = (double)pActor->sCurrentHP; + if ( v43 > v42 && (signed int)v36 < 10240 ) { - if ( pActor->pMonsterInfo.uMissleAttack1Type ) - { - if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) - { - Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); - } - else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - if ( v80 * 307.2 > (double)v81 ) - { - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); - } - } - } - else - { - if ( (double)v81 >= v80 * 307.2 ) - { - if ( v81 >= 1024 ) - { - if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - //monsters - Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); - } - } - else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - v70 = (signed __int64)v80 * 307.2; - //monsters - //guard after player runs away - // follow player - Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); - } - } - else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - //monsters - Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); - } - } - continue; - } - else if ( v45 == 2 || v45 == 3 ) - { - if ( v45 == 2 ) - v46 = pActor->pMonsterInfo.uSpell1ID; - else - v46 = pActor->pMonsterInfo.uSpell2ID; - if ( v46 ) - { - if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) - { - if ( v45 == 2 ) - Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); - else - Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); - } - else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); - } - } - else - { - if ( (double)v81 >= v80 * 307.2 ) - { - if ( v81 >= 1024 ) - { - if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); - } - } - else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - v70 = (signed __int64)v80 * 307.2; - Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); - } - } - else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) - { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - } - else - { - Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); - } - } + Actor::AI_Flee(actor_id, target_pid, 0, pDir); continue; } } } - - if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) + + v81 = v36 - pActor->uActorRadius; + if ( target_pid_type == OBJECT_Actor ) + v81 -= pActors[PID_ID(target_pid)].uActorRadius; + if ( v81 < 0 ) + v81 = 0; + rand(); + pActor->uAttributes &= 0xFFFBFFFF; + if ( v81 < 5120 ) { - if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT ) - { - Actor::AI_RandomMove(actor_id, 4, 1024, 0); - } - else if ( pActor->pMonsterInfo.uMovementType == 1 ) - { - Actor::AI_RandomMove(actor_id, 4, 2560, 0); - } - else if ( pActor->pMonsterInfo.uMovementType == 2 ) - { - Actor::AI_RandomMove(actor_id, 4, 5120, 0); - } - else if ( pActor->pMonsterInfo.uMovementType == 4 ) + v45 = stru_50C198.special_ability_use_check(pActor, actor_id); + if ( v45 == 0 ) { - Actor::AI_RandomMove(actor_id, 4, 10240, 0); - } - else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - { - v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); - v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - memcpy(&v74, v57, sizeof(v74)); - memcpy(&pDir, &v74, sizeof(pDir)); - Actor::AI_Stand(actor_id, 4, v58, &pDir); - } - } - else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) - { - if ( (double)v81 >= v80 * 307.2 ) - { - if ( v81 >= 1024 ) + if ( pActor->pMonsterInfo.uMissleAttack1Type ) { - if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) + { + Actor::AI_MissileAttack1(actor_id, target_pid, pDir); + } + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); + if ( radiusMultiplier * 307.2 > (double)v81 ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else + { + Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); + } + } + } + else + { + if ( (double)v81 >= radiusMultiplier * 307.2 ) + { + if (pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else if ( v81 >= 1024 ) + { + //monsters + Actor::AI_Pursue3(actor_id, target_pid, 0, pDir); + } + else + { + v70 = (signed int)(radiusMultiplier * 307.2); + //monsters + //guard after player runs away + // follow player + Actor::AI_Pursue2(actor_id, target_pid, 0, pDir, v70); + } + } + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); } else { - Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); + //monsters + Actor::AI_MeleeAttack(actor_id, target_pid, pDir); } } - else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + continue; + } + else if ( v45 == 2 || v45 == 3 ) + { + if ( v45 == 2 ) + v46 = pActor->pMonsterInfo.uSpell1ID; + else + v46 = pActor->pMonsterInfo.uSpell2ID; + if ( v46 ) { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) + { + if ( v45 == 2 ) + Actor::AI_SpellAttack1(actor_id, target_pid, pDir); + else + Actor::AI_SpellAttack2(actor_id, target_pid, pDir); + } + else if ( radiusMultiplier * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else + { + Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); + } } else - { - v70 = (signed __int64)v80 * 307.2; - Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); + { + if ( (double)v81 >= radiusMultiplier * 307.2 ) + { + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else if ( v81 >= 1024 ) + { + Actor::AI_Pursue3(actor_id, target_pid, 256, pDir); + } + else + { + v70 = (signed int)(radiusMultiplier * 307.2); + Actor::AI_Pursue2(actor_id, target_pid, 0, pDir, v70); + } + } + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else + { + Actor::AI_MeleeAttack(actor_id, target_pid, pDir); + } } + continue; } - else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) + } + } + + if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) + { + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT ) + { + Actor::AI_RandomMove(actor_id, 4, 1024, 0); + } + else if ( pActor->pMonsterInfo.uMovementType == 1 ) + { + Actor::AI_RandomMove(actor_id, 4, 2560, 0); + } + else if ( pActor->pMonsterInfo.uMovementType == 2 ) + { + Actor::AI_RandomMove(actor_id, 4, 5120, 0); + } + else if ( pActor->pMonsterInfo.uMovementType == 4 ) + { + Actor::AI_RandomMove(actor_id, 4, 10240, 0); + } + else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + { + v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); + v58 = (uint)(pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333); + Actor::AI_Stand(actor_id, 4, v58, v57); + } + } + else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) + { + if ( (double)v81 >= radiusMultiplier * 307.2 ) + { + if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + { + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + } + else if ( v81 >= 1024 ) { - v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 256, pDir); } else { - Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); + v70 = (int)(radiusMultiplier * 307.2); + Actor::AI_Pursue2(actor_id, target_pid, 0, pDir, v70); } } else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; - if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) - Actor::AI_Stand(actor_id, target_pid, v47, &pDir); - else - Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); + Actor::AI_Stand(actor_id, target_pid, v47, pDir); } else { - Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); - } + Actor::AI_MeleeAttack(actor_id, target_pid, pDir); + } } + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) + { + if ( radiusMultiplier * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) + Actor::AI_Stand(actor_id, target_pid, v47, pDir); + else + Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, pDir); + } + else + { + Actor::AI_MissileAttack2(actor_id, target_pid, pDir); + } } } //----- (0044665D) --------------------------------------------------------
--- a/CastSpellInfo.cpp Mon Oct 21 17:24:10 2013 +0600 +++ b/CastSpellInfo.cpp Mon Oct 21 23:20:29 2013 -0700 @@ -4011,7 +4011,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; pParty->armageddon_timer = 256; - pParty->field_16140 = v2; + pParty->armageddonDamage = v2; ++pPlayer->uNumArmageddonCasts; if ( pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions;
--- a/Party.h Mon Oct 21 17:24:10 2013 +0600 +++ b/Party.h Mon Oct 21 23:20:29 2013 -0700 @@ -301,7 +301,7 @@ char pHireling1Name[100]; char pHireling2Name[100]; int armageddon_timer; - int field_16140; + int armageddonDamage; std::array<int, 4> pTurnBasedPlayerRecoveryTimes; std::array<int, 53> InTheShopFlags; int uFine;