Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::Precache( void )
{
	for ( int i = 0; i < m_TeamData.Count(); i++ )
	{
		// Skip over spectator
		if ( i == TEAM_SPECTATOR )
			continue;

		if ( m_TeamData[i].iszCapSound != NULL_STRING )
		{
			PrecacheScriptSound( STRING(m_TeamData[i].iszCapSound) );
		}

		if ( m_TeamData[i].iszModel != NULL_STRING )
		{
			PrecacheModel( STRING(m_TeamData[i].iszModel) );
		}

		if ( m_TeamData[i].iszIcon != NULL_STRING )
		{
			PrecacheMaterial( STRING( m_TeamData[i].iszIcon ) );
			m_TeamData[i].iIcon = GetMaterialIndex( STRING( m_TeamData[i].iszIcon ) );
			Assert( m_TeamData[i].iIcon != 0 );
		}

		if ( !m_TeamData[i].iIcon )
		{
			Warning( "Invalid hud icon material for team %d in control point '%s' ( point index %d )\n", i, GetDebugName(), GetPointIndex() );
		}

		if ( m_TeamData[i].iszOverlay != NULL_STRING )
		{
			PrecacheMaterial( STRING( m_TeamData[i].iszOverlay ) );
			m_TeamData[i].iOverlay = GetMaterialIndex( STRING( m_TeamData[i].iszOverlay ) );
			Assert( m_TeamData[i].iOverlay != 0 );

			if ( !m_TeamData[i].iOverlay )
			{
				Warning( "Invalid hud overlay material for team %d in control point '%s' ( point index %d )\n", i, GetDebugName(), GetPointIndex() );
			}
		}
	}

	PrecacheScriptSound( STRING( m_iszCaptureStartSound ) );
	PrecacheScriptSound( STRING( m_iszCaptureEndSound ) );
	PrecacheScriptSound( STRING( m_iszCaptureInProgress ) );
	PrecacheScriptSound( STRING( m_iszCaptureInterrupted ) );

	if ( m_iszWarnSound != NULL_STRING )
	{
		PrecacheScriptSound( STRING( m_iszWarnSound ) );
	}

#if defined (TF_DLL) || defined (TF_CLASSIC)
	PrecacheScriptSound( "Announcer.ControlPointContested" );
	PrecacheScriptSound( "Announcer.ControlPointContested_Neutral" );
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Creates a flame and attaches it to a target entity.
// Input  : pTarget - 
//-----------------------------------------------------------------------------
CEntityParticleTrail *CEntityParticleTrail::Create( CBaseEntity *pTarget, const EntityParticleTrailInfo_t &info, CBaseEntity *pConstraintEntity )
{
	int iMaterialName = GetMaterialIndex( STRING(info.m_strMaterialName) );

	// Look for other particle trails on the entity + copy state to the new entity
	CEntityParticleTrail *pTrail;
	CBaseEntity *pNext;
	for ( CBaseEntity *pChild = pTarget->FirstMoveChild(); pChild; pChild = pNext )
	{
		pNext = pChild->NextMovePeer();
		pTrail = dynamic_cast<CEntityParticleTrail*>(pChild);
		if ( pTrail && (pTrail->m_iMaterialName == iMaterialName) )
		{
			// Prevent destruction if it re-enters the field
			pTrail->IncrementRefCount();
			return pTrail;
		}
	}

	pTrail = (CEntityParticleTrail *)CreateEntityByName( "env_particle_trail" );
	if ( pTrail == NULL )
		return NULL;

	pTrail->m_hConstraintEntity = pConstraintEntity;
	pTrail->m_iMaterialName = iMaterialName;
	pTrail->m_Info.CopyFrom(info);
	pTrail->m_nRefCount = 1;
	pTrail->AttachToEntity( pTarget );
	pTrail->Spawn();
	return pTrail;
}
void SphereColliderComponent::Initialize(void)
{
	if(m_bIsTrigger)
		m_SphereShapeDesc.shapeFlags |= NX_TRIGGER_ENABLE;

	m_SphereShapeDesc.materialIndex = GetMaterialIndex();

	m_pRigidBody->AddShape(&m_SphereShapeDesc);
}
Esempio n. 4
0
ManualObject* OgreNewtonMesh::CreateEntity (const String& name) const
{
	ManualObject* const object = new ManualObject(name);

	int pointCount = GetPointCount();
	int indexCount = GetTotalIndexCount();

	dNewtonScopeBuffer<int> indexList (indexCount);
	dNewtonScopeBuffer<int> remapIndex (indexCount);
	dNewtonScopeBuffer<dNewtonMesh::dPoint> posits (pointCount);
	dNewtonScopeBuffer<dNewtonMesh::dPoint> normals (pointCount);
	dNewtonScopeBuffer<dNewtonMesh::dUV> uv0 (pointCount);
	dNewtonScopeBuffer<dNewtonMesh::dUV> uv1 (pointCount);
	
	GetVertexStreams(&posits[0], &normals[0], &uv0[0], &uv1[0]);

	void* const materialsHandle = BeginMaterialHandle (); 
	for (int handle = GetMaterialIndex (materialsHandle); handle != -1; handle = GetNextMaterialIndex (materialsHandle, handle)) {
		int materialIndex = MaterialGetMaterial (materialsHandle, handle); 
		int indexCount = MaterialGetIndexCount (materialsHandle, handle); 
		MaterialGetIndexStream (materialsHandle, handle, &indexList[0]); 

		MaterialMap::const_iterator materialItr = m_materialMap.find(materialIndex);

		//object->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);
		object->begin(materialItr->second->getName(), Ogre::RenderOperation::OT_TRIANGLE_LIST);
		
		// ogre does not support shared vertex for sub mesh, we will have remap the vertex data
		int vertexCount = 0;
		memset (&remapIndex[0], 0xff, indexCount * sizeof (remapIndex[0]));
		for( int i = 0; i < indexCount; i ++) {
			int index = indexList[i];
			if (remapIndex[index] == -1) {
				remapIndex[index] = vertexCount;
				object->position (posits[index].m_x, posits[index].m_y, posits[index].m_z);
				object->normal (normals[index].m_x, normals[index].m_y, normals[index].m_z);
				object->textureCoord (uv0[index].m_u, uv0[index].m_v);
				vertexCount ++;
			}
			indexList[i] = remapIndex[index];
			
		}

		for (int i = 0; i < indexCount; i += 3) {
			object->triangle (indexList[i + 0], indexList[i + 1], indexList[i + 2]);
		}
		object->end();
	}
	EndMaterialHandle (materialsHandle); 

	return object;
}
Esempio n. 5
0
void CVGuiScreen::SetOverlayMaterial( const char *pMaterial )
{
	int iMaterial = GetMaterialIndex( pMaterial );

	if ( iMaterial == 0 )
	{
		m_nOverlayMaterial = OVERLAY_MATERIAL_INVALID_STRING;
	}
	else
	{
		m_nOverlayMaterial = iMaterial;
	}
}
Esempio n. 6
0
/*************
 * DESCRIPTION:	ON_WM_LBUTTONDBLCLK
 *						handles left mouse button double click
 *						Open Material dialog.
 *						display pop up menu
 * INPUT:			nFlags   Specifies if various flags are set
 *						point    coordinates of mouse cursor
 * OUTPUT:			-
 *************/
void CMatView::OnLButtonDblClk(UINT, CPoint point)
{
    CSurfaceSheet dialog(this);
    int index;

    index = GetMaterialIndex(point);

    if (index >= 0)
    {
        nSelectedMaterial = index;
        OnAttributes();
    }
}
//-----------------------------------------------------------------------------
// Suppression count
//-----------------------------------------------------------------------------
void CEntityParticleTrail::Destroy( CBaseEntity *pTarget, const EntityParticleTrailInfo_t &info )
{
	int iMaterialName = GetMaterialIndex( STRING(info.m_strMaterialName) );

	// Look for the particle trail attached to this entity + decrease refcount
	CBaseEntity *pNext;
	for ( CBaseEntity *pChild = pTarget->FirstMoveChild(); pChild; pChild = pNext )
	{
		pNext = pChild->NextMovePeer();
		CEntityParticleTrail *pTrail = dynamic_cast<CEntityParticleTrail*>(pChild);
		if ( !pTrail || (pTrail->m_iMaterialName != iMaterialName) )
			continue;

		pTrail->DecrementRefCount();
	}
}
void CTeamVisualizationManager::RefreshTeamMaterial( IEntity* pEntity, const bool isAlive, const bool isFriendly ) const
{
	if(ICharacterInstance* pCharInstance =  pEntity->GetCharacter(0))
	{
		const char* pPlayerModelName = pCharInstance->GetFilePath();
		if(pPlayerModelName && pPlayerModelName[0])
		{
			TModelNameCRC modelNameCRC = gEnv->pSystem->GetCrc32Gen()->GetCRC32Lowercase(pPlayerModelName); 
			TModelPartsMap::const_iterator iter = m_teamVisualizationPartsMap.find(modelNameCRC);
			if(iter != m_teamVisualizationPartsMap.end())
			{
				iter->second.ApplyMaterial(pCharInstance, GetMaterialIndex(isAlive, isFriendly));
			}
		}
	}
}
// Render - render this model (only)
//-----------------------------------------------------------------------------
void CPUTModelOGL::Render(CPUTRenderParameters &renderParams, int materialIndex)
{
    CPUTCamera* pCamera = renderParams.mpCamera;
    UpdateBoundsWorldSpace();
    if( renderParams.mDrawModels && !renderParams.mRenderOnlyVisibleModels || !pCamera || pCamera->mFrustum.IsVisible( mBoundingBoxCenterWorldSpace, mBoundingBoxHalfWorldSpace ) )
    {
        UpdateShaderConstants(renderParams);
        // loop over all meshes in this model and draw them
        for(UINT ii=0; ii<mMeshCount; ii++)
        {
            UINT finalMaterialIndex = GetMaterialIndex(ii, materialIndex);
            ASSERT( finalMaterialIndex < mpLayoutCount[ii], _L("material index out of range."));
            CPUTMaterialEffect *pMaterialEffect = (CPUTMaterialEffect*)(mpMaterialEffect[ii][finalMaterialIndex]);

		    mDrawModelCallBackFunc(this, renderParams, mpMesh[ii], pMaterialEffect, NULL, NULL);    
        }
    }
}
Esempio n. 10
0
// Render this model. Render only this model, not its children or siblings.
//-----------------------------------------------------------------------------
void CPUTModelDX11::Render(CPUTRenderParameters &renderParams, int materialIndex)
{
    CPUTRenderParametersDX *pParams = (CPUTRenderParametersDX*)&renderParams;
    CPUTCamera             *pCamera = pParams->mpCamera;

    // TODO: Move bboxDirty to member and set only when model moves.
    bool bboxDirty = true;
    if( bboxDirty )
    {
        UpdateBoundsWorldSpace();
    }

#ifdef SUPPORT_DRAWING_BOUNDING_BOXES 
    if( renderParams.mShowBoundingBoxes && (!pCamera || pCamera->mFrustum.IsVisible( mBoundingBoxCenterWorldSpace, mBoundingBoxHalfWorldSpace )))
    {
        DrawBoundingBox( renderParams );
    }
#endif
    if( !renderParams.mDrawModels ) { return; }

    if( !pParams->mRenderOnlyVisibleModels || !pCamera || pCamera->mFrustum.IsVisible( mBoundingBoxCenterWorldSpace, mBoundingBoxHalfWorldSpace ) )
    {
        // Update the model's constant buffer.
        // Note that the materials reference this, so we need to do it only once for all of the model's meshes.
        UpdateShaderConstants(renderParams);

        // loop over all meshes in this model and draw them
        for(UINT ii=0; ii<mMeshCount; ii++)
        {
            UINT finalMaterialIndex = GetMaterialIndex(ii, materialIndex);
            ASSERT( finalMaterialIndex < mpSubMaterialCount[ii], _L("material index out of range."));
            CPUTMaterialDX11 *pMaterial = (CPUTMaterialDX11*)(mpMaterial[ii][finalMaterialIndex]);
            pMaterial->SetRenderStates(renderParams);

            ((CPUTMeshDX11*)mpMesh[ii])->Draw(renderParams, mpInputLayout[ii][finalMaterialIndex]);
        }
    }
}
Esempio n. 11
0
/*************
 * DESCRIPTION:	ON_WM_RBUTTONDOWN
 *						handles right mouse button click
 *						display pop up menu
 * INPUT:			nFlags   Specifies if various flags are set
 *						point    coordinates of mouse cursor
 * OUTPUT:			-
 *************/
void CMatView::OnRButtonDown(UINT, CPoint point)
{
    CMenu Menu;
    int index;
    BOOL b;

    index = GetMaterialIndex(point);
    if (index != -1)
    {
        nSelectedMaterial = index;
        b = Menu.LoadMenu(IDR_MATERIAL);
    }
    else
        b = Menu.LoadMenu(IDR_MATERIAL_OUTSIDE);

    ClientToScreen(&point);
    if (b)
    {
        CMenu *pSubMenu = Menu.GetSubMenu(0);
        if (pSubMenu != NULL)
            pSubMenu->TrackPopupMenu(TPM_CENTERALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
    }
}
Esempio n. 12
0
void Mesh::LoadMesh(const char* name_mesh)
{
	std::fstream file(name_mesh, std::ios::in);
	char name[1000];
	std::string line;

	Triangle tri;
	glm::vec3 v;
	int a1,a2;
	float w;
	tri.material=0;
	int offset=0;
	

	std::vector<Triangle> triangles;
	std::vector<int>  lodmeshindex_offset;	// for LOD
	std::vector<int>  lodmeshindex_material;// for LOD		

	int normal_id=0,texcoord_id=0,tangent_id=0;
	char buf[50];

	if (!file.is_open())
	{
		sprintf (buf, "File %s not found!\n" ,name_mesh );
		std::cout << buf;
		return;
	}

	while(std::getline(file, line))
	{
		if(sscanf(line.c_str()," <face v1=\"%d\" v2=\"%d\" v3=\"%d\" />",&tri.index[0],&tri.index[1],&tri.index[2] )==3)
		{
			for (int i = 0; i < 3; i++)
			{
				tri.index[i]+=offset;
			}
			triangles.push_back(tri);
		}
		if(sscanf(line.c_str()," <position x=\"%f\" y=\"%f\" z=\"%f\" />",&v.x,&v.y,&v.z )==3)
		{
			Vertex a;
			a.position=v;
			vertices.push_back(a);
		}
		if(sscanf(line.c_str()," <normal x=\"%f\" y=\"%f\" z=\"%f\" />",&v.x,&v.y,&v.z )==3)
			vertices[normal_id++].normal=v;

		if(sscanf(line.c_str()," <texcoord u=\"%f\" v=\"%f\" />",&v.x,&v.y )==2)  
			vertices[texcoord_id++].texcoord=v;

		if(sscanf(line.c_str()," <tangent x=\"%f\" y=\"%f\" z=\"%f\" w=\"%f\"",&v.x,&v.y,&v.z,&w )==4)
			vertices[tangent_id++].tangent=glm::vec4(v.x,v.y,v.z,w);

		if(sscanf(line.c_str()," <vertexboneassignment vertexindex=\"%d\" boneindex=\"%d\" weight=\"%f\" />",&a1,&a2,&w )==3)
		{
			a1+=offset;
			if(a1>=vertices.size())
			{
				std::cerr << "Error!" << std::endl;
				return;
			}

			int i=vertices[a1].count;
			if(i<3)
			{
				vertices[a1].weight[i]=w;
				vertices[a1].boneindex[i]=a2;
				vertices[a1].count++;
			}
		}
		if(sscanf(line.c_str(),"        <submesh material=\"%s\" usesharedvertices",name )==1)
		{
			//if(lodmeshindex_offset.size() != 0)
			// 处理 TLBB 数据的时候, 其并不将顶点数据放在 submesh 内, 因此偏移出错
			if(lodmeshindex_offset.size() != 0 || triangles.size() > 0)
				offset=vertices.size();

			name[strlen(name)-1]=0;
			tri.material=GetMaterialIndex ( name );
			lodmeshindex_offset.push_back(offset);
			lodmeshindex_material.push_back(tri.material);
		}	
		if(sscanf(line.c_str()," <lodfacelist submeshindex=\"%d\" numfaces=",&a1)==1)
		{
			if(a1<0 || a1>=lodmeshindex_offset.size()) 
			{
				std::cerr << "Error!" << std::endl;
				return;
			}
			offset=lodmeshindex_offset[a1];
			tri.material=lodmeshindex_material[a1];
		}
		if(sscanf(line.c_str()," <lodgenerated value=\"%f\">",&w)==1)
		{
			LOD l;l.triangles=triangles;
			lod_meshes.push_back(l);
			triangles.clear();
		} 
	}

	if(lod_meshes.size() == 0)
	{
		LOD l;
		l.triangles = triangles;
		lod_meshes.push_back(l);
		triangles.clear();
	}
}
Esempio n. 13
0
void CBSPMapData_LW::SetFace(vector<CMapFace>* pvecFace, list<LWO2_Layer>::iterator thislayer)
{
	int i;
	WORD j;
	DWORD pnt_index;
	MAPVERTEX vDest;
	SPlane plane;
	LWO2_Object& lwobject = this->m_LWO2Object;
	LWO2_TextureUVMap* pTexuvmap = NULL;
	LWO2_VertexColorMap* pVertexColorMap = NULL;

	int iSurfaceIndex;

	int offset = pvecFace->size();

	// caution : this is a temporary solution. this will not work when multiple PNTS chunks exist
	// in a single layer.
	LWO2_TextureUVMap *pLightmapTextureUVMap = lwobject.FindTextureUVMapByName( "TUV_Lightmap", *thislayer );

	vector<LWO2_Face>& rvecPolygon = thislayer->GetFace();
	int iNumFaces = rvecPolygon.size();

	for(i=0; i<iNumFaces; i++)  // How many faces in the layer
	{
		LWO2_Face& rSrcFace = rvecPolygon[i];

		if( rSrcFace.GetNumPoints() <= 2 )
			continue;

		CMapFace new_face;

		// Find the surface mapped on this face
		LWO2_Surface& rSurf = lwobject.FindSurfaceFromTAG( rSrcFace.GetSurfaceIndex() );
		iSurfaceIndex = lwobject.GetSurfaceIndexFromSurfaceTAG( rSrcFace.GetSurfaceIndex() );

		strcpy( new_face.m_acSurfaceName, rSurf.GetName().c_str() );

		// set material index
		new_face.m_iSurfaceMaterialIndex = GetMaterialIndex( rSurf );


		// if the surface name contains "_NoClip"		
		if( strstr(rSurf.GetName().c_str(),"_NoClip") )
			new_face.RaiseTypeFlag(CMapFace::TYPE_NOCLIP);		// no collision detection against this face
		else
			new_face.ClearTypeFlag(CMapFace::TYPE_NOCLIP);	// usual case

		if( strstr(rSurf.GetName().c_str(),"_Invisible") )	//if the surface name contains "_Invisible"
			new_face.RaiseTypeFlag(CMapFace::TYPE_INVISIBLE);	// this face is not rendered
		else
			new_face.ClearTypeFlag(CMapFace::TYPE_INVISIBLE);	// usual case

		// find the image mapped on this face and get its index
		new_face.m_sTextureID = iSurfaceIndex;

		// The value of TextureID is given as the order of the still image 
		// in vector<m_clipstill> 
		// If a still image is the first element in vector<m_clipstill>, 
		// the TextureID of its owner face is 0

		// The image index of CLIP chunk in LWO2 file starts from 1. Therefore, if a surface doesn't
		// have any image, imagetag of the surface should be 0.  << Is this right?
		// And the 'm_sTextureID' remains -1

		// find the texture uvmap of this face	
		pTexuvmap = lwobject.FindTextureUVMapFromSurface(rSurf, ID_COLR, *thislayer);

		// find the vertex color map applied to this face		
		pVertexColorMap= lwobject.FindVertexColorMapFromSurface(rSurf, *thislayer);

		int iNumPoints = rSrcFace.GetNumPoints();
		for(j=0; j<iNumPoints ;j++)  // the number of points in this face
		{
			memset(&vDest, 0, sizeof(MAPVERTEX));
			vDest.color = 0xFFFFFFFF;	//default vertex color: white and opaque

			pnt_index = rSrcFace.GetVertexIndex()[j];   // the index to a point in the PNTS chunk
			vDest.vPosition = thislayer->GetVertex().at( pnt_index );

			// set texture-uv to the vertex
			// search uv map (VMAP chunk) until the corresponding uv-point is found
			if( pTexuvmap )  // if (pTexuvmap == NULL), we have no uv points for this face
			{
				if( !thislayer->GetUV( vDest.vTex0.u, vDest.vTex0.v, pnt_index, pTexuvmap ) )
				{
					vDest.vTex0.u = 32767;
					vDest.vTex0.v = 32767;
				}
			}

			new_face.m_sLightMapID = -1;
/*			if( pLightmapTextureUVMap )
			{
				if( !thislayer->GetUV( vDest.vTex1.u, vDest.vTex1.v, pnt_index, pLightmapTextureUVMap ) )
				{
					vDest.vTex1.u = -1;
					vDest.vTex1.v = -1;
				}
				else
					new_face.m_sLightMapID = 0;	// TODO: support for multiple lightmap textures
			}*/

			if( pVertexColorMap )
				SetVertexColor( vDest, pnt_index, (DWORD)i, pVertexColorMap );

			if( rSurf.GetMaxSmoothingAngle() < 3.141592f / 2.0f * 89.9f / 90.0f )
				vDest.vNormal = thislayer->GetInterpolatedNormal( rSrcFace, pnt_index );	// smooth shadeing
			else
				vDest.vNormal = rSrcFace.GetFaceNormal();	// flat shading

		//========== normal direction check (visual debugging) =============================================
//			vDest.color = D3DCOLOR_XRGB( abs((int)(vDest.vNormal.x * 250.0f)),
//				                         abs((int)(vDest.vNormal.y * 250.0f)),
//										 abs((int)(vDest.vNormal.z * 250.0f)) );
		//========== normal direction check (visual debugging) =============================================


			new_face.AddMAPVERTEX(vDest);
		}

		new_face.m_sNode = 0;
		new_face.m_bFlag = false;

		if( strstr(rSurf.GetName().c_str(),"_LightSource") )
		{	// mark as a light source
			new_face.RaiseTypeFlag( CMapFace::TYPE_LIGHTSOURCE );
			new_face.RaiseTypeFlag( CMapFace::TYPE_NOCLIP );		// light source faces are not used for collision detection - actually, this is not a good solution
		}


		//========== normal direction check =============================================
//		for(j=0; j<new_face.GetNumVertices()-1; j++)
//		{
//			if( 0.001f < D3DXVec3LengthSq( &(new_face.GetMapVertex(j).vNormal - new_face.GetMapVertex(j+1).vNormal) ) )
//				int iSmoothShadingPolygon = 1;
//		}
		//========== normal direction check =============================================


		pvecFace->push_back( new_face );

	}
}
//-----------------------------------------------------------------------------
// Caches/uncaches resources
//-----------------------------------------------------------------------------
void CPrecacheHandler::CacheResource( PrecacheResourceType_t nType, const char *pName, 
	bool bPrecache, ResourceList_t hResourceList, int *pIndex )
{
	if ( bPrecache )
	{
		if ( pIndex )
		{
			*pIndex = 0;
		}

		switch( nType )
		{
		case VGUI_RESOURCE:
			break;

		case MATERIAL:
			PrecacheMaterial( pName ); 
			if ( pIndex )
			{
				*pIndex = GetMaterialIndex( pName );
			}
			if ( hResourceList != RESOURCE_LIST_INVALID )
			{
				g_pResourceAccessControl->AddResource( hResourceList, RESOURCE_MATERIAL, pName );
			}
			break;

		case PARTICLE_MATERIAL:
			{
#ifdef CLIENT_DLL
				// FIXME: NOTE! This is not 64-bit safe.
				// Hopefully we can remove PARTICLE_MATERIAL soon though.
				// It can go away once we retire the old-style particle system
				int nIndex = (int)( ParticleMgr()->GetPMaterial( pName ) );
#else
				int nIndex = 0;
#endif
				if ( pIndex )
				{
					*pIndex = nIndex;
				}
			}
			break;

		case GAME_MATERIAL_DECALS:
			PrecacheGameMaterialDecals( bPrecache, hResourceList );
			break;

		case PHYSICS_GAMESOUNDS:
			PrecachePhysicsSounds( pName, bPrecache, hResourceList );
			break;

		case DECAL:
			{
				int nIndex = UTIL_PrecacheDecal( pName, true );
				if ( pIndex )
				{
					*pIndex = nIndex;
				}
			}
			break;

		case MODEL:
			{
				int nIndex = CBaseEntity::PrecacheModel( pName );
				if ( pIndex )
				{
					*pIndex = nIndex;
				}
				if ( hResourceList != RESOURCE_LIST_INVALID )
				{
					g_pResourceAccessControl->AddResource( hResourceList, RESOURCE_MODEL, pName );
				}
			}
			break;

		case GAMESOUND:
			{
				int nIndex = CBaseEntity::PrecacheScriptSound( pName );
				if ( pIndex )
				{
					*pIndex = nIndex;
				}
				if ( hResourceList != RESOURCE_LIST_INVALID )
				{
					g_pResourceAccessControl->AddResource( hResourceList, RESOURCE_GAMESOUND, pName );
				}
			}
			break;

		case PARTICLE_SYSTEM:
			PrecacheParticleSystem( pName );
			if ( pIndex )
			{
				*pIndex = GetParticleSystemIndex( pName );
			}
			if ( hResourceList != RESOURCE_LIST_INVALID )
			{
				g_pResourceAccessControl->AddResource( hResourceList, RESOURCE_PARTICLE_SYSTEM, pName );
			}
			break;

		case ENTITY:
			UTIL_PrecacheOther( pName );
			break;

		case SHARED:
			g_pPrecacheSystem->Cache( this, SHARED_SYSTEM, pName, bPrecache, hResourceList, false );
			break;

		case KV_DEP_FILE:
			CacheResourceFile( pName, bPrecache, hResourceList );
			break;
		}
		return;
	}

	// Blat out value
	if ( pIndex )
	{
		*pIndex = 0;
	}

	switch( nType )
	{
	case VGUI_RESOURCE:
		break;
	case MATERIAL:
		break;
	case MODEL:
		break;
	case GAMESOUND:
		break;
	case PARTICLE_SYSTEM:
		break;
	case ENTITY:
		break;
	case DECAL:
		break;
	case KV_DEP_FILE:
		break;
	}
}