Mercurial > mm7
changeset 1885:70719fa68500
Actor::AI_Flee cleaned up
author | Grumpy7 |
---|---|
date | Sat, 19 Oct 2013 07:26:35 +0200 |
parents | c77de46b31b1 |
children | df873a01767a |
files | Actor.cpp |
diffstat | 1 files changed, 13 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sat Oct 19 07:02:05 2013 +0200 +++ b/Actor.cpp Sat Oct 19 07:26:35 2013 +0200 @@ -2175,8 +2175,8 @@ v18 = 16; v7->uYawAngle = stru_5C6E00->Atan2( - pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, - pParty->vPosition.y + fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); + pParty->vPosition.x + (int)fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, + pParty->vPosition.y + (int)fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else @@ -2189,49 +2189,33 @@ //----- (00402968) -------------------------------------------------------- void Actor::AI_Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) { - unsigned int v4; // esi@1 Actor *v5; // ebx@1 - //unsigned int result; // eax@1 int v7; // ecx@2 - signed __int16 v8; // cx@10 unsigned __int16 v9; // ax@15 - AIDirection v10; // [sp+8h] [bp-7Ch]@4 - AIDirection a3; // [sp+24h] [bp-60h]@3 - AIDirection v12; // [sp+40h] [bp-44h]@3 - AIDirection v13; // [sp+5Ch] [bp-28h]@4 - signed int a1; // [sp+78h] [bp-Ch]@2 - unsigned int v15; // [sp+7Ch] [bp-8h]@1 - //signed int a2; // [sp+80h] [bp-4h]@1 + AIDirection* v10 = nullptr; // [sp+8h] [bp-7Ch]@4 + AIDirection* a3 = nullptr; // [sp+24h] [bp-60h]@3 + AIDirection* v13; // [sp+5Ch] [bp-28h]@4 - v4 = uActorID; - //a2 = edx0; - v15 = uActorID; v5 = &pActors[uActorID]; - //result = pActors[uActorID].CanAct(); - if ( pActors[uActorID].CanAct() ) + if ( v5->CanAct() ) { - v7 = PID(OBJECT_Actor,v4); - a1 = PID(OBJECT_Actor,v4); + v7 = PID(OBJECT_Actor,uActorID); if ( !a4 ) { - a4 = &v12; - memcpy(&v12, Actor::GetDirectionInfo(v7, sTargetPid, &a3, v5->pMonsterInfo.uFlying), sizeof(v12)); - v7 = a1; + a4 = Actor::GetDirectionInfo(v7, sTargetPid, a3, v5->pMonsterInfo.uFlying); } - memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3)); - memcpy(&v13, &a3, sizeof(v13)); + v13 = Actor::GetDirectionInfo(v7, 4u, v10, 0); if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) - || PID_TYPE(sTargetPid) == OBJECT_Actor && (double)(signed int)v13.uDistance < 307.2 ) + || PID_TYPE(sTargetPid) == OBJECT_Actor && v13->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_StandOrBored(v15, 4, uActionLength, &v13); + Actor::AI_StandOrBored(uActorID, 4, uActionLength, v13); } else { - v8 = v5->uMovementSpeed; - if ( v8 ) - v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v8; + if ( v5->uMovementSpeed ) + v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v5->uMovementSpeed; else v5->uCurrentActionLength = 0; if ( v5->uCurrentActionLength > 256 )