Пример #1
0
void CWeaponHL2MPBase::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if ( GetPredictable() && !ShouldPredict() )
		ShutdownPredictable();
}
Пример #2
0
	void CWeaponDODBase::OnDataChanged( DataUpdateType_t type )
	{
		if ( m_iState == WEAPON_NOT_CARRIED && m_iOldState != WEAPON_NOT_CARRIED ) 
		{
			// we are being notified of the weapon being dropped
			// add an interpolation history so the movement is smoother

			// Now stick our initial velocity into the interpolation history 
			CInterpolatedVar< Vector > &interpolator = GetOriginInterpolator();

			interpolator.ClearHistory();
			float changeTime = GetLastChangeTime( LATCH_SIMULATION_VAR );

			// Add a sample 1 second back.
			Vector vCurOrigin = GetLocalOrigin() - m_vInitialDropVelocity;
			interpolator.AddToHead( changeTime - 1.0, &vCurOrigin, false );

			// Add the current sample.
			vCurOrigin = GetLocalOrigin();
			interpolator.AddToHead( changeTime, &vCurOrigin, false );

			Vector estVel;
			EstimateAbsVelocity( estVel );

			/*Msg( "estimated velocity ( %.1f %.1f %.1f )  initial velocity ( %.1f %.1f %.1f )\n",
				estVel.x,
				estVel.y,
				estVel.z,
				m_vInitialDropVelocity.m_Value.x,
				m_vInitialDropVelocity.m_Value.y,
				m_vInitialDropVelocity.m_Value.z );*/

			OnWeaponDropped();
		}

		BaseClass::OnDataChanged( type );

		if ( GetPredictable() && !ShouldPredict() )
			ShutdownPredictable();
	}
Пример #3
0
void C_ASW_Hack::PostDataUpdate( DataUpdateType_t updateType )
{
	bool bPredict = ShouldPredict();
	if ( bPredict )
	{
		SetSimulatedEveryTick( true );	
		SetPredictionEligible( true );
	}
	else
	{
		SetSimulatedEveryTick( false );
		SetPredictionEligible( false );
	}

	BaseClass::PostDataUpdate( updateType );

	if ( GetPredictable() && !bPredict )
	{
		MDLCACHE_CRITICAL_SECTION();
		ShutdownPredictable();
	}
}
Пример #4
0
void CUnitBase::PhysicsSimulate( void )
{
#ifdef CLIENT_DLL
	if (ShouldPredict())
	{
		m_nSimulationTick = gpGlobals->tickcount;
		return;
	}
#else
	//NDebugOverlay::Box( GetAbsOrigin(), Vector(-16, -16, -16), Vector(16, 24, 16), 0, 255, 0, 255, 0.1f);
#endif // CLIENT_DLL

	if( GetMoveType() != MOVETYPE_WALK )
	{
		BaseClass::PhysicsSimulate();
		return;
	}

	// Run all but the base think function
	PhysicsRunThink( THINK_FIRE_ALL_BUT_BASE );
	PhysicsRunThink( THINK_FIRE_BASE_ONLY );
}