update files refactor and rebuild
This commit is contained in:
parent
8ede9ca66e
commit
2117f6608c
13 changed files with 324 additions and 314 deletions
|
|
@ -94,6 +94,8 @@ public:
|
||||||
|
|
||||||
### C++ (Metamod plugin)
|
### C++ (Metamod plugin)
|
||||||
|
|
||||||
|
Include header from `public/craytraceinterface.h`
|
||||||
|
|
||||||
``` cpp
|
``` cpp
|
||||||
CRayTraceInterface* g_pRayTrace = nullptr;
|
CRayTraceInterface* g_pRayTrace = nullptr;
|
||||||
bool g_bRayTraceLoaded = false;
|
bool g_bRayTraceLoaded = false;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ namespace RayTraceAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
||||||
public struct TraceOptions
|
public unsafe struct TraceOptions
|
||||||
{
|
{
|
||||||
[FieldOffset(0)] public ulong InteractsAs;
|
[FieldOffset(0)] public ulong InteractsAs;
|
||||||
[FieldOffset(8)] public ulong InteractsWith;
|
[FieldOffset(8)] public ulong InteractsWith;
|
||||||
|
|
@ -89,10 +89,10 @@ namespace RayTraceAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 8)]
|
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||||
public struct CUtlString
|
public unsafe struct CUtlString
|
||||||
{
|
{
|
||||||
public nint _ptr; // make public so Marshal sees it
|
[FieldOffset(0)] public nint _ptr; // make public so Marshal sees it
|
||||||
|
|
||||||
public string Value
|
public string Value
|
||||||
{
|
{
|
||||||
|
|
@ -106,20 +106,22 @@ namespace RayTraceAPI
|
||||||
public static implicit operator string(CUtlString s) => s.Value;
|
public static implicit operator string(CUtlString s) => s.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 200)]
|
||||||
public struct CPhysSurfacePropertiesTrace
|
public unsafe struct CPhysSurfacePropertiesTrace
|
||||||
{
|
{
|
||||||
public CUtlString Name;
|
[FieldOffset(0)] public CUtlString Name;
|
||||||
public uint NameHash;
|
[FieldOffset(8)] public uint NameHash;
|
||||||
public uint BaseNameHash;
|
[FieldOffset(12)] public uint BaseNameHash;
|
||||||
public int ListIndex;
|
[FieldOffset(16)] public int ListIndex;
|
||||||
public int BaseListIndex;
|
[FieldOffset(20)] public int BaseListIndex;
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
|
||||||
|
[MarshalAs(UnmanagedType.I1)] [FieldOffset(24)]
|
||||||
public bool Hidden;
|
public bool Hidden;
|
||||||
public CUtlString Description;
|
|
||||||
public CPhysSurfacePropertiesPhysicsTrace Physics;
|
[FieldOffset(32)] public CUtlString Description;
|
||||||
public CPhysSurfacePropertiesSoundNamesTrace AudioSounds;
|
[FieldOffset(40)] public CPhysSurfacePropertiesPhysicsTrace Physics;
|
||||||
public CPhysSurfacePropertiesAudioTrace AudioParams;
|
[FieldOffset(80)] public CPhysSurfacePropertiesSoundNamesTrace AudioSounds;
|
||||||
|
[FieldOffset(168)] public CPhysSurfacePropertiesAudioTrace AudioParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CollisionFunctionMask_t : byte
|
public enum CollisionFunctionMask_t : byte
|
||||||
|
|
@ -132,17 +134,17 @@ namespace RayTraceAPI
|
||||||
FCOLLISION_FUNC_ENABLE_TOUCH_PERSISTS = (1 << 5),
|
FCOLLISION_FUNC_ENABLE_TOUCH_PERSISTS = (1 << 5),
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 48)]
|
||||||
public struct RnCollisionAttr_t
|
public unsafe struct RnCollisionAttr_t
|
||||||
{
|
{
|
||||||
public ulong InteractsAs;
|
[FieldOffset(0)] public ulong InteractsAs;
|
||||||
public ulong InteractsWith;
|
[FieldOffset(8)] public ulong InteractsWith;
|
||||||
public ulong InteractsExclude;
|
[FieldOffset(16)] public ulong InteractsExclude;
|
||||||
public uint EntityId;
|
[FieldOffset(24)] public uint EntityId;
|
||||||
public uint OwnerId;
|
[FieldOffset(28)] public uint OwnerId;
|
||||||
public ushort HierarchyId;
|
[FieldOffset(32)] public ushort HierarchyId;
|
||||||
public CollisionGroup CollisionGroup;
|
[FieldOffset(36)] public CollisionGroup CollisionGroup;
|
||||||
public CollisionFunctionMask_t CollisionFunctionMask;
|
[FieldOffset(40)] public CollisionFunctionMask_t CollisionFunctionMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RayType_t : byte
|
public enum RayType_t : byte
|
||||||
|
|
@ -154,53 +156,53 @@ namespace RayTraceAPI
|
||||||
RAY_TYPE_MESH,
|
RAY_TYPE_MESH,
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 36)]
|
||||||
public struct CPhysSurfacePropertiesPhysicsTrace
|
public unsafe struct CPhysSurfacePropertiesPhysicsTrace
|
||||||
{
|
{
|
||||||
public float Friction;
|
[FieldOffset(0)] public float Friction;
|
||||||
public float Elasticity;
|
[FieldOffset(4)] public float Elasticity;
|
||||||
public float Density;
|
[FieldOffset(8)] public float Density;
|
||||||
public float Thickness;
|
[FieldOffset(12)] public float Thickness;
|
||||||
public float SoftContactFrequency;
|
[FieldOffset(16)] public float SoftContactFrequency;
|
||||||
public float SoftContactDampingRatio;
|
[FieldOffset(20)] public float SoftContactDampingRatio;
|
||||||
public float WheelDrag;
|
[FieldOffset(24)] public float WheelDrag;
|
||||||
public float HeatConductivity;
|
[FieldOffset(28)] public float HeatConductivity;
|
||||||
public float Flashpoint;
|
[FieldOffset(32)] public float Flashpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 88)]
|
||||||
public struct CPhysSurfacePropertiesSoundNamesTrace
|
public unsafe struct CPhysSurfacePropertiesSoundNamesTrace
|
||||||
{
|
{
|
||||||
public CUtlString ImpactSoft;
|
[FieldOffset(0)] public CUtlString ImpactSoft;
|
||||||
public CUtlString ImpactHard;
|
[FieldOffset(8)] public CUtlString ImpactHard;
|
||||||
public CUtlString ScrapeSmooth;
|
[FieldOffset(16)] public CUtlString ScrapeSmooth;
|
||||||
public CUtlString ScrapeRough;
|
[FieldOffset(24)] public CUtlString ScrapeRough;
|
||||||
public CUtlString BulletImpact;
|
[FieldOffset(32)] public CUtlString BulletImpact;
|
||||||
public CUtlString Rolling;
|
[FieldOffset(40)] public CUtlString Rolling;
|
||||||
public CUtlString Break;
|
[FieldOffset(48)] public CUtlString Break;
|
||||||
public CUtlString Strain;
|
[FieldOffset(56)] public CUtlString Strain;
|
||||||
public CUtlString MeleeImpact;
|
[FieldOffset(64)] public CUtlString MeleeImpact;
|
||||||
public CUtlString PushOff;
|
[FieldOffset(72)] public CUtlString PushOff;
|
||||||
public CUtlString SkidStop;
|
[FieldOffset(80)] public CUtlString SkidStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
||||||
public struct CPhysSurfacePropertiesAudioTrace
|
public unsafe struct CPhysSurfacePropertiesAudioTrace
|
||||||
{
|
{
|
||||||
public float Reflectivity;
|
[FieldOffset(0)] public float Reflectivity;
|
||||||
public float HardnessFactor;
|
[FieldOffset(4)] public float HardnessFactor;
|
||||||
public float RoughnessFactor;
|
[FieldOffset(8)] public float RoughnessFactor;
|
||||||
public float RoughThreshold;
|
[FieldOffset(12)] public float RoughThreshold;
|
||||||
public float HardThreshold;
|
[FieldOffset(16)] public float HardThreshold;
|
||||||
public float HardVelocityThreshold;
|
[FieldOffset(20)] public float HardVelocityThreshold;
|
||||||
public float StaticImpactVolume;
|
[FieldOffset(24)] public float StaticImpactVolume;
|
||||||
public float OcclusionFactor;
|
[FieldOffset(28)] public float OcclusionFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 4)]
|
||||||
public struct CUtlStringToken : IEquatable<CUtlStringToken>
|
public unsafe struct CUtlStringToken : IEquatable<CUtlStringToken>
|
||||||
{
|
{
|
||||||
private uint _hashCode;
|
[FieldOffset(0)] private uint _hashCode;
|
||||||
|
|
||||||
public CUtlStringToken(uint hashCode)
|
public CUtlStringToken(uint hashCode)
|
||||||
{
|
{
|
||||||
|
|
@ -239,34 +241,34 @@ namespace RayTraceAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit, Size = 104)]
|
||||||
public struct CHitBox
|
public unsafe struct CHitBox
|
||||||
{
|
{
|
||||||
public CUtlString m_name; // pointer to CUtlString
|
[FieldOffset(0)] public CUtlString m_name; // pointer to CUtlString
|
||||||
public CUtlString m_sSurfaceProperty; // pointer to CUtlString
|
[FieldOffset(8)] public CUtlString m_sSurfaceProperty; // pointer to CUtlString
|
||||||
public CUtlString m_sBoneName; // pointer to CUtlString
|
[FieldOffset(16)] public CUtlString m_sBoneName; // pointer to CUtlString
|
||||||
|
|
||||||
public Vector3 m_vMinBounds; // blittable
|
[FieldOffset(24)] public Vector3 m_vMinBounds; // blittable
|
||||||
public Vector3 m_vMaxBounds; // blittable
|
[FieldOffset(36)] public Vector3 m_vMaxBounds; // blittable
|
||||||
public float m_flShapeRadius;
|
[FieldOffset(48)] public float m_flShapeRadius;
|
||||||
|
|
||||||
public CUtlStringToken m_nBoneNameHash; // pointer or uint
|
[FieldOffset(52)] public CUtlStringToken m_nBoneNameHash; // pointer or uint
|
||||||
|
|
||||||
public byte m_nShapeType;
|
[FieldOffset(56)] public byte m_nShapeType;
|
||||||
public bool m_bTranslationOnly;
|
[FieldOffset(57)] public bool m_bTranslationOnly;
|
||||||
public uint m_CRC;
|
[FieldOffset(60)] public uint m_CRC;
|
||||||
public uint m_cRenderColor;
|
[FieldOffset(64)] public uint m_cRenderColor;
|
||||||
public ushort m_nHitBoxIndex;
|
[FieldOffset(68)] public ushort m_nHitBoxIndex;
|
||||||
public bool m_bForcedTransform;
|
[FieldOffset(70)] public bool m_bForcedTransform;
|
||||||
|
|
||||||
public CTransform m_forcedTransform; // only if blittable (no managed types inside)
|
[FieldOffset(72)] public CTransform m_forcedTransform; // only if blittable (no managed types inside)
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 16)]
|
[StructLayout(LayoutKind.Explicit, Pack = 16, Size = 32)]
|
||||||
public struct CTransform
|
public unsafe struct CTransform
|
||||||
{
|
{
|
||||||
public Vector4 Position; // VectorAligned: use Vector4 for 16-byte alignment
|
[FieldOffset(0)] public Vector4 Position; // VectorAligned: use Vector4 for 16-byte alignment
|
||||||
public System.Numerics.Quaternion Orientation;
|
[FieldOffset(16)] public System.Numerics.Quaternion Orientation;
|
||||||
|
|
||||||
public CTransform(Vector3 position, System.Numerics.Quaternion orientation)
|
public CTransform(Vector3 position, System.Numerics.Quaternion orientation)
|
||||||
{
|
{
|
||||||
|
|
@ -331,8 +333,8 @@ namespace RayTraceAPI
|
||||||
|
|
||||||
[FieldOffset(56)] public int TriangleIndex;
|
[FieldOffset(56)] public int TriangleIndex;
|
||||||
[FieldOffset(60)] public int HitboxBoneIndex;
|
[FieldOffset(60)] public int HitboxBoneIndex;
|
||||||
[FieldOffset(64)] public int Contents;
|
[FieldOffset(64)] public InteractionLayers Contents;
|
||||||
[FieldOffset(68)] public int RayType;
|
[FieldOffset(68)] public RayType_t RayType;
|
||||||
[FieldOffset(72)] public int AllSolid;
|
[FieldOffset(72)] public int AllSolid;
|
||||||
[FieldOffset(76)] public int ExactHitPoint;
|
[FieldOffset(76)] public int ExactHitPoint;
|
||||||
|
|
||||||
|
|
@ -342,7 +344,6 @@ namespace RayTraceAPI
|
||||||
[FieldOffset(104)] public nint BodyHandle;
|
[FieldOffset(104)] public nint BodyHandle;
|
||||||
[FieldOffset(112)] public nint ShapeHandle;
|
[FieldOffset(112)] public nint ShapeHandle;
|
||||||
|
|
||||||
|
|
||||||
[FieldOffset(128)] public CTransform BodyTransform;
|
[FieldOffset(128)] public CTransform BodyTransform;
|
||||||
[FieldOffset(160)] public RnCollisionAttr_t ShapeAttributes;
|
[FieldOffset(160)] public RnCollisionAttr_t ShapeAttributes;
|
||||||
|
|
||||||
|
|
@ -362,14 +363,21 @@ namespace RayTraceAPI
|
||||||
=> HitboxHandle == 0 ? default : Marshal.PtrToStructure<CHitBox>(HitboxHandle);
|
=> HitboxHandle == 0 ? default : Marshal.PtrToStructure<CHitBox>(HitboxHandle);
|
||||||
|
|
||||||
public CPhysSurfacePropertiesTrace SurfaceProps
|
public CPhysSurfacePropertiesTrace SurfaceProps
|
||||||
=> SurfacePropsHandle == 0 ? default : Marshal.PtrToStructure<CPhysSurfacePropertiesTrace>(SurfacePropsHandle);
|
=> SurfacePropsHandle == 0
|
||||||
|
? default
|
||||||
|
: Marshal.PtrToStructure<CPhysSurfacePropertiesTrace>(SurfacePropsHandle);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public interface CRayTraceInterface
|
public interface CRayTraceInterface
|
||||||
{
|
{
|
||||||
public unsafe bool TraceShape(Vector origin, QAngle angles, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
public unsafe bool TraceShape(Vector origin, QAngle angles, CBaseEntity? ignoreEntity, TraceOptions options,
|
||||||
public unsafe bool TraceEndShape(Vector origin, Vector endOrigin, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
out TraceResult result);
|
||||||
public unsafe bool TraceHullShape(Vector vecStart, Vector vecEnd, Vector hullMins, Vector hullMaxs, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
|
||||||
|
public unsafe bool TraceEndShape(Vector origin, Vector endOrigin, CBaseEntity? ignoreEntity,
|
||||||
|
TraceOptions options, out TraceResult result);
|
||||||
|
|
||||||
|
public unsafe bool TraceHullShape(Vector vecStart, Vector vecEnd, Vector hullMins, Vector hullMaxs,
|
||||||
|
CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Plugin.h"
|
#include "plugin.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "Shared.h"
|
#include "shared.h"
|
||||||
#include "dynlibutils/module.h"
|
#include "dynlibutils/module.h"
|
||||||
#include <entitysystem.h>
|
#include <entitysystem.h>
|
||||||
#include "igameevents.h"
|
#include "igameevents.h"
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <gameconfig.h>
|
#include <gameconfig.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <listeners/Listeners.h>
|
#include <listeners/listeners.h>
|
||||||
#include "CRayTraceInterface.h"
|
#include "craytraceinterface.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "RayTrace.h"
|
#include "raytrace.h"
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
|
|
||||||
#define VERSION_STRING SEMVER " @ " GITHUB_SHA
|
#define VERSION_STRING SEMVER " @ " GITHUB_SHA
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
// Created by Michal Přikryl on 30.08.2025.
|
// Created by Michal Přikryl on 30.08.2025.
|
||||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||||
//
|
//
|
||||||
#include "RayTrace.h"
|
#include "raytrace.h"
|
||||||
#include <Shared.h>
|
#include <shared.h>
|
||||||
#include "schema/CBaseModelEntity.h"
|
#include "schema/CBaseModelEntity.h"
|
||||||
#include "vectorextends.h"
|
#include "vectorextends.h"
|
||||||
#include "dynlibutils/memaddr.h"
|
#include "dynlibutils/memaddr.h"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
#include "gameconfig.h"
|
#include "gameconfig.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <Plugin.h>
|
#include <plugin.h>
|
||||||
|
|
||||||
namespace RayTracePlugin
|
namespace RayTracePlugin
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
// Created by Michal Přikryl on 10.07.2025.
|
// Created by Michal Přikryl on 10.07.2025.
|
||||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||||
//
|
//
|
||||||
#include "Listeners.h"
|
#include "listeners.h"
|
||||||
#include <RayTrace.h>
|
#include <raytrace.h>
|
||||||
#include <Shared.h>
|
#include <shared.h>
|
||||||
#include <tasks.h>
|
#include <tasks.h>
|
||||||
#include <dynlibutils/module.h>
|
#include <dynlibutils/module.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
namespace RayTracePlugin::Paths {
|
namespace RayTracePlugin::Paths {
|
||||||
static std::string gameDirectory;
|
static std::string gameDirectory;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "globaltypes.h"
|
#include "globaltypes.h"
|
||||||
#include "virtual.h"
|
#include "virtual.h"
|
||||||
#include "dynlibutils/module.h"
|
#include "dynlibutils/module.h"
|
||||||
#include "Shared.h"
|
#include "shared.h"
|
||||||
#include "ehandle.h"
|
#include "ehandle.h"
|
||||||
|
|
||||||
using namespace RayTracePlugin;
|
using namespace RayTracePlugin;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
#include "CTimer.h"
|
#include "CTimer.h"
|
||||||
|
|
||||||
#include <Shared.h>
|
#include <shared.h>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
RayTracePlugin
|
RayTracePlugin
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <Shared.h>
|
#include <shared.h>
|
||||||
|
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "Plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
class CGameEntitySystem;
|
class CGameEntitySystem;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Created by Michal Přikryl on 20.09.2025.
|
// Created by Michal Přikryl on 20.09.2025.
|
||||||
// Copyright (c) 2025 slynxcz. All rights reserved.
|
// Copyright (c) 2025 slynxcz. All rights reserved.
|
||||||
//
|
//
|
||||||
#include "Shared.h"
|
#include "shared.h"
|
||||||
#include <icvar.h>
|
#include <icvar.h>
|
||||||
#include <iserver.h>
|
#include <iserver.h>
|
||||||
#include <schemasystem.h>
|
#include <schemasystem.h>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue