From 2a86970f12b6da24108d409bf7224f6fa7515eda Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 30 Oct 2022 23:38:19 +0100 Subject: [PATCH] Fix Smart Pistol's trajectory trace (laser line) The smart pistol's laser line overlay did not draw after the debug overlay rebuild. After some small debugging, I found out that there was a function that creates the curved trace, and creates an overlay with index 4 (originally swept_box), however, the structure is different to that of swept_box. This is laser_line. Implemented logic for drawing out laser line, which essentially just calls DrawLine (as is the case in the engine). --- r5dev/engine/debugoverlay.cpp | 7 ++++--- r5dev/engine/debugoverlay.h | 36 +++++++++++++++++------------------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/r5dev/engine/debugoverlay.cpp b/r5dev/engine/debugoverlay.cpp index 206b65b6..d242c942 100644 --- a/r5dev/engine/debugoverlay.cpp +++ b/r5dev/engine/debugoverlay.cpp @@ -85,7 +85,7 @@ void DestroyOverlay(OverlayBase_t* pOverlay) case OverlayType_t::OVERLAY_TRIANGLE: pOverlaySize = 6200i64; goto LABEL_MALLOC; - case OverlayType_t::OVERLAY_SWEPT_BOX: + case OverlayType_t::OVERLAY_LASER_LINE: pOverlay->m_Type = OverlayType_t::OVERLAY_UNK1; LeaveCriticalSection(&*s_OverlayMutex); return; @@ -189,9 +189,10 @@ void DrawOverlay(OverlayBase_t* pOverlay) //printf("TRIANGLE %p\n", pOverlay); break; } - case OverlayType_t::OVERLAY_SWEPT_BOX: + case OverlayType_t::OVERLAY_LASER_LINE: { - //printf("SBOX %p\n", pOverlay); + OverlayLaserLine_t* pLaser = static_cast(pOverlay); + v_RenderLine(pLaser->start, pLaser->end, Color(pLaser->r, pLaser->g, pLaser->b, pLaser->a), !pLaser->noDepthTest); break; } case OverlayType_t::OVERLAY_BOX2: diff --git a/r5dev/engine/debugoverlay.h b/r5dev/engine/debugoverlay.h index 4d656df9..92371a79 100644 --- a/r5dev/engine/debugoverlay.h +++ b/r5dev/engine/debugoverlay.h @@ -26,7 +26,7 @@ enum class OverlayType_t OVERLAY_SPHERE, OVERLAY_LINE, OVERLAY_TRIANGLE, - OVERLAY_SWEPT_BOX, + OVERLAY_LASER_LINE, OVERLAY_BOX2, OVERLAY_CAPSULE, OVERLAY_UNK0, @@ -55,19 +55,6 @@ struct OverlayBase_t int m_nFlags{}; // Maybe }; -struct OverlayLine_t : public OverlayBase_t -{ - OverlayLine_t(void) { m_Type = OverlayType_t::OVERLAY_LINE; } - - Vector3D origin{}; - Vector3D dest{}; - int r{}; - int g{}; - int b{}; - int a{}; - bool noDepthTest{}; -}; - struct OverlayBox_t : public OverlayBase_t { OverlayBox_t(void) { m_Type = OverlayType_t::OVERLAY_BOX; } @@ -111,6 +98,19 @@ struct OverlaySphere_t : public OverlayBase_t int a{}; }; +struct OverlayLine_t : public OverlayBase_t +{ + OverlayLine_t(void) { m_Type = OverlayType_t::OVERLAY_LINE; } + + Vector3D origin{}; + Vector3D dest{}; + int r{}; + int g{}; + int b{}; + int a{}; + bool noDepthTest{}; +}; + struct OverlayTriangle_t : public OverlayBase_t { OverlayTriangle_t() { m_Type = OverlayType_t::OVERLAY_TRIANGLE; } @@ -125,19 +125,17 @@ struct OverlayTriangle_t : public OverlayBase_t bool noDepthTest; }; -struct OverlaySweptBox_t : public OverlayBase_t +struct OverlayLaserLine_t : public OverlayBase_t { - OverlaySweptBox_t() { m_Type = OverlayType_t::OVERLAY_SWEPT_BOX; } + OverlayLaserLine_t() { m_Type = OverlayType_t::OVERLAY_LASER_LINE; } Vector3D start; Vector3D end; - Vector3D mins; - Vector3D maxs; - QAngle angles; int r; int g; int b; int a; + bool noDepthTest; }; struct OverlayCapsule_t : public OverlayBase_t