feat(Core/Common): delete lib game-interface inherited (#5333)

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Kargatum
2021-05-07 02:16:44 +07:00
committed by GitHub
parent 6947789622
commit db7d754f3f
45 changed files with 428 additions and 475 deletions

View File

@@ -311,7 +311,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
SetDisplayId(goinfo->displayId);
if (!m_model)
m_model = GameObjectModel::Create(*this);
m_model = CreateModel();
switch (goinfo->type)
{
@@ -1961,7 +1961,7 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
if (G3D::fuzzyEq(dist, 0.0f))
return true;
float scale = GetFloatValue(OBJECT_FIELD_SCALE_X);
float scale = GetObjectScale();
float sinB = dx / dist;
float cosB = dy / dist;
dx = dist * (cosA * cosB + sinA * sinB);
@@ -2298,7 +2298,7 @@ void GameObject::UpdateModel()
if (GetMap()->ContainsGameObjectModel(*m_model))
GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
m_model = GameObjectModel::Create(*this);
m_model = CreateModel();
if (m_model)
GetMap()->InsertGameObjectModel(*m_model);
}
@@ -2517,4 +2517,26 @@ void GameObject::UpdateModelPosition()
}
}
std::unordered_map<int, goEventFlag> GameObject::gameObjectToEventFlag = {};
std::unordered_map<int, goEventFlag> GameObject::gameObjectToEventFlag = { };
class GameObjectModelOwnerImpl : public GameObjectModelOwnerBase
{
public:
explicit GameObjectModelOwnerImpl(GameObject* owner) : _owner(owner) { }
bool IsSpawned() const override { return _owner->isSpawned(); }
uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
uint32 GetPhaseMask() const override { return (_owner->GetGoState() == GO_STATE_READY || _owner->IsTransport()) ? _owner->GetPhaseMask() : 0; }
G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
float GetOrientation() const override { return _owner->GetOrientation(); }
float GetScale() const override { return _owner->GetObjectScale(); }
void DebugVisualizeCorner(G3D::Vector3 const& corner) const override { const_cast<GameObject*>(_owner)->SummonCreature(1, corner.x, corner.y, corner.z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 10000); }
private:
GameObject* _owner;
};
GameObjectModel* GameObject::CreateModel()
{
return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
}