bool HasContentsGrate( CBaseEntity *pEntity ) { // FIXME: Move this into the GetModelContents() function in base entity // Find the contents based on the model type int nModelType = modelinfo->GetModelType( pEntity->GetModel() ); if ( nModelType == mod_studio ) { CBaseAnimating *pAnim = dynamic_cast<CBaseAnimating *>(pEntity); if ( pAnim != NULL ) { CStudioHdr *pStudioHdr = pAnim->GetModelPtr(); if ( pStudioHdr != NULL && (pStudioHdr->contents() & CONTENTS_GRATE) ) return true; } } else if ( nModelType == mod_brush ) { // Brushes poll their contents differently int contents = modelinfo->GetModelContents( pEntity->GetModelIndex() ); if ( contents & CONTENTS_GRATE ) return true; } return false; }