Skip to content

Commit 2ae6d31

Browse files
authored
Merge branch 'master' into _VeH_39_
2 parents c92f3c1 + a9bfeef commit 2ae6d31

File tree

11 files changed

+226
-78
lines changed

11 files changed

+226
-78
lines changed

Client/loader/CInstallManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ SString CInstallManager::_ShowCrashFailDialog()
432432
strMessage += strReason;
433433
}
434434

435-
const SString moduleName = GetApplicationSetting("diagnostics", "last-crash-module");
436-
const int exceptionCode = GetApplicationSettingInt("diagnostics", "last-crash-code");
435+
// const SString moduleName = GetApplicationSetting("diagnostics", "last-crash-module");
436+
const int exceptionCode = GetApplicationSettingInt("diagnostics", "last-crash-code");
437437

438-
if (exceptionCode == CUSTOM_EXCEPTION_CODE_OOM && moduleName.EndsWithI("\\kernelbase.dll"))
438+
if (exceptionCode == CUSTOM_EXCEPTION_CODE_OOM)
439439
{
440440
strMessage += '\n';
441441
strMessage += _("** Out of memory - this crash was caused by insufficient free or fragmented memory. **");

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/CClientGame.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,6 +2630,8 @@ void CClientGame::AddBuiltInEvents()
26302630
m_Events.AddEvent("onClientElementModelChange", "oldModel, newModel", nullptr, false);
26312631
m_Events.AddEvent("onClientElementDimensionChange", "oldDimension, newDimension", nullptr, false);
26322632
m_Events.AddEvent("onClientElementInteriorChange", "oldInterior, newInterior", nullptr, false);
2633+
m_Events.AddEvent("onClientElementAttach", "attachSource, attachOffsetX, attachOffsetY, attachOffsetZ, attachOffsetRX, attachOffsetRY, attachOffsetRZ", nullptr, false);
2634+
m_Events.AddEvent("onClientElementDetach", "detachSource, detachWorldX, detachWorldY, detachWorldZ, detachWorldRX, detachWorldRY, detachWorldRZ", nullptr, false);
26332635

26342636
// Player events
26352637
m_Events.AddEvent("onClientPlayerJoin", "", NULL, false);

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;

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,35 +1371,64 @@ bool CStaticFunctionDefinitions::AttachElements(CClientEntity& Entity, CClientEn
13711371
RUN_CHILDREN(AttachElements(**iter, AttachedToEntity, vecPosition, vecRotation))
13721372

13731373
// Can these elements be attached?
1374-
if (Entity.IsAttachToable() && AttachedToEntity.IsAttachable() && !AttachedToEntity.IsAttachedToElement(&Entity) &&
1375-
Entity.GetDimension() == AttachedToEntity.GetDimension())
1374+
if (!Entity.IsAttachToable() || !AttachedToEntity.IsAttachable() || AttachedToEntity.IsAttachedToElement(&Entity) ||
1375+
Entity.GetDimension() != AttachedToEntity.GetDimension())
13761376
{
1377-
ConvertDegreesToRadians(vecRotation);
1377+
return false;
1378+
}
13781379

1379-
Entity.SetAttachedOffsets(vecPosition, vecRotation);
1380-
Entity.AttachTo(&AttachedToEntity);
1380+
CLuaArguments Arguments;
1381+
Arguments.PushElement(&AttachedToEntity);
1382+
Arguments.PushNumber(vecPosition.fX);
1383+
Arguments.PushNumber(vecPosition.fY);
1384+
Arguments.PushNumber(vecPosition.fZ);
1385+
Arguments.PushNumber(vecRotation.fX);
1386+
Arguments.PushNumber(vecRotation.fY);
1387+
Arguments.PushNumber(vecRotation.fZ);
1388+
1389+
if (!Entity.CallEvent("onClientElementAttach", Arguments, true))
1390+
return false;
13811391

1382-
return true;
1383-
}
1392+
ConvertDegreesToRadians(vecRotation);
13841393

1385-
return false;
1394+
Entity.SetAttachedOffsets(vecPosition, vecRotation);
1395+
Entity.AttachTo(&AttachedToEntity);
1396+
1397+
return true;
13861398
}
13871399

13881400
bool CStaticFunctionDefinitions::DetachElements(CClientEntity& Entity, CClientEntity* pAttachedToEntity)
13891401
{
13901402
RUN_CHILDREN(DetachElements(**iter, pAttachedToEntity))
13911403

13921404
CClientEntity* pActualAttachedToEntity = Entity.GetAttachedTo();
1393-
if (pActualAttachedToEntity)
1405+
if (!pActualAttachedToEntity || (pAttachedToEntity && pActualAttachedToEntity != pAttachedToEntity))
13941406
{
1395-
if (pAttachedToEntity == NULL || pActualAttachedToEntity == pAttachedToEntity)
1396-
{
1397-
Entity.AttachTo(NULL);
1398-
return true;
1399-
}
1407+
return false;
14001408
}
14011409

1402-
return false;
1410+
CVector vecPosition;
1411+
CVector vecRotation;
1412+
1413+
Entity.GetPosition(vecPosition);
1414+
Entity.GetRotationDegrees(vecRotation);
1415+
1416+
CLuaArguments Arguments;
1417+
Arguments.PushElement(pActualAttachedToEntity);
1418+
Arguments.PushNumber(vecPosition.fX);
1419+
Arguments.PushNumber(vecPosition.fY);
1420+
Arguments.PushNumber(vecPosition.fZ);
1421+
Arguments.PushNumber(vecRotation.fX);
1422+
Arguments.PushNumber(vecRotation.fY);
1423+
Arguments.PushNumber(vecRotation.fZ);
1424+
1425+
if (!Entity.CallEvent("onClientElementDetach", Arguments, true))
1426+
{
1427+
return false;
1428+
}
1429+
1430+
Entity.AttachTo(NULL);
1431+
return true;
14031432
}
14041433

14051434
bool CStaticFunctionDefinitions::SetElementAttachedOffsets(CClientEntity& Entity, CVector& vecPosition, CVector& vecRotation)

Client/mods/deathmatch/logic/rpc/CElementRPCs.cpp

Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -313,32 +313,90 @@ void CElementRPCs::SetElementDimension(CClientEntity* pSource, NetBitStreamInter
313313
void CElementRPCs::AttachElements(CClientEntity* pSource, NetBitStreamInterface& bitStream)
314314
{
315315
ElementID usAttachedToID;
316-
CVector vecPosition, vecRotation;
317-
if (bitStream.Read(usAttachedToID) && bitStream.Read(vecPosition.fX) && bitStream.Read(vecPosition.fY) && bitStream.Read(vecPosition.fZ) &&
318-
bitStream.Read(vecRotation.fX) && bitStream.Read(vecRotation.fY) && bitStream.Read(vecRotation.fZ))
316+
317+
CVector vecPosition;
318+
CVector vecRotation;
319+
320+
if (!(bitStream.Read(usAttachedToID) && bitStream.Read(vecPosition.fX) && bitStream.Read(vecPosition.fY) && bitStream.Read(vecPosition.fZ) &&
321+
bitStream.Read(vecRotation.fX) && bitStream.Read(vecRotation.fY) && bitStream.Read(vecRotation.fZ)))
319322
{
320-
CClientEntity* pAttachedToEntity = CElementIDs::GetElement(usAttachedToID);
321-
if (pAttachedToEntity)
322-
{
323-
pSource->SetAttachedOffsets(vecPosition, vecRotation);
324-
pSource->AttachTo(pAttachedToEntity);
325-
}
323+
return;
324+
}
325+
326+
CClientEntity* pAttachedToEntity = CElementIDs::GetElement(usAttachedToID);
327+
if (!pAttachedToEntity)
328+
{
329+
return;
326330
}
331+
332+
ConvertRadiansToDegrees(vecRotation);
333+
334+
CLuaArguments Arguments;
335+
Arguments.PushElement(pAttachedToEntity);
336+
Arguments.PushNumber(vecPosition.fX);
337+
Arguments.PushNumber(vecPosition.fY);
338+
Arguments.PushNumber(vecPosition.fZ);
339+
Arguments.PushNumber(vecRotation.fX);
340+
Arguments.PushNumber(vecRotation.fY);
341+
Arguments.PushNumber(vecRotation.fZ);
342+
343+
if (!pSource->CallEvent("onClientElementAttach", Arguments, true))
344+
{
345+
return;
346+
}
347+
348+
ConvertDegreesToRadians(vecRotation);
349+
350+
pSource->SetAttachedOffsets(vecPosition, vecRotation);
351+
pSource->AttachTo(pAttachedToEntity);
327352
}
328353

329354
void CElementRPCs::DetachElements(CClientEntity* pSource, NetBitStreamInterface& bitStream)
330355
{
331356
unsigned char ucTimeContext;
332-
if (bitStream.Read(ucTimeContext))
357+
if (!bitStream.Read(ucTimeContext))
333358
{
334-
pSource->SetSyncTimeContext(ucTimeContext);
335-
pSource->AttachTo(NULL);
359+
return;
360+
}
336361

337-
CVector vecPosition;
338-
if (bitStream.Read(vecPosition.fX) && bitStream.Read(vecPosition.fY) && bitStream.Read(vecPosition.fZ))
339-
{
340-
pSource->SetPosition(vecPosition);
341-
}
362+
ElementID usAttachedToID;
363+
CClientEntity* pAttachedToEntity = CElementIDs::GetElement(usAttachedToID);
364+
365+
CVector vecPosition;
366+
CVector vecRotation;
367+
368+
bitStream.Read(vecPosition.fX);
369+
bitStream.Read(vecPosition.fY);
370+
bitStream.Read(vecPosition.fZ);
371+
bitStream.Read(vecRotation.fX);
372+
bitStream.Read(vecRotation.fY);
373+
bitStream.Read(vecRotation.fZ);
374+
375+
CLuaArguments Arguments;
376+
Arguments.PushElement(pAttachedToEntity);
377+
Arguments.PushNumber(vecPosition.fX);
378+
Arguments.PushNumber(vecPosition.fY);
379+
Arguments.PushNumber(vecPosition.fZ);
380+
Arguments.PushNumber(vecRotation.fX);
381+
Arguments.PushNumber(vecRotation.fY);
382+
Arguments.PushNumber(vecRotation.fZ);
383+
384+
if (!pSource->CallEvent("onClientElementDetach", Arguments, true))
385+
{
386+
return;
387+
}
388+
389+
pSource->SetSyncTimeContext(ucTimeContext);
390+
pSource->AttachTo(NULL);
391+
392+
if (vecPosition.fX != 0.0f || vecPosition.fY != 0.0f || vecPosition.fZ != 0.0f)
393+
{
394+
pSource->SetPosition(vecPosition);
395+
}
396+
397+
if (vecRotation.fX != 0.0f || vecRotation.fY != 0.0f || vecRotation.fZ != 0.0f)
398+
{
399+
pSource->SetRotationDegrees(vecRotation);
342400
}
343401
}
344402

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/CGame.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,8 @@ void CGame::AddBuiltInEvents()
16681668
m_Events.AddEvent("onElementModelChange", "oldModel, newModel", NULL, false);
16691669
m_Events.AddEvent("onElementDimensionChange", "oldDimension, newDimension", nullptr, false);
16701670
m_Events.AddEvent("onElementInteriorChange", "oldInterior, newInterior", nullptr, false);
1671+
m_Events.AddEvent("onElementAttach", "attachSource, attachOffsetX, attachOffsetY, attachOffsetZ, attachOffsetRX, attachOffsetRY, attachOffsetRZ", nullptr, false);
1672+
m_Events.AddEvent("onElementDetach", "detachSource, detachWorldX, detachWorldY, detachWorldZ, detachWorldRX, detachWorldRY, detachWorldRZ", nullptr, false);
16711673

16721674
// Radar area events
16731675

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)