summaryrefslogtreecommitdiffstats
path: root/src/collision/Collision.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/collision/Collision.cpp')
-rw-r--r--src/collision/Collision.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp
index 20778345..45a15628 100644
--- a/src/collision/Collision.cpp
+++ b/src/collision/Collision.cpp
@@ -24,8 +24,6 @@
#include "Camera.h"
#include "ColStore.h"
-//--MIAMI: file done
-
#ifdef VU_COLLISION
#include "VuCollision.h"
@@ -93,7 +91,7 @@ CCollision::Update(void)
{
}
-//--MIAMI: unused
+// unused
eLevelName
GetCollisionInSectorList(CPtrList &list)
{
@@ -110,7 +108,7 @@ GetCollisionInSectorList(CPtrList &list)
return LEVEL_GENERIC;
}
-//--MIAMI: unused
+// unused
// Get a level this sector is in based on collision models
eLevelName
GetCollisionInSector(CSector &sect)
@@ -499,7 +497,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
// If we don't intersect with the bounding box, no chance on the rest
if(!TestLineBox(*(CColLine*)newline, model.boundingBox))
@@ -507,12 +505,14 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(TestLineSphere(*(CColLine*)newline, model.spheres[i]))
return true;
}
for(i = 0; i < model.numBoxes; i++){
if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.boxes[i].surface)) continue;
if(TestLineBox(*(CColLine*)newline, model.boxes[i]))
return true;
}
@@ -522,6 +522,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -539,6 +540,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
#endif
for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -876,7 +878,7 @@ CCollision::ProcessLineSphere(const CColLine &line, const CColSphere &sphere, CC
return true;
}
-//--MIAMI: unused
+// unused
bool
CCollision::ProcessVerticalLineTriangle(const CColLine &line,
const CompressedVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
@@ -1321,7 +1323,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1333,6 +1335,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
}
@@ -1348,6 +1351,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
CColTriangle *lasttri = nil;
for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1367,6 +1371,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float dist;
for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1456,7 +1461,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1466,13 +1471,13 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
}
for(i = 0; i < model.numBoxes; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.boxes[i].surface)) continue;
if(ProcessLineBox(*(CColLine*)newline, model.boxes[i], point, coldist))
point.Set(0, 0, model.boxes[i].surface, model.boxes[i].piece);
}
@@ -1484,7 +1489,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CColTriangle *lasttri = nil;
VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1503,7 +1508,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CVuVector pnt, normal;
float dist;
for(; i < model.numTriangles; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1655,16 +1660,16 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matAB *= matrixA;
CVuVector bsphereAB; // bounding sphere of A in B space
- TransformPoint(bsphereAB, matAB, *(RwV3d*)modelA.boundingSphere.center); // inlined
+ TransformPoint(bsphereAB, matAB, modelA.boundingSphere.center); // inlined
bsphereAB.w = modelA.boundingSphere.radius;
if(!TestSphereBox(*(CColSphere*)&bsphereAB, modelB.boundingBox))
return 0;
// transform modelA's spheres and lines to B space
- TransformPoints(aSpheresA, modelA.numSpheres, matAB, (RwV3d*)&modelA.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresA, modelA.numSpheres, matAB, &modelA.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelA.numSpheres; i++)
aSpheresA[i].w = modelA.spheres[i].radius;
- TransformPoints(aLinesA, modelA.numLines*2, matAB, (RwV3d*)&modelA.lines->p0, sizeof(CColLine)/2);
+ TransformPoints(aLinesA, modelA.numLines*2, matAB, &modelA.lines->p0, sizeof(CColLine)/2);
// Test them against model B's bounding volumes
int numSpheresA = 0;
@@ -1681,7 +1686,7 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matBA *= matrixB;
// transform modelB's spheres to A space
- TransformPoints(aSpheresB, modelB.numSpheres, matBA, (RwV3d*)&modelB.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresB, modelB.numSpheres, matBA, &modelB.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelB.numSpheres; i++)
aSpheresB[i].w = modelB.spheres[i].radius;