Mercurial > mm7
changeset 2494:de8c5c223e9c
for ACTOR_
author | Ritor1 |
---|---|
date | Tue, 16 Sep 2014 17:48:58 +0600 |
parents | bd4ada7615ce |
children | 7b076fe64f23 |
files | Actor.cpp Actor.h CastSpellInfo.cpp Indoor.cpp Monsters.cpp Outdoor.cpp Party.cpp Player.cpp SpriteObject.cpp TurnEngine.cpp UI/UiGame.cpp Viewport.cpp |
diffstat | 12 files changed, 136 insertions(+), 128 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Actor.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -215,7 +215,7 @@ if ( this->pMonsterInfo.uTreasureLevel ) pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->ActorHasItems[2]); } - this->uAttributes |= 0x800000; + this->uAttributes |= ACTOR_HAS_ITEM; } //----- (00404AC7) -------------------------------------------------------- @@ -730,7 +730,7 @@ int y = 0; y |= 0x80000; Actor* victim = &pActors[uActorID]; if ( a2 == 1 ) - victim->uAttributes |= 0x80000; + victim->uAttributes |= ACTOR_AGGRESSOR; for (uint i = 0; i < uNumActors; ++i) { @@ -747,7 +747,7 @@ { actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; if ( a2 == 1 ) - actor->uAttributes |= 0x80000; + actor->uAttributes |= ACTOR_AGGRESSOR; } } @@ -1393,15 +1393,15 @@ //----- (00438B9B) -------------------------------------------------------- bool Actor::IsPeasant() { - unsigned int v1; // eax@1 - - v1 = this->uAlly; - if ( !v1 ) - v1 = (this->pMonsterInfo.uID - 1) / 3 + 1; - return (signed int)v1 >= 39 && (signed int)v1 <= 44 - || (signed int)v1 >= 45 && (signed int)v1 <= 50 - || (signed int)v1 >= 51 && (signed int)v1 <= 62 - || (signed int)v1 >= 78 && (signed int)v1 <= 83; + unsigned int InHostile_Id; // eax@1 + + InHostile_Id = this->uAlly; + if ( !this->uAlly ) + InHostile_Id = (this->pMonsterInfo.uID - 1) / 3 + 1; + return (signed int)InHostile_Id >= 39 && (signed int)InHostile_Id <= 44//Dwarfs peasants + || (signed int)InHostile_Id >= 45 && (signed int)InHostile_Id <= 50//Elves peasants + || (signed int)InHostile_Id >= 51 && (signed int)InHostile_Id <= 62//Humans peasants + || (signed int)InHostile_Id >= 78 && (signed int)InHostile_Id <= 83;//Goblins peasants } //----- (0042EBEE) -------------------------------------------------------- @@ -1768,7 +1768,7 @@ Actor::AI_StandOrBored(uActor_id, OBJECT_Player, uActionLength, &doNotInitializeBecauseShouldBeRandom); return; } - if ( pActors[uActor_id].pMonsterInfo.uMovementType == 3 && absx < 128 ) + if ( pActors[uActor_id].pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_GLOBAL && absx < 128 ) { Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom); return; @@ -1781,7 +1781,7 @@ return; } v10 = v9 + rand() % 256 - 128; - if ( abs(v10 - pActors[uActor_id].uYawAngle) > 256 && !(pActors[uActor_id].uAttributes & 0x200000) ) + if ( abs(v10 - pActors[uActor_id].uYawAngle) > 256 && !(pActors[uActor_id].uAttributes & ACTOR_ANIMATION) ) { Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom); return; @@ -1864,10 +1864,10 @@ AIDirection a3; // [sp+Ch] [bp-40h]@16 if ( pActors[uActorID].uAIState == Fleeing ) - pActors[uActorID].uAttributes |= 0x20000; + pActors[uActorID].uAttributes |= ACTOR_FLEEING; if ( pActors[uActorID].pMonsterInfo.uHostilityType != 4 ) { - pActors[uActorID].uAttributes &= 0xFFFFFFFB; + pActors[uActorID].uAttributes &= 0xFFFFFFFB;//~0x4 pActors[uActorID].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) @@ -2355,7 +2355,7 @@ if (can_target_party && !pParty->Invisible()) { - if ( thisActor->uAttributes & 0x80000 + if ( thisActor->ActorEnemy() && thisActor->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && thisActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime <= 0 && thisActor->pActorBuffs[ACTOR_BUFF_SUMMONED].uExpireTime <= 0 ) @@ -2423,14 +2423,14 @@ if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !otherGroup || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !thisGroup ) return 0; - if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->uAttributes & 0x80000 && !otherGroup ) + if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime <= 0 && this->ActorEnemy() && !otherGroup ) return 4; if (thisGroup >= 89 || otherGroup >= 89) return 0; if ( thisGroup == 0 ) { - if ( (!otherActPtr || this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 && !(otherActPtr->uAttributes & 0x80000)) && !pFactionTable->relations[otherGroup][0]) + if ( (!otherActPtr || this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 && otherActPtr->ActorFriend()) && !pFactionTable->relations[otherGroup][0]) return pFactionTable->relations[0][otherGroup]; else return 4; @@ -2442,12 +2442,7 @@ //----- (0045976D) -------------------------------------------------------- void Actor::UpdateAnimation() { - //AIState state; // edx@1 - //unsigned int result; // eax@1 - - //state = (AIState)this->; - uAttributes &= 0xFFDFFFFF; - //result = this->uAttributes; + ResetAnimation(); switch (uAIState) { case Tethered: @@ -2456,7 +2451,7 @@ case AttackingMelee: uCurrentActionAnimation = ANIM_AtkMelee; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case AttackingRanged1: @@ -2464,36 +2459,36 @@ case AttackingRanged3: case AttackingRanged4: uCurrentActionAnimation = ANIM_AtkRanged; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Dying: case Resurrected: uCurrentActionAnimation = ANIM_Dying; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Pursuing: case Fleeing: uCurrentActionAnimation = ANIM_Walking; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Stunned: uCurrentActionAnimation = ANIM_GotHit; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Fidgeting: uCurrentActionAnimation = ANIM_Bored; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Standing: case Interacting: case Summoned: uCurrentActionAnimation = ANIM_Standing; - uAttributes |= 0x200000; + uAttributes |= ACTOR_ANIMATION; break; case Dead: @@ -2607,7 +2602,7 @@ { pActors[actor_id].uLastCharacterIDToHit = attacker_id; if ( pActors[actor_id].uAIState == Fleeing ) - pActors[actor_id].uAttributes |= 0x20000; + pActors[actor_id].uAttributes |= ACTOR_FLEEING; if ( pActors[PID_ID(attacker_id)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) ) { dmgToRecv = pActors[PID_ID(attacker_id)]._43B3E0_CalcDamage(a4); @@ -2762,8 +2757,8 @@ ++uNumActors; ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus; - if ( this->uAttributes & 0x80000 ) - actor->uAttributes |= 0x80000; + if ( ActorEnemy()) + actor->uAttributes |= ACTOR_AGGRESSOR; actor->uSummonerID = PID(OBJECT_Actor,summonerId); } @@ -3039,8 +3034,8 @@ pActor->pMonsterInfo.uRecoveryTime = v28 - v27; if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) pActor->pMonsterInfo.uRecoveryTime = 0; - if ( !(pActor->uAttributes & 0x8000) ) - pActor->uAttributes |= 0x8000; + if ( !pActor->ActorNearby() ) + pActor->uAttributes |= ACTOR_NEARBY; a1 = PID(OBJECT_Actor,actor_id); Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); @@ -3152,7 +3147,7 @@ if ( v81 < 0 ) v81 = 0; rand(); - pActor->uAttributes &= 0xFFFBFFFF; + pActor->uAttributes &= 0xFFFBFFFF;//~0x40000 - ACTOR_UNKNOW5 if ( v81 < 5120 ) { v45 = pActor->special_ability_use_check(actor_id); @@ -3341,7 +3336,7 @@ //v4 = GetAlertStatus(); *pTotalActors = 0; result = 0; - if ( (pActors[a2].uAttributes & 0x100000) == GetAlertStatus() ) + if ( (pActors[a2].uAttributes & ACTOR_UNKNOW7) == GetAlertStatus() ) { *pTotalActors = 1; if ( pActors[a2].IsNotAlive() == 1 ) @@ -3359,7 +3354,7 @@ result = 0; for ( uint i = 0; i < uNumActors; i++) { - if ( (pActors[i].uAttributes & 0x100000) == v8 && pActors[i].uGroup == uGroup) + if ( (pActors[i].uAttributes & ACTOR_UNKNOW7) == v8 && pActors[i].uGroup == uGroup) { ++*pTotalActors; if ( pActors[i].IsNotAlive() == 1 ) @@ -3379,7 +3374,7 @@ result = 0; for ( uint i = 0; i < uNumActors; i++) { - if ( (pActors[i].uAttributes & 0x100000) == v8 && pActors[i].pMonsterInfo.field_33 == uMonsterID) + if ( (pActors[i].uAttributes & ACTOR_UNKNOW7) == v8 && pActors[i].pMonsterInfo.field_33 == uMonsterID) { ++*pTotalActors; if ( pActors[i].IsNotAlive() == 1 ) @@ -3399,7 +3394,7 @@ *pTotalActors = 0; for ( uint i = 0; i < uNumActors; i++) { - if ( (pActors[i].uAttributes & 0x100000) == v2 ) + if ( (pActors[i].uAttributes & ACTOR_UNKNOW7) == v2 ) { ++*pTotalActors; if ( pActors[i].IsNotAlive() == 1 ) @@ -3451,10 +3446,10 @@ if (!bCelestia || good) if (!bPit || evil) if (actor->IsPeasant()) - actor->uAttributes &= 0xF70000; - - actor->uAttributes &= 0x7F0000; - if (actor->uAttributes & 0x400000) + actor->ResetAggressor();//~0x80000 + + actor->ResetHasItem();//~0x800000 + if (actor->uAttributes & ACTOR_UNKNOW9) Actor::_4031C1_update_job_never_gets_called(i, pParty->uCurrentHour, 1); } } @@ -3502,7 +3497,7 @@ pMonster->uAttributes |= 0xC000; if ( pMonster->uAIState == Fleeing ) - pMonster->uAttributes |= 0x20000; + pMonster->uAttributes |= ACTOR_FLEEING; bool hit_will_stun = false, hit_will_paralyze = false; if ( !projectileSprite ) @@ -3555,7 +3550,7 @@ int d3 = abs(pParty->vPosition.z - projectileSprite->vPosition.z); v61 = int_get_vector_length(d1, d2, d3); - if ( v61 >= 5120 && !(pMonster->uAttributes & 0x400) ) + if ( v61 >= 5120 && !(pMonster->uAttributes & ACTOR_ALIVE) )//0x400 return; else if ( v61 >= 2560 ) v61 = 2; @@ -4120,7 +4115,7 @@ { if ( pActors[i].uAIState != Dying && pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned - && (pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) ) ) + && (pActors[i].ActorEnemy() || pActors[i].GetActorsRelation(0) ) ) return true; } } @@ -4146,7 +4141,7 @@ v2 = 0; itemFound = false; v14 = 0; - if ( !( this->uAttributes & 0x800000 ) ) + if ( !ActorHasItem() ) { for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ ) v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; @@ -4211,17 +4206,17 @@ this->Remove(); return; } - if ( ( this->uAttributes & 0x800000 ) ) + if ( this->ActorHasItem() ) { if ( this->ActorHasItems[3].uItemID ) { memcpy(&Dst, &this->ActorHasItems[3], sizeof(Dst)); this->ActorHasItems[3].Reset(); - v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; + //v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; if ( v14 ) - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, pItemsTable->pItems[Dst.uItemID].pUnidentifiedName); else - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[Dst.uItemID].pUnidentifiedName); ShowStatusBarString(pTmpBuf2.data(), 2); if ( !pParty->AddItemToParty(&Dst) ) pParty->SetHoldingItem(&Dst); @@ -4232,15 +4227,15 @@ { if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance && (v7 = this->pMonsterInfo.uTreasureLevel) != 0 ) { - pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst); - v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; - if ( v14 ) - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)! - else - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]! - ShowStatusBarString(pTmpBuf2.data(), 2); - if ( !pParty->AddItemToParty(&Dst) ) - pParty->SetHoldingItem(&Dst); + pItemsTable->GenerateItem(v7, this->pMonsterInfo.uTreasureType, &Dst); + v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; + if ( v14 ) + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)! + else + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]! + ShowStatusBarString(pTmpBuf2.data(), 2); + if ( !pParty->AddItemToParty(&Dst) ) + pParty->SetHoldingItem(&Dst); itemFound = true; } } @@ -4598,17 +4593,17 @@ int v21; // [sp+Ch] [bp-14h]@4 int v22; // [sp+10h] [bp-10h]@4 - pParty->uFlags &= 0xFFFFFFCF; + pParty->uFlags &= 0xFFFFFFCF;//~0x30 ai_arrays_size = 0; for (uint i = 0; i < uNumActors; ++i) { Actor* actor = &pActors[i]; - actor->uAttributes &= 0xFFFFFBFF; + actor->ResetAlive();//~0x400 if (!actor->CanAct()) { - actor->uAttributes &= 0xFFFFBFFF; + actor->ResetActive(); continue; } @@ -4622,23 +4617,22 @@ if (distance < 5632) { - v10 = actor->uAttributes & 0xFEFFFFFF; - actor->uAttributes = v10; - if ( v10 & 0x80000 || actor->GetActorsRelation(0) ) + actor->ResetHostile(); + if ( actor->ActorEnemy() || actor->GetActorsRelation(0) ) { //v11 = (pParty->uFlags & 0x10) == 0; - actor->uAttributes = v10 | ACTOR_HOSTILE; + actor->uAttributes |= ACTOR_HOSTILE; if (distance < 5120 ) pParty->SetYellowAlert(); if (distance < 307) pParty->SetRedAlert(); } - actor->uAttributes |= 0x4000; + actor->uAttributes |= ACTOR_ACTIVE; ai_near_actors_distances[ai_arrays_size] = distance; ai_near_actors_ids[ai_arrays_size++] = i; } else - actor->uAttributes &= 0xFFFFBFFF; + actor->ResetActive(); } /* @@ -4694,7 +4688,7 @@ ai_arrays_size = 30; for (uint i = 0; i < ai_arrays_size; ++i) - pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; + pActors[ai_near_actors_ids[i]].uAttributes |= ACTOR_ALIVE;//0x400 } //----- (004016FA) -------------------------------------------------------- @@ -4717,15 +4711,15 @@ uint v45; // [sp+20h] [bp-4h]@1 // __debugbreak(); // refactor for blv ai - pParty->uFlags &= 0xFFFFFFCF; + pParty->uFlags &= 0xFFFFFFCF;//~0x30 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v45 = 0; for ( uint i = 0; i < (signed int)uNumActors; ++i ) { - pActors[i].uAttributes &= 0xFB00; + pActors[i].ResetAlive();//~0x0400 if ( !pActors[i].CanAct() ) { - pActors[i].uAttributes &= 0xBF00; + pActors[i].ResetActive(); continue; } v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x); @@ -4737,8 +4731,8 @@ distance = 0; if ( distance < 10240 ) { - pActors[i].uAttributes &= 0xFEFFFFFF; - if ( pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) ) + pActors[i].ResetHostile();//~0x01000000 + if ( pActors[i].ActorEnemy() || pActors[i].GetActorsRelation(0) ) { pActors[i].uAttributes |= ACTOR_HOSTILE; if ( !(pParty->uFlags & 0x10) && (double)distance < 307.2 ) @@ -4751,7 +4745,7 @@ v45++; } else - pActors[i].uAttributes &= 0xBF00; + pActors[i].ResetActive(); } v13 = 0; if ( v45 > 0 ) @@ -4777,10 +4771,10 @@ v19 = 0; for ( i = 0; i < v45; i++ ) { - if ( pActors[ai_near_actors_ids[i]].uAttributes & 0x8000 + if ( pActors[ai_near_actors_ids[i]].ActorNearby() || sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[i]), 4) ) { - pActors[ai_near_actors_ids[i]].uAttributes |= 0x8000; + pActors[ai_near_actors_ids[i]].uAttributes |= ACTOR_NEARBY; ai_array_4F6638_actor_ids[v19] = ai_near_actors_ids[i]; ai_array_4F5E68[v19++] = ai_near_actors_distances[i]; if ( v19 >= 30 ) @@ -4797,7 +4791,7 @@ v25 = 0; if ( v19 <= 0 ) { - pActors[i].uAttributes |= 0x4000; + pActors[i].uAttributes |= ACTOR_ACTIVE; ai_array_4F6638_actor_ids[ai_arrays_size++] = i; } else @@ -4807,7 +4801,7 @@ ++v25; if ( v25 >= v19 ) { - pActors[i].uAttributes |= 0x4000; + pActors[i].uAttributes |= ACTOR_ACTIVE; ai_array_4F6638_actor_ids[ai_arrays_size++] = i; break; } @@ -4842,7 +4836,7 @@ memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * ai_arrays_size); memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); for ( uint i = 0; i < ai_arrays_size; i++ ) - pActors[ai_near_actors_ids[i]].uAttributes |= 0x400; + pActors[ai_near_actors_ids[i]].uAttributes |= ACTOR_ALIVE;//0x400 return ai_arrays_size; }
--- a/Actor.h Mon Sep 15 17:30:29 2014 +0600 +++ b/Actor.h Tue Sep 16 17:48:58 2014 +0600 @@ -121,17 +121,19 @@ }; #pragma pack(pop) -#define ACTOR_UNKNOW 0x80 -#define ACTOR_UNKNOW1 0x400 -#define ACTOR_UNKNOW2 0x4000 -#define ACTOR_UNKNOW3 0x8000 -#define ACTOR_UNKNOW4 0x20000 +#define ACTOR_UNKNOW2 0x8 +#define ACTOR_STAND_IN_QUEUE 0x80 +#define ACTOR_ALIVE 0x400 +#define ACTOR_ACTIVE 0x4000 +#define ACTOR_NEARBY 0x8000 +#define ACTOR_UNKNOW11 0x10000 +#define ACTOR_FLEEING 0x20000 #define ACTOR_UNKNOW5 0x40000 -#define ACTOR_UNKNOW6 0x80000 +#define ACTOR_AGGRESSOR 0x80000 #define ACTOR_UNKNOW7 0x100000 -#define ACTOR_UNKNOW8 0x200000 +#define ACTOR_ANIMATION 0x200000 #define ACTOR_UNKNOW9 0x400000 -#define ACTOR_UNKNOW10 0x800000 +#define ACTOR_HAS_ITEM 0x800000 #define ACTOR_HOSTILE 0x1000000 #pragma pack(push, 1) @@ -202,6 +204,17 @@ bool IsNotAlive(); bool IsPeasant(); + inline void ResetAnimation(){uAttributes &= 0xFFDFFFFF;} + inline void ResetQueue(){uAttributes &= ~ACTOR_STAND_IN_QUEUE;} + inline void ResetActive(){uAttributes &= 0xFFFFBFFF;} + inline void ResetAlive(){uAttributes &= 0xFFFFFBFF;} + inline void ResetHasItem(){uAttributes &= 0xFF7FFFFF;} + inline void ResetHostile(){uAttributes &= 0xFEFFFFFF;} + inline void ResetAggressor(){uAttributes &= 0xFFF7FFFF;} + inline bool ActorEnemy()const {return(uAttributes & ACTOR_AGGRESSOR) != 0;} + inline bool ActorFriend()const {return(uAttributes & ACTOR_AGGRESSOR) == 0;} + inline bool ActorHasItem()const {return(uAttributes & ACTOR_HAS_ITEM) != 0;} + inline bool ActorNearby()const {return(uAttributes & ACTOR_NEARBY) != 0;} static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party); static void AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4);
--- a/CastSpellInfo.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/CastSpellInfo.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -629,7 +629,7 @@ { Actor::AI_Stand(PID_ID(a2), 4, 0x80, 0); pActors[mon_id].pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, 0, 0, 0); - pActors[mon_id].uAttributes |= 0x80000; + pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR; pActors[mon_id].vVelocity.x = 0; pActors[mon_id].vVelocity.y = 0; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); @@ -655,7 +655,7 @@ if (PID_TYPE(a2) == OBJECT_Actor && pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)3) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0); - pActors[mon_id].uAttributes |= 0x80000; + pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); } spell_sound_flag = true; @@ -1870,7 +1870,7 @@ { mon_id = PID_ID(pCastSpell->spell_target_pid); pActors[mon_id].pActorBuffs[ACTOR_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0); - pActors[mon_id].uAttributes |= 0x80000; + pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); } spell_sound_flag = true; @@ -2145,7 +2145,7 @@ if (PID_TYPE(a2) == OBJECT_Actor) { mon_id = PID_ID(a2); - if ( !(pActors[mon_id].uAttributes & 0x800000) ) + if ( !pActors[mon_id].ActorHasItem() ) pActors[mon_id].SetRandomGoldIfTheresNoItem(); int gold_num = 0; if ( pItemsTable->pItems[pActors[mon_id].ActorHasItems[3].uItemID].uEquipType == EQUIP_GOLD ) @@ -2892,7 +2892,7 @@ pActors[mon_id].pMonsterInfo.uTreasureLevel = 0; pActors[mon_id].pMonsterInfo.uTreasureType = 0; pActors[mon_id].uAlly = 9999; - pActors[mon_id].uAttributes &= 0xF70000; + pActors[mon_id].ResetAggressor();//~0x80000 pActors[mon_id].uGroup = 0; pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
--- a/Indoor.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Indoor.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -2385,7 +2385,7 @@ BLVDoor* door = &pIndoor->pDoors[i]; if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) { - door->uAttributes &= 0xFFFFFFFDu; + door->uAttributes &= 0xFFFFFFFDu;//~0x2 continue; } door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; @@ -3108,12 +3108,12 @@ v38 = 0; for (uint i = 0; i < uNumActors; ++i) { - if (pActors[i].uAttributes & 0x100000) + if (pActors[i].uAttributes & ACTOR_UNKNOW7) { if ( !map_id ) { pActors[i].pMonsterInfo.field_3E = 19; - pActors[i].uAttributes |= 0x10000; + pActors[i].uAttributes |= ACTOR_UNKNOW11; continue; } v28 = v38 == 0; @@ -3134,7 +3134,7 @@ else { pActors[i].pMonsterInfo.field_3E = 19; - pActors[i].uAttributes |= 0x10000; + pActors[i].uAttributes |= ACTOR_UNKNOW11; } } @@ -3459,7 +3459,7 @@ break; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - pActors[i].uAttributes |= 8; + pActors[i].uAttributes |= ACTOR_UNKNOW2; pBillboardRenderList[uNumBillboardsToDraw - 1].HwSpriteID = v9->pHwSpriteIDs[v6]; pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v9->uPaletteIndex; pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = pActors[i].uSectorID; @@ -4474,7 +4474,7 @@ pActors[v17].LootActor(); else { - if ( !pActors[v17].GetActorsRelation(0) && !(pActors[v17].uAttributes & 0x80000) && pActors[v17].CanAct() ) + if ( !pActors[v17].GetActorsRelation(0) && pActors[v17].ActorFriend() && pActors[v17].CanAct() ) { Actor::AI_FaceObject(v17, 4, 0, 0); if ( pActors[v17].sNPC_ID )
--- a/Monsters.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Monsters.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -827,11 +827,11 @@ if (tolower(test_string[1])!='h') pInfos[curr_rec_num].uMovementType=MONSTER_MOVEMENT_TYPE_STAIONARY; //stationary break; //short - case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long - case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med - case 'g': pInfos[curr_rec_num].uMovementType=3; break; //global? + case 'l': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_LONG; break; //long + case 'm': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_MEDIUM; break; //med + case 'g': pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_GLOBAL; break; //global? default: - pInfos[curr_rec_num].uMovementType=4; //free + pInfos[curr_rec_num].uMovementType = MONSTER_MOVEMENT_TYPE_FREE; //free } } break;
--- a/Outdoor.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Outdoor.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -2446,13 +2446,13 @@ alert_status = 0; for( int i = 0; i < uNumActors; ++i ) { - if ( !(pActors[i].uAttributes & 0x100000) ) + if ( !(pActors[i].uAttributes & ACTOR_UNKNOW7) ) { if ( alert_status != 1 ) { pActors[i].uCurrentActionTime = 0; pActors[i].uCurrentActionLength = 0; - if ( pActors[i].uAttributes & 0x10000 ) + if ( pActors[i].uAttributes & ACTOR_UNKNOW11 ) pActors[i].uAIState = AIState::Disabled; if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) @@ -2597,7 +2597,7 @@ //Actor* actor = &pActors[i]; //v2 = actor->uAIState; - pActors[i].uAttributes &= 0xFFFFFFF7u; + pActors[i].uAttributes &= 0xFFFFFFF7;//~0x8 if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) continue; @@ -2653,11 +2653,11 @@ if (v14->uFlags & 2) v62 = 2; if (v14->uFlags & 0x40000) - v62 |= 0x40u; + v62 |= 0x40; if (v14->uFlags & 0x20000) LOBYTE(v62) = v62 | 0x80; if ((256 << v41) & v14->uFlags) - v62 |= 4u; + v62 |= 4; if ( v15->uGlowRadius ) { //LOBYTE(v16) = _4E94D3_light_type; @@ -2703,16 +2703,16 @@ LODWORD(v25) = 0; HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad); v57 = v25 / X; - v27 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16); - v43 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16); - v46 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v25 / X, v45) + 32768) >> 16); + v27 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 0x8000) >> 16); + v43 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 0x8000) >> 16); + v46 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v25 / X, v45) + 0x8000) >> 16); result = uNumBillboardsToDraw; //v28 = &pBillboardRenderList[uNumBillboardsToDraw]; if (uNumBillboardsToDraw >= 500) return; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - pActors[i].uAttributes |= 8; + pActors[i].uAttributes |= ACTOR_UNKNOW2; pBillboardRenderList[uNumBillboardsToDraw - 1].HwSpriteID = v15->pHwSpriteIDs[v41]; pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = 0; pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v15->uPaletteIndex;
--- a/Party.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Party.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -579,7 +579,8 @@ for (unsigned int i = 0; i < uNumActors; i++) { v0 = &pActors[i]; - if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long && v0->pMonsterInfo.uMovementType != 5 ) + if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long + && v0->pMonsterInfo.uMovementType != MONSTER_MOVEMENT_TYPE_STAIONARY ) { v1 = abs(v0->vPosition.x - pParty->vPosition.x); v2 = abs(v0->vPosition.y - pParty->vPosition.y);
--- a/Player.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Player.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -2005,7 +2005,7 @@ { return 0; } - if ( !(actroPtr->uAttributes & 0x800000) ) + if ( !actroPtr->ActorHasItem() ) actroPtr->SetRandomGoldIfTheresNoItem(); unsigned __int16 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING]; v7 = v6 & 0x3F; @@ -2014,7 +2014,7 @@ int v29 = StealingRandomBonuses[rand() % 5]; fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); currMaxItemValue = v29 + v7 * v30; - if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->uAttributes & 0x80000 ) + if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->ActorEnemy() ) { Actor::AggroSurroundingPeasants(uActorID, 1); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName);//"%s was caught stealing!"
--- a/SpriteObject.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/SpriteObject.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -1186,7 +1186,7 @@ if (PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) { if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 - pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= 0x40000; + pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= ACTOR_UNKNOW5; } //v6 = v2->uType; @@ -1746,7 +1746,7 @@ if (v152 >= 3) v150 = 4; } - pActors[v139].uAttributes |= 0x80000; + pActors[v139].uAttributes |= ACTOR_AGGRESSOR; v107 = v135; } if (pSpriteObjects[uLayingItemID].uType == 6040)
--- a/TurnEngine.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/TurnEngine.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -44,12 +44,12 @@ if ( p_type == OBJECT_Actor ) { - pActors[p_id].uAttributes |= 0x80; + pActors[p_id].uAttributes |= ACTOR_STAND_IN_QUEUE;//0x80 if ( !pActors[p_id].CanAct() ) { --active_actors; pQueue[i].actor_initiative = 1001; - pActors[p_id].uAttributes &= ~0x80; + pActors[p_id].ResetQueue(); } } else if ( p_type == OBJECT_Player) @@ -154,9 +154,9 @@ continue; if ( pActors[ai_near_actors_ids[i]].CanAct() ) { - if ( pActors[ai_near_actors_ids[i]].uAttributes & 0x8000 ) + if ( pActors[ai_near_actors_ids[i]].ActorNearby() ) { - pActors[ai_near_actors_ids[i]].uAttributes |= 0x80; + pActors[ai_near_actors_ids[i]].uAttributes |= ACTOR_STAND_IN_QUEUE;//0x80 Actor::GetDirectionInfo(PID(OBJECT_Actor,ai_near_actors_ids[i]), ai_near_actors_targets_pid[ai_near_actors_ids[i]], &v31, 0); memcpy(&v30, &v31, sizeof(AIDirection)); Actor::AI_StandOrBored(ai_near_actors_ids[i], 4, 32, &v30); @@ -232,7 +232,7 @@ for( i = 0; i < uActorQueueSize; ++i) { if ( PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor ) - pActors[PID_ID(pQueue[i].uPackedID)].uAttributes &= ~0x80; + pActors[PID_ID(pQueue[i].uPackedID)].ResetQueue(); } for( uint i = 0; i < uNumSpriteObjects; ++i)
--- a/UI/UiGame.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/UI/UiGame.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -1963,7 +1963,7 @@ for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс) { if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled - && (pActors[i].uAIState == Dead || pActors[i].uAttributes & 0x8000) ) + && (pActors[i].uAIState == Dead || pActors[i].ActorNearby()) ) { pPoint_X = uCenterX + (fixpoint_mul((pActors[i].vPosition.x - pParty->vPosition.x), uZoom)); pPoint_Y = uCenterY - (fixpoint_mul((pActors[i].vPosition.y - pParty->vPosition.y), uZoom));
--- a/Viewport.cpp Mon Sep 15 17:30:29 2014 +0600 +++ b/Viewport.cpp Tue Sep 16 17:48:58 2014 +0600 @@ -407,7 +407,7 @@ } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { - if ( !pActors[mon_id].GetActorsRelation(0) && !(pActors[mon_id].uAttributes & 0x80000) ) + if ( !pActors[mon_id].GetActorsRelation(0) && pActors[mon_id].ActorFriend() ) { if ( HIWORD(v0) >= clickable_distance) {