@@ -536,12 +536,12 @@ bool CStaticProp::Init( int index, StaticPropLump_t &lump, model_t *pModel )
536536 m_Flags = ( lump.m_Flags & (STATIC_PROP_SCREEN_SPACE_FADE | STATIC_PROP_FLAG_FADES | STATIC_PROP_NO_PER_VERTEX_LIGHTING) );
537537
538538 int nCurrentDXLevel = g_pMaterialSystemHardwareConfig->GetDXSupportLevel ();
539- /* bool bNoDraw = ( lump.m_nMinDXLevel && lump.m_nMinDXLevel > nCurrentDXLevel );
539+ bool bNoDraw = ( lump.m_nMinDXLevel && lump.m_nMinDXLevel > nCurrentDXLevel );
540540 bNoDraw = bNoDraw || ( lump.m_nMaxDXLevel && lump.m_nMaxDXLevel < nCurrentDXLevel );
541541 if ( bNoDraw )
542542 {
543543 m_Flags |= STATIC_PROP_NO_DRAW;
544- }*/
544+ }
545545
546546 // Cache the model to world matrix since it never changes.
547547 AngleMatrix ( lump.m_Angles , lump.m_Origin , m_ModelToWorld );
@@ -1329,73 +1329,30 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf )
13291329
13301330 // Gotta preallocate the static props here so no rellocations take place
13311331 // the leaf list stores pointers to these tricky little guys.
1332- bool bSkip = false ;
1333- m_StaticProps.EnsureCapacity (count);
1332+ m_StaticProps.AddMultipleToTail (count);
13341333 for ( int i = 0 ; i < count; ++i )
13351334 {
1336- // Reset every loop.
1337- bSkip = false ;
1338-
13391335 StaticPropLump_t lump;
13401336 switch ( nLumpVersion )
13411337 {
1342- case 4 :
1343- buf.Get ( &lump, sizeof (StaticPropLumpV4_t) );
1344- lump.m_flForcedFadeScale = 1 .0f ;
1345- lump.m_nMinCPULevel = lump.m_nMaxCPULevel = lump.m_nMinGPULevel = lump.m_nMaxGPULevel = 0 ;
1346- lump.m_DiffuseModulation .r = lump.m_DiffuseModulation .g = lump.m_DiffuseModulation .b = lump.m_DiffuseModulation .a = 255 ; // default color/alpha modulation to identity
1347- lump.m_bDisableX360 = false ;
1348- lump.m_FlagsEx = 0 ;
1349- break ;
1350-
1351- case 5 :
1352- buf.Get ( &lump, sizeof (StaticPropLumpV5_t) );
1353- lump.m_nMinCPULevel = lump.m_nMaxCPULevel = lump.m_nMinGPULevel = lump.m_nMaxGPULevel = 0 ;
1354- lump.m_DiffuseModulation .r = lump.m_DiffuseModulation .g = lump.m_DiffuseModulation .b = lump.m_DiffuseModulation .a = 255 ; // default color/alpha modulation to identity
1355- lump.m_bDisableX360 = false ;
1356- lump.m_FlagsEx = 0 ;
1357- break ;
1358-
1359- case 6 :
1360- buf.Get ( &lump, sizeof ( StaticPropLumpV6_t ) );
1361- lump.m_nMinCPULevel = lump.m_nMaxCPULevel = lump.m_nMinGPULevel = lump.m_nMaxGPULevel = 0 ;
1362- lump.m_DiffuseModulation .r = lump.m_DiffuseModulation .g = lump.m_DiffuseModulation .b = lump.m_DiffuseModulation .a = 255 ; // default color/alpha modulation to identity
1363- lump.m_bDisableX360 = false ;
1364- lump.m_FlagsEx = 0 ;
1365- break ;
1366-
1367- case 7 :
1368- buf.Get ( &lump, sizeof ( StaticPropLumpV7_t ) );
1369- lump.m_nMinCPULevel = lump.m_nMaxCPULevel = lump.m_nMinGPULevel = lump.m_nMaxGPULevel = 0 ;
1370- lump.m_bDisableX360 = false ;
1371- lump.m_FlagsEx = 0 ;
1372- break ;
1373-
1374- case 8 :
1375- buf.Get ( &lump, sizeof ( StaticPropLumpV8_t ) );
1376- lump.m_bDisableX360 = false ;
1377- lump.m_FlagsEx = 0 ;
1378- break ;
1379-
1380- case 9 :
1381- buf.Get ( &lump, sizeof ( StaticPropLumpV9_t ) );
1382- lump.m_FlagsEx = 0 ;
1383- break ;
1384-
1385- case 10 :
1386- if ( s_MapHeader.version >= 21 )
1387- buf.Get ( &lump, sizeof ( StaticPropLumpV10_21_t ) );
1388- else
1389- buf.Get ( &lump, sizeof ( StaticPropLumpV10_t ) );
1390- break ;
1391-
1392- case 11 :
1393- buf.Get ( &lump, sizeof ( StaticPropLump_t ) );
1394- break ;
1338+ case 4 : UnserializeLump<StaticPropLumpV4_t>(&lump, buf); break ;
1339+ case 5 : UnserializeLump<StaticPropLumpV5_t>(&lump, buf); break ;
1340+ case 6 : UnserializeLump<StaticPropLumpV6_t>(&lump, buf); break ;
1341+ case 7 : // Falls down to version 10. We promoted TF to version 10 to deal with SFM.
1342+ case 9 : UnserializeLump<StaticPropLumpV9_t>(&lump, buf); break ;
1343+ case 10 :
1344+ {
1345+ if ( s_MapHeader.version == 21 )
1346+ UnserializeLump<StaticPropLumpV10_21_t>(&lump, buf);
1347+ else
1348+ UnserializeLump<StaticPropLumpV10_t>(&lump, buf);
1349+ break ;
1350+ }
1351+ default :
1352+ Assert (" Unexpected version while deserializing lumps." );
13951353 }
13961354
1397- int j = m_StaticProps.AddToTail ();
1398- m_StaticProps[j].Init ( j, lump, m_StaticPropDict[lump.m_PropType ].m_pModel );
1355+ m_StaticProps[i].Init ( i, lump, m_StaticPropDict[lump.m_PropType ].m_pModel );
13991356
14001357 // For distance-based fading, keep a list of the things that need
14011358 // to be faded out. Not sure if this is the optimal way of doing it
0 commit comments