//----------------------------------------------------------------------------- // Places Detail Objects in the lump //----------------------------------------------------------------------------- static void SetLumpData( ) { // Sort detail props by leaf qsort( s_DetailObjectLump.Base(), s_DetailObjectLump.Count(), sizeof(DetailObjectLump_t), SortFunc ); GameLumpHandle_t handle = GetGameLumpHandle(GAMELUMP_DETAIL_PROPS); if (handle != InvalidGameLump()) DestroyGameLump(handle); int nDictSize = s_DetailObjectDictLump.Count() * sizeof(DetailObjectDictLump_t); int nSpriteDictSize = s_DetailSpriteDictLump.Count() * sizeof(DetailSpriteDictLump_t); int nObjSize = s_DetailObjectLump.Count() * sizeof(DetailObjectLump_t); int nSize = nDictSize + nSpriteDictSize + nObjSize + 3 * sizeof(int); handle = CreateGameLump( GAMELUMP_DETAIL_PROPS, nSize, 0, GAMELUMP_DETAIL_PROPS_VERSION ); // Serialize the data CUtlBuffer buf( GetGameLump(handle), nSize ); buf.PutInt( s_DetailObjectDictLump.Count() ); if (nDictSize) buf.Put( s_DetailObjectDictLump.Base(), nDictSize ); buf.PutInt( s_DetailSpriteDictLump.Count() ); if (nSpriteDictSize) buf.Put( s_DetailSpriteDictLump.Base(), nSpriteDictSize ); buf.PutInt( s_DetailObjectLump.Count() ); if (nObjSize) buf.Put( s_DetailObjectLump.Base(), nObjSize ); }
//----------------------------------------------------------------------------- // Writes the detail lighting lump //----------------------------------------------------------------------------- static void WriteDetailLightingLump( int lumpID, int lumpVersion, CUtlVector<DetailPropLightstylesLump_t> &lumpData ) { GameLumpHandle_t handle = GetGameLumpHandle(lumpID); if (handle != InvalidGameLump()) DestroyGameLump(handle); int lightsize = lumpData.Size() * sizeof(DetailPropLightstylesLump_t); int lumpsize = lightsize + sizeof(int); handle = CreateGameLump( lumpID, lumpsize, 0, lumpVersion ); // Serialize the data CUtlBuffer buf( GetGameLump(handle), lumpsize ); buf.PutInt( lumpData.Size() ); if (lightsize) buf.Put( lumpData.Base(), lightsize ); }
static void SetLumpData( ) { GameLumpHandle_t handle = GetGameLumpHandle(GAMELUMP_STATIC_PROPS); if (handle != InvalidGameLump()) DestroyGameLump(handle); int dictsize = s_StaticPropDictLump.Size() * sizeof(StaticPropDictLump_t); int objsize = s_StaticPropLump.Size() * sizeof(StaticPropLump_t); int leafsize = s_StaticPropLeafLump.Size() * sizeof(StaticPropLeafLump_t); int size = dictsize + objsize + leafsize + 3 * sizeof(int); handle = CreateGameLump( GAMELUMP_STATIC_PROPS, size, 0, GAMELUMP_STATIC_PROPS_VERSION ); // Serialize the data CUtlBuffer buf( GetGameLump(handle), size ); buf.PutInt( s_StaticPropDictLump.Size() ); if (dictsize) buf.Put( s_StaticPropDictLump.Base(), dictsize ); buf.PutInt( s_StaticPropLeafLump.Size() ); if (leafsize) buf.Put( s_StaticPropLeafLump.Base(), leafsize ); buf.PutInt( s_StaticPropLump.Size() ); if (objsize) buf.Put( s_StaticPropLump.Base(), objsize ); }