Mercurial > mm7
changeset 1862:a2bdc17ffd2f
Actor::AI_RangedAttack cleaned up
author | Grumpy7 |
---|---|
date | Mon, 14 Oct 2013 07:32:04 +0200 |
parents | a86c60679949 |
children | 97b75e6100ff |
files | Actor.cpp Actor.h |
diffstat | 2 files changed, 53 insertions(+), 99 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Oct 14 06:32:30 2013 +0200 +++ b/Actor.cpp Mon Oct 14 07:32:04 2013 +0200 @@ -741,7 +741,6 @@ { unsigned int v2; // esi@1 unsigned int v3; // edi@1 - bool result; // eax@9 v2 = a1->uAlly; v3 = a2->uAlly; @@ -796,158 +795,113 @@ } //----- (00404874) -------------------------------------------------------- -char __fastcall Actor::AI_RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) +void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 ) { - AIDirection *v4; // edi@1 - Actor *v5; // esi@1 - char result; // al@1 - char *v7; // eax@15 - unsigned __int16 v8; // ax@18 - unsigned __int16 v9; // ax@19 - __int16 v10; // ax@19 - signed int v11; // ecx@19 - //int v12; // eax@19 + Actor *actPtr; // esi@1 + char specAb; // al@1 int v13; // edx@28 - //SpriteObject a1; // [sp+Ch] [bp-74h]@1 - unsigned int v15; // [sp+7Ch] [bp-4h]@1 - signed int v16; // [sp+88h] [bp+8h]@14 - signed int v17; // [sp+88h] [bp+8h]@19 - v15 = uActorID; - v4 = a2; - v5 = &pActors[uActorID]; + actPtr = &pActors[uActorID]; SpriteObject a1; // [sp+Ch] [bp-74h]@1 - //SpriteObject::SpriteObject(&a1); - result = a3 - 1; - switch ( a3 ) + switch ( type ) { case 1: a1.uType = 545; - goto LABEL_14; + break; case 2: a1.uType = 550; - goto LABEL_14; + break; case 3: a1.uType = 510; - goto LABEL_14; + break; case 4: a1.uType = 500; - goto LABEL_14; + break; case 5: a1.uType = 515; - goto LABEL_14; + break; case 6: a1.uType = 505; - goto LABEL_14; + break; case 7: a1.uType = 530; - goto LABEL_14; + break; case 8: a1.uType = 525; - goto LABEL_14; + break; case 9: a1.uType = 520; - goto LABEL_14; + break; case 10: a1.uType = 535; - goto LABEL_14; + break; case 11: a1.uType = 540; - goto LABEL_14; + break; case 13: a1.uType = 555; -LABEL_14: - v16 = 0; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - goto LABEL_18; - v7 = (char *)&pObjectList->pObjects->uObjectID; break; default: - return result; - } - while ( (short)a1.uType != *(short *)v7 ) - { - ++v16; - v7 += 56; - if ( v16 >= (signed int)pObjectList->uNumObjects ) - { -LABEL_18: - v8 = 0; - goto LABEL_19; - } + return; } - v8 = v16; -LABEL_19: - a1.uObjectDescID = v8; + a1.uObjectDescID = GetObjDescId(a1.uType); a1.stru_24.Reset(); - a1.vPosition.x = v5->vPosition.x; + a1.vPosition.x = actPtr->vPosition.x; a1.spell_id = 0; - a1.vPosition.y = v5->vPosition.y; + a1.vPosition.y = actPtr->vPosition.y; a1.spell_level = 0; - v17 = v5->uActorHeight; a1.spell_skill = 0; - v9 = LOWORD(v4->uYawAngle); - a1.vPosition.z = v5->vPosition.z - (unsigned int)(signed __int64)((double)v17 * -0.75); - a1.uFacing = v9; + a1.vPosition.z = actPtr->vPosition.z - (unsigned int)(actPtr->uActorHeight * -0.75); + a1.uFacing = pDir->uYawAngle; a1.uSoundID = 0; a1.uAttributes = 0; - v10 = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); - v11 = v4->uDistance; - a1.uSectorID = v10; + a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Actor, v15); + a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); a1.spell_target_pid = 0; - if ( (double)v11 >= 307.2 ) + if (pDir->uDistance < 307.2 ) + a1.field_60_distance_related_prolly_lod = 0; + else if ( pDir->uDistance < 1024 ) + a1.field_60_distance_related_prolly_lod = 1; + else if ( pDir->uDistance < 2560 ) + a1.field_60_distance_related_prolly_lod = 2; + else + a1.field_60_distance_related_prolly_lod = 3; + + a1.field_61 = a4; + a1.Create( + pDir->uYawAngle, + pDir->uPitchAngle, + pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, + 0); + if ( actPtr->pMonsterInfo.uSpecialAbilityType == 1 ) { - if ( v11 >= 1024 ) + specAb = actPtr->pMonsterInfo.uSpecialAbilityDamageDiceBonus; + if ( specAb == 2 ) { - a1.field_60_distance_related_prolly_lod = 2; - if ( v11 >= 2560 ) - a1.field_60_distance_related_prolly_lod = 3; + a1.vPosition.z += 40; + v13 = pDir->uYawAngle; } else { - a1.field_60_distance_related_prolly_lod = 1; - } - } - else - { - a1.field_60_distance_related_prolly_lod = 0; - } - a1.field_61 = a4; - result = a1.Create( - v4->uYawAngle, - v4->uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0); - if ( v5->pMonsterInfo.uSpecialAbilityType == 1 ) - { - result = v5->pMonsterInfo.uSpecialAbilityDamageDiceBonus; - if ( result == 2 ) - { - a1.vPosition.z += 40; - v13 = v4->uYawAngle; - } - else - { - if ( result != 3 ) - return result; + if ( specAb != 3 ) + return; a1.Create( - v4->uYawAngle + 30, - v4->uPitchAngle, + pDir->uYawAngle + 30, //TODO find out why the YawAngle change + pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); - v13 = v4->uYawAngle - 30; + v13 = pDir->uYawAngle - 30; } - result = a1.Create( + a1.Create( v13, - v4->uPitchAngle, + pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); } - return result; + return; } //----- (00404736) --------------------------------------------------------
--- a/Actor.h Mon Oct 14 06:32:30 2013 +0200 +++ b/Actor.h Mon Oct 14 07:32:04 2013 +0200 @@ -229,7 +229,7 @@ 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 AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); + static void AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); static void AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel); static unsigned short GetObjDescId( int spellId );