Mercurial > mm7
changeset 1060:b79139c3b5c8
some AI cleaning
author | zipi |
---|---|
date | Thu, 23 May 2013 20:51:27 +0100 |
parents | 0e0f1192aa57 |
children | 89422dd58318 |
files | Actor.cpp Actor.h Indoor.cpp Party.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_5.cpp |
diffstat | 8 files changed, 255 insertions(+), 265 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri May 24 00:53:48 2013 +0600 +++ b/Actor.cpp Thu May 23 20:51:27 2013 +0100 @@ -293,7 +293,7 @@ } //----- (00404AC7) -------------------------------------------------------- -void __fastcall Actor::SpellAttack(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel) +void __fastcall Actor::AI_SpellAttack(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel) { Actor *v5; // esi@1 unsigned int v6; // edi@1 @@ -1398,7 +1398,7 @@ } //----- (00404874) -------------------------------------------------------- -char __fastcall Actor::RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) +char __fastcall Actor::AI_RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) { AIDirection *v4; // edi@1 Actor *v5; // esi@1 @@ -1890,7 +1890,7 @@ } //----- (00404030) -------------------------------------------------------- -void Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) +void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) { unsigned int v4; // edi@1 unsigned int v5; // esi@1 @@ -1981,7 +1981,7 @@ } //----- (00403C6C) -------------------------------------------------------- -void Actor::MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) +void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) { Actor *v3; // ebx@1 char v4; // zf@1 @@ -2077,7 +2077,7 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); + Actor::AI_Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); } //----- (00438CF3) -------------------------------------------------------- @@ -2383,7 +2383,7 @@ } //----- (00403A60) -------------------------------------------------------- -void Actor::SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) +void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2485,11 +2485,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v22, a2, v22, 64, pDir); + Actor::AI_Pursue1(v22, a2, v22, 64, pDir); } //----- (00403854) -------------------------------------------------------- -void Actor::SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2591,11 +2591,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v22, sTargetPid, v22, 64, pDir); + Actor::AI_Pursue1(v22, sTargetPid, v22, 64, pDir); } //----- (0040368B) -------------------------------------------------------- -void Actor::MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 AIDirection *v4; // esi@3 @@ -2682,11 +2682,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); } //----- (00403476) -------------------------------------------------------- -void Actor::MissileAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) +void Actor::AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 int v4; // esi@3 @@ -2786,11 +2786,11 @@ v3->UpdateAnimation(); } else - Actor::Pursue1(v21, sTargetPid, v21, 64, pDir); + Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); } //----- (004032B2) -------------------------------------------------------- -void Actor::_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) +void Actor::AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength) { unsigned int v4; // edi@1 Actor *v5; // esi@1 @@ -2926,7 +2926,7 @@ } //----- (004030AD) -------------------------------------------------------- -void Actor::Stun(unsigned int uActorID, signed int edx0, int arg0) +void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int arg0) { unsigned int v3; // edi@1 Actor *v4; // ebx@1 @@ -2980,7 +2980,7 @@ { unsigned int v7; // eax@3 unsigned int v9; // eax@3 - + assert(uActorID < uNumActors); auto actor = pActors + uActorID; @@ -3148,7 +3148,7 @@ } //----- (00402AD7) -------------------------------------------------------- -void Actor::Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) +void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3221,7 +3221,7 @@ } //----- (00402968) -------------------------------------------------------- -void Actor::Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) +void Actor::AI_Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) { unsigned int v4; // esi@1 Actor *v5; // ebx@1 @@ -3282,7 +3282,7 @@ } //----- (0040281C) -------------------------------------------------------- -void Actor::Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) +void Actor::AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) { unsigned int v5; // edi@1 int v6; // eax@1 @@ -3365,7 +3365,7 @@ } //----- (00402686) -------------------------------------------------------- -void Actor::Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) +void Actor::AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) { //unsigned int v4; // edi@1 int v5; // eax@1
--- a/Actor.h Fri May 24 00:53:48 2013 +0600 +++ b/Actor.h Thu May 23 20:51:27 2013 +0100 @@ -191,30 +191,30 @@ static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party); - static void Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); - static void Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); - static void Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); - static void Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); + static void AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4); + static void AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5); + static void AI_Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4); + static void AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir); static void PlaySound(unsigned int uActorID, unsigned int uSoundID); static void Die(unsigned int uActorID); static void Resurrect(unsigned int uActorID); static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4); - static void Stun(unsigned int uActorID, signed int edx0, int arg0); + static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0); static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3); - static void _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); - static void MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void SpellAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); - static void MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0); + static void AI_4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength); + static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_SpellAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir); + static void AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0); static void __fastcall StandAwhile(unsigned int uActorID); static void AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, struct AIDirection *a4); static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4); - static void FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); + static void AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4); static struct AIDirection *__fastcall GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4); static signed int __fastcall Explode(unsigned int uActorID); - static char __fastcall RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); - static void __fastcall SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel); + static char __fastcall AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); + static void __fastcall AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel); static void AggroSurroundingPeasants(unsigned int uActorID, int a2); static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2); static bool StealFrom(unsigned int uActorID);
--- a/Indoor.cpp Fri May 24 00:53:48 2013 +0600 +++ b/Indoor.cpp Thu May 23 20:51:27 2013 +0100 @@ -4208,7 +4208,7 @@ } v36 = stru_721530.uFaceID; LABEL_118: - Actor::FaceObject(v63, v36, v22, (AIDirection *)v22); + Actor::AI_FaceObject(v63, v36, v22, (AIDirection *)v22); goto LABEL_119; } if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) ) @@ -4225,7 +4225,7 @@ if ( !pActors[v37].pMonsterInfo.uHostilityType ) goto LABEL_118; LABEL_114: - Actor::Flee(v63, v36, v22, (AIDirection *)v22); + Actor::AI_Flee(v63, v36, v22, (AIDirection *)v22); goto LABEL_119; } }
--- a/Party.cpp Fri May 24 00:53:48 2013 +0600 +++ b/Party.cpp Thu May 23 20:51:27 2013 +0100 @@ -854,7 +854,7 @@ v2 = abs(v0->vPosition.y - pParty->vPosition.y); v3 = abs(v0->vPosition.z - pParty->vPosition.z); if (int_get_vector_length(v1, v2, v3) < 512) - Actor::Flee(v4, 4, 0, 0); + Actor::AI_Flee(v4, 4, 0, 0); } ++v4; ++v0;
--- a/mm7_1.cpp Fri May 24 00:53:48 2013 +0600 +++ b/mm7_1.cpp Thu May 23 20:51:27 2013 +0100 @@ -1069,7 +1069,7 @@ if ( !v17->CanAct() ) return; v18 = a2.y; - Actor::FaceObject(a2.y, 4u, 0, 0); + Actor::AI_FaceObject(a2.y, 4u, 0, 0); if ( !v17->sNPC_ID ) { v19 = pNPCStats->pGroups_copy[v17->uGroup];
--- a/mm7_2.cpp Fri May 24 00:53:48 2013 +0600 +++ b/mm7_2.cpp Thu May 23 20:51:27 2013 +0100 @@ -10473,7 +10473,7 @@ { if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) { - Actor::FaceObject(v12, 4u, 0, 0); + Actor::AI_FaceObject(v12, 4u, 0, 0); if ( v13->sNPC_ID ) { pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0);
--- a/mm7_3.cpp Fri May 24 00:53:48 2013 +0600 +++ b/mm7_3.cpp Thu May 23 20:51:27 2013 +0100 @@ -1178,7 +1178,7 @@ { if ( v71 == 0 ) { - Actor::Flee(v75, v38, 0, (AIDirection *)0); + Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); } else { @@ -1191,11 +1191,11 @@ } else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) { - Actor::Flee(v75, v38, 0, (AIDirection *)0); + Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); } else { - Actor::FaceObject(v75, v38, 0, (AIDirection *)0); + Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); } } break; @@ -1203,7 +1203,7 @@ if ( !v0->GetActorsRelation(0) ) { v38 = stru_721530.uFaceID; - Actor::FaceObject(v75, v38, 0, (AIDirection *)0); + Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); break; } //v52 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == 0; @@ -14385,15 +14385,15 @@ { //unsigned int v0; // esi@4 int v1; // eax@7 - int v2; // ecx@7 - int v3; // eax@7 + //int v2; // ecx@7 + //int v3; // eax@7 signed int v4; // edi@10 Actor *v5; // esi@12 - signed int v6; // eax@14 + signed int sDmg; // eax@14 __int16 v7; // cx@14 - Player **v8; // esi@20 + //Player **v8; // esi@20 Player *pPlayer; // ecx@21 - //Actor *pActor; // esi@34 + Actor *pActor; // esi@34 //__int16 v11; // ax@34 //unsigned int v12; // eax@47 //signed int v13; // edi@47 @@ -14404,7 +14404,7 @@ //unsigned int v18; // ecx@67 //unsigned __int16 v19; // ax@72 //int *v20; // esi@80 - Actor *v21; // ebx@80 + //Actor *v21; // ebx@80 unsigned __int16 v22; // ax@86 //signed int v23; // eax@94 //unsigned int v24; // eax@102 @@ -14487,58 +14487,48 @@ else { pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); - v1 = rand(); - v2 = 128; - v3 = pParty->sRotationX + v1 % 16 - 8; - pParty->sRotationX = v3; - if ( v3 > 128 || (v2 = -128, v3 < -128) ) - pParty->sRotationX = v2; + pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8; + if ( pParty->sRotationX > 128) + pParty->sRotationX = 128; + else if ( pParty->sRotationX < -128 ) + pParty->sRotationX = -128; + pParty->uFlags |= 2u; pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; v4 = pParty->field_16140 + 50; if ( pParty->armageddon_timer <= 0 ) { pParty->armageddon_timer = 0; - v84 = 0; - if ( (signed int)uNumActors > 0 ) + for(int i = 0; i < uNumActors; i++) { - v5 = pActors;//[0].sCurrentHP; - do + pActor=&pActors[i]; + if ( pActor->CanAct() ) { - if ( v5->CanAct() ) + sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); + pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); + if ( sDmg ) { - v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); - v7 = v5->sCurrentHP - v6; - v5->sCurrentHP = v7; - if ( v6 ) + if ( pActor->sCurrentHP >= 0 ) { - if ( v7 >= 0 ) - { - Actor::Stun(v84, 4, 0); - } - else - { - Actor::Die(v84); - if ( v5->pMonsterInfo.uExp ) - GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); - } + Actor::AI_Stun(i, 4, 0); + } + else + { + Actor::Die(i); + if ( pActor->pMonsterInfo.uExp ) + GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp); } } - ++v84; - ++v5; } - while ( (signed int)v84 < (signed int)uNumActors ); + ++v84; + ++v5; } - v8 = &pPlayers[1]; - do + for(int i = 1; i <= 4; i++) { - pPlayer = *v8; - if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) + pPlayer = pPlayers[i]; + if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) pPlayer->ReceiveDamage(v4, DMGT_5); - ++v8; } - while ( (signed int)v8 <= (signed int)&pPlayers[4] ); - //v0 = 0; } if (pTurnEngine->field_1C) --pTurnEngine->field_1C; @@ -14555,7 +14545,7 @@ //uActorID = v0; for (uint i = 0; i < uNumActors; ++i) { - auto actor = pActors + i; + pActor = &pActors[i]; //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState //do //{ @@ -14563,10 +14553,10 @@ //v11 = *(unsigned int *)LODWORD(v80); //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) + if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) continue; - if (!actor->sCurrentHP && actor->uAIState != Dying) + if (!pActor->sCurrentHP && pActor->uAIState != Dying) Actor::Die(i); //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; @@ -14577,7 +14567,7 @@ for (uint j = 0; j < 22; ++j) { if (j != 10) - actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); + pActor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); } /*do { @@ -14590,52 +14580,52 @@ ++v14; } while ( v13 < 22 );*/ - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) + if ( (signed __int64)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) ) - actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) - actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + 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)actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) - actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; + else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) + pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; - if ((signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 - || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) + if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 + || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) continue; //v15 = pMiscTimer->uTimeElapsed; //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; //v17 = pActor->uCurrentActionTime; //v18 = pActor->pMonsterInfo.uRecoveryTime; - if (actor->pMonsterInfo.uRecoveryTime) + if (pActor->pMonsterInfo.uRecoveryTime) { - if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) - actor->pMonsterInfo.uRecoveryTime = 0; + if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) + pActor->pMonsterInfo.uRecoveryTime = 0; else - actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; + pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; } - actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; - if (actor->uCurrentActionTime < actor->uCurrentActionLength) + pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; + if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) continue; //v19 = actor->uAIState; - if (actor->uAIState == Dying) - actor->uAIState = Dead; + if (pActor->uAIState == Dying) + pActor->uAIState = Dead; else { - if (actor->uAIState != Summoned) + if (pActor->uAIState != Summoned) { Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); continue; } - actor->uAIState = Standing; + pActor->uAIState = Standing; } - actor->uCurrentActionTime = 0; - actor->uCurrentActionLength = 0; - actor->UpdateAnimation(); + pActor->uCurrentActionTime = 0; + pActor->uCurrentActionLength = 0; + pActor->UpdateAnimation(); //LABEL_78: //++uActorID; //LODWORD(v80) += 836; @@ -14655,61 +14645,61 @@ assert(actor_id < uNumActors); //v20 = &ai_near_actors_targets_pid[actor_id]; - v21 = &pActors[actor_id]; + pActor = &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; + 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 = v21->uAIState; + v22 = pActor->uAIState; if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) { continue; } - if ( !v21->sCurrentHP ) + if ( !pActor->sCurrentHP ) Actor::Die(actor_id); for(int i=0;i<22;i++) { if ( i != 10 ) { - v21->pActorBuffs[i]._4585CA(pParty->uTimePlayed); + pActor->pActorBuffs[i]._4585CA(pParty->uTimePlayed); } } - if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) - v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; - if ( (signed __int64)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; + 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)v21->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) - v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; - if ( (signed __int64)v21->pActorBuffs[2].uExpireTime < 0 ) + 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 ) { - v21->uAIState = Removed; + pActor->uAIState = Removed; continue; } - if ( (signed __int64)v21->pActorBuffs[5].uExpireTime > 0 - || (signed __int64)v21->pActorBuffs[6].uExpireTime > 0) + if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 + || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) { continue; } v27 = pMiscTimer->uTimeElapsed; - v28 = v21->pMonsterInfo.uRecoveryTime; - v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; + v28 = pActor->pMonsterInfo.uRecoveryTime; + pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; if ( (signed int)v28 > 0 ) - v21->pMonsterInfo.uRecoveryTime = v28 - v27; - if ( v21->pMonsterInfo.uRecoveryTime < 0 ) - v21->pMonsterInfo.uRecoveryTime = 0; - if ( !(v21->uAttributes & 0x8000) ) - v21->uAttributes |= 0x8000; + 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 = v21->uAIState; + uAIState = pActor->uAIState; /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 && v80 * 307.2 >= (double)(signed int)v75.uDistance @@ -14720,60 +14710,60 @@ } else */ - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly - || (signed int)v21->pMonsterInfo.uRecoveryTime > 0 + 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 - && !v21->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) + && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) { - if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) + if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) { continue; } - else if ( v21->uAIState == AttackingMelee ) + else if ( pActor->uAIState == AttackingMelee ) { - v35 = stru_50C198.special_ability_use_check(v21, actor_id); + v35 = stru_50C198.special_ability_use_check(pActor, actor_id); stru_50FE08.Add( a1, 5120, - v21->vPosition.x, - v21->vPosition.y, - v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), + pActor->vPosition.x, + pActor->vPosition.y, + pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), v35, 1 ); } - else if ( v21->uAIState == AttackingRanged1 ) + else if ( pActor->uAIState == AttackingRanged1 ) { - v34 = v21->pMonsterInfo.uMissleAttack1Type; - Actor::RangedAttack(actor_id, &pDir, v34, 0); + v34 = pActor->pMonsterInfo.uMissleAttack1Type; + Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); } - else if ( v21->uAIState == AttackingRanged2 ) + else if ( pActor->uAIState == AttackingRanged2 ) { - v34 = v21->pMonsterInfo.uMissleAttack2Type; - Actor::RangedAttack(actor_id, &pDir, v34, 1); + v34 = pActor->pMonsterInfo.uMissleAttack2Type; + Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); } - else if ( v21->uAIState == AttackingRanged3 ) + else if ( pActor->uAIState == AttackingRanged3 ) { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; - v33 = v21->pMonsterInfo.uSpell1ID; - Actor::SpellAttack(actor_id, &pDir, v33, 2, v65); + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; + v33 = pActor->pMonsterInfo.uSpell1ID; + Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); } - else if ( v21->uAIState == AttackingRanged4 ) + else if ( pActor->uAIState == AttackingRanged4 ) { - v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; - v33 = v21->pMonsterInfo.uSpell2ID; - Actor::SpellAttack(actor_id, &pDir, v33, 3, v65); + v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; + v33 = pActor->pMonsterInfo.uSpell2ID; + Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); } } v36 = v75.uDistance; - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) { if ( target_pid_type == OBJECT_Actor ) { v36 = v75.uDistance; - v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] + v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); } else @@ -14800,85 +14790,85 @@ v38 = 5120; } if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) - v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } - if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) + if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 ) { if ( (signed int)v36 >= 10240 ) { - Actor::_4032B2(actor_id, target_pid, 1024, 0); + Actor::AI_4032B2(actor_id, target_pid, 1024, 0); } else { //peasents after attacked //guard after attacked - Actor::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); } continue; } - if ( v21->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) + if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) { - if ( v21->pMonsterInfo.uAIType == 1 ) + if ( pActor->pMonsterInfo.uAIType == 1 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); + Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); } else { - Actor::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); continue; } } - if ( !(v21->uAttributes & 0x020000) ) + if ( !(pActor->uAttributes & 0x020000) ) { - if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3) + if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) { - if ( v21->pMonsterInfo.uAIType == 2 ) - v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; - if ( v21->pMonsterInfo.uAIType == 3 ) - v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; - v84 = v21->sCurrentHP; + 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::Flee(actor_id, target_pid, 0, &pDir); + Actor::AI_Flee(actor_id, target_pid, 0, &pDir); continue; } } } - v81 = v36 - v21->uActorRadius; + v81 = v36 - pActor->uActorRadius; if ( target_pid_type == OBJECT_Actor ) v81 -= pActors[PID_ID(target_pid)].uActorRadius; if ( v81 < 0 ) v81 = 0; rand(); - v21->uAttributes &= 0xFBFFFF; + pActor->uAttributes &= 0xFBFFFF; if ( v81 < 5120 ) { - v45 = stru_50C198.special_ability_use_check(v21, actor_id); + v45 = stru_50C198.special_ability_use_check(pActor, actor_id); if ( v45 == 0 ) { - if ( v21->pMonsterInfo.uMissleAttack1Type ) + if ( pActor->pMonsterInfo.uMissleAttack1Type ) { - if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) { - Actor::MissileAttack1(actor_id, target_pid, &pDir); + Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; if ( v80 * 307.2 > (double)v81 ) { v64 = (signed __int64)v47; @@ -14886,7 +14876,7 @@ } else { - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } } @@ -14896,21 +14886,21 @@ { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { //monsters - Actor::Pursue3(actor_id, target_pid, 0, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } @@ -14920,19 +14910,19 @@ //monsters //guard after player runs away // follow player - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { //monsters - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } continue; @@ -14940,28 +14930,28 @@ else if ( v45 == 2 || v45 == 3 ) { if ( v45 == 2 ) - v46 = v21->pMonsterInfo.uSpell1ID; + v46 = pActor->pMonsterInfo.uSpell1ID; else - v46 = v21->pMonsterInfo.uSpell2ID; + v46 = pActor->pMonsterInfo.uSpell2ID; if ( v46 ) { - if ( (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) + if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) { if ( v45 == 2 ) - Actor::SpellAttack1(actor_id, target_pid, &pDir); + Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); else - Actor::SpellAttack2(actor_id, target_pid, &pDir); + Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); } - else if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) + else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } else @@ -14970,130 +14960,130 @@ { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue3(actor_id, target_pid, 256, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { v70 = (signed __int64)v80 * 307.2; - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } continue; } } } - - if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) + + if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) { - if ( !v21->pMonsterInfo.uMovementType ) + if ( !pActor->pMonsterInfo.uMovementType ) { - Actor::_4032B2(actor_id, 4, 1024, 0); + Actor::AI_4032B2(actor_id, 4, 1024, 0); } - else if ( v21->pMonsterInfo.uMovementType == 1 ) + else if ( pActor->pMonsterInfo.uMovementType == 1 ) { - Actor::_4032B2(actor_id, 4, 2560, 0); + Actor::AI_4032B2(actor_id, 4, 2560, 0); } - else if ( v21->pMonsterInfo.uMovementType == 2 ) + else if ( pActor->pMonsterInfo.uMovementType == 2 ) { - Actor::_4032B2(actor_id, 4, 5120, 0); + Actor::AI_4032B2(actor_id, 4, 5120, 0); } - else if ( v21->pMonsterInfo.uMovementType == 4 ) + else if ( pActor->pMonsterInfo.uMovementType == 4 ) { - Actor::_4032B2(actor_id, 4, 10240, 0); + Actor::AI_4032B2(actor_id, 4, 10240, 0); } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); - v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; memcpy(&v74, v57, sizeof(v74)); memcpy(&pDir, &v74, sizeof(pDir)); v64 = (signed __int64)v58; Actor::AI_Stand(actor_id, 4, v64, &pDir); } } - else if ( !v21->pMonsterInfo.uMissleAttack2Type ) + else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) { if ( (double)v81 >= v80 * 307.2 ) { if ( v81 >= 1024 ) { - if ( v21->pMonsterInfo.uMovementType == 5 ) + if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue3(actor_id, target_pid, 256, &pDir); + Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); } } - else if ( v21->pMonsterInfo.uMovementType == 5 ) + else if ( pActor->pMonsterInfo.uMovementType == 5 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { v70 = (signed __int64)v80 * 307.2; - Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70); + Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::MeleeAttack(actor_id, target_pid, &pDir); + Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); } } - else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 ) + else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) { - v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; - if ( v80 * 307.2 > (double)v81 || v21->pMonsterInfo.uMovementType == 5 ) + v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; + if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) { v64 = (signed __int64)v47; Actor::AI_Stand(actor_id, target_pid, v64, &pDir); } else { - Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); + Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); } } else { - Actor::MissileAttack2(actor_id, target_pid, &pDir); - } + Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); + } } } }
--- a/mm7_5.cpp Fri May 24 00:53:48 2013 +0600 +++ b/mm7_5.cpp Thu May 23 20:51:27 2013 +0100 @@ -4672,7 +4672,7 @@ } if ( pMonster->sCurrentHP > 0 ) { - Actor::Stun(uActorID_Monster_, a1, 0); + Actor::AI_Stun(uActorID_Monster_, a1, 0); Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); if ( bShowDamage ) { @@ -5007,7 +5007,7 @@ { if ( v7->sCurrentHP >= 1 ) { - Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); + Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5193,7 +5193,7 @@ { if ( v44->sCurrentHP >= 1 ) { - Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); + Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); Actor::AggroSurroundingPeasants(uActorID, 1); } else @@ -5459,7 +5459,7 @@ if ( v7 ) { if ( pActor->sCurrentHP > 0 ) - Actor::Stun(uActorIDa, a2, 0); + Actor::AI_Stun(uActorIDa, a2, 0); else Actor::Die(uActorIDa); a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; @@ -5478,7 +5478,7 @@ } else { - Actor::Stun(uActorIDa, a2, 0); + Actor::AI_Stun(uActorIDa, a2, 0); } } } @@ -5567,7 +5567,7 @@ if ( v14 ) { if ( v7->sCurrentHP > 0 ) - Actor::Stun(uActorID, v17, 0); + Actor::AI_Stun(uActorID, v17, 0); else Actor::Die(uActorID); Actor::AggroSurroundingPeasants(uActorID, 0); @@ -5587,7 +5587,7 @@ } else { - Actor::Stun(uActorID, v17, 0); + Actor::AI_Stun(uActorID, v17, 0); } return; } @@ -6884,7 +6884,7 @@ v22 = 2; v17 = v5->pMonsterInfo.uSpell1ID; } - Actor::SpellAttack(v4, &a4, v17, v22, v24); + Actor::AI_SpellAttack(v4, &a4, v17, v22, v24); LABEL_25: v16 = a2a; v23 = &a4; @@ -6900,7 +6900,7 @@ v18 = v5->pMonsterInfo.uMissleAttack1Type; v25 = 0; } - Actor::RangedAttack(v4, &a4, v18, v25); + Actor::AI_RangedAttack(v4, &a4, v18, v25); goto LABEL_25; } } @@ -7015,7 +7015,7 @@ { if ( v5->pMonsterInfo.uMissleAttack2Type ) { - Actor::MissileAttack2(v13, v22, &v18); + Actor::AI_MissileAttack2(v13, v22, &v18); goto LABEL_43; } } @@ -7030,16 +7030,16 @@ if ( v15 ) { if ( v14 == 2 ) - Actor::SpellAttack1(v13, v22, &v18); + Actor::AI_SpellAttack1(v13, v22, &v18); else - Actor::SpellAttack2(v13, v22, &v18); + Actor::AI_SpellAttack2(v13, v22, &v18); goto LABEL_43; } goto LABEL_44; } if ( v5->pMonsterInfo.uMissleAttack1Type ) { - Actor::MissileAttack1(v13, v22, &v18); + Actor::AI_MissileAttack1(v13, v22, &v18); LABEL_43: //v3 = v21; v21->field_C = 1; @@ -7052,7 +7052,7 @@ LABEL_44: if ( (double)(signed int)v20 < 307.2 ) { - Actor::MeleeAttack(v13, v22, &v18); + Actor::AI_MeleeAttack(v13, v22, &v18); //v3 = v21; v21->field_C = 3; goto LABEL_48; @@ -7331,12 +7331,12 @@ { if ( (signed int)v11 < 10240 ) { - Actor::Flee(uActorID, a2a, 0, &pDir); + Actor::AI_Flee(uActorID, a2a, 0, &pDir); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::_4032B2(uActorID, a2a, 1024, 0); + Actor::AI_4032B2(uActorID, a2a, 1024, 0); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7354,7 +7354,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7373,7 +7373,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7394,7 +7394,7 @@ v29->uActionLength = actor->uCurrentActionLength; return 1; } - Actor::Flee(uActorID, a2a, 32, 0); + Actor::AI_Flee(uActorID, a2a, 32, 0); v29->field_C = 4; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7408,9 +7408,9 @@ if ( (signed int)v11 < 5120 ) { if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) - Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); + Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); else - Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); + Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; @@ -7418,28 +7418,28 @@ LABEL_46: if ( !actor->pMonsterInfo.uMovementType ) { - Actor::_4032B2(uActorID, a2a, 1024, 32); + Actor::AI_4032B2(uActorID, a2a, 1024, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 1 ) { - Actor::_4032B2(uActorID, a2a, 2560, 32); + Actor::AI_4032B2(uActorID, a2a, 2560, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 2 ) { - Actor::_4032B2(uActorID, a2a, 5120, 32); + Actor::AI_4032B2(uActorID, a2a, 5120, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1; } if ( actor->pMonsterInfo.uMovementType == 4 ) { - Actor::_4032B2(uActorID, a2a, 10240, 32); + Actor::AI_4032B2(uActorID, a2a, 10240, 32); v29->field_C = 2; v29->uActionLength = actor->uCurrentActionLength; return 1;