Skip to content

Commit f5ae77e

Browse files
Synchronize changes from 1.6 master branch [ci skip]
841bf30 Fix cylinder marker colshape and collision radius not matching visual (PR #3436)
2 parents 2c1a4a4 + 841bf30 commit f5ae77e

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

Client/mods/deathmatch/logic/CClientColTube.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CClientColTube final : public CClientColShape
2626
float GetRadius() { return m_fRadius; };
2727
void SetRadius(float fRadius)
2828
{
29-
m_fRadius = fRadius;
29+
m_fRadius = (fRadius / 2.0f) + 0.15f;
3030
SizeChanged();
3131
};
3232
float GetHeight() { return m_fHeight; };

Client/mods/deathmatch/logic/CClientMarker.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,15 @@ void CClientMarker::SetSize(float fSize)
314314
pShape->SetRadius(fSize);
315315
break;
316316
}
317+
case COLSHAPE_TUBE:
318+
{
319+
CClientColTube* pShape = static_cast<CClientColTube*>(m_pCollision);
320+
pShape->SetRadius(fSize);
321+
pShape->SetHeight(fSize);
322+
break;
323+
}
317324
}
325+
318326
m_pMarker->SetSize(fSize);
319327
}
320328

@@ -485,7 +493,8 @@ void CClientMarker::CreateOfType(int iType)
485493
CClient3DMarker* p3DMarker = new CClient3DMarker(this);
486494
p3DMarker->Set3DMarkerType(CClient3DMarker::TYPE_CYLINDER);
487495
m_pMarker = p3DMarker;
488-
m_pCollision = new CClientColCircle(g_pClientGame->GetManager(), INVALID_ELEMENT_ID, vecOrigin, GetSize());
496+
497+
m_pCollision = new CClientColTube(g_pClientGame->GetManager(), INVALID_ELEMENT_ID, vecOrigin, GetSize(), GetSize());
489498
m_pCollision->m_pOwningMarker = this;
490499
m_pCollision->SetHitCallback(this);
491500
break;

Server/mods/deathmatch/logic/CColTube.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CColTube : public CColShape
2727
float GetRadius() { return m_fRadius; };
2828
void SetRadius(float fRadius)
2929
{
30-
m_fRadius = fRadius;
30+
m_fRadius = (fRadius / 2.0f) + 0.15f;
3131
SizeChanged();
3232
};
3333
float GetHeight() { return m_fHeight; };

Server/mods/deathmatch/logic/CMarker.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "CMarkerManager.h"
1515
#include "CColCircle.h"
1616
#include "CColSphere.h"
17+
#include "CColTube.h"
1718
#include "CResource.h"
1819
#include "CLogger.h"
1920
#include "Utils.h"
@@ -398,11 +399,18 @@ void CMarker::UpdateCollisionObject(unsigned char ucOldType)
398399

399400
m_pCollision = new CColCircle(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
400401
}
401-
else if (ucOldType == CMarker::TYPE_CHECKPOINT)
402+
else if (m_ucType == CMarker::TYPE_CYLINDER)
402403
{
403404
if (m_pCollision)
404405
g_pGame->GetElementDeleter()->Delete(m_pCollision);
405406

407+
m_pCollision = new CColTube(m_pColManager, nullptr, m_vecPosition, m_fSize, m_fSize);
408+
}
409+
else if (ucOldType == CMarker::TYPE_CHECKPOINT)
410+
{
411+
if (m_pCollision)
412+
g_pGame->GetElementDeleter()->Delete(m_pCollision);
413+
406414
m_pCollision = new CColSphere(m_pColManager, nullptr, m_vecPosition, m_fSize, true);
407415
}
408416

@@ -416,6 +424,12 @@ void CMarker::UpdateCollisionObject(unsigned char ucOldType)
416424
{
417425
static_cast<CColCircle*>(m_pCollision)->SetRadius(m_fSize);
418426
}
427+
else if (m_ucType == CMarker::TYPE_CYLINDER)
428+
{
429+
CColTube* pShape = static_cast<CColTube*>(m_pCollision);
430+
pShape->SetRadius(m_fSize);
431+
pShape->SetHeight(m_fSize);
432+
}
419433
else
420434
{
421435
static_cast<CColSphere*>(m_pCollision)->SetRadius(m_fSize);

0 commit comments

Comments
 (0)