re3/src/core/TempColModels.cpp

290 lines
9.8 KiB
C++
Raw Normal View History

2019-05-28 06:39:36 +00:00
#include "common.h"
2020-04-17 13:31:11 +00:00
2019-05-28 06:39:36 +00:00
#include "TempColModels.h"
2019-11-11 13:16:51 +00:00
#include "SurfaceTable.h"
2019-05-28 06:39:36 +00:00
2020-04-17 05:54:14 +00:00
CColModel CTempColModels::ms_colModelPed1;
CColModel CTempColModels::ms_colModelPed2;
CColModel CTempColModels::ms_colModelBBox;
CColModel CTempColModels::ms_colModelBumper1;
CColModel CTempColModels::ms_colModelWheel1;
CColModel CTempColModels::ms_colModelPanel1;
CColModel CTempColModels::ms_colModelBodyPart2;
CColModel CTempColModels::ms_colModelBodyPart1;
CColModel CTempColModels::ms_colModelCutObj[5];
CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1;
CColModel CTempColModels::ms_colModelBonnet1;
2019-08-15 14:51:39 +00:00
2019-11-11 13:16:51 +00:00
CColSphere s_aPedSpheres[3];
CColSphere s_aPed2Spheres[3];
CColSphere s_aPedGSpheres[4];
CColSphere s_aDoorSpheres[4];
CColSphere s_aBumperSpheres[4];
CColSphere s_aPanelSpheres[4];
CColSphere s_aBonnetSpheres[4];
CColSphere s_aBootSpheres[4];
CColSphere s_aWheelSpheres[2];
CColSphere s_aBodyPartSpheres1[2];
CColSphere s_aBodyPartSpheres2[2];
void
CTempColModels::Initialise(void)
{
#define SET_COLMODEL_SPHERES(colmodel, sphrs)\
2020-04-15 12:05:24 +00:00
colmodel.numSpheres = ARRAY_SIZE(sphrs);\
2019-11-11 13:16:51 +00:00
colmodel.spheres = sphrs;\
colmodel.level = LEVEL_NONE;\
colmodel.ownsCollisionVolumes = false;\
int i;
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
ms_colModelBBox.level = LEVEL_NONE;
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
2019-11-11 13:16:51 +00:00
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
ms_colModelCutObj[i].level = LEVEL_NONE;
}
2019-11-11 14:36:37 +00:00
// Ped Spheres
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPedSpheres); i++)
2019-11-11 14:36:37 +00:00
s_aPedSpheres[i].radius = 0.35f;
2019-11-11 13:16:51 +00:00
s_aPedSpheres[0].center = CVector(0.0f, 0.0f, -0.25f);
s_aPedSpheres[1].center = CVector(0.0f, 0.0f, 0.15f);
s_aPedSpheres[2].center = CVector(0.0f, 0.0f, 0.55f);
#ifdef FIX_BUGS
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPedSpheres); i++) {
2019-11-11 13:16:51 +00:00
#else
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) {
2019-11-11 13:16:51 +00:00
#endif
2020-05-26 09:37:46 +00:00
s_aPedSpheres[i].surface = SURFACE_PED;
2019-11-11 13:16:51 +00:00
s_aPedSpheres[i].piece = 0;
}
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
2019-11-11 14:36:37 +00:00
// Ped 2 Spheres
2019-11-11 13:16:51 +00:00
s_aPed2Spheres[0].radius = 0.3f;
s_aPed2Spheres[1].radius = 0.4f;
s_aPed2Spheres[2].radius = 0.3f;
s_aPed2Spheres[0].center = CVector(0.0f, 0.35f, -0.9f);
s_aPed2Spheres[1].center = CVector(0.0f, 0.0f, -0.9f);
s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
2020-05-26 09:37:46 +00:00
s_aPed2Spheres[i].surface = SURFACE_PED;
2019-11-11 13:16:51 +00:00
s_aPed2Spheres[i].piece = 0;
}
ms_colModelPed2.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelPed2.boundingBox.Set(CVector(-0.7f, -0.7f, -1.2f), CVector(0.7f, 0.7f, 0.0f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelPed2, s_aPed2Spheres);
// Ped ground collision
s_aPedGSpheres[0].radius = 0.35f;
s_aPedGSpheres[1].radius = 0.35f;
s_aPedGSpheres[2].radius = 0.35f;
s_aPedGSpheres[3].radius = 0.3f;
s_aPedGSpheres[0].center = CVector(0.0f, -0.4f, -0.9f);
s_aPedGSpheres[1].center = CVector(0.0f, -0.1f, -0.9f);
s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f);
s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f);
2020-05-26 09:37:46 +00:00
s_aPedGSpheres[0].surface = SURFACE_PED;
s_aPedGSpheres[1].surface = SURFACE_PED;
s_aPedGSpheres[2].surface = SURFACE_PED;
s_aPedGSpheres[3].surface = SURFACE_PED;
2019-11-11 13:16:51 +00:00
s_aPedGSpheres[0].piece = 4;
s_aPedGSpheres[1].piece = 1;
s_aPedGSpheres[2].piece = 0;
s_aPedGSpheres[3].piece = 6;
ms_colModelPedGroundHit.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelPedGroundHit.boundingBox.Set(CVector(-0.4f, -1.0f, -1.25f), CVector(0.4f, 1.2f, -0.5f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelPedGroundHit, s_aPedGSpheres);
// Door Spheres
s_aDoorSpheres[0].radius = 0.15f;
s_aDoorSpheres[1].radius = 0.15f;
s_aDoorSpheres[2].radius = 0.25f;
s_aDoorSpheres[0].center = CVector(0.0f, -0.25f, -0.35f);
s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f);
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
2020-05-26 09:37:46 +00:00
s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
2019-11-11 13:16:51 +00:00
s_aDoorSpheres[i].piece = 0;
}
ms_colModelDoor1.boundingSphere.Set(1.5f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelDoor1.boundingBox.Set(CVector(-0.3f, 0.0f, -0.6f), CVector(0.3f, -1.2f, 0.6f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelDoor1, s_aDoorSpheres);
// Bumper Spheres
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++)
2019-11-11 13:16:51 +00:00
s_aBumperSpheres[i].radius = 0.15f;
s_aBumperSpheres[0].center = CVector(0.85f, -0.05f, 0.0f);
s_aBumperSpheres[1].center = CVector(0.4f, 0.05f, 0.0f);
s_aBumperSpheres[2].center = CVector(-0.4f, 0.05f, 0.0f);
s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) {
2020-05-26 09:37:46 +00:00
s_aBumperSpheres[i].surface = SURFACE_CAR_PANEL;
2019-11-11 13:16:51 +00:00
s_aBumperSpheres[i].piece = 0;
}
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
// Panel Spheres
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++)
2019-11-11 13:16:51 +00:00
s_aPanelSpheres[i].radius = 0.15f;
s_aPanelSpheres[0].center = CVector(0.15f, 0.45f, 0.0f);
s_aPanelSpheres[1].center = CVector(0.15f, -0.45f, 0.0f);
s_aPanelSpheres[2].center = CVector(-0.15f, -0.45f, 0.0f);
s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) {
2020-05-26 09:37:46 +00:00
s_aPanelSpheres[i].surface = SURFACE_CAR_PANEL;
2019-11-11 13:16:51 +00:00
s_aPanelSpheres[i].piece = 0;
}
ms_colModelPanel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelPanel1.boundingBox.Set(CVector(-0.3f, -0.6f, -0.15f), CVector(0.3f, 0.6f, 0.15f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelPanel1, s_aPanelSpheres);
2019-11-11 14:36:37 +00:00
// Bonnet Spheres
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++)
2019-11-11 13:16:51 +00:00
s_aBonnetSpheres[i].radius = 0.2f;
s_aBonnetSpheres[0].center = CVector(-0.4f, 0.1f, 0.0f);
s_aBonnetSpheres[1].center = CVector(-0.4f, 0.9f, 0.0f);
s_aBonnetSpheres[2].center = CVector(0.4f, 0.1f, 0.0f);
s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) {
2020-05-26 09:37:46 +00:00
s_aBonnetSpheres[i].surface = SURFACE_CAR_PANEL;
2019-11-11 13:16:51 +00:00
s_aBonnetSpheres[i].piece = 0;
}
ms_colModelBonnet1.boundingSphere.Set(1.7f, CVector(0.0f, 0.5f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBonnet1.boundingBox.Set(CVector(-0.7f, -0.2f, -0.3f), CVector(0.7f, 1.2f, 0.3f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBonnet1, s_aBonnetSpheres);
2019-11-11 14:36:37 +00:00
// Boot Spheres
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++)
2019-11-11 13:16:51 +00:00
s_aBootSpheres[i].radius = 0.2f;
s_aBootSpheres[0].center = CVector(-0.4f, -0.1f, 0.0f);
s_aBootSpheres[1].center = CVector(-0.4f, -0.6f, 0.0f);
s_aBootSpheres[2].center = CVector(0.4f, -0.1f, 0.0f);
s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f);
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
2020-05-26 09:37:46 +00:00
s_aBootSpheres[i].surface = SURFACE_CAR_PANEL;
2019-11-11 13:16:51 +00:00
s_aBootSpheres[i].piece = 0;
}
ms_colModelBoot1.boundingSphere.Set(1.4f, CVector(0.0f, -0.4f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBoot1.boundingBox.Set(CVector(-0.7f, -0.9f, -0.3f), CVector(0.7f, 0.2f, 0.3f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBoot1, s_aBootSpheres);
2019-11-11 14:36:37 +00:00
// Wheel Spheres
2019-11-11 13:16:51 +00:00
s_aWheelSpheres[0].radius = 0.35f;
s_aWheelSpheres[1].radius = 0.35f;
s_aWheelSpheres[0].center = CVector(-0.3f, 0.0f, 0.0f);
s_aWheelSpheres[1].center = CVector(0.3f, 0.0f, 0.0f);
#ifdef FIX_BUGS
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aWheelSpheres); i++) {
2019-11-11 13:16:51 +00:00
#else
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
2019-11-11 13:16:51 +00:00
#endif
2020-05-26 09:37:46 +00:00
s_aWheelSpheres[i].surface = SURFACE_WHEELBASE;
2019-11-11 13:16:51 +00:00
s_aWheelSpheres[i].piece = 0;
}
ms_colModelWheel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelWheel1.boundingBox.Set(CVector(-0.7f, -0.4f, -0.4f), CVector(0.7f, 0.4f, 0.4f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelWheel1, s_aWheelSpheres);
2019-11-11 14:36:37 +00:00
// Body Part Spheres 1
2019-11-11 13:16:51 +00:00
s_aBodyPartSpheres1[0].radius = 0.2f;
s_aBodyPartSpheres1[1].radius = 0.2f;
s_aBodyPartSpheres1[0].center = CVector(0.0f, 0.0f, 0.0f);
s_aBodyPartSpheres1[1].center = CVector(0.8f, 0.0f, 0.0f);
#ifdef FIX_BUGS
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBodyPartSpheres1); i++) {
2019-11-11 13:16:51 +00:00
#else
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
2019-11-11 13:16:51 +00:00
#endif
2020-05-26 09:37:46 +00:00
s_aBodyPartSpheres1[i].surface = SURFACE_PED;
2019-11-11 13:16:51 +00:00
s_aBodyPartSpheres1[i].piece = 0;
}
ms_colModelBodyPart1.boundingSphere.Set(0.7f, CVector(0.4f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBodyPart1.boundingBox.Set(CVector(-0.3f, -0.3f, -0.3f), CVector(1.1f, 0.3f, 0.3f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBodyPart1, s_aBodyPartSpheres1);
2019-11-11 14:36:37 +00:00
// Body Part Spheres 2
2019-11-11 13:16:51 +00:00
s_aBodyPartSpheres2[0].radius = 0.15f;
s_aBodyPartSpheres2[1].radius = 0.15f;
s_aBodyPartSpheres2[0].center = CVector(0.0f, 0.0f, 0.0f);
s_aBodyPartSpheres2[1].center = CVector(0.5f, 0.0f, 0.0f);
#ifdef FIX_BUGS
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBodyPartSpheres2); i++) {
2019-11-11 13:16:51 +00:00
#else
2020-04-15 12:05:24 +00:00
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
2019-11-11 13:16:51 +00:00
#endif
2020-05-26 09:37:46 +00:00
s_aBodyPartSpheres2[i].surface = SURFACE_PED;
2019-11-11 13:16:51 +00:00
s_aBodyPartSpheres2[i].piece = 0;
}
ms_colModelBodyPart2.boundingSphere.Set(0.5f, CVector(0.25f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBodyPart2.boundingBox.Set(CVector(-0.2f, -0.2f, -0.2f), CVector(0.7f, 0.2f, 0.2f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
#undef SET_COLMODEL_SPHERES
}