mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Engine trace cleanup
Separate into different files to make it easier for other classes to access.
This commit is contained in:
parent
1544442cc4
commit
7b669ea8c6
@ -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);
|
||||
REGISTER(VEngineTrace);
|
59
r5dev/public/cmodel.h
Normal file
59
r5dev/public/cmodel.h
Normal file
@ -0,0 +1,59 @@
|
||||
//====== Copyright <20> 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
|
26
r5dev/public/engine/IEngineTrace.h
Normal file
26
r5dev/public/engine/IEngineTrace.h
Normal file
@ -0,0 +1,26 @@
|
||||
//====== Copyright <20> 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
|
33
r5dev/public/gametrace.h
Normal file
33
r5dev/public/gametrace.h
Normal file
@ -0,0 +1,33 @@
|
||||
//====== Copyright <20> 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
|
41
r5dev/public/trace.h
Normal file
41
r5dev/public/trace.h
Normal file
@ -0,0 +1,41 @@
|
||||
//====== Copyright <20> 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
|
@ -289,11 +289,14 @@
|
||||
<ClInclude Include="..\public\avi\ibik.h" />
|
||||
<ClInclude Include="..\public\basehandle.h" />
|
||||
<ClInclude Include="..\public\bitmap\stb_image.h" />
|
||||
<ClInclude Include="..\public\cmodel.h" />
|
||||
<ClInclude Include="..\public\datamap.h" />
|
||||
<ClInclude Include="..\public\dt_common.h" />
|
||||
<ClInclude Include="..\public\dt_recv.h" />
|
||||
<ClInclude Include="..\public\eiface.h" />
|
||||
<ClInclude Include="..\public\engine\ICollideable.h" />
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h" />
|
||||
<ClInclude Include="..\public\gametrace.h" />
|
||||
<ClInclude Include="..\public\iengine.h" />
|
||||
<ClInclude Include="..\public\client_class.h" />
|
||||
<ClInclude Include="..\public\const.h" />
|
||||
@ -332,6 +335,7 @@
|
||||
<ClInclude Include="..\public\rendersystem\schema\texture.g.h" />
|
||||
<ClInclude Include="..\public\studio.h" />
|
||||
<ClInclude Include="..\core\resource.h" />
|
||||
<ClInclude Include="..\public\trace.h" />
|
||||
<ClInclude Include="..\public\utility\binstream.h" />
|
||||
<ClInclude Include="..\public\utility\crashhandler.h" />
|
||||
<ClInclude Include="..\public\utility\httplib.h" />
|
||||
|
@ -1952,6 +1952,18 @@
|
||||
<ClInclude Include="..\game\client\cliententitylist.h">
|
||||
<Filter>sdk\game\client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h">
|
||||
<Filter>sdk\public\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\cmodel.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\gametrace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\trace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -239,11 +239,14 @@
|
||||
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
|
||||
<ClInclude Include="..\public\baseentity.h" />
|
||||
<ClInclude Include="..\public\basehandle.h" />
|
||||
<ClInclude Include="..\public\cmodel.h" />
|
||||
<ClInclude Include="..\public\datamap.h" />
|
||||
<ClInclude Include="..\public\dt_common.h" />
|
||||
<ClInclude Include="..\public\dt_send.h" />
|
||||
<ClInclude Include="..\public\eiface.h" />
|
||||
<ClInclude Include="..\public\engine\ICollideable.h" />
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h" />
|
||||
<ClInclude Include="..\public\gametrace.h" />
|
||||
<ClInclude Include="..\public\iengine.h" />
|
||||
<ClInclude Include="..\public\client_class.h" />
|
||||
<ClInclude Include="..\public\const.h" />
|
||||
@ -272,6 +275,7 @@
|
||||
<ClInclude Include="..\public\server_class.h" />
|
||||
<ClInclude Include="..\public\string_t.h" />
|
||||
<ClInclude Include="..\public\studio.h" />
|
||||
<ClInclude Include="..\public\trace.h" />
|
||||
<ClInclude Include="..\public\utility\binstream.h" />
|
||||
<ClInclude Include="..\public\utility\crashhandler.h" />
|
||||
<ClInclude Include="..\public\utility\httplib.h" />
|
||||
|
@ -1377,6 +1377,18 @@
|
||||
<ClInclude Include="..\game\shared\util_shared.h">
|
||||
<Filter>sdk\game\shared</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h">
|
||||
<Filter>sdk\public\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\cmodel.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\gametrace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\trace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common\opcodes.cpp">
|
||||
|
@ -330,12 +330,15 @@
|
||||
<ClInclude Include="..\public\baseentity.h" />
|
||||
<ClInclude Include="..\public\basehandle.h" />
|
||||
<ClInclude Include="..\public\bitmap\stb_image.h" />
|
||||
<ClInclude Include="..\public\cmodel.h" />
|
||||
<ClInclude Include="..\public\datamap.h" />
|
||||
<ClInclude Include="..\public\dt_common.h" />
|
||||
<ClInclude Include="..\public\dt_recv.h" />
|
||||
<ClInclude Include="..\public\dt_send.h" />
|
||||
<ClInclude Include="..\public\eiface.h" />
|
||||
<ClInclude Include="..\public\engine\ICollideable.h" />
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h" />
|
||||
<ClInclude Include="..\public\gametrace.h" />
|
||||
<ClInclude Include="..\public\iengine.h" />
|
||||
<ClInclude Include="..\public\client_class.h" />
|
||||
<ClInclude Include="..\public\const.h" />
|
||||
@ -381,6 +384,7 @@
|
||||
<ClInclude Include="..\public\string_t.h" />
|
||||
<ClInclude Include="..\public\studio.h" />
|
||||
<ClInclude Include="..\core\resource.h" />
|
||||
<ClInclude Include="..\public\trace.h" />
|
||||
<ClInclude Include="..\public\utility\binstream.h" />
|
||||
<ClInclude Include="..\public\utility\crashhandler.h" />
|
||||
<ClInclude Include="..\public\utility\httplib.h" />
|
||||
|
@ -2108,6 +2108,18 @@
|
||||
<ClInclude Include="..\game\client\cliententitylist.h">
|
||||
<Filter>sdk\game\client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\engine\IEngineTrace.h">
|
||||
<Filter>sdk\public\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\cmodel.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\gametrace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\trace.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user