@@ -1472,6 +1472,7 @@ void CDetailObjectSystem::LevelInitPreEntity()
14721472 }
14731473 }
14741474
1475+ #ifndef BDSBASE
14751476 if ( m_DetailObjects.Count () || m_DetailSpriteDict.Count () )
14761477 {
14771478 // There are detail objects in the level, so precache the material
@@ -1490,6 +1491,7 @@ void CDetailObjectSystem::LevelInitPreEntity()
14901491 }
14911492 }
14921493 }
1494+ #endif
14931495
14941496 int detailPropLightingLump;
14951497 if ( g_pMaterialSystemHardwareConfig->GetHDRType () != HDR_TYPE_NONE )
@@ -1513,13 +1515,40 @@ void CDetailObjectSystem::LevelInitPreEntity()
15131515
15141516void CDetailObjectSystem::LevelInitPostEntity ()
15151517{
1518+ #ifdef BDSBASE
1519+ if (m_DetailObjects.Count () || m_DetailSpriteDict.Count ())
1520+ {
1521+ const char * pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
1522+ C_World* pWorld = GetClientWorldEntity ();
1523+ if (pWorld && pWorld->GetDetailSpriteMaterial () && *(pWorld->GetDetailSpriteMaterial ()))
1524+ pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial ();
1525+
1526+ m_DetailSpriteMaterial.Init (pDetailSpriteMaterial, TEXTURE_GROUP_OTHER);
1527+ PrecacheMaterial (pDetailSpriteMaterial);
1528+ IMaterial* pMat = m_DetailSpriteMaterial;
1529+
1530+ // adjust for non-square textures (cropped)
1531+ float flRatio = pMat->GetMappingWidth () / pMat->GetMappingHeight ();
1532+ if (flRatio > 1.0 )
1533+ {
1534+ for (int i = 0 ; i < m_DetailSpriteDict.Count (); i++)
1535+ {
1536+ m_DetailSpriteDict[i].m_TexUL .y *= flRatio;
1537+ m_DetailSpriteDict[i].m_TexLR .y *= flRatio;
1538+ m_DetailSpriteDictFlipped[i].m_TexUL .y *= flRatio;
1539+ m_DetailSpriteDictFlipped[i].m_TexLR .y *= flRatio;
1540+ }
1541+ }
1542+ }
1543+ #else
15161544 const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
15171545 C_World *pWorld = GetClientWorldEntity ();
15181546 if ( pWorld && pWorld->GetDetailSpriteMaterial () && *(pWorld->GetDetailSpriteMaterial ()) )
15191547 {
15201548 pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial ();
15211549 }
15221550 m_DetailSpriteMaterial.Init ( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
1551+ #endif
15231552
15241553 if ( GetDetailController () )
15251554 {
0 commit comments