summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/MloModelInfo.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-20 21:41:41 +0100
committerSergeanur <s.anureev@yandex.ua>2020-01-20 21:58:13 +0100
commita9f39d828426df60876f00a5d2164eb50879b5c9 (patch)
tree739e2dafe2617481334ba7f28a94b1733e19cc1a /src/modelinfo/MloModelInfo.cpp
parentPowerPoints (diff)
downloadre3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar.gz
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar.bz2
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar.lz
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar.xz
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.tar.zst
re3-a9f39d828426df60876f00a5d2164eb50879b5c9.zip
Diffstat (limited to '')
-rw-r--r--src/modelinfo/MloModelInfo.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/modelinfo/MloModelInfo.cpp b/src/modelinfo/MloModelInfo.cpp
new file mode 100644
index 00000000..693f1fb6
--- /dev/null
+++ b/src/modelinfo/MloModelInfo.cpp
@@ -0,0 +1,39 @@
+#include "common.h"
+#include "patcher.h"
+#include "VisibilityPlugins.h"
+#include "ModelInfo.h"
+
+void
+CMloModelInfo::ConstructClump()
+{
+ m_clump = RpClumpCreate();
+ RwFrame *mainFrame = RwFrameCreate();
+ RwFrameSetIdentity(mainFrame);
+ RpClumpSetFrame(m_clump, mainFrame);
+
+ for (int i = firstInstance; i < lastInstance; i++) {
+ int modelId = CModelInfo::GetMloInstanceStore()->store[i].m_modelIndex;
+ RwMatrix *attMat = CModelInfo::GetMloInstanceStore()->store[i].GetMatrix().m_attachment;
+ CSimpleModelInfo *minfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(modelId);
+
+ if (minfo->m_atomics[0] != nil) {
+ RpAtomic *newAtomic = RpAtomicClone(minfo->m_atomics[0]);
+ RwFrame *newFrame = RwFrameCreate();
+ if (newAtomic != nil && newFrame != nil) {
+ *RwFrameGetMatrix(newFrame) = *attMat;
+ RpAtomicSetFrame(newAtomic, newFrame);
+ RwFrameAddChild(mainFrame, newFrame);
+ RpClumpAddAtomic(m_clump, newAtomic);
+ } else {
+ debug("Failed to allocate memory while creating template MLO.\n");
+ }
+ }
+ }
+
+ if (RpClumpGetNumAtomics(m_clump) != 0) {
+ CVisibilityPlugins::SetClumpModelInfo(m_clump, this);
+ } else {
+ RpClumpDestroy(m_clump);
+ m_clump = nil;
+ }
+} \ No newline at end of file