Core/Collision: Replaced phasemask with proper phases in GameObject c…

…ollision calculation
This commit is contained in:
Aokromes
2017-05-06 01:55:17 +02:00
parent 27683014f2
commit 0fbcdca05e
29 changed files with 120 additions and 152 deletions

View File

@@ -237,8 +237,8 @@ public:
Map2ZoneCoordinates(zoneX, zoneY, zoneId);
Map const* map = object->GetMap();
float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
float groundZ = map->GetHeight(object->GetPhases(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
float floorZ = map->GetHeight(object->GetPhases(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());

View File

@@ -1172,7 +1172,7 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
}
@@ -1290,7 +1290,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);

View File

@@ -541,7 +541,7 @@ public:
float x = caster->GetPositionX() + dist * std::cos(angle);
float y = caster->GetPositionY() + dist * std::sin(angle);
float z = caster->GetMap()->GetHeight(x, y, caster->GetPositionZ());
float z = caster->GetMap()->GetHeight(caster->GetPhases(), x, y, caster->GetPositionZ());
const_cast<WorldLocation*>(GetExplTargetDest())->Relocate(x, y, z);
GetHitDest()->Relocate(x, y, z);

View File

@@ -268,7 +268,7 @@ class boss_high_priestess_azil : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_EARTH_FURY_CASTING_VISUAL);
me->RemoveAurasDueToSpell(SPELL_EARTH_FURY_ENERGY_SHIELD);
Position pos = me->GetPosition();
pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
me->GetMotionMaster()->MovePoint(POINT_GROUND, pos);
break;
}

View File

@@ -266,7 +266,7 @@ class boss_slabhide : public CreatureScript
case EVENT_LAND:
{
Position pos = me->GetPosition();
pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
me->GetMotionMaster()->MoveLand(POINT_SLABHIDE_LAND, pos);
break;
}
@@ -479,7 +479,7 @@ public:
{
Unit* caster = GetCaster();
Position pos = caster->GetPosition();
pos.m_positionZ = caster->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 100.0f);
pos.m_positionZ = caster->GetMap()->GetHeight(caster->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 100.0f);
dest.Relocate(pos);
}

View File

@@ -88,7 +88,7 @@ class boss_amanitar : public CreatureScript
for (uint8 i = 0; i < 30; ++i)
{
Position pos = me->GetRandomNearPosition(30.0f);
pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
{

View File

@@ -626,7 +626,7 @@ class npc_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
float floorZ = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
float floorZ = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
if (fabs(me->GetPositionZ() - floorZ) < 0.1f)
{
// we are close to the ground

View File

@@ -805,7 +805,7 @@ class boss_prince_valanar_icc : public CreatureScript
{
float x, y, z;
summon->GetPosition(x, y, z);
float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f);
float ground_Z = summon->GetMap()->GetHeight(summon->GetPhases(), x, y, z, true, 500.0f);
summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z);
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
break;
@@ -1047,7 +1047,7 @@ class npc_kinetic_bomb : public CreatureScript
me->SetReactState(REACT_PASSIVE);
me->GetPosition(_x, _y, _groundZ);
me->DespawnOrUnsummon(60000);
_groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f);
_groundZ = me->GetMap()->GetHeight(me->GetPhases(), _x, _y, _groundZ, true, 500.0f);
}
void DoAction(int32 action) override

View File

@@ -2018,7 +2018,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader
return;
Position pos = caster->GetNearPosition(5.0f, 0.0f);
//pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
//pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
//pos.m_positionZ += 0.05f;
caster->SetHomePosition(pos);
caster->GetMotionMaster()->MoveLand(POINT_LAND, pos);

View File

@@ -777,7 +777,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
{
float x, y, z;
me->GetPosition(x, y, z);
z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
}

View File

@@ -863,7 +863,7 @@ class boss_sara : public CreatureScript
float angle = frand(0.0f, 2.0f * float(M_PI));
pos.m_positionX = YoggSaronSpawnPos.GetPositionX() + radius * cosf(angle);
pos.m_positionY = YoggSaronSpawnPos.GetPositionY() + radius * sinf(angle);
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f);
pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f);
me->SummonCreature(NPC_DEATH_RAY, pos, TEMPSUMMON_TIMED_DESPAWN, 20000);
}
break;

View File

@@ -780,7 +780,7 @@ public:
bird->KillSelf();
crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
bird->GetMap()->GetWaterOrGroundLevel(bird->GetPhaseMask(), bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
bird->GetMap()->GetWaterOrGroundLevel(bird->GetPhases(), bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
/// @todo Make crunchy perform emote eat when he reaches the bird
break;

View File

@@ -74,7 +74,7 @@ public:
void Reset() override
{
ground = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
ground = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
SummonInfernal();
events.ScheduleEvent(EVENT_CAST_SUMMON_INFERNAL, urand(1000, 3000));
}