//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CPropJeep::CheckWater( void ) { bool bInWater = false; // Check all four wheels. for ( int iWheel = 0; iWheel < JEEP_WHEEL_COUNT; ++iWheel ) { // Get the current wheel and get its contact point. IPhysicsObject *pWheel = m_VehiclePhysics.GetWheel( iWheel ); if ( !pWheel ) continue; // Check to see if we hit water. if ( pWheel->GetContactPoint( &m_WaterData.m_vecWheelContactPoints[iWheel], NULL ) ) { m_WaterData.m_bWheelInWater[iWheel] = ( UTIL_PointContents( m_WaterData.m_vecWheelContactPoints[iWheel] ) & MASK_WATER ) ? true : false; if ( m_WaterData.m_bWheelInWater[iWheel] ) { bInWater = true; } } } // Check the body and the BONNET. int iEngine = LookupAttachment( "vehicle_engine" ); Vector vecEnginePoint; QAngle vecEngineAngles; GetAttachment( iEngine, vecEnginePoint, vecEngineAngles ); m_WaterData.m_bBodyInWater = ( UTIL_PointContents( vecEnginePoint ) & MASK_WATER ) ? true : false; if ( m_WaterData.m_bBodyInWater ) { if ( m_bHasPoop ) { RemoveAllDecals(); m_bHasPoop = false; } if ( !m_VehiclePhysics.IsEngineDisabled() ) { m_VehiclePhysics.SetDisableEngine( true ); } } else { if ( m_VehiclePhysics.IsEngineDisabled() ) { m_VehiclePhysics.SetDisableEngine( false ); } } if ( bInWater ) { // Check the player's water level. CheckWaterLevel(); } return bInWater; }