diff --git a/src/model/CM2Model.cpp b/src/model/CM2Model.cpp index ede97a6..f24fb0f 100644 --- a/src/model/CM2Model.cpp +++ b/src/model/CM2Model.cpp @@ -1081,6 +1081,18 @@ C3Vector CM2Model::GetPosition() { return reinterpret_cast(this->matrixF4.d0) * this->m_scene->m_viewInv; } +bool CM2Model::HasAttachment(uint32_t id) { + if (!this->m_loaded) { + this->WaitForLoad("HasAttachment"); + } + + if (id < this->m_shared->m_data->attachmentIndicesById.Count()) { + return this->m_shared->m_data->attachmentIndicesById[id] < this->m_shared->m_data->attachments.Count(); + } + + return this->m_shared->m_data->attachments.Count() > 0xFFFF; +} + int32_t CM2Model::Initialize(CM2Scene* scene, CM2Shared* shared, CM2Model* a4, uint32_t flags) { this->AttachToScene(scene); diff --git a/src/model/CM2Model.hpp b/src/model/CM2Model.hpp index 2016847..92e795c 100644 --- a/src/model/CM2Model.hpp +++ b/src/model/CM2Model.hpp @@ -167,6 +167,7 @@ class CM2Model { CAaBox& GetBoundingBox(CAaBox& bounds); HCAMERA GetCameraByIndex(uint32_t index); C3Vector GetPosition(); + bool HasAttachment(uint32_t id); int32_t Initialize(CM2Scene* scene, CM2Shared* shared, CM2Model* a4, uint32_t flags); int32_t InitializeLoaded(); int32_t IsBatchDoodadCompatible(M2Batch* batch);