diff --git a/r5dev/engine/enginetrace.h b/r5dev/engine/enginetrace.h index 43b1b143..011efe5d 100644 --- a/r5dev/engine/enginetrace.h +++ b/r5dev/engine/enginetrace.h @@ -1,78 +1,13 @@ #pragma once +#include "public/engine/IEngineTrace.h" +#include "public/cmodel.h" +#include "public/trace.h" #include "mathlib/mathlib.h" -// EVERYTHING IN HERE STILL NEEDS TESTING!!!! - -struct Ray_t +class CEngineTrace : public IEngineTrace { - VectorAligned m_Start; - VectorAligned m_Delta; - VectorAligned m_StartOffset; - VectorAligned m_Extents; - char gap2C[0x10]; - void* m_pWorldAxisTransform; - bool m_IsRay; - bool m_IsSwept; - - void Init(Vector3D const& start, Vector3D const& end) - { - m_Delta = end - start; - - m_IsSwept = (m_Delta.LengthSqr() != 0); - - m_Extents.Init(); - - m_pWorldAxisTransform = NULL; - m_IsRay = true; - - m_StartOffset.Init(); - m_Start = start; - } -}; - -struct csurface_t -{ - const char* name; - short surfaceProp; - uint16_t flags; -}; - -struct cplanetrace_t -{ - Vector3D normal; - float dist; -}; - -struct trace_t -{ - Vector3D start; - float unk1; - Vector3D endpos; - float unk2; - cplanetrace_t plane; - float fraction; - int contents; - bool allsolid; - bool startsolid; - char gap3A[0x6]; - csurface_t surface; - float fractionleftsolid; - int hitgroup; - short physicsBone; - char gap5A[0x6]; - void* hit_entity; - int hitbox; - char gap6C[0x114]; -}; //Size: 0x0180 - -class CEngineTrace -{ - virtual void stub_0() const = 0; - virtual void stub_1() const = 0; - virtual void ClipRayToCollideable(__m128* a2, unsigned int a3, __int64* a4, void* a5) = 0; - virtual void TraceRay(const Ray_t& ray, unsigned int fMask, void* tracefilter, trace_t pTrace) = 0; - virtual void TraceRay(const Ray_t& ray, unsigned int fMask, trace_t pTrace) = 0; +public: }; /* ==== CENGINETRACE ======================================================================================================================================================= */ @@ -84,7 +19,7 @@ void CEngineTrace_Attach(); void CEngineTrace_Detach(); /////////////////////////////////////////////////////////////////////////////// -class VEngine_Trace : public IDetour +class VEngineTrace : public IDetour { virtual void GetAdr(void) const { } virtual void GetFun(void) const { } @@ -95,4 +30,4 @@ class VEngine_Trace : public IDetour }; /////////////////////////////////////////////////////////////////////////////// -REGISTER(VEngine_Trace); \ No newline at end of file +REGISTER(VEngineTrace); \ No newline at end of file diff --git a/r5dev/public/cmodel.h b/r5dev/public/cmodel.h new file mode 100644 index 00000000..ccc84d48 --- /dev/null +++ b/r5dev/public/cmodel.h @@ -0,0 +1,59 @@ +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// $NoKeywords: $ +//=============================================================================// + +#ifndef CMODEL_H +#define CMODEL_H +#ifdef _WIN32 +#pragma once +#endif +#include "mathlib/mathlib.h" + +// EVERYTHING IN HERE STILL NEEDS TESTING!!!! + +struct Ray_t +{ + VectorAligned m_Start; + VectorAligned m_Delta; + VectorAligned m_StartOffset; + VectorAligned m_Extents; + char gap2C[0x10]; + void* m_pWorldAxisTransform; + bool m_IsRay; + bool m_IsSwept; + + void Init(Vector3D const& start, Vector3D const& end) + { + m_Delta = end - start; + + m_IsSwept = (m_Delta.LengthSqr() != 0); + + m_Extents.Init(); + + m_pWorldAxisTransform = NULL; + m_IsRay = true; + + m_StartOffset.Init(); + m_Start = start; + } +}; + +struct csurface_t +{ + const char* name; + short surfaceProp; + uint16_t flags; +}; + +struct cplanetrace_t +{ + Vector3D normal; + float dist; +}; + +#endif // CMODEL_H \ No newline at end of file diff --git a/r5dev/public/engine/IEngineTrace.h b/r5dev/public/engine/IEngineTrace.h new file mode 100644 index 00000000..33b28c83 --- /dev/null +++ b/r5dev/public/engine/IEngineTrace.h @@ -0,0 +1,26 @@ +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#ifndef ENGINE_IENGINETRACE_H +#define ENGINE_IENGINETRACE_H +#ifdef _WIN32 +#pragma once +#endif +#include "..\gametrace.h" + +abstract_class IEngineTrace +{ +public: + virtual void stub_0() const = 0; + virtual void stub_1() const = 0; + virtual void ClipRayToCollideable(__m128* a2, unsigned int a3, __int64* a4, void* a5) = 0; + virtual void TraceRay(const Ray_t& ray, unsigned int fMask, void* tracefilter, trace_t pTrace) = 0; + virtual void TraceRay(const Ray_t& ray, unsigned int fMask, trace_t pTrace) = 0; +}; + +#endif // ENGINE_IENGINETRACE_H diff --git a/r5dev/public/gametrace.h b/r5dev/public/gametrace.h new file mode 100644 index 00000000..f83c22be --- /dev/null +++ b/r5dev/public/gametrace.h @@ -0,0 +1,33 @@ +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// +// +// Purpose: +// +//=============================================================================// + +#ifndef GAMETRACE_H +#define GAMETRACE_H +#ifdef _WIN32 +#pragma once +#endif +#include "trace.h" +#include "cmodel.h" + +//----------------------------------------------------------------------------- +// Purpose: A trace is returned when a box is swept through the world +//----------------------------------------------------------------------------- +class CGameTrace : public CBaseTrace +{ + char gap3A[0x4]; + csurface_t surface; + float fractionleftsolid; + int hitgroup; + short physicsBone; + char gap5A[0x6]; + void* hit_entity; // !TODO: CBaseEntity/C_BaseEntity. + int hitbox; + char gap6C[0x114]; +}; +static_assert(sizeof(CGameTrace) == 0x180); +typedef CGameTrace trace_t; + +#endif // GAMETRACE_H diff --git a/r5dev/public/trace.h b/r5dev/public/trace.h new file mode 100644 index 00000000..1ae9a58f --- /dev/null +++ b/r5dev/public/trace.h @@ -0,0 +1,41 @@ +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef TRACE_H +#define TRACE_H + +#ifdef _WIN32 +#pragma once +#endif +#include "mathlib/mathlib.h" +#include "cmodel.h" + +//============================================================================= +// Base Trace Structure +// - shared between engine/game dlls and tools (vrad) +//============================================================================= +class CBaseTrace +{ +public: + Vector3D startpos; + float unk1; + Vector3D endpos; + float unk2; + cplanetrace_t plane; + float fraction; + int contents; + bool allsolid; + bool startsolid; +}; + +#endif // TRACE_H diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 2967f138..775c4029 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -289,11 +289,14 @@ + + + @@ -332,6 +335,7 @@ + diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index de89d058..a2cb256d 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -1952,6 +1952,18 @@ sdk\game\client + + sdk\public\engine + + + sdk\public + + + sdk\public + + + sdk\public + diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj index 052adea5..cb4885bb 100644 --- a/r5dev/vproj/dedicated.vcxproj +++ b/r5dev/vproj/dedicated.vcxproj @@ -239,11 +239,14 @@ + + + @@ -272,6 +275,7 @@ + diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters index 1246239a..e61b8be6 100644 --- a/r5dev/vproj/dedicated.vcxproj.filters +++ b/r5dev/vproj/dedicated.vcxproj.filters @@ -1377,6 +1377,18 @@ sdk\game\shared + + sdk\public\engine + + + sdk\public + + + sdk\public + + + sdk\public + diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj index acbb15a0..4f0b3155 100644 --- a/r5dev/vproj/gamesdk.vcxproj +++ b/r5dev/vproj/gamesdk.vcxproj @@ -330,12 +330,15 @@ + + + @@ -381,6 +384,7 @@ + diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters index 45225760..8d93902a 100644 --- a/r5dev/vproj/gamesdk.vcxproj.filters +++ b/r5dev/vproj/gamesdk.vcxproj.filters @@ -2108,6 +2108,18 @@ sdk\game\client + + sdk\public\engine + + + sdk\public + + + sdk\public + + + sdk\public +