Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpPosition.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | return | ||||
"<data type='decimal'/>" | "<data type='decimal'/>" | ||||
"</element>" | "</element>" | ||||
"<element name='Floating' a:help='Whether the entity floats on water'>" | "<element name='Floating' a:help='Whether the entity floats on water'>" | ||||
"<data type='boolean'/>" | "<data type='boolean'/>" | ||||
"</element>" | "</element>" | ||||
"<element name='FloatDepth' a:help='The depth at which an entity floats on water (needs Floating to be true)'>" | "<element name='FloatDepth' a:help='The depth at which an entity floats on water (needs Floating to be true)'>" | ||||
"<ref name='nonNegativeDecimal'/>" | "<ref name='nonNegativeDecimal'/>" | ||||
"</element>" | "</element>" | ||||
"<element name='TurnRate' a:help='Maximum graphical rotation speed around Y axis, in radians per second'>" | "<element name='TurnRate' a:help='Maximum rotation speed around Y axis, in radians per second. Used for all graphical rotations and some real unitMotion driven rotations.'>" | ||||
"<ref name='positiveDecimal'/>" | "<ref name='positiveDecimal'/>" | ||||
"</element>"; | "</element>"; | ||||
} | } | ||||
virtual void Init(const CParamNode& paramNode) | virtual void Init(const CParamNode& paramNode) | ||||
{ | { | ||||
std::wstring anchor = paramNode.GetChild("Anchor").ToString(); | std::wstring anchor = paramNode.GetChild("Anchor").ToString(); | ||||
if (anchor == L"pitch") | if (anchor == L"pitch") | ||||
Show All 9 Lines | virtual void Init(const CParamNode& paramNode) | ||||
m_LastYDifference = entity_pos_t::Zero(); | m_LastYDifference = entity_pos_t::Zero(); | ||||
m_Y = paramNode.GetChild("Altitude").ToFixed(); | m_Y = paramNode.GetChild("Altitude").ToFixed(); | ||||
m_RelativeToGround = true; | m_RelativeToGround = true; | ||||
m_Floating = paramNode.GetChild("Floating").ToBool(); | m_Floating = paramNode.GetChild("Floating").ToBool(); | ||||
m_FloatDepth = paramNode.GetChild("FloatDepth").ToFixed(); | m_FloatDepth = paramNode.GetChild("FloatDepth").ToFixed(); | ||||
m_RotYSpeed = paramNode.GetChild("TurnRate").ToFixed().ToFloat(); | m_RotYSpeed = paramNode.GetChild("TurnRate").ToFixed().ToFloat(); | ||||
bb: Lets serialize that, shall we | |||||
m_RotX = m_RotY = m_RotZ = entity_angle_t::FromInt(0); | m_RotX = m_RotY = m_RotZ = entity_angle_t::FromInt(0); | ||||
m_InterpolatedRotX = m_InterpolatedRotY = m_InterpolatedRotZ = 0.f; | m_InterpolatedRotX = m_InterpolatedRotY = m_InterpolatedRotZ = 0.f; | ||||
m_LastInterpolatedRotX = m_LastInterpolatedRotZ = 0.f; | m_LastInterpolatedRotX = m_LastInterpolatedRotZ = 0.f; | ||||
m_Territory = INVALID_PLAYER; | m_Territory = INVALID_PLAYER; | ||||
m_TurretParent = INVALID_ENTITY; | m_TurretParent = INVALID_ENTITY; | ||||
m_TurretPosition = CFixedVector3D(); | m_TurretPosition = CFixedVector3D(); | ||||
▲ Show 20 Lines • Show All 364 Lines • ▼ Show 20 Lines | virtual CFixedVector2D GetPreviousPosition2D() const | ||||
{ | { | ||||
LOGERROR("CCmpPosition::GetPreviousPosition2D called on entity when IsInWorld is false"); | LOGERROR("CCmpPosition::GetPreviousPosition2D called on entity when IsInWorld is false"); | ||||
return CFixedVector2D(); | return CFixedVector2D(); | ||||
} | } | ||||
return CFixedVector2D(m_PrevX, m_PrevZ); | return CFixedVector2D(m_PrevX, m_PrevZ); | ||||
} | } | ||||
virtual float GetTurnRate() const | |||||
{ | |||||
return m_RotYSpeed; | |||||
} | |||||
virtual void TurnTo(entity_angle_t y) | virtual void TurnTo(entity_angle_t y) | ||||
{ | { | ||||
if (m_TurretParent != INVALID_ENTITY) | if (m_TurretParent != INVALID_ENTITY) | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
y -= cmpPosition->GetRotation().Y; | y -= cmpPosition->GetRotation().Y; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 435 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Lets serialize that, shall we