diff --git a/sp/src/game/client/detailobjectsystem.cpp b/sp/src/game/client/detailobjectsystem.cpp index 3e211bb03..732679926 100644 --- a/sp/src/game/client/detailobjectsystem.cpp +++ b/sp/src/game/client/detailobjectsystem.cpp @@ -1,3 +1,11 @@ +//---------------------------------- +// CHANGES +// +// Enabled shape support +// Fixed aspect ratio for detail.vbsp +// Allowed vertex lit models +//---------------------------------- + //========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: Draws grasses and other small objects @@ -26,14 +34,10 @@ #include #include "tier0/valve_minmax_on.h" -#if defined(DOD_DLL) || defined(CSTRIKE_DLL) #define USE_DETAIL_SHAPES -#endif -#ifdef USE_DETAIL_SHAPES #include "engine/ivdebugoverlay.h" #include "playerenumerator.h" -#endif #include "materialsystem/imaterialsystemhardwareconfig.h" @@ -1471,24 +1475,7 @@ 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 +1499,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; iLoadModel( lump.m_Name, true ); - // Don't allow vertex-lit models - if (modelinfo->IsModelVertexLit(dict.m_pModel)) - { - Warning("Detail prop model %s is using vertex-lit materials!\nIt must use unlit materials!\n", lump.m_Name ); - dict.m_pModel = (model_t *)engine->LoadModel( "models/error.mdl" ); - } - m_DetailObjectDict.AddToTail( dict ); } }