Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Server/mods/deathmatch/logic/CColCircle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ CColCircle::CColCircle ( CColManager* pManager, CElement* pParent, const CVector
}


CColCircle* CColCircle::Clone ( CColManager* pManager )
{
return new CColCircle ( pManager, this->m_pParent, this->m_vecPosition, this->m_fRadius, this->m_pXMLNode, this->IsPartnered() );
}


bool CColCircle::DoHitDetection ( const CVector& vecNowPosition )
{
// Do a simple distance check between now position and our position
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColCircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CColCircle : public CColShape
public:
CColCircle ( CColManager* pManager, CElement* pParent, const CVector2D& vecPosition, float fRadius, CXMLNode* pNode = NULL, bool bIsPartnered = false );

CColCircle* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_CIRCLE; }
Expand Down
6 changes: 6 additions & 0 deletions Server/mods/deathmatch/logic/CColCuboid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ CColCuboid::CColCuboid ( CColManager* pManager, CElement* pParent, const CVector
}


CColCuboid* CColCuboid::Clone ( CColManager* pManager )
{
return new CColCuboid ( pManager, this->m_pParent, this->m_vecPosition, this->m_vecSize, this->m_pXMLNode );
}


bool CColCuboid::DoHitDetection ( const CVector& vecNowPosition )
{
// FIXME: What about radius?
Expand Down
3 changes: 2 additions & 1 deletion Server/mods/deathmatch/logic/CColCuboid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CColCuboid : public CColShape
{
public:
CColCuboid ( CColManager* pManager, CElement* pParent, const CVector& vecPosition, const CVector& vecSize, CXMLNode* pNode = NULL );


CColCuboid* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_CUBOID; }
Expand Down
8 changes: 8 additions & 0 deletions Server/mods/deathmatch/logic/CColPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ CColPolygon::CColPolygon ( CColManager* pManager, CElement* pParent, const CVect
}


CColPolygon* CColPolygon::Clone ( CColManager* pManager )
{
CColPolygon* pNewCol = new CColPolygon ( pManager, this->m_pParent, this->m_vecPosition, this->m_pXMLNode );
pNewCol->m_Points = this->m_Points;
return pNewCol;
}


bool CColPolygon::DoHitDetection ( const CVector& vecNowPosition )
{
if ( !IsInBounds ( vecNowPosition ) )
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColPolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CColPolygon : public CColShape
public:
CColPolygon ( CColManager* pManager, CElement* pParent, const CVector& vecPosition, CXMLNode* pNode = NULL );

CColPolygon* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_POLYGON; }
Expand Down
6 changes: 6 additions & 0 deletions Server/mods/deathmatch/logic/CColRectangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ CColRectangle::CColRectangle ( CColManager* pManager, CElement* pParent, const C
}


CColRectangle* CColRectangle::Clone ( CColManager* pManager )
{
return new CColRectangle ( pManager, this->m_pParent, this->m_vecPosition, this->m_vecSize, this->m_pXMLNode );
}


bool CColRectangle::DoHitDetection ( const CVector& vecNowPosition )
{
// FIXME: What about radius?
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColRectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CColRectangle : public CColShape
public:
CColRectangle ( CColManager* pManager, CElement* pParent, const CVector2D& vecPosition, const CVector2D& vecSize, CXMLNode* pNode = NULL );

CColRectangle* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_RECTANGLE; }
Expand Down
19 changes: 19 additions & 0 deletions Server/mods/deathmatch/logic/CColShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ CColShape::~CColShape ( void )
}


CColShape* CColShape::Clone ( CColManager* pManager ) {
switch ( this->GetShapeType () ) {
case COLSHAPE_CIRCLE:
return static_cast < CColCircle* > ( this )->Clone ( pManager );
case COLSHAPE_CUBOID:
return static_cast < CColCuboid* > ( this )->Clone ( pManager );
case COLSHAPE_POLYGON:
return static_cast < CColPolygon* > ( this )->Clone ( pManager );
case COLSHAPE_RECTANGLE:
return static_cast < CColRectangle* > ( this )->Clone ( pManager );
case COLSHAPE_SPHERE:
return static_cast < CColSphere* > ( this )->Clone ( pManager );
case COLSHAPE_TUBE:
return static_cast < CColTube* > ( this )->Clone ( pManager );
}
return NULL;
}


void CColShape::Unlink ( void )
{
// Remove us from manager's list
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class CColShape : public CElement
CColShape ( class CColManager* pManager, CElement* pParent, CXMLNode* pNode = NULL, bool bIsPartnered = false );
virtual ~CColShape ( void );

virtual CColShape* Clone ( CColManager* pManager );
virtual eColShapeType GetShapeType ( void ) = 0;

void Unlink ( void );
Expand Down
8 changes: 7 additions & 1 deletion Server/mods/deathmatch/logic/CColSphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ CColSphere::CColSphere ( CColManager* pManager, CElement* pParent, const CVector
}


CColSphere* CColSphere::Clone ( CColManager* pManager )
{
return new CColSphere ( pManager, this->m_pParent, this->m_vecPosition, this->m_fRadius, this->m_pXMLNode, this->IsPartnered() );
}


bool CColSphere::DoHitDetection ( const CVector& vecNowPosition )
{
// Do a simple distance check between now position and our position
Expand All @@ -45,4 +51,4 @@ bool CColSphere::ReadSpecialData ( void )
CSphere CColSphere::GetWorldBoundingSphere ( void )
{
return CSphere ( m_vecPosition, m_fRadius );
}
}
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColSphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CColSphere : public CColShape
public:
CColSphere ( CColManager* pManager, CElement* pParent, const CVector& vecPosition, float fRadius, CXMLNode* pNode = NULL, bool bIsPartnered = false );

CColSphere* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_SPHERE; }
Expand Down
6 changes: 6 additions & 0 deletions Server/mods/deathmatch/logic/CColTube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ CColTube::CColTube ( CColManager* pManager, CElement* pParent, const CVector& ve
}


CColTube* CColTube::Clone ( CColManager* pManager )
{
return new CColTube ( pManager, this->m_pParent, this->m_vecPosition, this->m_fRadius, this->m_fHeight, this->m_pXMLNode );
}


bool CColTube::DoHitDetection ( const CVector& vecNowPosition )
{
// FIXME: What about radius in height?
Expand Down
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CColTube.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CColTube : public CColShape
public:
CColTube ( CColManager* pManager, CElement* pParent, const CVector& vecPosition, float fRadius, float fHeight, CXMLNode* pNode = NULL );

CColTube* Clone ( CColManager* pManager );
virtual CSphere GetWorldBoundingSphere ( void );

eColShapeType GetShapeType ( void ) { return COLSHAPE_TUBE; }
Expand Down
8 changes: 8 additions & 0 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ CElement* CStaticFunctionDefinitions::CloneElement ( CResource* pResource, CElem
case CElement::PICKUP:
case CElement::RADAR_AREA:
case CElement::PATH_NODE_UNUSED:
case CElement::COLSHAPE:
break;
default:
return NULL;
Expand Down Expand Up @@ -512,6 +513,13 @@ CElement* CStaticFunctionDefinitions::CloneElement ( CResource* pResource, CElem
}
break;
}
case CElement::COLSHAPE:
{
CColShape* pColShape = static_cast < CColShape* > ( pElement );

pNewElement = pColShape->Clone ( m_pColManager );
break;
}
}

if ( pNewElement )
Expand Down