Allow actors to override the entity's anchor type

Optionally let actor templates define their own anchor types.
These override the default value defined in the template.
Useful for actors without their own entity template.

Reviewed-By: Itms
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/7542
This commit is contained in:
Vantha
2025-01-23 21:47:26 +01:00
committed by Nicolas Auvray
parent 0ce889ca6d
commit eb2f59eeaa
8 changed files with 67 additions and 22 deletions
+4
View File
@@ -60,6 +60,7 @@ CObjectBase::CObjectBase(CObjectManager& objectManager, CActorDef& actorDef, u8
: m_ObjectManager(objectManager), m_ActorDef(actorDef)
{
m_QualityLevel = qualityLevel;
m_Properties.m_AnchorType = "";
m_Properties.m_CastShadows = false;
m_Properties.m_FloatOnWater = false;
@@ -82,6 +83,7 @@ bool CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)
// Define all the elements used in the XML file
#define EL(x) int el_##x = XeroFile.GetElementID(#x)
#define AT(x) int at_##x = XeroFile.GetAttributeID(#x)
EL(anchor);
EL(castshadow);
EL(float);
EL(group);
@@ -143,6 +145,8 @@ bool CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)
return false;
}
}
else if (child_name == el_anchor)
m_Properties.m_AnchorType = child.GetText();
else if (child_name == el_castshadow)
m_Properties.m_CastShadows = true;
else if (child_name == el_float)