ColModel / Triangle planes: more fixes for miami and liberty

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis
2025-03-23 08:23:35 +02:00
committed by Stefanos Kornilios Mitsis Poiitidis
parent 3b7f5cffc3
commit 1c12637506
3 changed files with 8 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include "ColModel.h"
#include "Game.h"
#include "MemoryHeap.h"
#include "Collision.h"
void* re3StreamingAlloc(size_t size);
@@ -24,12 +25,12 @@ CColModel::CColModel(void)
CColModel::~CColModel(void)
{
RemoveCollisionVolumes();
RemoveTrianglePlanes();
}
void
CColModel::RemoveCollisionVolumes(void)
{
CCollision::RemoveTrianglePlanes(this);
if(ownsCollisionVolumes){
RwFree(spheres);
RwFree(lines);
@@ -95,6 +96,8 @@ CColModel::operator=(const CColModel &other)
int i;
int numVerts;
CCollision::RemoveTrianglePlanes(this);
boundingSphere = other.boundingSphere;
boundingBox = other.boundingBox;

View File

@@ -223,7 +223,7 @@ CFileLoader::LoadCollisionFile(const char *filename)
mi = CModelInfo::GetModelInfo(modelname, nil);
if(mi){
if(mi->GetColModel()){
if(mi->GetColModel() && mi->DoesOwnColModel()){
LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname);
}else{
CColModel *model = new CColModel;

View File

@@ -45,13 +45,13 @@ CColModel::operator delete(void *p, size_t) throw()
void
CColModel::RemoveCollisionVolumes(void)
{
CCollision::RemoveTrianglePlanes(this);
if(ownsCollisionVolumes){
RwFree(spheres);
RwFree(lines);
RwFree(boxes);
RwFree(vertices);
RwFree(triangles);
CCollision::RemoveTrianglePlanes(this);
}
numSpheres = 0;
numLines = 0;
@@ -111,6 +111,8 @@ CColModel::operator=(const CColModel &other)
int i;
int numVerts;
CCollision::RemoveTrianglePlanes(this);
boundingSphere = other.boundingSphere;
boundingBox = other.boundingBox;