diff --git a/Client/mods/deathmatch/logic/CClientColTube.h b/Client/mods/deathmatch/logic/CClientColTube.h index ed6a345f3d..bf773533ca 100644 --- a/Client/mods/deathmatch/logic/CClientColTube.h +++ b/Client/mods/deathmatch/logic/CClientColTube.h @@ -35,6 +35,7 @@ class CClientColTube final : public CClientColShape m_fHeight = fHeight; SizeChanged(); }; + float AdjustSize(float fSize); protected: float m_fRadius; diff --git a/Client/mods/deathmatch/logic/CClientMarker.cpp b/Client/mods/deathmatch/logic/CClientMarker.cpp index 429f8168d9..85178ff15e 100644 --- a/Client/mods/deathmatch/logic/CClientMarker.cpp +++ b/Client/mods/deathmatch/logic/CClientMarker.cpp @@ -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()) @@ -314,7 +319,15 @@ void CClientMarker::SetSize(float fSize) pShape->SetRadius(fSize); break; } + case COLSHAPE_TUBE: + { + CClientColTube* pShape = static_cast(m_pCollision); + pShape->SetRadius(pShape->AdjustSize(fSize)); + pShape->SetHeight(fSize); + break; + } } + m_pMarker->SetSize(fSize); } @@ -469,7 +482,8 @@ 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(), INVALID_ELEMENT_ID, vecOrigin, GetSize()); + + m_pCollision = new CClientColTube(g_pClientGame->GetManager(), INVALID_ELEMENT_ID, vecOrigin, GetSize(), GetSize()); m_pCollision->m_pOwningMarker = this; m_pCollision->SetHitCallback(this); break; diff --git a/Server/mods/deathmatch/logic/CColTube.h b/Server/mods/deathmatch/logic/CColTube.h index 8788de0372..e110b82ef6 100644 --- a/Server/mods/deathmatch/logic/CColTube.h +++ b/Server/mods/deathmatch/logic/CColTube.h @@ -36,6 +36,7 @@ class CColTube : public CColShape m_fHeight = fHeight; SizeChanged(); }; + float AdjustSize(float fSize); protected: bool ReadSpecialData(const int iLine) override; diff --git a/Server/mods/deathmatch/logic/CMarker.cpp b/Server/mods/deathmatch/logic/CMarker.cpp index 5055b01b58..121340dc84 100644 --- a/Server/mods/deathmatch/logic/CMarker.cpp +++ b/Server/mods/deathmatch/logic/CMarker.cpp @@ -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" @@ -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? @@ -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); @@ -416,6 +426,12 @@ void CMarker::UpdateCollisionObject(unsigned char ucOldType) { static_cast(m_pCollision)->SetRadius(m_fSize); } + else if (m_ucType == CMarker::TYPE_CYLINDER) + { + CColTube* pShape = static_cast(m_pCollision); + pShape->SetRadius(pShape->AdjustSize(m_fSize)); + pShape->SetHeight(m_fSize); + } else { static_cast(m_pCollision)->SetRadius(m_fSize);