Revert "Workaround for Gmod ConVars causing a crash"
This reverts commit 1d4db16dd6
.
This commit is contained in:
parent
17a5f973ae
commit
d4da00674b
|
@ -54,7 +54,7 @@
|
||||||
#include "mathlib/vector.h"
|
#include "mathlib/vector.h"
|
||||||
|
|
||||||
// Tier1
|
// Tier1
|
||||||
#include "vjolt_convar.h" // Also includes tier1/tier1.h
|
#include "tier1/tier1.h"
|
||||||
#include "tier1/strtools.h"
|
#include "tier1/strtools.h"
|
||||||
#include "tier1/interface.h"
|
#include "tier1/interface.h"
|
||||||
#ifndef GAME_L4D2_OR_NEWER
|
#ifndef GAME_L4D2_OR_NEWER
|
||||||
|
|
|
@ -27,18 +27,18 @@ static constexpr float kCharacterPadding = 0.02f;
|
||||||
// Also in vjolt_collide.cpp, should unify or just remove entirely
|
// Also in vjolt_collide.cpp, should unify or just remove entirely
|
||||||
static constexpr float kMaxConvexRadius = JPH::cDefaultConvexRadius;
|
static constexpr float kMaxConvexRadius = JPH::cDefaultConvexRadius;
|
||||||
|
|
||||||
static JoltConVar vjolt_trace_debug( "vjolt_trace_debug", "0", FCVAR_CHEAT );
|
static ConVar vjolt_trace_debug( "vjolt_trace_debug", "0", FCVAR_CHEAT );
|
||||||
static JoltConVar vjolt_trace_debug_castray( "vjolt_trace_debug_castray", "0", FCVAR_CHEAT );
|
static ConVar vjolt_trace_debug_castray( "vjolt_trace_debug_castray", "0", FCVAR_CHEAT );
|
||||||
static JoltConVar vjolt_trace_debug_collidepoint( "vjolt_trace_debug_collidepoint", "0", FCVAR_CHEAT );
|
static ConVar vjolt_trace_debug_collidepoint( "vjolt_trace_debug_collidepoint", "0", FCVAR_CHEAT );
|
||||||
static JoltConVar vjolt_trace_debug_castbox( "vjolt_trace_debug_castbox", "0", FCVAR_CHEAT );
|
static ConVar vjolt_trace_debug_castbox( "vjolt_trace_debug_castbox", "0", FCVAR_CHEAT );
|
||||||
static JoltConVar vjolt_trace_debug_collidebox( "vjolt_trace_debug_collidebox", "0", FCVAR_CHEAT );
|
static ConVar vjolt_trace_debug_collidebox( "vjolt_trace_debug_collidebox", "0", FCVAR_CHEAT );
|
||||||
|
|
||||||
// Josh: Enables a hack to make portals work. For some reason when we enable colliding with
|
// Josh: Enables a hack to make portals work. For some reason when we enable colliding with
|
||||||
// backfaces, the player gets easily stuck in all sorts of things!
|
// backfaces, the player gets easily stuck in all sorts of things!
|
||||||
// Slart and I have not been able to determine the root cause of this problem and have tried for a long time...
|
// Slart and I have not been able to determine the root cause of this problem and have tried for a long time...
|
||||||
//
|
//
|
||||||
// Slart: Portal 2 probably passes in a bad winding order in the polyhedron or something, dunno if it affects Portal 1
|
// Slart: Portal 2 probably passes in a bad winding order in the polyhedron or something, dunno if it affects Portal 1
|
||||||
static JoltConVar vjolt_trace_portal_hack( "vjolt_trace_portal_hack", "0", FCVAR_NONE );
|
static ConVar vjolt_trace_portal_hack( "vjolt_trace_portal_hack", "0", FCVAR_NONE );
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
static JoltConVar vjolt_ragdoll_hinge_optimization( "vjolt_ragdoll_hinge_optimization", "1", FCVAR_REPLICATED,
|
static ConVar vjolt_ragdoll_hinge_optimization( "vjolt_ragdoll_hinge_optimization", "1", FCVAR_REPLICATED,
|
||||||
"Optimizes ragdolls to use hinge constraints for joints with 1 degree of freedom. Additionally fixes legs going back on themselves. Currently breaks ragdolls of NPCs killed in a pose (they inherit the pose).");
|
"Optimizes ragdolls to use hinge constraints for joints with 1 degree of freedom. Additionally fixes legs going back on themselves. Currently breaks ragdolls of NPCs killed in a pose (they inherit the pose).");
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
static JoltConVar vjolt_player_collision_tolerance( "vjolt_player_collision_tolerance", "0.05" );
|
static ConVar vjolt_player_collision_tolerance( "vjolt_player_collision_tolerance", "0.05" );
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
static JoltConVar vjolt_vehicle_wheel_debug( "vjolt_vehicle_wheel_debug", "0", FCVAR_CHEAT );
|
static ConVar vjolt_vehicle_wheel_debug( "vjolt_vehicle_wheel_debug", "0", FCVAR_CHEAT );
|
||||||
|
|
||||||
static JoltConVar vjolt_vehicle_throttle_opposition_limit( "vjolt_vehicle_throttle_opposition_limit", "5", FCVAR_NONE,
|
static ConVar vjolt_vehicle_throttle_opposition_limit( "vjolt_vehicle_throttle_opposition_limit", "5", FCVAR_NONE,
|
||||||
"Below what speed should we be attempting to drive/climb with handbrake on to avoid falling down." );
|
"Below what speed should we be attempting to drive/climb with handbrake on to avoid falling down." );
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
#include "cbase.h"
|
|
||||||
|
|
||||||
#ifdef GAME_GMOD
|
|
||||||
JoltConVar::JoltConVar( const char *pName, const char *pDefaultValue, int flags, const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax )
|
|
||||||
{
|
|
||||||
// ConVar stuff
|
|
||||||
m_pszName = pName;
|
|
||||||
m_pszDefaultValue = pDefaultValue;
|
|
||||||
|
|
||||||
SetValue(m_pszDefaultValue);
|
|
||||||
|
|
||||||
m_bHasMin = bMin;
|
|
||||||
m_fMinVal = fMin;
|
|
||||||
m_bHasMax = bMax;
|
|
||||||
m_fMaxVal = fMax;
|
|
||||||
|
|
||||||
// Set the callback
|
|
||||||
m_bUsingNewCommandCallback = true;
|
|
||||||
//m_fnCompletionCallback = JoltConVar_CompletionFunc;
|
|
||||||
m_bHasCompletionCallback = ( m_fnCompletionCallback != 0 );
|
|
||||||
m_bUsingCommandCallbackInterface = false;
|
|
||||||
|
|
||||||
// Setup the rest
|
|
||||||
BaseClass::CreateBase( pName, pHelpString, flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
JoltConVar::~JoltConVar( void )
|
|
||||||
{
|
|
||||||
if (m_pszString) {
|
|
||||||
delete[] m_pszString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void JoltConVar::Dispatch( const CCommand &cmd )
|
|
||||||
{
|
|
||||||
if ( cmd.ArgC() == 1 ) {
|
|
||||||
Msg( "%s: %s\n", m_pszName, GetString() );
|
|
||||||
} else if ( cmd.ArgC() == 2 ) {
|
|
||||||
SetValue( cmd.Arg(1) );
|
|
||||||
Msg( "%s set to %s\n", m_pszName, GetString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int JoltConVar::AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands )
|
|
||||||
{
|
|
||||||
std::string cmd = partial;
|
|
||||||
size_t found = cmd.find_first_of( " " );
|
|
||||||
if ( found ) {
|
|
||||||
cmd = cmd.substr(0, found);
|
|
||||||
}
|
|
||||||
|
|
||||||
commands.AddToTail(( cmd + " " + GetString() ).c_str() );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JoltConVar::SetValueInternal( const char* m_pszValue )
|
|
||||||
{
|
|
||||||
if (m_pszString) {
|
|
||||||
delete[] m_pszString;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_StringLength = V_strlen( m_pszValue ) + 1;
|
|
||||||
m_pszString = new char[m_StringLength];
|
|
||||||
memcpy( m_pszString, m_pszValue, m_StringLength );
|
|
||||||
|
|
||||||
m_fValue = ( float )atof( m_pszString );
|
|
||||||
m_nValue = atoi( m_pszString );
|
|
||||||
}
|
|
||||||
|
|
||||||
void JoltConVar::SetValue( const char* m_pszValue )
|
|
||||||
{
|
|
||||||
SetValueInternal(m_pszValue);
|
|
||||||
|
|
||||||
float m_fClamped = m_fValue;
|
|
||||||
if (m_bHasMin) {
|
|
||||||
m_fClamped = clamp(m_fValue, m_fMinVal, m_fValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_bHasMax) {
|
|
||||||
m_fClamped = clamp(m_fValue, m_fValue, m_fMaxVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_fClamped != m_fValue) {
|
|
||||||
SetValueInternal(std::to_string(m_fClamped).c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,72 +0,0 @@
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "tier1/tier1.h"
|
|
||||||
|
|
||||||
#ifndef JOLTCONVAR_H
|
|
||||||
#define JOLTCONVAR_H
|
|
||||||
|
|
||||||
#ifdef GAME_GMOD
|
|
||||||
class JoltConVar : public ConCommandBase
|
|
||||||
{
|
|
||||||
friend class CCvar;
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef ConCommandBase BaseClass;
|
|
||||||
|
|
||||||
JoltConVar( const char *pName, const char *pDefaultValue, int flags = 0, const char *pHelpString = "", bool bMin = false, float fMin = 0.0, bool bMax = false, float fMax = 0.0 );
|
|
||||||
|
|
||||||
virtual ~JoltConVar( void );
|
|
||||||
|
|
||||||
virtual bool IsCommand( void ) const { return true; };
|
|
||||||
|
|
||||||
virtual int AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands );
|
|
||||||
|
|
||||||
virtual bool CanAutoComplete( void ) { return true; };
|
|
||||||
|
|
||||||
virtual void Dispatch( const CCommand &command );
|
|
||||||
public:
|
|
||||||
virtual float GetFloat(){ return m_fValue; }
|
|
||||||
virtual int GetInt(){ return m_nValue; }
|
|
||||||
virtual bool GetBool() { return !!GetInt(); }
|
|
||||||
virtual const char* GetString() { return m_pszString; }
|
|
||||||
|
|
||||||
virtual void SetValue(const char*);
|
|
||||||
private:
|
|
||||||
union
|
|
||||||
{
|
|
||||||
FnCommandCallbackVoid_t m_fnCommandCallbackV1;
|
|
||||||
FnCommandCallback_t m_fnCommandCallback;
|
|
||||||
ICommandCallback *m_pCommandCallback;
|
|
||||||
};
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
FnCommandCompletionCallback m_fnCompletionCallback;
|
|
||||||
ICommandCompletionCallback *m_pCommandCompletionCallback;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool m_bHasCompletionCallback : 1;
|
|
||||||
bool m_bUsingNewCommandCallback : 1;
|
|
||||||
bool m_bUsingCommandCallbackInterface : 1;
|
|
||||||
private:
|
|
||||||
virtual void SetValueInternal(const char*);
|
|
||||||
|
|
||||||
const char* m_pszName;
|
|
||||||
const char *m_pszDefaultValue;
|
|
||||||
|
|
||||||
char *m_pszString;
|
|
||||||
int m_StringLength;
|
|
||||||
|
|
||||||
float m_fValue;
|
|
||||||
int m_nValue;
|
|
||||||
|
|
||||||
bool m_bHasMin;
|
|
||||||
float m_fMinVal;
|
|
||||||
bool m_bHasMax;
|
|
||||||
float m_fMaxVal;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
#define JoltConVar ConVar
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -25,7 +25,7 @@
|
||||||
#define JOLT_VERTEX_BUFFER_NAME "Jolt Debug Renderer Vertices"
|
#define JOLT_VERTEX_BUFFER_NAME "Jolt Debug Renderer Vertices"
|
||||||
#define JOLT_INDEX_BUFFER_NAME "Jolt Debug Renderer Indices"
|
#define JOLT_INDEX_BUFFER_NAME "Jolt Debug Renderer Indices"
|
||||||
|
|
||||||
static JoltConVar vjolt_debugrender( "vjolt_debugrender", "0", FCVAR_CHEAT );
|
static ConVar vjolt_debugrender( "vjolt_debugrender", "0", FCVAR_CHEAT );
|
||||||
#ifndef VJOLT_USE_PHYSICS_DEBUG_OVERLAY
|
#ifndef VJOLT_USE_PHYSICS_DEBUG_OVERLAY
|
||||||
static ConVar vjolt_debugrender_picture_in_picture( "vjolt_debugrender_picture_in_picture", "1" );
|
static ConVar vjolt_debugrender_picture_in_picture( "vjolt_debugrender_picture_in_picture", "1" );
|
||||||
static ConVar vjolt_debugrender_clear_rt( "vjolt_debugrender_clear_rt", "1" );
|
static ConVar vjolt_debugrender_clear_rt( "vjolt_debugrender_clear_rt", "1" );
|
||||||
|
|
|
@ -49,12 +49,12 @@ static constexpr uint kMaxBodyPairs = kMaxBodies;
|
||||||
// number then these contacts will be ignored and bodies will start interpenetrating / fall through the world.
|
// number then these contacts will be ignored and bodies will start interpenetrating / fall through the world.
|
||||||
static constexpr uint kMaxContactConstraints = kMaxBodies;
|
static constexpr uint kMaxContactConstraints = kMaxBodies;
|
||||||
|
|
||||||
static JoltConVar vjolt_linearcast( "vjolt_linearcast", "1", FCVAR_NONE, "Whether bodies will be created with linear cast motion quality (only takes effect after map restart)." );
|
static ConVar vjolt_linearcast( "vjolt_linearcast", "1", FCVAR_NONE, "Whether bodies will be created with linear cast motion quality (only takes effect after map restart)." );
|
||||||
static JoltConVar vjolt_initial_simulation( "vjolt_initial_simulation", "0", FCVAR_NONE, "Whether to pre-settle physics objects on map load." );
|
static ConVar vjolt_initial_simulation( "vjolt_initial_simulation", "0", FCVAR_NONE, "Whether to pre-settle physics objects on map load." );
|
||||||
|
|
||||||
static JoltConVar vjolt_substeps_collision( "vjolt_substeps_collision", "1", FCVAR_NONE, "Number of collision steps to perform.", true, 0.0f, true, 4.0f );
|
static ConVar vjolt_substeps_collision( "vjolt_substeps_collision", "1", FCVAR_NONE, "Number of collision steps to perform.", true, 0.0f, true, 4.0f );
|
||||||
|
|
||||||
static JoltConVar vjolt_baumgarte_factor( "vjolt_baumgarte_factor", "0.2", FCVAR_NONE, "Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update). Changing this may help with constraint stability. Requires a map restart to change.", true, 0.0f, true, 1.0f );
|
static ConVar vjolt_baumgarte_factor( "vjolt_baumgarte_factor", "0.2", FCVAR_NONE, "Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update). Changing this may help with constraint stability. Requires a map restart to change.", true, 0.0f, true, 1.0f );
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ $Project "$PROJNAME"
|
||||||
$File "vjolt_controller_player.cpp"
|
$File "vjolt_controller_player.cpp"
|
||||||
$File "vjolt_controller_vehicle.cpp"
|
$File "vjolt_controller_vehicle.cpp"
|
||||||
$File "vjolt_controller_shadow.cpp"
|
$File "vjolt_controller_shadow.cpp"
|
||||||
$File "vjolt_convar.cpp"
|
|
||||||
$File "vjolt_debugrender.cpp"
|
$File "vjolt_debugrender.cpp"
|
||||||
$File "vjolt_environment.cpp"
|
$File "vjolt_environment.cpp"
|
||||||
$File "vjolt_friction.cpp"
|
$File "vjolt_friction.cpp"
|
||||||
|
@ -129,7 +128,6 @@ $Project "$PROJNAME"
|
||||||
$File "vjolt_controller_player.h"
|
$File "vjolt_controller_player.h"
|
||||||
$File "vjolt_controller_vehicle.h"
|
$File "vjolt_controller_vehicle.h"
|
||||||
$File "vjolt_controller_shadow.h"
|
$File "vjolt_controller_shadow.h"
|
||||||
$File "vjolt_convar.h"
|
|
||||||
$File "vjolt_debugrender.h"
|
$File "vjolt_debugrender.h"
|
||||||
$File "vjolt_environment.h"
|
$File "vjolt_environment.h"
|
||||||
$File "vjolt_friction.h"
|
$File "vjolt_friction.h"
|
||||||
|
|
Loading…
Reference in New Issue