bool CSpecialItemLoader::Init() { m_allItems.SetLessFunc(DefLessFunc(uint64)); if(GAME_HAS_ITEMS()) { m_itemsMutex = new CThreadMutexPthread(); m_pLoadThread = new CSpecialItemLoaderThread(); return m_pLoadThread != NULL; } else { return true; } }
void logprint( char const *logfile, const char *fmt, ... ) { char string[ 8192 ]; va_list va; va_start( va, fmt ); vsprintf( string, fmt, va ); va_end( va ); FILE *fp = NULL; UnusedContent::CUtlSymbol sym = g_Analysis.symbols.Find( logfile ); static CUtlRBTree< UnusedContent::CUtlSymbol, int > previousfiles( 0, 0, DefLessFunc( UnusedContent::CUtlSymbol ) ); if ( previousfiles.Find( sym ) == previousfiles.InvalidIndex() ) { previousfiles.Insert( sym ); fp = fopen( logfile, "wb" ); } else { fp = fopen( logfile, "ab" ); } if ( fp ) { char *p = string; while ( *p ) { if ( *p == '\n' ) { fputc( '\r', fp ); } fputc( *p, fp ); p++; } fclose( fp ); } }
#include "utldict.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" struct DecalEntry { #ifdef _DEBUG char *m_pDebugName; // only used in debug builds #endif IMaterial *material; int index; }; // This stores the list of all decals CUtlMap< FileNameHandle_t, DecalEntry > g_DecalDictionary( 0, 0, DefLessFunc( FileNameHandle_t ) ); // This is a list of indices into the dictionary. // This list is indexed by network id, so it maps network ids to decal dictionary entries CUtlVector< int > g_DecalLookup; //----------------------------------------------------------------------------- // Purpose: // Output : int //----------------------------------------------------------------------------- int Draw_DecalMax( void ) { return g_nMaxDecals; } //-----------------------------------------------------------------------------
int i; for ( i = 0; i < c; ++i ) { AddCheckdir( directories_to_check[ i ] ); } // add the list of dirs to ignore from the others lists c = ARRAYSIZE( directories_to_ignore ); for ( i = 0; i < c; ++i ) { AddIgnoredir( directories_to_ignore[ i ] ); } } } static CUtlRBTree< UnusedContent::CUtlSymbol, int > g_WhiteList( 0, 0, DefLessFunc( UnusedContent::CUtlSymbol ) ); #define WHITELIST_FILE "whitelist.cfg" static int wl_added = 0; static int wl_removed = 0; void AddToWhiteList( char const *path ) { vprint( 2, "+\t'%s'\n", path ); char dir[ 512 ]; Q_strncpy( dir, path, sizeof( dir ) ); // Get the base filename from the path _strlwr( dir );
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CRecastMgr::CRecastMgr() : m_bLoaded(false), m_Obstacles( 0, 0, DefLessFunc( EHANDLE ) ) { #ifndef CLIENT_DLL m_pMapMesh = NULL; #endif // CLIENT_DLL }
void IFaceposerModels::CFacePoserModel::ReconcileAnimationBitmaps() { // iterate files in directory and see if each checksum is valid and if not delete the .bmp char path[ 512 ]; Q_snprintf( path, sizeof( path ), "expressions/%s/animation/*.bmp", GetShortModelName() ); FileFindHandle_t hFindFile; char const *fn = filesystem->FindFirstEx( path, "MOD", &hFindFile ); g_pProgressDialog->Start( CFmtStr( "%s - Reconcile Animation Thumbnails", GetShortModelName() ), "", true ); CUtlVector< CUtlString > workList; if ( fn ) { while ( fn ) { // Don't do anything with directories if ( !filesystem->FindIsDirectory( hFindFile ) ) { CUtlString s = fn; workList.AddToTail( s ); } fn = filesystem->FindNext( hFindFile ); } filesystem->FindClose( hFindFile ); } CUtlRBTree< CRC32_t > tree( 0, 0, DefLessFunc( CRC32_t ) ); BuildValidChecksums( tree ); for ( int i = 0 ; i < workList.Count(); ++i ) { char testname[ 256 ]; Q_StripExtension( workList[ i ].String(), testname, sizeof( testname ) ); g_pProgressDialog->UpdateText( "%s", testname ); g_pProgressDialog->Update( (float)i / (float)workList.Count() ); CRC32_t check; Q_hextobinary( testname, Q_strlen( testname ), (byte *)&check, sizeof( check ) ); if ( tree.Find( check ) == tree.InvalidIndex() ) { Q_snprintf( testname, sizeof( testname ), "expressions/%s/animation/%s", GetShortModelName(), fn ); char fullpath[ 512 ]; filesystem->RelativePathToFullPath( testname, "MOD", fullpath, sizeof( fullpath ) ); // Delete it Con_ErrorPrintf( "Removing unused bitmap file %s\n", fullpath ); _unlink( fullpath ); } if ( g_pProgressDialog->IsCancelled() ) { Msg( "Cancelled\n" ); break; } } g_pProgressDialog->Finish(); }