Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientColTube.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CClientColTube final : public CClientColShape
m_fHeight = fHeight;
SizeChanged();
};
float AdjustSize(float fSize);

protected:
float m_fRadius;
Expand Down
15 changes: 14 additions & 1 deletion Client/mods/deathmatch/logic/CClientMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ float CClientMarker::GetSize() const
return m_pMarker->GetSize();
}

float CClientColTube::AdjustSize(float fSize)
{
return (fSize / 2.0f) + 0.15f;
}

void CClientMarker::SetSize(float fSize)
{
switch (m_pCollision->GetShapeType())
Expand All @@ -314,7 +319,15 @@ void CClientMarker::SetSize(float fSize)
pShape->SetRadius(fSize);
break;
}
case COLSHAPE_TUBE:
{
CClientColTube* pShape = static_cast<CClientColTube*>(m_pCollision);
pShape->SetRadius(pShape->AdjustSize(fSize));
pShape->SetHeight(fSize);
break;
}
}

m_pMarker->SetSize(fSize);
}

Expand Down Expand Up @@ -469,7 +482,7 @@ void CClientMarker::CreateOfType(int iType)
CClient3DMarker* p3DMarker = new CClient3DMarker(this);
p3DMarker->Set3DMarkerType(CClient3DMarker::TYPE_CYLINDER);
m_pMarker = p3DMarker;
m_pCollision = new CClientColCircle(g_pClientGame->GetManager(), NULL, vecOrigin, GetSize());
m_pCollision = new CClientColTube(g_pClientGame->GetManager(), NULL, vecOrigin, GetSize(), GetSize());
m_pCollision->m_pOwningMarker = this;
m_pCollision->SetHitCallback(this);
break;
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 @@ -36,6 +36,7 @@ class CColTube : public CColShape
m_fHeight = fHeight;
SizeChanged();
};
float AdjustSize(float fSize);

protected:
bool ReadSpecialData(const int iLine) override;
Expand Down
24 changes: 20 additions & 4 deletions Server/mods/deathmatch/logic/CMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "CMarkerManager.h"
#include "CColCircle.h"
#include "CColSphere.h"
#include "CColTube.h"
#include "CResource.h"
#include "CLogger.h"
#include "Utils.h"
Expand Down Expand Up @@ -383,6 +384,11 @@ void CMarker::Callback_OnCollisionDestroy(CColShape* pCollision)
m_pCollision = NULL;
}

float CColTube::AdjustSize(float fSize)
{
return (fSize / 2.0f) + 0.15f;
}

void CMarker::UpdateCollisionObject(unsigned char ucOldType)
{
// Different type than before?
Expand All @@ -395,15 +401,19 @@ void CMarker::UpdateCollisionObject(unsigned char ucOldType)
{
if (m_pCollision)
g_pGame->GetElementDeleter()->Delete(m_pCollision);

m_pCollision = new CColCircle(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
m_pCollision = new CColCircle(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
}
else if (m_ucType == CMarker::TYPE_CYLINDER)
{
if (m_pCollision)
g_pGame->GetElementDeleter()->Delete(m_pCollision);
m_pCollision = new CColTube(m_pColManager, nullptr, m_vecPosition, m_fSize, m_fSize);
}
else if (ucOldType == CMarker::TYPE_CHECKPOINT)
{
if (m_pCollision)
g_pGame->GetElementDeleter()->Delete(m_pCollision);

m_pCollision = new CColSphere(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
m_pCollision = new CColSphere(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
}

m_pCollision->SetCallback(this);
Expand All @@ -416,6 +426,12 @@ void CMarker::UpdateCollisionObject(unsigned char ucOldType)
{
static_cast<CColCircle*>(m_pCollision)->SetRadius(m_fSize);
}
else if (m_ucType == CMarker::TYPE_CYLINDER)
{
CColTube* pShape = static_cast<CColTube*>(m_pCollision);
pShape->SetRadius(pShape->AdjustSize(m_fSize));
pShape->SetHeight(m_fSize);
}
else
{
static_cast<CColSphere*>(m_pCollision)->SetRadius(m_fSize);
Expand Down
Loading