summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-07-29 19:41:38 +0200
committeraap <aap@papnet.eu>2021-07-29 19:59:34 +0200
commit3f3e258d7769aa3522602687aea1119f32f3c589 (patch)
treeca6beec16a570275e5da7dc83d242e4ca4fb86f6 /src/modelinfo
parentMerge branch 'miami' into lcs (diff)
downloadre3-3f3e258d7769aa3522602687aea1119f32f3c589.tar
re3-3f3e258d7769aa3522602687aea1119f32f3c589.tar.gz
re3-3f3e258d7769aa3522602687aea1119f32f3c589.tar.bz2
re3-3f3e258d7769aa3522602687aea1119f32f3c589.tar.lz
re3-3f3e258d7769aa3522602687aea1119f32f3c589.tar.xz
re3-3f3e258d7769aa3522602687aea1119f32f3c589.tar.zst
re3-3f3e258d7769aa3522602687aea1119f32f3c589.zip
Diffstat (limited to 'src/modelinfo')
-rw-r--r--src/modelinfo/MloModelInfo.cpp58
-rw-r--r--src/modelinfo/MloModelInfo.h20
-rw-r--r--src/modelinfo/ModelInfo.h2
-rw-r--r--src/modelinfo/SimpleModelInfo.cpp8
-rw-r--r--src/modelinfo/XtraCompsModelInfo.cpp21
-rw-r--r--src/modelinfo/XtraCompsModelInfo.h19
6 files changed, 124 insertions, 4 deletions
diff --git a/src/modelinfo/MloModelInfo.cpp b/src/modelinfo/MloModelInfo.cpp
new file mode 100644
index 00000000..dc5e64fa
--- /dev/null
+++ b/src/modelinfo/MloModelInfo.cpp
@@ -0,0 +1,58 @@
+#include "common.h"
+
+#include "VisibilityPlugins.h"
+#include "ModelInfo.h"
+
+base::cRelocatableChunkClassInfo CMloModelInfo::msClassInfo("CMloModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
+CMloModelInfo CMloModelInfo::msClassInstance;
+
+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;
+ }
+*/
+}
+
+void
+CMloModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
+
+void
+CMloModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
diff --git a/src/modelinfo/MloModelInfo.h b/src/modelinfo/MloModelInfo.h
new file mode 100644
index 00000000..918efb89
--- /dev/null
+++ b/src/modelinfo/MloModelInfo.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "ClumpModelInfo.h"
+
+class CMloModelInfo : public CClumpModelInfo
+{
+public:
+ float drawDist;
+ int firstInstance;
+ int lastInstance;
+public:
+ CMloModelInfo(void) : CClumpModelInfo(MITYPE_MLO) {}
+ void ConstructClump();
+
+ virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
+ virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
+
+ static base::cRelocatableChunkClassInfo msClassInfo;
+ static CMloModelInfo msClassInstance;
+}; \ No newline at end of file
diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h
index f92a73ad..a0be1937 100644
--- a/src/modelinfo/ModelInfo.h
+++ b/src/modelinfo/ModelInfo.h
@@ -2,11 +2,13 @@
#include "2dEffect.h"
#include "SimpleModelInfo.h"
+#include "MloModelInfo.h"
#include "TimeModelInfo.h"
#include "WeaponModelInfo.h"
#include "ClumpModelInfo.h"
#include "PedModelInfo.h"
#include "VehicleModelInfo.h"
+#include "XtraCompsModelInfo.h"
#include "templates.h"
class CModelInfo
diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp
index 8d0ea677..ba1cfb40 100644
--- a/src/modelinfo/SimpleModelInfo.cpp
+++ b/src/modelinfo/SimpleModelInfo.cpp
@@ -206,8 +206,8 @@ CSimpleModelInfo::GetAtomicFromDistance(float dist)
{
int i;
i = 0;
-// HACk until we figure out what's going on
-if(m_atomics == nil) return nil;
+ if(m_atomics == nil)
+ return nil;
if(m_isDamaged)
i = m_firstDamaged;
for(; i < m_numAtomics; i++)
@@ -219,8 +219,8 @@ if(m_atomics == nil) return nil;
RpAtomic*
CSimpleModelInfo::GetFirstAtomicFromDistance(float dist)
{
-// HACk until we figure out what's going on
-if(m_atomics == nil) return nil;
+ if(m_atomics == nil)
+ return nil;
if(dist < m_lodDistances[0] * TheCamera.LODDistMultiplier)
return m_atomics[0];
return nil;
diff --git a/src/modelinfo/XtraCompsModelInfo.cpp b/src/modelinfo/XtraCompsModelInfo.cpp
new file mode 100644
index 00000000..c11edaf8
--- /dev/null
+++ b/src/modelinfo/XtraCompsModelInfo.cpp
@@ -0,0 +1,21 @@
+#include "common.h"
+
+#include "VisibilityPlugins.h"
+#include "ModelInfo.h"
+
+base::cRelocatableChunkClassInfo CXtraCompsModelInfo::msClassInfo("CXtraCompsModelInfo", VTABLE_ADDR(&msClassInstance), sizeof(msClassInstance));
+CXtraCompsModelInfo CXtraCompsModelInfo::msClassInstance;
+
+void
+CXtraCompsModelInfo::RcWriteThis(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
+
+void
+CXtraCompsModelInfo::RcWriteEmpty(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), sizeof(void*), false, true);
+ writer.Class(VTABLE_ADDR(this), msClassInfo);
+}
diff --git a/src/modelinfo/XtraCompsModelInfo.h b/src/modelinfo/XtraCompsModelInfo.h
new file mode 100644
index 00000000..7cd9b7ea
--- /dev/null
+++ b/src/modelinfo/XtraCompsModelInfo.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "ClumpModelInfo.h"
+
+class CXtraCompsModelInfo : public CClumpModelInfo
+{
+ int field_34;
+public:
+ CXtraCompsModelInfo(void) : CClumpModelInfo(MITYPE_XTRACOMPS) { field_34 = 0; }
+ void Shutdown(void) {};
+ RwObject *CreateInstance(void) { return nil; }
+ void SetClump(RpClump*) {};
+
+ virtual void RcWriteThis(base::cRelocatableChunkWriter &writer);
+ virtual void RcWriteEmpty(base::cRelocatableChunkWriter &writer);
+
+ static base::cRelocatableChunkClassInfo msClassInfo;
+ static CXtraCompsModelInfo msClassInstance;
+}; \ No newline at end of file