# HG changeset patch # User Grumpy7 # Date 1382253157 25200 # Node ID ecab40f41fe884979221e3f2454c48dd967f7ed9 # Parent eafc12a77a92f76df97faf7dbaeec6ccccc3e80b Actor::GetActorsRelation cleanup 2 diff -r eafc12a77a92 -r ecab40f41fe8 Actor.cpp --- a/Actor.cpp Sat Oct 19 23:08:02 2013 -0700 +++ b/Actor.cpp Sun Oct 20 00:12:37 2013 -0700 @@ -2500,8 +2500,6 @@ //----- (0040104C) -------------------------------------------------------- signed int Actor::GetActorsRelation(Actor *otherActPtr) { - int v3; // ebp@5 - int v4; // edi@11 unsigned int v5; // edx@15 unsigned int v6; // eax@16 unsigned int v7; // ebp@19 @@ -2521,105 +2519,62 @@ { if (this->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) return 4; - v3 = this->pMonsterInfo.uID; + v9 = this->uAlly; + if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || v9 == 9999) + v7 = 0; + else if ( v9 > 0 ) + { + v7 = v9; + } + else + { + v7 = (this->pMonsterInfo.uID - 1) / 3 + 1; + } } else { - v3 = 0; + v7 = 0; } if ( otherActPtr ) { if (otherActPtr->pActorBuffs[ACTOR_BUFF_BERSERK].uExpireTime > 0) return 4; - v4 = otherActPtr->pMonsterInfo.uID; + v10 = otherActPtr->uAlly; + if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || v10 == 9999) + v8 = 0; + else if ( v10 > 0 ) + { + v8 = v10; + } + else + { + v8 = (otherActPtr->pMonsterInfo.uID - 1) / 3 + 1; + } } else { - v4 = 0; + v8 = 0; } - if ( v3 ) - v7 = (v3 - 1) / 3 + 1; - else - v7 = 0; - if ( v4 ) - v8 = (v4 - 1) / 3 + 1; - else - v8 = 0; - if ( this ) - { - if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 ) - v7 = 0; - else - { - v9 = this->uAlly; - if ( v9 > 0 ) - { - if ( v9 != 9999 ) - { - v7 = this->uAlly; - } - else - v7 = 0; - } - } - } - if ( otherActPtr ) - { - if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 ) - v8 = 0; - else - { - v10 = otherActPtr->uAlly; - if ( (signed int)v10 > 0 ) - { - if ( v10 != 9999 ) - { - v8 = otherActPtr->uAlly; - } - else - { - v8 = 0; - } - } - } - } - if ( this && this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !v8 + + if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !v8 || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !v7 ) return 0; - if ( this && this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->uAttributes & 0x80000 && !v8 ) + if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->uAttributes & 0x80000 && !v8 ) return 4; - if ( otherActPtr && this && this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && otherActPtr->uAttributes & 0x80000 ) + if (v7 >= 89 || v8 >= 89) + return 0; + + if ( v7 == 0 ) { - if ( v7 ) - { - if ( (signed int)v7 < 89 ) - { - if ( v8 < 89 ) - return pFactionTable->relations[v7][v8]; - return 0; - } - return 0; - } - return 4; + if ( (!otherActPtr || this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 && !(otherActPtr->uAttributes & 0x80000)) && !pFactionTable->relations[v8][0]) + return pFactionTable->relations[0][v8]; + else + return 4; } - if ( !v7 ) + else { - if ( (!otherActPtr || otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || !(otherActPtr->uAttributes & 0x80000)) - && !pFactionTable->relations[v8][0]) - { - if ( v8 < 89 ) - return pFactionTable->relations[v7][v8]; - return 0; - } - return 4; + return pFactionTable->relations[v7][v8]; } - if ( v7 < 89 ) - { - if ( v8 < 89 ) - return pFactionTable->relations[v7][v8]; - return 0; - } - return 0; } //----- (0045976D) --------------------------------------------------------