From ae995e24bfc9516ab408be7b5c497f3a23042f14 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 10 Apr 2023 01:24:51 +0100 Subject: [PATCH] compat: Support for GMod mini-source-sdk --- .github/workflows/artifacts.yml | 2 +- vphysics_jolt/compat/branch_overrides.h | 9 +++++++ vphysics_jolt/vjolt_surfaceprops.cpp | 32 +++++++++++++++++++++++++ vphysics_jolt/vjolt_surfaceprops.h | 7 ++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 37c8c8e..951cfa1 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - source_branch: [sdk2013-sp, sdk2013-mp, asw] + source_branch: [sdk2013-sp, sdk2013-mp, asw, gmod] runs-on: windows-2022 diff --git a/vphysics_jolt/compat/branch_overrides.h b/vphysics_jolt/compat/branch_overrides.h index 05a5c09..956548c 100644 --- a/vphysics_jolt/compat/branch_overrides.h +++ b/vphysics_jolt/compat/branch_overrides.h @@ -10,6 +10,15 @@ #define override_not_csgo override #endif +// GMod SDK2013 x86 branch +#if defined( GAME_GMOD ) +#define override_gmod override +#define override_not_gmod +#else +#define override_gmod +#define override_not_gmod override +#endif + #if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_PORTAL2 ) #define GAME_PORTAL2_OR_NEWER #define override_portal2 override diff --git a/vphysics_jolt/vjolt_surfaceprops.cpp b/vphysics_jolt/vjolt_surfaceprops.cpp index 2dea9af..8e1289a 100644 --- a/vphysics_jolt/vjolt_surfaceprops.cpp +++ b/vphysics_jolt/vjolt_surfaceprops.cpp @@ -234,6 +234,38 @@ KeyValues *JoltPhysicsSurfaceProps::SurfacePropsToKeyValues( const char *pszBuff //------------------------------------------------------------------------------------------------- +void *JoltPhysicsSurfaceProps::GetIVPMaterial( int nIndex ) +{ + Log_Stub( LOG_VJolt ); + return nullptr; +} + +int JoltPhysicsSurfaceProps::GetIVPMaterialIndex( const void *pMaterial ) const +{ + Log_Stub( LOG_VJolt ); + return (int)(uintp)( pMaterial ); +} + +void *JoltPhysicsSurfaceProps::GetIVPManager( void ) +{ + Log_Stub( LOG_VJolt ); + return nullptr; +} + +int JoltPhysicsSurfaceProps::RemapIVPMaterialIndex( int nIndex ) const +{ + Log_Stub( LOG_VJolt ); + return nIndex; +} + +const char *JoltPhysicsSurfaceProps::GetReservedMaterialName( int nMaterialIndex ) const +{ + Log_Stub( LOG_VJolt ); + return "default"; +} + +//------------------------------------------------------------------------------------------------- + JoltPhysicsMaterialIndexSaveOps JoltPhysicsMaterialIndexSaveOps::s_Instance; void JoltPhysicsMaterialIndexSaveOps::Save( const SaveRestoreFieldInfo_t &fieldInfo, ISave *pSave ) diff --git a/vphysics_jolt/vjolt_surfaceprops.h b/vphysics_jolt/vjolt_surfaceprops.h index a4dc6d7..9d6103d 100644 --- a/vphysics_jolt/vjolt_surfaceprops.h +++ b/vphysics_jolt/vjolt_surfaceprops.h @@ -43,6 +43,13 @@ public: ISaveRestoreOps *GetMaterialIndexDataOps() const override_portal2; + // GMod-specific internal gubbins that was exposed in the public interface. + void *GetIVPMaterial( int nIndex ) override_gmod; + int GetIVPMaterialIndex( const void *pMaterial ) const override_gmod; + void *GetIVPManager( void ) override_gmod; + int RemapIVPMaterialIndex( int nIndex ) const override_gmod; + const char *GetReservedMaterialName( int nMaterialIndex ) const override_gmod; + public: static JoltPhysicsSurfaceProps& GetInstance() { return s_PhysicsSurfaceProps; }