Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions vphysics_jolt/compat/branch_overrides.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@

#pragma once

#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_CHAOS )
#if defined( GAME_STRATA )
#define override_strata override
#define override_not_strata
#else
#define override_strata
#define override_not_strata override
#endif

#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_STRATA )
#define GAME_CSGO_OR_NEWER
#define override_csgo override
#define override_not_csgo
Expand All @@ -19,7 +27,7 @@
#define override_not_gmod override
#endif

#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_CHAOS ) || defined( GAME_PORTAL2 )
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_STRATA ) || defined( GAME_PORTAL2 )
#define GAME_PORTAL2_OR_NEWER
#define override_portal2 override
#define override_not_portal2
Expand All @@ -28,7 +36,7 @@
#define override_not_portal2 override
#endif

#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_CHAOS ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 )
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_STRATA ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 )
#define GAME_L4D2_OR_NEWER
#define override_l4d2 override
#define override_not_l4d2
Expand All @@ -37,7 +45,7 @@
#define override_not_l4d2 override
#endif

#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_CHAOS ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_ASW )
#if defined( GAME_CSGO ) || defined( GAME_DESOLATION ) || defined( GAME_STRATA ) || defined( GAME_PORTAL2 ) || defined( GAME_L4D2 ) || defined( GAME_ASW )
#define GAME_ASW_OR_NEWER
#define override_asw override
#define override_not_asw
Expand Down
11 changes: 11 additions & 0 deletions vphysics_jolt/vjolt_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ JoltPhysicsObject::JoltPhysicsObject( JPH::Body *pBody, JoltPhysicsEnvironment *

JoltPhysicsObject::~JoltPhysicsObject()
{
if ( m_pDestroyCallback )
m_pDestroyCallback( m_pDestroyCallbackData, this );

RemoveShadowController();

// Josh:
Expand Down Expand Up @@ -1042,6 +1045,14 @@ uint32 JoltPhysicsObject::GetCollisionHints() const

//-------------------------------------------------------------------------------------------------

void JoltPhysicsObject::SetDestroyCallback( void(*pCallback)( void*, IPhysicsObject* ), void* pData )
{
m_pDestroyCallback = pCallback;
m_pDestroyCallbackData = pData;
}

//-------------------------------------------------------------------------------------------------

IPredictedPhysicsObject *JoltPhysicsObject::GetPredictedInterface() const
{
Log_Stub( LOG_VJolt );
Expand Down
5 changes: 5 additions & 0 deletions vphysics_jolt/vjolt_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class JoltPhysicsObject final : public IPhysicsObjectInterface
void SetErrorDelta_Position( const Vector& vPosition ) override_csgo {}
void SetErrorDelta_Velocity( const Vector& vVelocity ) override_csgo {}

void SetDestroyCallback( void(*pCallback)( void*, IPhysicsObject* ), void* pData ) override_strata;

public:
JoltPhysicsEnvironment *GetEnvironment() { return m_pEnvironment; }

Expand Down Expand Up @@ -275,6 +277,9 @@ class JoltPhysicsObject final : public IPhysicsObjectInterface
JPH::Body *m_pBody = nullptr; // Underlying Jolt body
JoltPhysicsEnvironment *m_pEnvironment = nullptr; // Physics environment this body belongs to
JPH::PhysicsSystem *m_pPhysicsSystem = nullptr; // Physics system this body belongs to

void (*m_pDestroyCallback)( void*, IPhysicsObject* ) = nullptr;
void *m_pDestroyCallbackData = nullptr;
};

// Josh: This doesn't handle mass change and is kind of a hack and sliightly wrong.
Expand Down
Loading