refactor(Core/Entities): clean up vendor item removal and add QuaternionData Euler helpers (#24790)
This commit is contained in:
@@ -88,7 +88,7 @@ bool VendorItemData::RemoveItem(uint32 item_id)
|
|||||||
{
|
{
|
||||||
if ((*i)->item == item_id)
|
if ((*i)->item == item_id)
|
||||||
{
|
{
|
||||||
i = m_items.erase(i++);
|
i = m_items.erase(i);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,6 +43,17 @@ bool QuaternionData::IsUnit() const
|
|||||||
return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5f;
|
return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuaternionData::ToEulerAnglesZYX(float& Z, float& Y, float& X) const
|
||||||
|
{
|
||||||
|
G3D::Matrix3(G3D::Quat(x, y, z, w)).toEulerAnglesZYX(Z, Y, X);
|
||||||
|
}
|
||||||
|
|
||||||
|
QuaternionData QuaternionData::FromEulerAnglesZYX(float Z, float Y, float X)
|
||||||
|
{
|
||||||
|
G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(Z, Y, X));
|
||||||
|
return QuaternionData(quat.x, quat.y, quat.z, quat.w);
|
||||||
|
}
|
||||||
|
|
||||||
GameObject::GameObject() : WorldObject(), MovableMapObject(),
|
GameObject::GameObject() : WorldObject(), MovableMapObject(),
|
||||||
m_model(nullptr), m_goValue(), m_AI(nullptr)
|
m_model(nullptr), m_goValue(), m_AI(nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -689,6 +689,8 @@ struct AC_GAME_API QuaternionData
|
|||||||
QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { }
|
QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { }
|
||||||
|
|
||||||
[[nodiscard]] bool IsUnit() const;
|
[[nodiscard]] bool IsUnit() const;
|
||||||
|
void ToEulerAnglesZYX(float& Z, float& Y, float& X) const;
|
||||||
|
[[nodiscard]] static QuaternionData FromEulerAnglesZYX(float Z, float Y, float X);
|
||||||
};
|
};
|
||||||
|
|
||||||
// `gameobject_addon` table
|
// `gameobject_addon` table
|
||||||
|
|||||||
Reference in New Issue
Block a user