Example #1
0
void CVradStaticPropMgr::UnserializeStaticProps()
{
	// Unserialize static props, insert them into the appropriate leaves
	GameLumpHandle_t handle = GetGameLumpHandle( GAMELUMP_STATIC_PROPS );
	int size = GameLumpSize( handle );
	if (!size)
		return;

	if ( GetGameLumpVersion( handle ) != GAMELUMP_STATIC_PROPS_VERSION )
	{
		Error( "Cannot load the static props... encountered a stale map version. Re-vbsp the map." );
	}

	if ( GetGameLump( handle ) )
	{
		CUtlBuffer buf( GetGameLump(handle), size, CUtlBuffer::READ_ONLY );
		UnserializeModelDict( buf );

		// Skip the leaf list data
		int count = buf.GetInt();
		buf.SeekGet( CUtlBuffer::SEEK_CURRENT, count * sizeof(StaticPropLeafLump_t) );

		UnserializeModels( buf );
	}
}
void CVradStaticPropMgr::UnserializeStaticProps()
{
	// Unserialize static props, insert them into the appropriate leaves
	GameLumpHandle_t handle = GetGameLumpHandle( GAMELUMP_STATIC_PROPS );
	int size = GameLumpSize( handle );
	if (!size)
		return;

	if (GetGameLump( handle ))
	{
		CUtlBuffer buf( GetGameLump(handle), size );
		UnserializeModelDict( buf );

		// Skip the leaf list data
		int count = buf.GetInt();
		buf.SeekGet( CUtlBuffer::SEEK_CURRENT, count * sizeof(StaticPropLeafLump_t) );

		UnserializeModels( buf );
	}
}
Example #3
0
//-----------------------------------------------------------------------------
// Unserializes the detail props
//-----------------------------------------------------------------------------
static int UnserializeDetailProps( DetailObjectLump_t*& pProps )
{
	GameLumpHandle_t handle = GetGameLumpHandle( GAMELUMP_DETAIL_PROPS );

	if (GetGameLumpVersion(handle) != GAMELUMP_DETAIL_PROPS_VERSION)
		return 0;

	// Unserialize
	CUtlBuffer buf( GetGameLump(handle), GameLumpSize( handle ), CUtlBuffer::READ_ONLY );

	UnserializeModelDict( buf );
	UnserializeSpriteDict( buf );

	// Now we're pointing to the detail prop data
	// This actually works because the scope of the game lump data
	// is global and the buf was just pointing to it.
	int count = buf.GetInt();
	if (count)
		pProps = (DetailObjectLump_t*)buf.PeekGet();
	else
		pProps = 0;
	return count;
}
Example #4
0
// need to do this so that if we are building HDR data, the LDR data is intact, and vice versa.s
void UnserializeDetailPropLighting( int lumpID, int lumpVersion, CUtlVector<DetailPropLightstylesLump_t> &lumpData )
{
	GameLumpHandle_t handle = GetGameLumpHandle( lumpID );

	if( handle == InvalidGameLump() )
	{
		return;
	}

	if (GetGameLumpVersion(handle) != lumpVersion)
		return;

	// Unserialize
	CUtlBuffer buf( GetGameLump(handle), GameLumpSize( handle ), CUtlBuffer::READ_ONLY );

	int count = buf.GetInt();
	if( !count )
	{
		return;
	}
	lumpData.SetCount( count );
	int lightsize = lumpData.Size() * sizeof(DetailPropLightstylesLump_t);
	buf.Get( lumpData.Base(), lightsize );
}