feat(model): add CM2Model::HasAttachment

This commit is contained in:
fallenoak 2025-11-03 16:24:01 -06:00
parent 9acffa737e
commit 7bcb1363e3
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 13 additions and 0 deletions

View File

@ -1081,6 +1081,18 @@ C3Vector CM2Model::GetPosition() {
return reinterpret_cast<C3Vector&>(this->matrixF4.d0) * this->m_scene->m_viewInv; return reinterpret_cast<C3Vector&>(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) { int32_t CM2Model::Initialize(CM2Scene* scene, CM2Shared* shared, CM2Model* a4, uint32_t flags) {
this->AttachToScene(scene); this->AttachToScene(scene);

View File

@ -167,6 +167,7 @@ class CM2Model {
CAaBox& GetBoundingBox(CAaBox& bounds); CAaBox& GetBoundingBox(CAaBox& bounds);
HCAMERA GetCameraByIndex(uint32_t index); HCAMERA GetCameraByIndex(uint32_t index);
C3Vector GetPosition(); C3Vector GetPosition();
bool HasAttachment(uint32_t id);
int32_t Initialize(CM2Scene* scene, CM2Shared* shared, CM2Model* a4, uint32_t flags); int32_t Initialize(CM2Scene* scene, CM2Shared* shared, CM2Model* a4, uint32_t flags);
int32_t InitializeLoaded(); int32_t InitializeLoaded();
int32_t IsBatchDoodadCompatible(M2Batch* batch); int32_t IsBatchDoodadCompatible(M2Batch* batch);