mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-03 05:49:41 +03:00
physics: fix a lot of problems
This commit is contained in:
@@ -150,8 +150,8 @@ C_SteamJet::C_SteamJet()
|
||||
m_bFaceLeft = false;
|
||||
m_ParticleEffect.SetAlwaysSimulate( false ); // Don't simulate outside the PVS or frustum.
|
||||
|
||||
m_vLastRampUpdatePos.Init( 1e16, 1e16, 1e16 );
|
||||
m_vLastRampUpdateAngles.Init( 1e16, 1e16, 1e16 );
|
||||
m_vLastRampUpdatePos.Init( 1e24, 1e24, 1e24 );
|
||||
m_vLastRampUpdateAngles.Init( 1e24, 1e24, 1e24 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ struct CInterpolatedVarEntryBase<Type, false>
|
||||
{
|
||||
Assert(maxCount==1);
|
||||
}
|
||||
Type *NewEntry( const Type *pValue, int maxCount, float time )
|
||||
Type *NewEntry( Type *pValue, int maxCount, float time )
|
||||
{
|
||||
Assert(maxCount==1);
|
||||
changetime = time;
|
||||
|
||||
@@ -125,8 +125,8 @@ inline CParticleRenderIterator::CParticleRenderIterator()
|
||||
m_bGotFirst = false;
|
||||
m_flPrevZ = 0;
|
||||
m_nParticlesInCurrentBatch = 0;
|
||||
m_MinZ = 1e16;
|
||||
m_MaxZ = -1e16;
|
||||
m_MinZ = 1e24;
|
||||
m_MaxZ = -1e24;
|
||||
m_nZCoords = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ void CMCVMinimapPanel::OnMousePressed( vgui::MouseCode code )
|
||||
|
||||
// Find the closest MCV to their mouse press.
|
||||
int iClosest = -1;
|
||||
float flClosest = 1e16;
|
||||
float flClosest = 1e24;
|
||||
Vector2D curMousePos( m_LastX, m_LastY );
|
||||
|
||||
for ( int i=0; i < pPanel->m_DeployedTeleportStations.Count(); i++ )
|
||||
|
||||
@@ -79,7 +79,7 @@ IPhysicsObject *PhysModelCreateCustom( C_BaseEntity *pEntity, const CPhysCollide
|
||||
solid_t solid;
|
||||
solid.params = g_PhysDefaultObjectParams;
|
||||
solid.params.mass = 85.0f;
|
||||
solid.params.inertia = 1e16f;
|
||||
solid.params.inertia = 1e24f;
|
||||
int surfaceProp = -1;
|
||||
if ( props && props[0] )
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ static float g_PhysAverageSimTime;
|
||||
CCallQueue g_PostSimulationQueue;
|
||||
|
||||
|
||||
// local routines
|
||||
// local roeutines
|
||||
static IPhysicsObject *PhysCreateWorld( CBaseEntity *pWorld );
|
||||
static void PhysFrame( float deltaTime );
|
||||
static bool IsDebris( int collisionGroup );
|
||||
@@ -1689,6 +1689,7 @@ void PhysFrame( float deltaTime )
|
||||
float simRealTime = 0;
|
||||
|
||||
deltaTime *= phys_timescale.GetFloat();
|
||||
|
||||
// !!!HACKHACK -- hard limit scaled time to avoid spending too much time in here
|
||||
// Limit to 100 ms
|
||||
if ( deltaTime > 0.100f )
|
||||
@@ -1709,10 +1710,9 @@ void PhysFrame( float deltaTime )
|
||||
g_Collisions.BufferTouchEvents( true );
|
||||
#endif
|
||||
|
||||
physenv->Simulate( deltaTime );
|
||||
|
||||
int activeCount = physenv->GetActiveObjectCount();
|
||||
IPhysicsObject **pActiveList = NULL;
|
||||
#if 0
|
||||
if ( activeCount )
|
||||
{
|
||||
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
|
||||
@@ -1721,6 +1721,26 @@ void PhysFrame( float deltaTime )
|
||||
for ( int i = 0; i < activeCount; i++ )
|
||||
{
|
||||
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
|
||||
OutputVPhysicsDebugInfo(pEntity);
|
||||
}
|
||||
stackfree( pActiveList );
|
||||
}
|
||||
#endif
|
||||
|
||||
physenv->Simulate( deltaTime );
|
||||
|
||||
activeCount = physenv->GetActiveObjectCount();
|
||||
pActiveList = NULL;
|
||||
|
||||
if ( activeCount )
|
||||
{
|
||||
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
|
||||
physenv->GetActiveObjects( pActiveList );
|
||||
|
||||
for ( int i = 0; i < activeCount; i++ )
|
||||
{
|
||||
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
|
||||
// OutputVPhysicsDebugInfo(pEntity);
|
||||
if ( pEntity )
|
||||
{
|
||||
if ( pEntity->CollisionProp()->DoesVPhysicsInvalidateSurroundingBox() )
|
||||
@@ -1948,7 +1968,7 @@ void CCollisionEvent::Friction( IPhysicsObject *pObject, float energy, int surfa
|
||||
if ( pEntity )
|
||||
{
|
||||
friction_t *pFriction = g_Collisions.FindFriction( pEntity );
|
||||
|
||||
|
||||
if ( pFriction && pFriction->pObject)
|
||||
{
|
||||
// in MP mode play sound and effects once every 500 msecs,
|
||||
|
||||
@@ -8014,7 +8014,7 @@ void CBasePlayer::SetupVPhysicsShadow( const Vector &vecAbsOrigin, const Vector
|
||||
Q_strncpy( solid.surfaceprop, "player", sizeof(solid.surfaceprop) );
|
||||
solid.params = g_PhysDefaultObjectParams;
|
||||
solid.params.mass = 85.0f;
|
||||
solid.params.inertia = 1e16f;
|
||||
solid.params.inertia = 1e24f;
|
||||
solid.params.enableCollisions = false;
|
||||
//disable drag
|
||||
solid.params.dragCoefficient = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ bool COrderHeal::CreateOrder( CPlayerClass *pClass )
|
||||
ORDER_HEAL,
|
||||
pTeam->GetPlayer( sorted[0] ),
|
||||
pClass->GetPlayer(),
|
||||
1e16,
|
||||
1e24,
|
||||
60,
|
||||
pOrder );
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ bool OrderCreator_ResourceZoneObject(
|
||||
ORDER_BUILD,
|
||||
pClosest,
|
||||
pPlayer,
|
||||
1e16,
|
||||
1e24,
|
||||
60,
|
||||
pOrder
|
||||
);
|
||||
|
||||
@@ -95,7 +95,7 @@ bool COrderKillMortarGuy::CreateOrder( CPlayerClass *pClass )
|
||||
ORDER_KILL,
|
||||
pBrian,
|
||||
pClass->GetPlayer(),
|
||||
1e16,
|
||||
1e24,
|
||||
60,
|
||||
pOrder
|
||||
);
|
||||
|
||||
@@ -61,7 +61,7 @@ bool COrderMortarAttack::CreateOrder( CPlayerClass *pClass )
|
||||
ORDER_MORTAR_ATTACK,
|
||||
pEnt,
|
||||
pPlayer,
|
||||
1e16,
|
||||
1e24,
|
||||
40,
|
||||
pOrder
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@ bool COrderRepair::CreateOrder_RepairFriendlyObjects( CPlayerClassDefender *pCla
|
||||
ORDER_REPAIR,
|
||||
pObjToHeal,
|
||||
pPlayer,
|
||||
1e16,
|
||||
1e24,
|
||||
60,
|
||||
pOrder
|
||||
);
|
||||
@@ -130,7 +130,7 @@ bool COrderRepair::CreateOrder_RepairOwnObjects( CPlayerClass *pClass )
|
||||
ORDER_REPAIR,
|
||||
pObj,
|
||||
info.m_pPlayer,
|
||||
1e16,
|
||||
1e24,
|
||||
60,
|
||||
pOrder
|
||||
);
|
||||
|
||||
@@ -177,7 +177,7 @@ void CObjectBarbedWire::StartPlacement( CBaseTFPlayer *pPlayer )
|
||||
if ( pPlayer && !m_hConnectedTo )
|
||||
{
|
||||
// Automatically connect to the nearest barbed wire on our team.
|
||||
float flClosest = 1e16;
|
||||
float flClosest = 1e24;
|
||||
CObjectBarbedWire *pClosest = NULL;
|
||||
|
||||
CBaseEntity *pCur = gEntList.FirstEnt();
|
||||
|
||||
@@ -1041,7 +1041,7 @@ void CPlayerClass::InitVCollision( void )
|
||||
solid_t solid;
|
||||
solid.params = g_PhysDefaultObjectParams;
|
||||
solid.params.mass = 85.0f;
|
||||
solid.params.inertia = 1e16f;
|
||||
solid.params.inertia = 1e24f;
|
||||
solid.params.enableCollisions = false;
|
||||
//disable drag
|
||||
solid.params.dragCoefficient = 0;
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
int iOrderType,
|
||||
CBaseEntity *pTarget,
|
||||
CBaseTFPlayer *pPlayer = NULL,
|
||||
float flDistanceToRemove = 1e16,
|
||||
float flDistanceToRemove = 1e24,
|
||||
float flLifetime = 60,
|
||||
COrder *pDefaultOrder = NULL // If this is specified, then it is used instead of
|
||||
// asking COrder to allocate an order.
|
||||
|
||||
@@ -478,7 +478,7 @@ void PhysGetDefaultAABBSolid( solid_t &solid )
|
||||
{
|
||||
solid.params = g_PhysDefaultObjectParams;
|
||||
solid.params.mass = 85.0f;
|
||||
solid.params.inertia = 1e16f;
|
||||
solid.params.inertia = 1e24f;
|
||||
Q_strncpy( solid.surfaceprop, "default", sizeof( solid.surfaceprop ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user