# HG changeset patch # User Grumpy7 # Date 1382158925 -7200 # Node ID c77de46b31b1ddbf974abcaeb56d889f0390adc2 # Parent 7d334cc596e0cb7bc159da55da9febcfe4756219 Actor::AI_Pursue1 cleaned up diff -r 7d334cc596e0 -r c77de46b31b1 Actor.cpp --- a/Actor.cpp Sat Oct 19 06:48:02 2013 +0200 +++ b/Actor.cpp Sat Oct 19 07:02:05 2013 +0200 @@ -2124,28 +2124,17 @@ //----- (00402AD7) -------------------------------------------------------- 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 Actor *v7; // ebx@1 unsigned int v8; // ecx@1 - char v9; // zf@1 AIDirection *v10; // esi@6 - //int v12; // ecx@19 - //unsigned int v13; // eax@19 AIDirection a3; // [sp+Ch] [bp-5Ch]@7 - //AIDirection v15; // [sp+28h] [bp-40h]@7 - AIDirection v16; // [sp+44h] [bp-24h]@7 - //unsigned int v17; // [sp+60h] [bp-8h]@1 unsigned int v18; // [sp+64h] [bp-4h]@1 - //int v19; // [sp+70h] [bp+8h]@19 - v5 = uActorID; v6 = 0; v7 = &pActors[uActorID]; - v18 = a2; v8 = PID(OBJECT_Actor,uActorID); - v9 = v7->pMonsterInfo.uFlying == 0; - if ( !v9 && !pParty->bFlying ) + if ( v7->pMonsterInfo.uFlying != 0 && !pParty->bFlying ) //TODO: Does v6 have a point? { if ( v7->pMonsterInfo.uMissleAttack1Type ) v6 = v7->uActorRadius + 512; @@ -2153,34 +2142,37 @@ v6 = pParty->uPartyHeight; } - v10 = pDir; - if ( !pDir ) + if ( pDir == nullptr ) { - memcpy(&v16, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v16)); - v10 = &v16; + v10 = Actor::GetDirectionInfo(v8, a2, &a3, v6); + } + else + { + v10 = pDir; } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_StandOrBored(v5, 4, uActionLength, v10); + Actor::AI_StandOrBored(uActorID, 4, uActionLength, v10); return; } - if ( (double)(signed int)v10->uDistance < 307.2 ) + if ( v10->uDistance < 307.2 ) { if ( !uActionLength ) uActionLength = 256; - Actor::AI_Stand(v5, v18, uActionLength, v10); + Actor::AI_Stand(uActorID, a2, uActionLength, v10); return; } - if ( !v7->uMovementSpeed ) + if ( v7->uMovementSpeed == 0 ) { - Actor::AI_Stand(v5, v18, uActionLength, v10); + Actor::AI_Stand(uActorID, a2, uActionLength, v10); return; } - v18 = 16; if ( arg0 % 2 ) v18 = -16; + else + 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,