diff options
Diffstat (limited to 'src/collision/Collision.cpp')
-rw-r--r-- | src/collision/Collision.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp index 703804d9..bead5183 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 §) @@ -880,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, @@ -2101,12 +2099,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin float dot = DotProduct(*point - *l0, *l1 - *l0); // Between 0 and len we're above the line. // if not, calculate distance to endpoint - if(dot <= 0.0f) - return (*point - *l0).Magnitude(); - if(dot >= lensq) - return (*point - *l1).Magnitude(); + if(dot <= 0.0f) return (*point - *l0).Magnitude(); + if(dot >= lensq) return (*point - *l1).Magnitude(); // distance to line - return Sqrt((*point - *l0).MagnitudeSqr() - dot*dot/lensq); + float distSqr = (*point - *l0).MagnitudeSqr() - dot * dot / lensq; + if(distSqr <= 0.f) return 0.f; + return Sqrt(distSqr); } // same as above but also return the point on the line @@ -2573,4 +2571,4 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel, RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); -}
\ No newline at end of file +} |