# HG changeset patch
# User Ritor1
# Date 1410780629 -21600
# Node ID bd4ada7615ce656dbe485afddc68795315499eb9
# Parent 85a12b497698c67e85d6bea18b8e0b8f9b9a13a7# Parent e9adbbce69f9b3f09e5b3eb0b72b100fd5baffae
Слияние
diff -r e9adbbce69f9 -r bd4ada7615ce Actor.cpp
--- a/Actor.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Actor.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -1860,40 +1860,36 @@
//----- (004030AD) --------------------------------------------------------
void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int stunRegardlessOfState)
{
- Actor *v4; // ebx@1
__int16 v7; // ax@16
AIDirection a3; // [sp+Ch] [bp-40h]@16
- AIDirection* v10; // [sp+28h] [bp-24h]@16
-
- v4 = &pActors[uActorID];
- if ( v4->uAIState == Fleeing )
- BYTE2(v4->uAttributes) |= 2u;
- if ( v4->pMonsterInfo.uHostilityType != 4 )
+
+ if ( pActors[uActorID].uAIState == Fleeing )
+ pActors[uActorID].uAttributes |= 0x20000;
+ if ( pActors[uActorID].pMonsterInfo.uHostilityType != 4 )
{
- v4->uAttributes &= 0xFFFFFFFBu;
- v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
+ pActors[uActorID].uAttributes &= 0xFFFFFFFB;
+ pActors[uActorID].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
}
- if ( v4->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
- v4->pActorBuffs[ACTOR_BUFF_CHARM].Reset();
- if ( v4->pActorBuffs[ACTOR_BUFF_AFRAID].uExpireTime > 0 )
- v4->pActorBuffs[ACTOR_BUFF_AFRAID].Reset();
- if ( stunRegardlessOfState
- || (v4->uAIState != Stunned
- && v4->uAIState != AttackingRanged1
- && v4->uAIState != AttackingRanged2
- && v4->uAIState != AttackingRanged3
- && v4->uAIState != AttackingRanged4
- && v4->uAIState != AttackingMelee))
+ if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 )
+ pActors[uActorID].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
+ if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_AFRAID].uExpireTime > 0 )
+ pActors[uActorID].pActorBuffs[ACTOR_BUFF_AFRAID].Reset();
+ if ( stunRegardlessOfState || (pActors[uActorID].uAIState != Stunned
+ && pActors[uActorID].uAIState != AttackingRanged1
+ && pActors[uActorID].uAIState != AttackingRanged2
+ && pActors[uActorID].uAIState != AttackingRanged3
+ && pActors[uActorID].uAIState != AttackingRanged4
+ && pActors[uActorID].uAIState != AttackingMelee))
{
Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), edx0, &a3, 0);
- v10 = &a3;
- v4->uYawAngle = LOWORD(v10->uYawAngle);
- v7 = pSpriteFrameTable->pSpriteSFrames[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength;
- v4->uCurrentActionTime = 0;
- v4->uAIState = Stunned;
- v4->uCurrentActionLength = 8 * v7;
- Actor::PlaySound(uActorID, 2u);
- v4->UpdateAnimation();
+ //v10 = &a3;
+ pActors[uActorID].uYawAngle = LOWORD(a3.uYawAngle);
+ v7 = pSpriteFrameTable->pSpriteSFrames[pActors[uActorID].pSpriteIDs[ANIM_GotHit]].uAnimLength;
+ pActors[uActorID].uCurrentActionTime = 0;
+ pActors[uActorID].uAIState = Stunned;
+ pActors[uActorID].uCurrentActionLength = 8 * v7;
+ Actor::PlaySound(uActorID, 2);
+ pActors[uActorID].UpdateAnimation();
}
}
@@ -2460,7 +2456,7 @@
case AttackingMelee:
uCurrentActionAnimation = ANIM_AtkMelee;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case AttackingRanged1:
@@ -2468,36 +2464,36 @@
case AttackingRanged3:
case AttackingRanged4:
uCurrentActionAnimation = ANIM_AtkRanged;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Dying:
case Resurrected:
uCurrentActionAnimation = ANIM_Dying;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Pursuing:
case Fleeing:
uCurrentActionAnimation = ANIM_Walking;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Stunned:
uCurrentActionAnimation = ANIM_GotHit;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Fidgeting:
uCurrentActionAnimation = ANIM_Bored;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Standing:
case Interacting:
case Summoned:
uCurrentActionAnimation = ANIM_Standing;
- uAttributes |= 0x200000u;
+ uAttributes |= 0x200000;
break;
case Dead:
@@ -2676,9 +2672,9 @@
int summonMonsterBaseType; // esi@1
int v5; // edx@2
int v7; // edi@10
- Actor *v8; // esi@10
+ Actor *actor; // esi@10
MonsterInfo *v9; // ebx@10
- MonsterDesc *v10; // edi@10
+ //MonsterDesc *v10; // edi@10
int v13; // ebx@10
int v15; // edi@10
int v17; // ebx@10
@@ -2694,7 +2690,7 @@
actorSector = pIndoor->GetSector(this->vPosition.x, this->vPosition.y, this->vPosition.z);
v19 = this->uAlly;
- if ( !v19 )
+ if ( !this->uAlly )
{
monsterId = this->pMonsterInfo.uID - 1;
v19 = (uint)(monsterId * 0.33333334);
@@ -2704,7 +2700,7 @@
v15 = fixpoint_mul(stru_5C6E00->Cos(v13), v27) + this->vPosition.x;
v17 = fixpoint_mul(stru_5C6E00->Sin(v13), v27) + this->vPosition.y;
- if (uCurrentlyLoadedLevelType != LEVEL_Outdoor)
+ if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
{
result = pIndoor->GetSector(v15, v17, this->vPosition.z);
if (result != actorSector)
@@ -2720,7 +2716,7 @@
summonMonsterBaseType = this->pMonsterInfo.field_3C_some_special_attack;
if ( extraSummonLevel )
{
- if ( extraSummonLevel >= 1u && extraSummonLevel <= 3u )
+ if ( extraSummonLevel >= 1 && extraSummonLevel <= 3 )
summonMonsterBaseType = summonMonsterBaseType + extraSummonLevel - 1;
}
else
@@ -2732,42 +2728,43 @@
summonMonsterBaseType += 1;
}
v7 = summonMonsterBaseType - 1;
- v8 = &pActors[uNumActors];
+ actor = &pActors[uNumActors];
v9 = &pMonsterStats->pInfos[v7 + 1];
pActors[uNumActors].Reset();
- v10 = &pMonsterList->pMonsters[v7];
- strcpy(v8->pActorName, v9->pName);
- v8->sCurrentHP = LOWORD(v9->uHP);
- memcpy(&v8->pMonsterInfo, v9, sizeof(v8->pMonsterInfo));
- v8->word_000086_some_monster_id = summonMonsterBaseType;
- v8->uActorRadius = v10->uMonsterRadius;
- v8->uActorHeight = v10->uMonsterHeight;
- v8->pMonsterInfo.uTreasureDiceRolls = 0;
- v8->pMonsterInfo.uTreasureType = 0;
- v8->pMonsterInfo.uExp = 0;
- v8->uMovementSpeed = v10->uMovementSpeed;
- v8->vInitialPosition.z = this->vPosition.z;
- v8->vPosition.z = this->vPosition.z;
- v8->vInitialPosition.x = v15;
- v8->vPosition.x = v15;
- v8->vInitialPosition.y = v17;
- v8->vPosition.y = v17;
- v8->uTetherDistance = 256;
- v8->uSectorID = actorSector;
- v8->PrepareSprites(0);
- v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
- v8->uAlly = v19;
- v8->uCurrentActionTime = 0;
- v8->uGroup = this->uGroup;
- v8->uAIState = Summoned;
- v8->uCurrentActionLength = 256;
- v8->UpdateAnimation();
+ strcpy(actor->pActorName, v9->pName);
+ actor->sCurrentHP = LOWORD(v9->uHP);
+ memcpy(&actor->pMonsterInfo, v9, sizeof(actor->pMonsterInfo));
+ actor->word_000086_some_monster_id = summonMonsterBaseType;
+ actor->uActorRadius = pMonsterList->pMonsters[v7].uMonsterRadius;
+ actor->uActorHeight = pMonsterList->pMonsters[v7].uMonsterHeight;
+ actor->pMonsterInfo.uTreasureDiceRolls = 0;
+ actor->pMonsterInfo.uTreasureType = 0;
+ actor->pMonsterInfo.uExp = 0;
+ actor->uMovementSpeed = pMonsterList->pMonsters[v7].uMovementSpeed;
+
+ actor->vInitialPosition.x = v15;
+ actor->vInitialPosition.y = v17;
+ actor->vInitialPosition.z = this->vPosition.z;
+ actor->vPosition.x = v15;
+ actor->vPosition.y = v17;
+ actor->vPosition.z = this->vPosition.z;
+
+ actor->uTetherDistance = 256;
+ actor->uSectorID = actorSector;
+ actor->PrepareSprites(0);
+ actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
+ actor->uAlly = v19;
+ actor->uCurrentActionTime = 0;
+ actor->uGroup = this->uGroup;
+ actor->uAIState = Summoned;
+ actor->uCurrentActionLength = 256;
+ actor->UpdateAnimation();
++uNumActors;
++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
if ( this->uAttributes & 0x80000 )
- v8->uAttributes |= 0x80000;
- v8->uSummonerID = PID(OBJECT_Actor,summonerId);
+ actor->uAttributes |= 0x80000;
+ actor->uSummonerID = PID(OBJECT_Actor,summonerId);
}
// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
@@ -3113,11 +3110,9 @@
if (pActor->pActorBuffs[ACTOR_BUFF_AFRAID].uExpireTime > 0)
{
if ( (signed int)v36 >= 10240 )
- Actor::AI_RandomMove(actor_id, target_pid, 1024, 0);
+ Actor::AI_RandomMove(actor_id, target_pid, 1024, 0);
else
- {
- Actor::AI_Flee(actor_id, target_pid, 0, pDir);
- }
+ Actor::AI_Flee(actor_id, target_pid, 0, pDir);
continue;
}
@@ -3340,105 +3335,99 @@
//----- (00408B54) --------------------------------------------------------
unsigned int Actor::SearchActorByID(unsigned int *pTotalActors, unsigned int a2)
{
- int v4; // eax@1
- unsigned int v5; // ebx@1
-
- v4 = GetAlertStatus();
+ //int v4; // eax@1
+ unsigned int result; // ebx@1
+
+ //v4 = GetAlertStatus();
*pTotalActors = 0;
+ result = 0;
if ( (pActors[a2].uAttributes & 0x100000) == GetAlertStatus() )
{
*pTotalActors = 1;
if ( pActors[a2].IsNotAlive() == 1 )
- v5 = 1;
+ result = 1;
}
- return v5;
+ return result;
}
//----- (00408AE7) --------------------------------------------------------
unsigned int Actor::SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup)
{
- int v8; // [sp+Ch] [bp-8h]@1
- unsigned int v9; // [sp+10h] [bp-4h]@1
- Actor* v4;
-
- v8 = GetAlertStatus();
+ unsigned int result; // [sp+10h] [bp-4h]@1
+
+ int v8 = GetAlertStatus();
*pTotalActors = 0;
- v9 = 0;
+ result = 0;
for ( uint i = 0; i < uNumActors; i++)
{
- v4 = &pActors[i];
- if ( (v4->uAttributes & 0x100000) == v8 && v4->uGroup == uGroup)
+ if ( (pActors[i].uAttributes & 0x100000) == v8 && pActors[i].uGroup == uGroup)
{
++*pTotalActors;
- if ( v4->IsNotAlive() == 1 )
- ++v9;
+ if ( pActors[i].IsNotAlive() == 1 )
+ ++result;
}
}
- return v9;
+ return result;
}
//----- (00408A7E) --------------------------------------------------------
unsigned int Actor::SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID)
{
- Actor *v4; // edi@2
int v8; // [sp+Ch] [bp-8h]@1
- unsigned int v9; // [sp+10h] [bp-4h]@1
+ unsigned int result; // [sp+10h] [bp-4h]@1
v8 = GetAlertStatus();
*pTotalActors = 0;
- v9 = 0;
+ result = 0;
for ( uint i = 0; i < uNumActors; i++)
{
- v4 = &pActors[i];
- if ( (v4->uAttributes & 0x100000) == v8 && v4->pMonsterInfo.field_33 == uMonsterID)
+ if ( (pActors[i].uAttributes & 0x100000) == v8 && pActors[i].pMonsterInfo.field_33 == uMonsterID)
{
++*pTotalActors;
- if ( v4->IsNotAlive() == 1 )
- ++v9;
+ if ( pActors[i].IsNotAlive() == 1 )
+ ++result;
}
}
- return v9;
+ return result;
}
//----- (00408A27) --------------------------------------------------------
unsigned int Actor::SearchAliveActors(unsigned int *pTotalActors)
{
int v2; // eax@1
- unsigned int v3; // ebp@1
- Actor *v5; // edi@2
+ unsigned int result; // ebp@1
v2 = GetAlertStatus();
- v3 = 0;
+ result = 0;
*pTotalActors = 0;
for ( uint i = 0; i < uNumActors; i++)
{
- v5 = &pActors[i];
- if ( (v5->uAttributes & 0x100000) == v2 )
+ if ( (pActors[i].uAttributes & 0x100000) == v2 )
{
++*pTotalActors;
- if ( v5->IsNotAlive() == 1 )
- ++v3;
+ if ( pActors[i].IsNotAlive() == 1 )
+ ++result;
}
}
- return v3;
+ return result;
}
//----- (00408768) --------------------------------------------------------
void Actor::InitializeActors()
{
- signed int v5; // [sp+Ch] [bp-10h]@1
- signed int v6; // [sp+10h] [bp-Ch]@1
- signed int v7; // [sp+14h] [bp-8h]@1
- signed int v8; // [sp+18h] [bp-4h]@1
-
- v8 = 0;
- v6 = 0;
- v7 = 0;
- v5 = 0;
- if ( !_stricmp(pCurrentMapName, "d25.blv") )
- v8 = 1;
- if ( !_stricmp(pCurrentMapName, "d26.blv") )
- v6 = 1;
+ bool evil; // [sp+Ch] [bp-10h]@1
+ bool bPit; // [sp+10h] [bp-Ch]@1
+ bool good; // [sp+14h] [bp-8h]@1
+ bool bCelestia; // [sp+18h] [bp-4h]@1
+
+ bCelestia = false;
+ bPit = false;
+ good = false;
+ evil = false;
+ if ( !_stricmp(pCurrentMapName, "d25.blv") )//the Celestia
+ bCelestia = true;
+ if ( !_stricmp(pCurrentMapName, "d26.blv") )//the Pit
+ bPit = true;
if (pParty->IsPartyGood())
- v7 = 1;
+ good = true;
if (pParty->IsPartyEvil())
- v5 = 1;
+ evil = true;
Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0; original code behaviour is identical
for (uint i = 0; i < uNumActors; ++i)
@@ -3459,8 +3448,8 @@
actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
- if (!v8 || v7)
- if (!v6 || v5)
+ if (!bCelestia || good)
+ if (!bPit || evil)
if (actor->IsPeasant())
actor->uAttributes &= 0xF70000;
@@ -3513,7 +3502,7 @@
pMonster->uAttributes |= 0xC000;
if ( pMonster->uAIState == Fleeing )
- pMonster->uAttributes |= 0x20000u;
+ pMonster->uAttributes |= 0x20000;
bool hit_will_stun = false,
hit_will_paralyze = false;
if ( !projectileSprite )
@@ -4112,12 +4101,6 @@
int for_x; // ebx@5
int for_y; // [sp+Ch] [bp-10h]@5
int for_z; // [sp+10h] [bp-Ch]@5
-// int v3; // eax@5
-// int v4; // ebx@5
-// unsigned int v5; // ecx@5
-// int v6; // edx@6
-// unsigned int v7; // edx@8
-// unsigned int v8; // edx@10
distance = 5120;
@@ -4167,7 +4150,7 @@
{
for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ )
v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
- if ( v14 != 0 )
+ if ( v14 )
{
pParty->PartyFindsGold(v14, 0);
viewparams->bRedrawGameUI = 1;
@@ -4239,7 +4222,7 @@
sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
else
sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
- ShowStatusBarString(pTmpBuf2.data(), 2u);
+ ShowStatusBarString(pTmpBuf2.data(), 2);
if ( !pParty->AddItemToParty(&Dst) )
pParty->SetHoldingItem(&Dst);
itemFound = true;
@@ -4281,7 +4264,7 @@
}
this->ActorHasItems[1].Reset();
}
- if ( !itemFound || rand() % 100 < 90 )
+ if ( !itemFound || rand() % 100 < 90 )//for repeatedly get gold and item
this->Remove();
}
@@ -4609,18 +4592,13 @@
void Actor::MakeActorAIList_ODM()
{
int v1; // eax@4
-// int v2; // ebx@4
-// unsigned int v3; // ecx@4
-// int v4; // edx@5
-// int v5; // edx@7
-// unsigned int v6; // edx@9
unsigned int v7; // ST20_4@10
- int v9; // edi@10
+ int distance; // edi@10
int v10; // ebx@14
int v21; // [sp+Ch] [bp-14h]@4
int v22; // [sp+10h] [bp-10h]@4
- pParty->uFlags &= 0xFFFFFFCFu;
+ pParty->uFlags &= 0xFFFFFFCF;
ai_arrays_size = 0;
for (uint i = 0; i < uNumActors; ++i)
@@ -4637,35 +4615,30 @@
v22 = abs(pParty->vPosition.z - actor->vPosition.z);
v21 = abs(pParty->vPosition.y - actor->vPosition.y);
v1 = abs(pParty->vPosition.x - actor->vPosition.x);
- v7 = int_get_vector_length(v22, v21, v1);
- //v8 = actor->uActorRadius;
- v9 = v7 - actor->uActorRadius;
- //v23 = v7 - v8;
- if ( v9 < 0 )
- {
- v9 = 0;
- //v23 = 0;
- }
-
- if (v9 < 5632)
+ v7 = int_get_vector_length(v22, v21, v1);
+ distance = v7 - actor->uActorRadius;
+ if ( distance < 0 )
+ distance = 0;
+
+ if (distance < 5632)
+ {
+ v10 = actor->uAttributes & 0xFEFFFFFF;
+ actor->uAttributes = v10;
+ if ( v10 & 0x80000 || actor->GetActorsRelation(0) )
{
- v10 = actor->uAttributes & 0xFEFFFFFF;
- actor->uAttributes = v10;
- if ( v10 & 0x80000 || actor->GetActorsRelation(0) )
- {
- //v11 = (pParty->uFlags & 0x10) == 0;
- actor->uAttributes = v10 | 0x1000000;
- if (v9 < 5120 )
- pParty->SetYellowAlert();
- if (v9 < 307)
- pParty->SetRedAlert();
- }
- actor->uAttributes |= 0x00004000;
- ai_near_actors_distances[ai_arrays_size] = v9;
- ai_near_actors_ids[ai_arrays_size++] = i;
+ //v11 = (pParty->uFlags & 0x10) == 0;
+ actor->uAttributes = v10 | ACTOR_HOSTILE;
+ if (distance < 5120 )
+ pParty->SetYellowAlert();
+ if (distance < 307)
+ pParty->SetRedAlert();
}
- else
- actor->uAttributes &= 0xFFFFBFFF;
+ actor->uAttributes |= 0x4000;
+ ai_near_actors_distances[ai_arrays_size] = distance;
+ ai_near_actors_ids[ai_arrays_size++] = i;
+ }
+ else
+ actor->uAttributes &= 0xFFFFBFFF;
}
/*
@@ -4728,7 +4701,7 @@
int Actor::MakeActorAIList_BLV()
{
int v1; // eax@4
- int v9; // edi@10
+ int distance; // edi@10
int v13; // edx@24
int v15; // ebx@26
unsigned int v17; // esi@27
@@ -4744,7 +4717,7 @@
uint v45; // [sp+20h] [bp-4h]@1
// __debugbreak(); // refactor for blv ai
- pParty->uFlags &= 0xFFFFFFCFu;
+ pParty->uFlags &= 0xFFFFFFCF;
v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
v45 = 0;
for ( uint i = 0; i < (signed int)uNumActors; ++i )
@@ -4759,21 +4732,21 @@
v38 = abs(pParty->vPosition.y - pActors[i].vPosition.y);
v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z);
- v9 = int_get_vector_length(v39, v38, v1) - pActors[i].uActorRadius;
- if ( v9 < 0 )
- v9 = 0;
- if ( v9 < 10240 )
+ distance = int_get_vector_length(v39, v38, v1) - pActors[i].uActorRadius;
+ if ( distance < 0 )
+ distance = 0;
+ if ( distance < 10240 )
{
pActors[i].uAttributes &= 0xFEFFFFFF;
if ( pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) )
{
- pActors[i].uAttributes |= 0x1000000;
- if ( !(pParty->uFlags & 0x10) && (double)v9 < 307.2 )
- pParty->uFlags |= 0x10;
- if ( !(pParty->uFlags & 0x20) && v9 < 5120 )
- pParty->uFlags |= 0x20;
+ pActors[i].uAttributes |= ACTOR_HOSTILE;
+ if ( !(pParty->uFlags & 0x10) && (double)distance < 307.2 )
+ pParty->SetRedAlert();
+ if ( !(pParty->uFlags & 0x20) && distance < 5120 )
+ pParty->SetYellowAlert();
}
- ai_near_actors_distances[v45] = v9;
+ ai_near_actors_distances[v45] = distance;
ai_near_actors_ids[v45] = i;
v45++;
}
diff -r e9adbbce69f9 -r bd4ada7615ce Actor.h
--- a/Actor.h Fri Sep 12 22:12:51 2014 +0600
+++ b/Actor.h Mon Sep 15 17:30:29 2014 +0600
@@ -119,7 +119,22 @@
ANIM_Dead = 0x6,
ANIM_Bored = 0x7,
};
+#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_UNKNOW5 0x40000
+#define ACTOR_UNKNOW6 0x80000
+#define ACTOR_UNKNOW7 0x100000
+#define ACTOR_UNKNOW8 0x200000
+#define ACTOR_UNKNOW9 0x400000
+#define ACTOR_UNKNOW10 0x800000
+#define ACTOR_HOSTILE 0x1000000
+
+#pragma pack(push, 1)
diff -r e9adbbce69f9 -r bd4ada7615ce Build/Visual Studio 2010/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Fri Sep 12 22:12:51 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Mon Sep 15 17:30:29 2014 +0600
@@ -275,7 +275,6 @@
-
diff -r e9adbbce69f9 -r bd4ada7615ce Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Fri Sep 12 22:12:51 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Mon Sep 15 17:30:29 2014 +0600
@@ -1272,7 +1272,6 @@
Engine\Graphics
-
diff -r e9adbbce69f9 -r bd4ada7615ce CastSpellInfo.cpp
--- a/CastSpellInfo.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/CastSpellInfo.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -3296,37 +3296,13 @@
//----- (0042777D) --------------------------------------------------------
void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6)
{
- //bool result; // eax@2
- //__int16 v6; // bx@4
- //Player *v7; // eax@4
- //char v8; // zf@12
unsigned __int16 v9; // cx@16
unsigned int v10; // eax@18
unsigned __int8 v11; // sf@18
unsigned __int8 v12; // of@18
unsigned __int16 v13; // cx@21
unsigned int v14; // eax@23
- //stru277 *v15; // esi@27
- //stru277 *v16; // eax@28
- //GUIWindow *v17; // eax@43
- //GUIWindow *v18; // [sp-30h] [bp-48h]@44
- //unsigned int v19; // [sp-2Ch] [bp-44h]@44
- //unsigned int v20; // [sp-28h] [bp-40h]@44
- //unsigned int v21; // [sp-24h] [bp-3Ch]@44
- //unsigned int v22; // [sp-20h] [bp-38h]@44
- //int v23; // [sp-1Ch] [bp-34h]@44
- //int v24; // [sp-18h] [bp-30h]@44
- //unsigned int v25; // [sp-14h] [bp-2Ch]@43
- //unsigned int v26; // [sp-10h] [bp-28h]@43
- //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43
- //char *v28; // [sp-8h] [bp-20h]@43
- //Texture *v29; // [sp-4h] [bp-1Ch]@43
- //__int16 a3a; // [sp+10h] [bp-8h]@1
- //__int16 a2a; // [sp+14h] [bp-4h]@1
- //a3a = uPlayerID;
- //a2a = a1;
-
//if ( pParty->bTurnBasedModeOn != 1
// || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 )
if (pParty->bTurnBasedModeOn)
diff -r e9adbbce69f9 -r bd4ada7615ce Monsters.cpp
--- a/Monsters.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Monsters.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -1199,83 +1199,47 @@
//----- (00438BDF) --------------------------------------------------------
bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
{
- unsigned __int8 v2; // zf@15
- char v3; // sf@15
- unsigned __int8 v4; // of@15
- bool result; // eax@33
-
switch ( eSupertype )
{
case MONSTER_SUPERTYPE_UNDEAD:
- if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3
- || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3
- || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3
- || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3
- || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3
- || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 )
- goto ret_true;
- if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3);
- v2 = uMonsterInfoID == MONSTER_GHOUL_3;
- v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 //70<=id<=72
+ || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 //91-93
+ || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 //199-201
+ || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 //217-219
+ || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 //223-225
+ || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 //229-231
+ || (signed int)uMonsterInfoID >= MONSTER_GHOUL_1 && (signed int)uMonsterInfoID <= MONSTER_GHOUL_3) //256-258
+ return true;
+ return false;
case MONSTER_SUPERTYPE_KREEGAN:
- if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3);
- v2 = uMonsterInfoID == MONSTER_DEVIL_3;
- v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_DEVIL_1 && (signed int)uMonsterInfoID <= MONSTER_DEVIL_3 )//22-24
+ return true;
+ return false;
case MONSTER_SUPERTYPE_ELF:
- if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1
- && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3
- || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 )
- goto ret_true;
- if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3);
- v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3;
- v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3//133 - 150
+ || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3//49-51
+ || (signed int)uMonsterInfoID >= MONSTER_ELF_SPEARMAN_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_SPEARMAN_3)//52-54
+ return true;
+ return false;
case MONSTER_SUPERTYPE_DRAGON:
- if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3);
- v2 = uMonsterInfoID == MONSTER_DRAGON_3;
- v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_DRAGON_1 && (signed int)uMonsterInfoID <= MONSTER_DRAGON_3 )//25-27
+ return true;
+ return false;
case MONSTER_SUPERTYPE_WATER_ELEMENTAL:
- if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3);
- v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3;
- v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_ELEMENTAL_WATER_1 && (signed int)uMonsterInfoID <= MONSTER_ELEMENTAL_WATER_3)//46-48
+ return true;
+ return false;
case MONSTER_SUPERTYPE_TREANT:
- if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3);
- v2 = uMonsterInfoID == MONSTER_TREANT_3;
- v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0;
- goto false_if_outside;
+ if ( (signed int)uMonsterInfoID >= MONSTER_TREANT_1 && (signed int)uMonsterInfoID <= MONSTER_TREANT_3 )//253-255
+ return true;
+ return false;
case MONSTER_SUPERTYPE_TITAN:
- if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 )
- goto ret_false;
- v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3);
- v2 = uMonsterInfoID == MONSTER_TITAN_3;
- v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0;
-false_if_outside:
- if ( !((unsigned __int8)(v3 ^ v4) | v2) )
- goto ret_false;
-ret_true:
- result = 1;
- break;
+ if ( (signed int)uMonsterInfoID >= MONSTER_TITAN_1 && (signed int)uMonsterInfoID <= MONSTER_TITAN_3 )//211-213
+ return true;
+ return false;
default:
-ret_false:
- result = 0;
- break;
+ return false;
}
- return result;
+ return false;
}
diff -r e9adbbce69f9 -r bd4ada7615ce Party.cpp
--- a/Party.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Party.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -1217,7 +1217,7 @@
//----- (00449B57) --------------------------------------------------------
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
{
- return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0;
+ return (a1[(a2 - 1) >> 3] & (0x80 >> (a2 - 1) % 8)) != 0;
}
//----- (00449B7E) --------------------------------------------------------
diff -r e9adbbce69f9 -r bd4ada7615ce Player.cpp
--- a/Player.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Player.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -2005,7 +2005,7 @@
{
return 0;
}
- if ( !(BYTE2(actroPtr->uAttributes) & 0x80) )
+ if ( !(actroPtr->uAttributes & 0x800000) )
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 || BYTE2(actroPtr->uAttributes) & 8 )
+ if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->uAttributes & 0x80000 )
{
Actor::AggroSurroundingPeasants(uActorID, 1);
sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName);//"%s was caught stealing!"
diff -r e9adbbce69f9 -r bd4ada7615ce SpriteObject.cpp
--- a/SpriteObject.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/SpriteObject.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -1740,9 +1740,7 @@
{
v150 = 2;
if (v152 == 2)
- {
- v150 = 3;
- }
+ v150 = 3;
else
{
if (v152 >= 3)
diff -r e9adbbce69f9 -r bd4ada7615ce TileTable.cpp
--- a/TileTable.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/TileTable.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -521,18 +521,16 @@
else
{
v75 = (int)&v2->pTiles[v2->sNumTiles].uAttributes;
- *(char *)v75 |= 4u;
+ *(char *)v75 |= 4;
}
}
else
- {
- HIBYTE(v2->pTiles[v2->sNumTiles].uAttributes) |= 1u;
- }
+ HIBYTE(v2->pTiles[v2->sNumTiles].uAttributes) |= 1;
}
else
{
v74 = (int)&v2->pTiles[v2->sNumTiles].uAttributes;
- *(char *)v74 |= 2u;
+ *(char *)v74 |= 2;
}
}
else
diff -r e9adbbce69f9 -r bd4ada7615ce UI/UiGame.cpp
--- a/UI/UiGame.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/UI/UiGame.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -1172,8 +1172,6 @@
unsigned int pX; // [sp+D4h] [bp-Ch]@1
unsigned int pY; // [sp+D8h] [bp-8h]@1
- int interaction_distance_limit = 512;
-
pMouse->uPointingObjectID = 0;
pMouse->GetClickPos(&pX, &pY);
if ( pX < 0 || pX > window->GetWidth() - 1 || pY < 0 || pY > window->GetHeight() - 1 )
@@ -1973,7 +1971,7 @@
// && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w )
{
pColor = ui_game_minimap_actor_friendly_color;
- if ( pActors[i].uAttributes & 0x1000000 )
+ if ( pActors[i].uAttributes & ACTOR_HOSTILE )
pColor = ui_game_minimap_actor_hostile_color;
if ( pActors[i].uAIState == Dead)
pColor = ui_game_minimap_actor_corpse_color;
diff -r e9adbbce69f9 -r bd4ada7615ce Viewport.cpp
--- a/Viewport.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Viewport.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -357,7 +357,7 @@
//a2.y = v16;
if ( pActors[mon_id].uAIState == Dead )
{
- if ( (unsigned int)v0 < 0x2000000 )
+ if ( (unsigned int)v0 < 0x2000000 )//distance limit for loot monster
{
pActors[mon_id].LootActor();
return;
diff -r e9adbbce69f9 -r bd4ada7615ce Vis.cpp
--- a/Vis.cpp Fri Sep 12 22:12:51 2014 +0600
+++ b/Vis.cpp Mon Sep 15 17:30:29 2014 +0600
@@ -277,13 +277,10 @@
{
int v5; // eax@1
signed int pFaceID; // edi@2
-// int v8; // ecx@7
int v9; // eax@7
unsigned int *pNumPointers; // eax@7
-// unsigned int v11; // ecx@7
Vis_ObjectInfo *v12; // edi@7
RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1
- BLVFace *pFace; // [sp+3Ch] [bp-14h]@7
void *v15; // [sp+40h] [bp-10h]@7
int v17; // [sp+48h] [bp-8h]@1
@@ -308,12 +305,9 @@
LOWORD(v9) = 0;
v15 = (void *)((PID(OBJECT_BModel,pFaceID)) + v9);
pNumPointers = &list->uNumPointers;
- //v16 = 2;
- //v11 = list->uNumPointers;
- pFace = &pIndoor->pFaces[pFaceID];
v12 = &list->object_pool[list->uNumPointers];
v12->object = &pIndoor->pFaces[pFaceID];
- v12 = (Vis_ObjectInfo *)((char *)v12 + 4);
+ v12 = (Vis_ObjectInfo *) &v12->sZValue;
v12->object = v15;
v12->sZValue = 2;
++*pNumPointers;