diff --git a/binaries/data/mods/public/art/actors/structures/athenians/temple.xml b/binaries/data/mods/public/art/actors/structures/athenians/temple.xml index 5c0fb1d292..2e9bdc1ff5 100644 --- a/binaries/data/mods/public/art/actors/structures/athenians/temple.xml +++ b/binaries/data/mods/public/art/actors/structures/athenians/temple.xml @@ -8,6 +8,7 @@ + diff --git a/binaries/data/mods/public/art/actors/units/athenians/pericles.xml b/binaries/data/mods/public/art/actors/units/athenians/pericles.xml index 65558eb483..b2ca447b98 100644 --- a/binaries/data/mods/public/art/actors/units/athenians/pericles.xml +++ b/binaries/data/mods/public/art/actors/units/athenians/pericles.xml @@ -23,6 +23,7 @@ + diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp index d9dc265d3b..127bbd5894 100644 --- a/source/graphics/Model.cpp +++ b/source/graphics/Model.cpp @@ -208,7 +208,7 @@ const CBoundingBoxAligned CModel::GetObjectSelectionBoundsRec() for (size_t i = 0; i < m_Props.size(); ++i) { const Prop& prop = m_Props[i]; - if (prop.m_Hidden) + if (prop.m_Hidden || !prop.m_Selectable) continue; // prop is hidden from rendering, so it also shouldn't be used for selection CBoundingBoxAligned propSelectionBounds = prop.m_Model->GetObjectSelectionBoundsRec(); @@ -400,7 +400,7 @@ void CModel::ValidatePosition() } // Adjust prop height to terrain level when needed - if (prop.m_maxHeight != 0.f || prop.m_minHeight != 0.f) + if (prop.m_MaxHeight != 0.f || prop.m_MinHeight != 0.f) { CVector3D propTranslation = proptransform.GetTranslation(); CVector3D objTranslation = m_Transform.GetTranslation(); @@ -410,8 +410,8 @@ void CModel::ValidatePosition() { float objTerrain = cmpTerrain->GetExactGroundLevel(objTranslation.X, objTranslation.Z); float propTerrain = cmpTerrain->GetExactGroundLevel(propTranslation.X, propTranslation.Z); - float translateHeight = std::min(prop.m_maxHeight, - std::max(prop.m_minHeight, propTerrain - objTerrain)); + float translateHeight = std::min(prop.m_MaxHeight, + std::max(prop.m_MinHeight, propTerrain - objTerrain)); CMatrix3D translate = CMatrix3D(); translate.SetTranslation(0.f, translateHeight, 0.f); proptransform.Concatenate(translate); @@ -508,7 +508,7 @@ void CModel::CopyAnimationFrom(CModel* source) ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // AddProp: add a prop to the model on the given point -void CModel::AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight, float maxHeight) +void CModel::AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight, float maxHeight, bool selectable) { // position model according to prop point position @@ -520,8 +520,9 @@ void CModel::AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntr prop.m_Point = point; prop.m_Model = model; prop.m_ObjectEntry = objectentry; - prop.m_minHeight = minHeight; - prop.m_maxHeight = maxHeight; + prop.m_MinHeight = minHeight; + prop.m_MaxHeight = maxHeight; + prop.m_Selectable = selectable; m_Props.push_back(prop); } @@ -603,7 +604,7 @@ CModelAbstract* CModel::Clone() const if (m_AmmoPropPoint && i == m_AmmoLoadedProp) clone->AddAmmoProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry); else - clone->AddProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry, m_Props[i].m_minHeight, m_Props[i].m_maxHeight); + clone->AddProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry, m_Props[i].m_MinHeight, m_Props[i].m_MaxHeight, m_Props[i].m_Selectable); } return clone; diff --git a/source/graphics/Model.h b/source/graphics/Model.h index 7df5221379..b0cb0a96fb 100644 --- a/source/graphics/Model.h +++ b/source/graphics/Model.h @@ -54,10 +54,10 @@ class CModel : public CModelAbstract public: struct Prop { - Prop() : m_minHeight(0.f), m_maxHeight(0.f), m_Point(0), m_Model(0), m_ObjectEntry(0), m_Hidden(false) {} + Prop() : m_MinHeight(0.f), m_MaxHeight(0.f), m_Point(0), m_Model(0), m_ObjectEntry(0), m_Hidden(false), m_Selectable(true) {} - float m_minHeight; - float m_maxHeight; + float m_MinHeight; + float m_MaxHeight; /** * Location of the prop point within its parent model, relative to either a bone in the parent model or to the @@ -75,6 +75,7 @@ public: CObjectEntry* m_ObjectEntry; bool m_Hidden; ///< Should this prop be temporarily removed from rendering? + bool m_Selectable; /// < should this prop count in the selection size? }; public: @@ -213,7 +214,7 @@ public: /** * Add a prop to the model on the given point. */ - void AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight = 0.f, float maxHeight = 0.f); + void AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight = 0.f, float maxHeight = 0.f, bool selectable = true); /** * Add a prop to the model on the given point, and treat it as the ammo prop. diff --git a/source/graphics/ObjectBase.cpp b/source/graphics/ObjectBase.cpp index becda45bad..f55ff9ab00 100644 --- a/source/graphics/ObjectBase.cpp +++ b/source/graphics/ObjectBase.cpp @@ -82,6 +82,7 @@ bool CObjectBase::Load(const VfsPath& pathname) AT(offsetz); AT(minheight); AT(maxheight); + AT(selectable); #undef AT #undef EL @@ -252,6 +253,8 @@ bool CObjectBase::Load(const VfsPath& pathname) prop.m_minHeight = pe.Value.ToFloat(); else if (pe.Name == at_maxheight) prop.m_maxHeight = pe.Value.ToFloat(); + else if (pe.Name == at_selectable) + prop.m_selectable = pe.Value != "false"; } currentVariant->m_Props.push_back(prop); } diff --git a/source/graphics/ObjectBase.h b/source/graphics/ObjectBase.h index 85b4a24d9f..9c020ab830 100644 --- a/source/graphics/ObjectBase.h +++ b/source/graphics/ObjectBase.h @@ -56,7 +56,7 @@ public: struct Prop { // constructor - Prop() : m_minHeight(0.f), m_maxHeight(0.f) {} + Prop() : m_minHeight(0.f), m_maxHeight(0.f), m_selectable(true) {} // name of the prop point to attach to - "Prop01", "Prop02", "Head", "LeftHand", etc .. CStr m_PropPointName; // name of the model file - art/actors/props/sword.xml or whatever @@ -64,6 +64,7 @@ public: // allow the prop to ajust the height from minHeight to maxHeight relative to the main model float m_minHeight; float m_maxHeight; + bool m_selectable; }; struct Samp diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 59c44ccdf0..16b4e4834e 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -235,7 +235,7 @@ bool CObjectEntry::BuildVariation(const std::vector >& selections if (isAmmo) model->AddAmmoProp(proppoint, propmodel, oe); else - model->AddProp(proppoint, propmodel, oe, prop.m_minHeight, prop.m_maxHeight); + model->AddProp(proppoint, propmodel, oe, prop.m_minHeight, prop.m_maxHeight, prop.m_selectable); if (propmodel->ToCModel()) propmodel->ToCModel()->SetAnimation(oe->GetRandomAnimation("idle")); }