Mercurial > mm7
changeset 1879:7efa09ddb8b4
Actor::AI_SpellAttack1 cleaned up
author | Grumpy7 |
---|---|
date | Thu, 17 Oct 2013 10:00:57 +0200 |
parents | 6ffa3228eaf7 |
children | 52e98d25cd64 |
files | Actor.cpp |
diffstat | 1 files changed, 33 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu Oct 17 09:50:25 2013 +0200 +++ b/Actor.cpp Thu Oct 17 10:00:57 2013 +0200 @@ -1504,10 +1504,8 @@ int16_t v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - //unsigned int result; // eax@7 AIDirection *v9; // eax@8 __int16 v13; // ax@10 - signed int v16; // ecx@17 AIDirection a3; // [sp+Ch] [bp-48h]@9 AIDirection v18; // [sp+28h] [bp-2Ch]@9 int v19; // [sp+44h] [bp-10h]@6 @@ -1564,11 +1562,10 @@ v3->pMonsterInfo.uRecoveryTime = pDira; else v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); - v16 = v3->pMonsterInfo.uSpell2ID; v3->vVelocity.z = 0; v3->vVelocity.y = 0; v3->vVelocity.x = 0; - if ( _42FB5C_check_spell(v16) ) + if ( _42FB5C_check_spell(v3->pMonsterInfo.uSpell2ID) ) { v3->uCurrentActionLength = 64; v3->uCurrentActionTime = 0; @@ -1587,97 +1584,75 @@ void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) { Actor *v3; // ebx@1 - AIDirection *v4; // esi@3 - AIDirection *v5; // edi@3 + int16_t v4; // esi@3 + int16_t v5; // edi@3 signed int v6; // eax@4 Vec3_int_ v7; // ST04_12@6 - //unsigned int result; // eax@7 AIDirection *v9; // eax@8 - unsigned int v10; // esi@8 - AIDirection *v11; // esi@9 - SpriteFrame *v12; // ecx@10 __int16 v13; // ax@10 - unsigned int v14; // ecx@10 - unsigned int v15; // eax@10 signed int v16; // ecx@17 AIDirection a3; // [sp+Ch] [bp-48h]@9 AIDirection v18; // [sp+28h] [bp-2Ch]@9 int v19; // [sp+44h] [bp-10h]@6 - //signed int a2; // [sp+48h] [bp-Ch]@1 int v21; // [sp+4Ch] [bp-8h]@3 - unsigned int v22; // [sp+50h] [bp-4h]@1 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 - v22 = uActorID; v3 = &pActors[uActorID]; - //a2 = edx0; if ( PID_TYPE(sTargetPid) == OBJECT_Actor) { v6 = PID_ID(sTargetPid); - v4 = (AIDirection *)pActors[v6].vPosition.x; - v5 = (AIDirection *)pActors[v6].vPosition.y; - v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); + v4 = pActors[v6].vPosition.x; + v5 = pActors[v6].vPosition.y; + v21 = (int)(pActors[v6].uActorHeight * 0.75 + pActors[v6].vPosition.z); + } + else if ( PID_TYPE(sTargetPid) == OBJECT_Player) + { + v4 = pParty->vPosition.x; + v5 = pParty->vPosition.y; + v21 = pParty->vPosition.z + pParty->sEyelevel; } else { - if ( PID_TYPE(sTargetPid) == OBJECT_Player) - { - v4 = (AIDirection *)pParty->vPosition.x; - v5 = (AIDirection *)pParty->vPosition.y; - v21 = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - v4 = pDir; - v5 = pDir; - } + Error("Should not get here"); + return; } v19 = v3->uActorHeight; v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); v7.y = v3->vPosition.y; v7.x = v3->vPosition.x; - if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) + if ( sub_407A1C(v4, v5, v21, v7) ) { - v9 = pDir; - v10 = 0; - if ( !pDir ) + if ( pDir == nullptr ) { - v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), sTargetPid, &a3, 0); - v9 = &v18; - memcpy(&v18, v11, sizeof(v18)); - v10 = 0; + v9 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), sTargetPid, &a3, 0); } - v12 = pSpriteFrameTable->pSpriteSFrames; + else + { + v9 = pDir; + } v3->uYawAngle = LOWORD(v9->uYawAngle); - v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; - v14 = v22; + v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; v3->uCurrentActionLength = 8 * v13; - v3->uCurrentActionTime = v10; + v3->uCurrentActionTime = 0; v3->uAIState = AttackingRanged3; - Actor::PlaySound(v14, 0); - v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + Actor::PlaySound(uActorID, 0); pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) + if (v3->pActorBuffs[7].uExpireTime > 0) { - v15 *= 2; - pDira = v15; + pDira *= 2; } if ( pParty->bTurnBasedModeOn == 1 ) - v3->pMonsterInfo.uRecoveryTime = v15; + v3->pMonsterInfo.uRecoveryTime = pDira; else - v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength - - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 - * (double)(signed int)pDira - * -2.133333333333333); + v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength + (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333); v16 = v3->pMonsterInfo.uSpell1ID; - v3->vVelocity.z = v10; - v3->vVelocity.y = v10; - v3->vVelocity.x = v10; + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; if ( _42FB5C_check_spell(v16) ) { v3->uCurrentActionLength = 64; - v3->uCurrentActionTime = v10; + v3->uCurrentActionTime = 0; v3->uAIState = Fidgeting; v3->UpdateAnimation(); v3->uAIState = AttackingRanged3; @@ -1686,7 +1661,7 @@ v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v22, sTargetPid, v22, 64, pDir); + Actor::AI_Pursue1(uActorID, sTargetPid, uActorID, 64, pDir); } //----- (0040368B) --------------------------------------------------------