Mercurial > mm7
diff Actor.cpp @ 1871:e26d8d15ef30
Actor::AI_MeleeAttack cleaned up
author | Grumpy7 |
---|---|
date | Thu, 17 Oct 2013 03:47:21 +0200 |
parents | 7a193504f18e |
children | a53bd0511de2 |
line wrap: on
line diff
--- a/Actor.cpp Wed Oct 16 05:59:21 2013 +0200 +++ b/Actor.cpp Thu Oct 17 03:47:21 2013 +0200 @@ -1220,34 +1220,18 @@ void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) { Actor *v3; // ebx@1 - char v4; // zf@1 - //unsigned int result; // eax@3 - AIDirection *v6; // esi@6 - AIDirection *v7; // edi@6 + int16_t v6; // esi@6 + int16_t v7; // edi@6 signed int v8; // eax@7 - double v9; // st7@9 Vec3_int_ v10; // ST04_12@9 - //int v11; // eax@10 AIDirection *v12; // eax@11 - unsigned int v13; // esi@11 - AIDirection *v14; // esi@12 - SpriteFrame *v15; // ecx@13 - __int16 v16; // ax@13 - unsigned int v17; // ecx@13 - signed __int64 v18; // qax@13 AIDirection a3; // [sp+Ch] [bp-48h]@12 AIDirection v20; // [sp+28h] [bp-2Ch]@12 - unsigned int v21; // [sp+44h] [bp-10h]@9 - //signed int a2; // [sp+48h] [bp-Ch]@1 int v23; // [sp+4Ch] [bp-8h]@6 - unsigned int v24; // [sp+50h] [bp-4h]@1 unsigned int v25; // [sp+5Ch] [bp+8h]@13 v3 = &pActors[uActorID]; - //a2 = edx0; - v4 = v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY; - v24 = uActorID; - if ( v4 && v3->pMonsterInfo.uAIType == 1 ) + if ( v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY && v3->pMonsterInfo.uAIType == 1 ) { Actor::AI_Stand(uActorID, sTargetPid, 0, arg0); return; @@ -1255,65 +1239,61 @@ if ( PID_TYPE(sTargetPid) == OBJECT_Actor) { - v8 = PID_ID(sTargetPid); - v6 = (AIDirection *)pActors[v8].vPosition.x; - v7 = (AIDirection *)pActors[v8].vPosition.y; - v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z); + v8 = PID_ID(sTargetPid); + v6 = pActors[v8].vPosition.x; + v7 = pActors[v8].vPosition.y; + v23 = (int)(pActors[v8].uActorHeight * 0.75 + pActors[v8].vPosition.z); } else if ( PID_TYPE(sTargetPid) == OBJECT_Player) { - v6 = (AIDirection *)pParty->vPosition.x; - v7 = (AIDirection *)pParty->vPosition.y; + v6 = pParty->vPosition.x; + v7 = pParty->vPosition.y; v23 = pParty->vPosition.z + pParty->sEyelevel; } else { - v6 = arg0; - v7 = arg0; + Error("Should not get here"); + return; } - v21 = v3->uActorHeight; - v9 = (double)(signed int)v21 * 0.75; - v21 = v3->vPosition.z; - v10.z = (signed __int64)(v9 + (double)(signed int)v21); + v10.z = (int32_t)(v3->uActorHeight * 0.75 + v3->vPosition.z); v10.y = v3->vPosition.y; v10.x = v3->vPosition.x; + if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) { - v12 = arg0; - v13 = 0; - if ( !arg0 ) + if (arg0 != nullptr) + { + v12 = arg0; + } + else { - v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0); - v12 = &v20; - memcpy(&v20, v14, sizeof(v20)); - v13 = 0; + v12 = Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0); } - v15 = pSpriteFrameTable->pSpriteSFrames; v3->uYawAngle = LOWORD(v12->uYawAngle); - v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; - v17 = v24; - v3->uCurrentActionLength = 8 * v16; - v3->uCurrentActionTime = v13; + v3->uCurrentActionLength = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength * 8; + v3->uCurrentActionTime = 0; v3->uAIState = AttackingMelee; - Actor::PlaySound(v17, 0); - LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; + Actor::PlaySound(uActorID, 0); v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; - if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 - && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) + if ( pParty->bTurnBasedModeOn != 1 ) + { + v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333); + } + else if ( v3->pActorBuffs[7].uExpireTime > 0 ) { - LODWORD(v18) = 2 * v18; - v25 = v18; + v3->pMonsterInfo.uRecoveryTime = v25 * 2; } - if ( pParty->bTurnBasedModeOn != 1 ) - v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333); - v3->pMonsterInfo.uRecoveryTime = v18; - v3->vVelocity.z = v13; - v3->vVelocity.y = v13; - v3->vVelocity.x = v13; + else + { + v3->pMonsterInfo.uRecoveryTime = v25; + } + v3->vVelocity.z = 0; + v3->vVelocity.y = 0; + v3->vVelocity.x = 0; v3->UpdateAnimation(); } else - Actor::AI_Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); + Actor::AI_Pursue1(uActorID, sTargetPid, rand() % 2, 64, arg0); } //----- (00438CF3) --------------------------------------------------------