diff --git a/mp/src/game/client/detailobjectsystem.cpp b/mp/src/game/client/detailobjectsystem.cpp index 3e211bb03..7275c8608 100644 --- a/mp/src/game/client/detailobjectsystem.cpp +++ b/mp/src/game/client/detailobjectsystem.cpp @@ -1471,25 +1471,6 @@ void CDetailObjectSystem::LevelInitPreEntity() } } - if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() ) - { - // There are detail objects in the level, so precache the material - PrecacheMaterial( DETAIL_SPRITE_MATERIAL ); - IMaterial *pMat = m_DetailSpriteMaterial; - // adjust for non-square textures (cropped) - float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight(); - if ( flRatio > 1.0 ) - { - for( int i = 0; iGetHDRType() != HDR_TYPE_NONE ) { @@ -1512,13 +1493,30 @@ void CDetailObjectSystem::LevelInitPreEntity() void CDetailObjectSystem::LevelInitPostEntity() { - const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL; - C_World *pWorld = GetClientWorldEntity(); - if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) ) + if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() ) { - pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial(); + const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL; + C_World *pWorld = GetClientWorldEntity(); + if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) ) + pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial(); + + m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER ); + PrecacheMaterial( pDetailSpriteMaterial ); + IMaterial *pMat = m_DetailSpriteMaterial; + + // adjust for non-square textures (cropped) + float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight(); + if ( flRatio > 1.0 ) + { + for( int i = 0; i