Core/Phases: Preliminary work with correctly implementing the phase system in 4.3.4

Put here for peer review.
This commit is contained in:
Subv committed 2014-06-01 22:27:29 -05:00
1 parent 6bc62d730e
commit 48ec2df81f
40 files changed
+436 -863

No files matched your search

@@ -813,6 +813,16 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
if (!Create(guid, entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit))
return false;
if (data->phaseid)
SetInPhase(data->phaseid, false, true);
if (data->phaseGroup)
{
// Set the gameobject in all the phases of the phasegroup
for (auto ph : GetPhasesForGroup(data->phaseGroup))
SetInPhase(ph, false, true);
}
if (data->spawntimesecs >= 0)
{
m_spawnedByDefault = true;
@@ -2053,6 +2063,13 @@ void GameObject::SetDisplayId(uint32 displayid)
UpdateModel();
}
void GameObject::SetInPhase(uint32 id, bool update, bool apply)
{
WorldObject::SetInPhase(id, update, apply);
if (m_model && m_model->isEnabled())
EnableCollision(true);
}
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
WorldObject::SetPhaseMask(newPhaseMask, update);
@@ -592,7 +592,7 @@ struct GameObjectData
{
explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f),
rotation0(0.0f), rotation1(0.0f), rotation2(0.0f), rotation3(0.0f), spawntimesecs(0),
animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { }
animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { }
uint32 id; // entry in gamobject_template
uint16 mapid;
uint32 phaseMask;
@@ -609,6 +609,8 @@ struct GameObjectData
GOState go_state;
uint8 spawnMask;
uint8 artKit;
uint32 phaseid;
uint32 phaseGroup;
bool dbData;
};
@@ -725,6 +727,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
void SetPhaseMask(uint32 newPhaseMask, bool update);
void SetInPhase(uint32 id, bool update, bool apply);
void EnableCollision(bool enable);
void Use(Unit* user);
@@ -876,6 +879,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
//! Following check does check 3d distance
return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
}
GameObjectAI* m_AI;
};
#endif