summaryrefslogtreecommitdiffstats
path: root/src/collision
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-01-24 17:14:16 +0100
committeraap <aap@papnet.eu>2021-01-24 17:14:16 +0100
commita202e6734991060d921e22aff0358862530e47a4 (patch)
tree2fe352f839dcdc64c6d00d79d9ece2fa8185ef60 /src/collision
parentCClumpModelInfo (diff)
downloadre3-a202e6734991060d921e22aff0358862530e47a4.tar
re3-a202e6734991060d921e22aff0358862530e47a4.tar.gz
re3-a202e6734991060d921e22aff0358862530e47a4.tar.bz2
re3-a202e6734991060d921e22aff0358862530e47a4.tar.lz
re3-a202e6734991060d921e22aff0358862530e47a4.tar.xz
re3-a202e6734991060d921e22aff0358862530e47a4.tar.zst
re3-a202e6734991060d921e22aff0358862530e47a4.zip
Diffstat (limited to 'src/collision')
-rw-r--r--src/collision/ColModel.cpp7
-rw-r--r--src/collision/ColModel.h2
-rw-r--r--src/collision/TempColModels.cpp85
-rw-r--r--src/collision/TempColModels.h13
4 files changed, 85 insertions, 22 deletions
diff --git a/src/collision/ColModel.cpp b/src/collision/ColModel.cpp
index 49847dbd..ccd679b2 100644
--- a/src/collision/ColModel.cpp
+++ b/src/collision/ColModel.cpp
@@ -204,3 +204,10 @@ CColModel::operator=(const CColModel &other)
}
return *this;
}
+
+bool
+CColModel::Write(base::cRelocatableChunkWriter &writer, bool allocSpace)
+{
+ assert(0 && "TODO(LCS)");
+ return 1;
+}
diff --git a/src/collision/ColModel.h b/src/collision/ColModel.h
index cd5ae651..c58a4d9b 100644
--- a/src/collision/ColModel.h
+++ b/src/collision/ColModel.h
@@ -36,4 +36,6 @@ struct CColModel
void *operator new(size_t);
void operator delete(void *p, size_t);
CColModel& operator=(const CColModel& other);
+
+ bool Write(base::cRelocatableChunkWriter &writer, bool allocSpace);
}; \ No newline at end of file
diff --git a/src/collision/TempColModels.cpp b/src/collision/TempColModels.cpp
index 32f2285c..148b86fe 100644
--- a/src/collision/TempColModels.cpp
+++ b/src/collision/TempColModels.cpp
@@ -1,11 +1,12 @@
#include "common.h"
+#include "main.h"
#include "TempColModels.h"
#include "Game.h"
-CColModel CTempColModels::ms_colModelPed1;
+// LCS: haven't yet checked the numbers but they probably haven't changed
+
CColModel CTempColModels::ms_colModelPed2;
-CColModel CTempColModels::ms_colModelBBox;
CColModel CTempColModels::ms_colModelBumper1;
CColModel CTempColModels::ms_colModelWheel1;
CColModel CTempColModels::ms_colModelPanel1;
@@ -16,7 +17,9 @@ CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1;
CColModel CTempColModels::ms_colModelBonnet1;
-CColModel CTempColModels::ms_colModelWeapon;
+CColModel CTempColModels::ms_colModelFerryDocked;
+
+CTempColModels *gpTempColModels;
CColSphere s_aPedSpheres[3];
@@ -34,6 +37,7 @@ CColSphere s_aBootSpheres[4];
CColSphere s_aWheelSpheres[2];
CColSphere s_aBodyPartSpheres1[2];
CColSphere s_aBodyPartSpheres2[2];
+CColBox S_aFerryDockedBoxes[1];
void
CTempColModels::Initialise(void)
@@ -44,11 +48,26 @@ CTempColModels::Initialise(void)
colmodel.level = LEVEL_GENERIC;\
colmodel.ownsCollisionVolumes = false;
- int i;
+ if(gMakeResources){
+ if(gpTempColModels == nil){
+ gpTempColModels = new CTempColModels;
+ gpTempColModels->Initialise();
+ return;
+ }
+
+ ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
+ ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
+ ms_colModelBBox.level = LEVEL_GENERIC;
- ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
- ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
- ms_colModelBBox.level = LEVEL_GENERIC;
+ ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
+ ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
+ SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
+
+ ms_colModelWeapon.boundingSphere.Set(0.25f, CVector(0.0f, 0.0f, 0.0f));
+ ms_colModelWeapon.boundingBox.Set(CVector(-0.25f, -0.25f, -0.25f), CVector(0.25f, 0.25f, 0.25f));
+ }
+
+ int i;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
@@ -74,10 +93,6 @@ CTempColModels::Initialise(void)
s_aPedSpheres[i].piece = 0;
}
- ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f));
- ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f));
- SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
-
// Ped 2 Spheres
s_aPed2Spheres[0].radius = 0.3f;
@@ -294,13 +309,47 @@ CTempColModels::Initialise(void)
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
- ms_colModelWeapon.boundingSphere.radius = 0.25f;
- ms_colModelWeapon.boundingBox.min.x = -0.25f;
- ms_colModelWeapon.boundingBox.min.y = -0.25f;
- ms_colModelWeapon.boundingBox.min.z = -0.25f;
- ms_colModelWeapon.boundingBox.max.x = 0.25f;
- ms_colModelWeapon.boundingBox.max.y = 0.25f;
- ms_colModelWeapon.boundingBox.max.z = 0.25f;
+ // Ferry Docked
+
+ S_aFerryDockedBoxes[0].Set(CVector(-6.3f, -22.78f, -2.0f), CVector(6.3f, 22.78f, 2.8f), SURFACE_THICK_METAL_PLATE, SURFACE_DEFAULT);
+
+ ms_colModelFerryDocked.boundingSphere.Set(35.0f, CVector(0.0f, -0.0f, 0.0f));
+ ms_colModelFerryDocked.boundingBox.Set(S_aFerryDockedBoxes[0].min, S_aFerryDockedBoxes[0].max);
+ ms_colModelFerryDocked.spheres = nil;
+ ms_colModelFerryDocked.numSpheres = 0;
+ ms_colModelFerryDocked.boxes = S_aFerryDockedBoxes;
+ ms_colModelFerryDocked.numBoxes = ARRAY_SIZE(S_aFerryDockedBoxes);
+ ms_colModelFerryDocked.level = LEVEL_GENERIC;
+
#undef SET_COLMODEL_SPHERES
}
+
+void
+CTempColModels::Write(base::cRelocatableChunkWriter &writer)
+{
+ writer.AllocateRaw(this, sizeof(*this), 0x10, false, true);
+
+ ms_colModelBBox.Write(writer, false);
+ writer.AddPatch(&ms_colModelBBox);
+
+ ms_colModelPed1.Write(writer, false);
+ writer.AddPatch(&ms_colModelPed1);
+
+ ms_colModelWeapon.Write(writer, false);
+ writer.AddPatch(&ms_colModelWeapon);
+
+ for(int i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++)
+ ms_colModelCutObj[i].Write(writer, true);
+ ms_colModelPed2.Write(writer, true);
+ ms_colModelPedGroundHit.Write(writer, true);
+ ms_colModelDoor1.Write(writer, true);
+ ms_colModelBumper1.Write(writer, true);
+ ms_colModelPanel1.Write(writer, true);
+ ms_colModelBonnet1.Write(writer, true);
+ ms_colModelBoot1.Write(writer, true);
+ ms_colModelWheel1.Write(writer, true);
+ ms_colModelBodyPart1.Write(writer, true);
+ ms_colModelBodyPart2.Write(writer, true);
+ ms_colModelFerryDocked.Write(writer, true);
+}
diff --git a/src/collision/TempColModels.h b/src/collision/TempColModels.h
index e8a39695..0f1f06c3 100644
--- a/src/collision/TempColModels.h
+++ b/src/collision/TempColModels.h
@@ -5,9 +5,11 @@
class CTempColModels
{
public:
- static CColModel ms_colModelPed1;
+ CColModel ms_colModelPed1;
+ CColModel ms_colModelBBox;
+ CColModel ms_colModelWeapon;
+
static CColModel ms_colModelPed2;
- static CColModel ms_colModelBBox;
static CColModel ms_colModelBumper1;
static CColModel ms_colModelWheel1;
static CColModel ms_colModelPanel1;
@@ -18,7 +20,10 @@ public:
static CColModel ms_colModelBoot1;
static CColModel ms_colModelDoor1;
static CColModel ms_colModelBonnet1;
- static CColModel ms_colModelWeapon;
+ static CColModel ms_colModelFerryDocked;
- static void Initialise(void);
+ void Initialise(void);
+ void Write(base::cRelocatableChunkWriter &writer);
};
+
+extern CTempColModels *gpTempColModels;