Mercurial > mm7
comparison Actor.cpp @ 2235:6ab7d7c112bb
adding int_get_vector_length calls where the calls were inlined
author | Grumpy7 |
---|---|
date | Sun, 23 Feb 2014 03:07:46 +0100 |
parents | b65e71eadd1b |
children | 47bcb700b74b aff7a7b072b7 |
comparison
equal
deleted
inserted
replaced
2234:fd0b2a697416 | 2235:6ab7d7c112bb |
---|---|
3601 else | 3601 else |
3602 { | 3602 { |
3603 v61 = projectileSprite->field_60_distance_related_prolly_lod; | 3603 v61 = projectileSprite->field_60_distance_related_prolly_lod; |
3604 if ( projectileSprite->spell_id != SPELL_DARK_SOULDRINKER ) | 3604 if ( projectileSprite->spell_id != SPELL_DARK_SOULDRINKER ) |
3605 { | 3605 { |
3606 std::array<int, 3> distances; | 3606 int d1 = abs(pParty->vPosition.x - projectileSprite->vPosition.x); |
3607 distances[0] = abs(pParty->vPosition.x - projectileSprite->vPosition.x); | 3607 int d2 = abs(pParty->vPosition.y - projectileSprite->vPosition.y); |
3608 distances[1] = abs(pParty->vPosition.y - projectileSprite->vPosition.y); | 3608 int d3 = abs(pParty->vPosition.z - projectileSprite->vPosition.z); |
3609 distances[2] = abs(pParty->vPosition.z - projectileSprite->vPosition.z); | 3609 v61 = int_get_vector_length(d1, d2, d3); |
3610 std::sort(distances.begin(), distances.end()); | |
3611 v61 = ((unsigned int)(11 * distances[1]) >> 5) + (distances[0] >> 2) + distances[2]; | |
3612 | 3610 |
3613 if ( v61 >= 5120 && !(pMonster->uAttributes & 0x400) ) | 3611 if ( v61 >= 5120 && !(pMonster->uAttributes & 0x400) ) |
3614 return; | 3612 return; |
3615 else if ( v61 >= 2560 ) | 3613 else if ( v61 >= 2560 ) |
3616 v61 = 2; | 3614 v61 = 2; |
4005 for ( uint i = 0; i < (signed int)uNumActors; ++i ) | 4003 for ( uint i = 0; i < (signed int)uNumActors; ++i ) |
4006 { | 4004 { |
4007 for_x = abs(pActors[i].vInitialPosition.x - pParty->vPosition.x); | 4005 for_x = abs(pActors[i].vInitialPosition.x - pParty->vPosition.x); |
4008 for_y = abs(pActors[i].vInitialPosition.y - pParty->vPosition.y); | 4006 for_y = abs(pActors[i].vInitialPosition.y - pParty->vPosition.y); |
4009 for_z = abs(pActors[i].vInitialPosition.z - pParty->vPosition.z); | 4007 for_z = abs(pActors[i].vInitialPosition.z - pParty->vPosition.z); |
4010 v3 = for_x; | 4008 if ( int_get_vector_length(for_x, for_y, for_z) < distance ) |
4011 v4 = for_y; | |
4012 v5 = for_z; | |
4013 if ( v3 < for_y ) | |
4014 { | |
4015 v6 = v3; | |
4016 v3 = for_y; | |
4017 v4 = v6; | |
4018 } | |
4019 if ( v3 < for_z ) | |
4020 { | |
4021 v7 = v3; | |
4022 v3 = for_z; | |
4023 v5 = v7; | |
4024 } | |
4025 if ( v4 < (signed int)v5 ) | |
4026 { | |
4027 v8 = v5; | |
4028 v5 = v4; | |
4029 v4 = v8; | |
4030 } | |
4031 if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < distance ) | |
4032 { | 4009 { |
4033 if ( pActors[i].uAIState != Dead ) | 4010 if ( pActors[i].uAIState != Dead ) |
4034 { | 4011 { |
4035 if ( pActors[i].uAIState != Dying && pActors[i].uAIState != Removed | 4012 if ( pActors[i].uAIState != Dying && pActors[i].uAIState != Removed |
4036 && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned | 4013 && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned |