//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- boost::python::list PyFS_ListDir( const char *pPath, const char *pPathID, const char *pWildCard, bool appendslashdir ) { if( !pPath || !pWildCard ) return boost::python::list(); const char *pFileName; char wildcard[MAX_PATH]; FileFindHandle_t fh; boost::python::list result; // Construct the wildcard V_strncpy( wildcard, pPath, sizeof( wildcard ) ); if( V_strlen( wildcard ) == 0 ) V_strncpy( wildcard, "./", sizeof( wildcard ) ); if( appendslashdir && filesystem->IsDirectory( pPath ) ) V_AppendSlash( wildcard, sizeof( wildcard ) ); V_strcat( wildcard, pWildCard, sizeof( wildcard ) ); pFileName = filesystem->FindFirstEx( wildcard, pPathID, &fh ); while( pFileName ) { result.append( boost::python::object( boost::python::handle<>( PyUnicode_DecodeUTF8( pFileName, V_strlen( pFileName ), "ignore" ) ) ) ); pFileName = filesystem->FindNext( fh ); } filesystem->FindClose( fh ); return result; }
void CObjectBuffStation::InitAttachmentData( void ) { // Initialize the attachment data. char szAttachName[13]; m_nPlayerCount = 0; V_strncpy( szAttachName, "playercable1", 13 ); for ( int iPlayer = 0; iPlayer < BUFF_STATION_MAX_PLAYERS; ++iPlayer ) { m_hPlayers.Set( iPlayer, NULL ); szAttachName[11] = '1' + iPlayer; m_aPlayerAttachInfo[iPlayer].m_iAttachPoint = LookupAttachment( szAttachName ); } m_nObjectCount = 0; V_strncpy( szAttachName, "objectcable1", 13 ); for ( int iObject = 0; iObject < BUFF_STATION_MAX_OBJECTS; ++iObject ) { m_hObjects.Set( iObject, NULL ); szAttachName[11] = '1' + iObject; m_aObjectAttachInfo[iObject].m_iAttachPoint = LookupAttachment( szAttachName ); } }
void CommandMenu::OnMessage(const KeyValues *params, VPANEL fromPanel) { char text[255]; bool bHandled = false; KeyValues *param1 = const_cast<KeyValues *>(params); // toggle attached cvar, if any V_strncpy( text, param1->GetString("toggle"), sizeof( text ) ); if ( text[0] ) { ConVarRef convar( text ); if ( convar.IsValid() ) { // toggle cvar if ( convar.GetInt() ) { convar.SetValue( 0 ); } else { convar.SetValue( 1 ); } UpdateMenu(); } else { Msg("CommandComboBox::OnMessage: cvar %s not found.\n", param1->GetString("typedata") ); } bHandled = true; } // execute attached command, if any V_strncpy( text, param1->GetString("command"), sizeof( text ) ); if ( text[0] ) { engine->ClientCmd( text ); bHandled = true; } // fire custom message, if any V_strncpy( text, param1->GetString("custom"), sizeof( text ) ); if ( text[0] ) { OnCustomItem( param1 ); // let derived class decide what to do bHandled = true; } if ( bHandled ) { PostMessage( GetParent(), new KeyValues("CommandMenuClosed") ); } BaseClass::OnMessage( params, fromPanel ); }
CUtlString CUtlString::Replace( const char *pszFrom, const char *pszTo ) const { Assert( pszTo ); // Can be 0 length, but not null Assert( pszFrom && *pszFrom ); // Must be valid and have one character. const char *pos = V_strstr( String(), pszFrom ); if ( !pos ) { return *this; } const char *pFirstFound = pos; // count number of search string int nSearchCount = 0; int nSearchLength = V_strlen( pszFrom ); while ( pos ) { nSearchCount++; int nSrcOffset = ( pos - String() ) + nSearchLength; pos = V_strstr( String() + nSrcOffset, pszFrom ); } // allocate the new string int nReplaceLength = V_strlen( pszTo ); int nAllocOffset = nSearchCount * ( nReplaceLength - nSearchLength ); size_t srcLength = Length(); CUtlString strDest; size_t destLength = srcLength + nAllocOffset; strDest.SetLength( destLength ); // find and replace the search string pos = pFirstFound; int nDestOffset = 0; int nSrcOffset = 0; while ( pos ) { // Found an instance int nCurrentSearchOffset = pos - String(); int nCopyLength = nCurrentSearchOffset - nSrcOffset; V_strncpy( strDest.GetForModify() + nDestOffset, String() + nSrcOffset, nCopyLength + 1 ); nDestOffset += nCopyLength; V_strncpy( strDest.GetForModify() + nDestOffset, pszTo, nReplaceLength + 1 ); nDestOffset += nReplaceLength; nSrcOffset = nCurrentSearchOffset + nSearchLength; pos = V_strstr( String() + nSrcOffset, pszFrom ); } // making sure that the left over string from the source is the same size as the left over dest buffer Assert( destLength - nDestOffset == srcLength - nSrcOffset ); if ( destLength - nDestOffset > 0 ) { V_strncpy( strDest.GetForModify() + nDestOffset, String() + nSrcOffset, destLength - nDestOffset + 1 ); } return strDest; }
virtual bool GetString( short stringId, char *buff, int buffSize ) { if ( stringId < 0 || stringId >= m_StringMap.GetNumStrings() ) { V_strncpy( buff, "", buffSize ); return false; } V_strncpy( buff, m_StringMap.String( stringId ), buffSize ); return true; }
bool CChoreoStringPool::GetString( short stringId, char *buff, int buffSize ) { // fetch from compiled pool const char *pString = scenefilecache->GetSceneString( stringId ); if ( !pString ) { V_strncpy( buff, "", buffSize ); return false; } V_strncpy( buff, pString, buffSize ); return true; }
char* CopyString( const char *pStr ) { int len = V_strlen( pStr ) + 1; char *pRet = new char[len]; V_strncpy( pRet, pStr, len ); return pRet; }
//----------------------------------------------------------------------------- // Purpose: Composes a path and filename together, inserting a path separator // if need be // Input: path - path to use // filename - filename to use // dest - buffer to compose result in // destSize - size of destination buffer //----------------------------------------------------------------------------- void V_ComposeFileName( const char *path, const char *filename, char *dest, int destSize ) { V_strncpy( dest, path, destSize ); V_AppendSlash( dest, destSize ); V_strncat( dest, filename, destSize, COPY_ALL_CHARACTERS ); V_FixSlashes( dest ); }
//----------------------------------------------------------------------------- // Purpose: // Input : *path - // *dest - // destSize - // Output : void V_ExtractFileExtension //----------------------------------------------------------------------------- void V_ExtractFileExtension(const char *path, char *dest, int destSize) { *dest = 0; const char *extension = V_GetFileExtension( path ); if (extension) V_strncpy(dest, extension, destSize); }
//=============================================================================== // Actualiza la textura de la luz //=============================================================================== void CBaseFlashlightEffect::UpdateFlashlightTexture( const char* pTextureName ) { static const char *pEmptyString = ""; if ( pTextureName == NULL ) pTextureName = pEmptyString; if ( !m_nFlashlightTexture.IsValid() || V_stricmp( m_textureName, pTextureName ) != 0 ) { if ( pTextureName == pEmptyString ) { m_nFlashlightTexture.Init( "effects/flashlight001", TEXTURE_GROUP_OTHER, true ); } else { m_nFlashlightTexture.Init( pTextureName, TEXTURE_GROUP_OTHER, true ); } V_strncpy( m_textureName, pTextureName, sizeof(m_textureName) ); } // Iniciamos la textura del Flash if ( !m_nMuzzleFlashTexture.IsValid() ) m_nMuzzleFlashTexture.Init( "effects/muzzleflash_light", TEXTURE_GROUP_OTHER, true ); }
//----------------------------------------------------------------------------- // Purpose: // Input : *in - // *out - // outSize - //----------------------------------------------------------------------------- void V_StripExtension( const char *in, char *out, int outSize ) { // Find the last dot. If it's followed by a dot or a slash, then it's part of a // directory specifier like ../../somedir/./blah. // scan backward for '.' int end = V_strlen( in ) - 1; while ( end > 0 && in[end] != '.' && !PATHSEPARATOR( in[end] ) ) { --end; } if (end > 0 && !PATHSEPARATOR( in[end] ) && end < outSize) { int nChars = min( end, outSize-1 ); if ( out != in ) { memcpy( out, in, nChars ); } out[nChars] = 0; } else { // nothing found if ( out != in ) { V_strncpy( out, in, outSize ); } } }
//----------------------------------------------------------------------------- // Purpose: Bone followers //----------------------------------------------------------------------------- void PyBoneFollowerManager::InitBoneFollowers( CBaseAnimating *pParentEntity, boost::python::list followerbonenames ) { if( !pParentEntity ) return; int i, iNumBones; iNumBones = bp::len(followerbonenames); char **pFollowerBoneNames = (char **)malloc(sizeof(char *) * iNumBones); for( i = 0; i < iNumBones; i++ ) { pFollowerBoneNames[i] = (char *)malloc( sizeof(char) * _MAX_PATH ); const char *pFollowerBoneName = bp::extract<const char *>(followerbonenames[i]); if( pFollowerBoneName ) V_strncpy(pFollowerBoneNames[i], pFollowerBoneName, _MAX_PATH); else pFollowerBoneNames[i][0] = '\0'; } CBoneFollowerManager::InitBoneFollowers( pParentEntity, iNumBones, (const char **)pFollowerBoneNames ); for( i = 0; i < iNumBones; i++ ) free( pFollowerBoneNames[i] ); free( pFollowerBoneNames ); }
PyEntityFactory::PyEntityFactory( const char *pClassName, boost::python::object PyClass ) { m_pPyNext = NULL; m_ClassName[0] = 0; if( !pClassName ) { PyErr_SetString(PyExc_ValueError, "EntityFactory must have a valid name"); throw boost::python::error_already_set(); return; } V_strncpy( m_ClassName, pClassName, sizeof( m_ClassName ) ); m_PyClass = PyClass; // Remove old factory if any if( EntityFactoryDictionary()->FindFactory( m_ClassName ) ) EntityFactoryDictionary()->RemoveFactory( m_ClassName ); // Install new factory EntityFactoryDictionary()->InstallFactory( this, m_ClassName ); // Link m_pPyNext = g_pPyEntityFactoryHead; g_pPyEntityFactoryHead = this; // Init if( g_bDoNotInitPythonClasses == false) InitPyClass(); CheckEntities(); }
bool VideoPlayerPanel::SetVideo( const char *pVideoFile ) { ClearVideo(); // clearing the video? if ( pVideoFile == NULL || pVideoFile[0] == 0x00 ) { return true; } // create the material m_VideoMaterial = g_pVideo->CreateVideoMaterial( "VideoPlayerMaterial", pVideoFile, "GAME", VideoPlaybackFlags::DEFAULT_MATERIAL_OPTIONS, VideoSystem::DETERMINE_FROM_FILE_EXTENSION, true ); if ( m_VideoMaterial == NULL ) { return false; } // save filename int sLen = V_strlen( pVideoFile ) + 1; m_VideoFileName = new char[ sLen ]; V_strncpy( m_VideoFileName, pVideoFile, sLen ); // compute Playback dimensions int nWidth, nHeight; m_VideoMaterial->GetVideoImageSize( &nWidth, &nHeight ); m_VideoMaterial->GetVideoTexCoordRange( &m_flU, &m_flV ); float flFrameRatio = ( (float) GetWide() / (float) GetTall() ); float flVideoRatio = ( (float) nWidth / (float) nHeight ); if ( flVideoRatio > flFrameRatio ) { m_nPlaybackWidth = GetWide(); m_nPlaybackHeight = ( GetWide() / flVideoRatio ); m_letterBox = 1; } else if ( flVideoRatio < flFrameRatio ) { m_nPlaybackWidth = ( GetTall() * flVideoRatio ); m_nPlaybackHeight = GetTall(); m_letterBox = 2; } else { m_nPlaybackWidth = GetWide(); m_nPlaybackHeight = GetTall(); m_letterBox = 0; } m_pMaterial = m_VideoMaterial->GetMaterial(); m_VideoDuration = m_VideoMaterial->GetVideoDuration(); m_VideoLoaded = true; return true; }
//----------------------------------------------------------------------------- // Remove entry from dictionary, Returns TRUE if removed. //----------------------------------------------------------------------------- bool RemoveFileFromResourceList( const char *pFilename, CUtlRBTree< CUtlString, int > *pTree ) { char szOutName[MAX_PATH]; char *pOutName; V_strncpy( szOutName, pFilename, sizeof( szOutName ) ); V_FixSlashes( szOutName ); V_RemoveDotSlashes( szOutName ); V_strlower( szOutName ); pOutName = szOutName; // strip any prefixed game name for ( int i = 0; g_GameNames[i] != NULL; i++ ) { size_t len = strlen( g_GameNames[i] ); if ( !V_strnicmp( pOutName, g_GameNames[i], len ) && pOutName[len] == '\\' ) { // skip past game name and slash pOutName += len+1; break; } } if ( pTree->Find( pOutName ) != pTree->InvalidIndex() ) { pTree->Remove( pOutName ); return true; } return false; }
// Message handler for PyNetworkCls void __MsgFunc_PyNetworkCls( bf_read &msg ) { int iClassID; char networkName[PYNETCLS_BUFSIZE]; iClassID = msg.ReadWord(); msg.ReadString( networkName, PYNETCLS_BUFSIZE ); DbgStrPyMsg( "__MsgFunc_PyNetworkCls: Registering Python network class message %d %s\n", iClassID, networkName ); // Get module path const char *pch = V_strrchr( networkName, '.' ); if( !pch ) { Warning( "Invalid python class name %s\n", networkName ); return; } int n = pch - networkName + 1; char modulePath[PYNETCLS_BUFSIZE]; V_strncpy( modulePath, networkName, n ); // Make sure the client class is imported SrcPySystem()->Import( modulePath ); // Read which client class we are modifying PyClientClassBase *p = FindPyClientClassByID( iClassID ); if( !p ) { Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %d\n", iClassID ); return; } // Read network class name V_strncpy( p->m_strPyNetworkedClassName, networkName, sizeof( p->m_strPyNetworkedClassName ) ); // Attach if a network class exists unsigned short lookup = m_NetworkClassDatabase.Find( networkName ); if ( lookup != m_NetworkClassDatabase.InvalidIndex() ) { m_NetworkClassDatabase.Element(lookup)->AttachClientClass( p ); } else { Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", networkName ); } }
//----------------------------------------------------------------------------- // Fixes up a file name, removing dot slashes, fixing slashes, converting to lowercase, etc. //----------------------------------------------------------------------------- void V_FixupPathName( char *pOut, size_t nOutLen, const char *pPath ) { V_strncpy( pOut, pPath, nOutLen ); V_FixSlashes( pOut ); V_RemoveDotSlashes( pOut ); V_FixDoubleSlashes( pOut ); V_strlower( pOut ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFViewModel::RemoveViewmodelAddon( void ) { if (m_viewmodelAddon) { m_viewmodelAddon->SetModel(""); m_viewmodelAddon->Remove(); } V_strncpy(m_viewmodelAddonName, "", sizeof(m_viewmodelAddonName)); }
//----------------------------------------------------------------------------- // Purpose: Extracts the base name of a file (no path, no extension, assumes '/' or '\' as path separator) // Input : *in - // *out - // maxlen - //----------------------------------------------------------------------------- void V_FileBase( const char *in, char *out, int maxlen ) { Assert( maxlen >= 1 ); Assert( in ); Assert( out ); if ( !in || !in[ 0 ] ) { *out = 0; return; } int len, start, end; len = V_strlen( in ); // scan backward for '.' end = len - 1; while ( end&& in[end] != '.' && !PATHSEPARATOR( in[end] ) ) { end--; } if ( in[end] != '.' ) // no '.', copy to end { end = len-1; } else { end--; // Found ',', copy to left of '.' } // Scan backward for '/' start = len-1; while ( start >= 0 && !PATHSEPARATOR( in[start] ) ) { start--; } if ( start < 0 || !PATHSEPARATOR( in[start] ) ) { start = 0; } else { start++; } // Length of new sting len = end - start + 1; int maxcopy = min( len + 1, maxlen ); // Copy partial string V_strncpy( out, &in[start], maxcopy ); }
/* ============ EndBSPFile ============ */ void EndBSPFile (void) { // Mark noshadow faces. MarkNoShadowFaces(); EmitBrushes (); EmitPlanes (); // stick flat normals at the verts SaveVertexNormals(); // Figure out lightmap extents for all faces. UpdateAllFaceLightmapExtents(); // Generate geometry and lightmap alpha for displacements. EmitDispLMAlphaAndNeighbors(); // Emit overlay data. Overlay_EmitOverlayFaces(); OverlayTransition_EmitOverlayFaces(); // phys collision needs dispinfo to operate (needs to generate phys collision for displacement surfs) EmitPhysCollision(); // We can't calculate this properly until vvis (since we need vis to do this), so we set // to zero everywhere by default. ClearDistToClosestWater(); // Emit static props found in the .vmf file EmitStaticProps(); // Place detail props found in .vmf and based on material properties EmitDetailObjects(); // Compute bounds after creating disp info because we need to reference it ComputeBoundsNoSkybox(); // Make sure that we have a water lod control eneity if we have water in the map. EnsurePresenceOfWaterLODControlEntity(); // Doing this here because stuff about may filter out entities UnparseEntities (); // remove unused texinfos CompactTexinfos(); // Figure out which faces want macro textures. DiscoverMacroTextures(); char fileName[1024]; V_strncpy( fileName, source, sizeof( fileName ) ); V_DefaultExtension( fileName, ".bsp", sizeof( fileName ) ); Msg ("Writing %s\n", fileName); WriteBSPFile (fileName); }
void V_StrRight( const char *pStr, int nChars, char *pOut, int outSize ) { int len = strlen( pStr ); if ( nChars >= len ) { V_strncpy( pOut, pStr, outSize ); } else { V_StrSlice( pStr, -nChars, strlen( pStr ), pOut, outSize ); } }
char* AllocString( const char *pStr, int nMaxChars ) { int allocLen; if ( nMaxChars == -1 ) allocLen = strlen( pStr ) + 1; else allocLen = min( (int)strlen(pStr), nMaxChars ) + 1; char *pOut = new char[allocLen]; V_strncpy( pOut, pStr, allocLen ); return pOut; }
// Returns true if it completed successfully. // If it would overflow pOut, it fills as much as it can and returns false. bool V_StrSubst( const char *pIn, const char *pMatch, const char *pReplaceWith, char *pOut, int outLen, bool bCaseSensitive ) { int replaceFromLen = strlen( pMatch ); int replaceToLen = strlen( pReplaceWith ); const char *pInStart = pIn; char *pOutPos = pOut; pOutPos[0] = 0; while ( 1 ) { int nRemainingOut = outLen - (pOutPos - pOut); const char *pTestPos = ( bCaseSensitive ? strstr( pInStart, pMatch ) : V_stristr( pInStart, pMatch ) ); if ( pTestPos ) { // Found an occurence of pMatch. First, copy whatever leads up to the string. int copyLen = pTestPos - pInStart; if ( !CopyToMaxChars( pOutPos, nRemainingOut, pInStart, copyLen ) ) return false; // Did we hit the end of the output string? if ( copyLen > nRemainingOut-1 ) return false; pOutPos += strlen( pOutPos ); nRemainingOut = outLen - (pOutPos - pOut); // Now add the replacement string. if ( !CopyToMaxChars( pOutPos, nRemainingOut, pReplaceWith, replaceToLen ) ) return false; pInStart += copyLen + replaceFromLen; pOutPos += replaceToLen; } else { // We're at the end of pIn. Copy whatever remains and get out. int copyLen = strlen( pInStart ); V_strncpy( pOutPos, pInStart, nRemainingOut ); return ( copyLen <= nRemainingOut-1 ); } } }
void SetPassword( const char *pPassword ) { delete [] g_pPassword; if ( pPassword ) { int len = V_strlen( pPassword ) + 1; g_pPassword = new char[len]; V_strncpy( g_pPassword, pPassword, len ); } else { g_pPassword = NULL; } }
CefRefPtr<CefResourceHandler> LocalSchemeHandlerFactory::Create(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& scheme_name, CefRefPtr<CefRequest> request) { CefRefPtr<CefResourceHandler> pResourceHandler = NULL; CefURLParts parts; CefParseURL(request->GetURL(), parts); if( CefString(&parts.path).size() < 2 ) { return NULL; } char path[MAX_PATH]; V_strncpy( path, CefString(&parts.path).ToString().c_str() + 1, sizeof(path) ); V_FixupPathName( path, sizeof( path ), path ); if( filesystem->IsDirectory( path ) ) { V_AppendSlash( path, sizeof( path ) ); V_strcat( path, "index.html", sizeof(path) ); } if( filesystem->FileExists( path, NULL ) ) { const char *pExtension = V_GetFileExtension( path ); if( cef_scheme_debug_local_handler.GetBool() ) { Msg( "Local scheme request => Path: %s, Extension: %s, Mime Type: %s, modified path: %s, exists: %d, resource type: %d\n", CefString(&parts.path).ToString().c_str(), pExtension, CefGetMimeType(pExtension).ToString().c_str(), path, filesystem->FileExists( path ), request->GetResourceType() ); } CUtlBuffer buf( 0, filesystem->Size( path, NULL ) ); if( filesystem->ReadFile( path, NULL, buf ) ) { CefRefPtr<CefStreamReader> stream = CefStreamReader::CreateForData( buf.Base(), buf.TellPut() ); if( stream != NULL ) { pResourceHandler = new CefStreamResourceHandler( CefGetMimeType(pExtension), stream ); } } } return pResourceHandler; }
void V_MakeAbsolutePath( char *pOut, int outLen, const char *pPath, const char *pStartingDir ) { if ( V_IsAbsolutePath( pPath ) ) { // pPath is not relative.. just copy it. V_strncpy( pOut, pPath, outLen ); } else { // Make sure the starting directory is absolute.. if ( pStartingDir && V_IsAbsolutePath( pStartingDir ) ) { V_strncpy( pOut, pStartingDir, outLen ); } else { if ( !_getcwd( pOut, outLen ) ) Error( "V_MakeAbsolutePath: _getcwd failed." ); if ( pStartingDir ) { V_AppendSlash( pOut, outLen ); V_strncat( pOut, pStartingDir, outLen, COPY_ALL_CHARACTERS ); } } // Concatenate the paths. V_AppendSlash( pOut, outLen ); V_strncat( pOut, pPath, outLen, COPY_ALL_CHARACTERS ); } if ( !V_RemoveDotSlashes( pOut ) ) Error( "V_MakeAbsolutePath: tried to \"..\" past the root." ); V_FixSlashes( pOut ); }
void WCKeyValuesT<Base>::SetValue(const char *pszKey, const char *pszValue) { char szTmpKey[KEYVALUE_MAX_KEY_LENGTH]; char szTmpValue[KEYVALUE_MAX_VALUE_LENGTH]; V_strcpy_safe(szTmpKey, pszKey); if (pszValue != NULL) { V_strcpy_safe(szTmpValue, pszValue); } else { szTmpValue[0] = 0; } StripEdgeWhiteSpace(szTmpKey); StripEdgeWhiteSpace(szTmpValue); int i = FindByKeyName( szTmpKey ); if ( i == GetInvalidIndex() ) { if ( pszValue ) { // // Add the keyvalue to our list. // MDkeyvalue newkv; Q_strncpy( newkv.szKey, szTmpKey, sizeof( newkv.szKey ) ); Q_strncpy( newkv.szValue, szTmpValue, sizeof( newkv.szValue ) ); InsertKeyValue( newkv ); } } else { if (pszValue != NULL) { V_strncpy(m_KeyValues[i].szValue, szTmpValue, sizeof(m_KeyValues[i].szValue)); } // // If we are setting to a NULL value, delete the key. // else { RemoveKeyAt( i ); } } }
//----------------------------------------------------------------------------- // Purpose: Given an absolute path, do a find first find next on it and build // a list of files. Physical file system only //----------------------------------------------------------------------------- static void FindFileAbsoluteList( CUtlVector< CUtlString > &outAbsolutePathNames, const char *pszFindName ) { char szPath[MAX_PATH]; V_strncpy( szPath, pszFindName, sizeof( szPath ) ); V_StripFilename( szPath ); char szResult[MAX_PATH]; FileFindHandle_t hFile = FILESYSTEM_INVALID_FIND_HANDLE; for ( const char *pszFoundFile = g_pFullFileSystem->FindFirst( pszFindName, &hFile ); pszFoundFile && hFile != FILESYSTEM_INVALID_FIND_HANDLE; pszFoundFile = g_pFullFileSystem->FindNext( hFile ) ) { V_ComposeFileName( szPath, pszFoundFile, szResult, sizeof( szResult ) ); outAbsolutePathNames.AddToTail( szResult ); } g_pFullFileSystem->FindClose( hFile ); }
//================================================================================ // Crea o actualiza la textura que se usara para proyectar la luz //================================================================================ void CInternalLight::UpdateTexture( const char* pTextureName ) { static const char *pEmptyString = ""; if ( pTextureName == NULL ) pTextureName = pEmptyString; if ( !m_nLightTexture.IsValid() || V_stricmp( m_textureName, pTextureName ) != 0 ) { if ( pTextureName == pEmptyString ) { m_nLightTexture.Init( "effects/flashlight001", TEXTURE_GROUP_OTHER, true ); } else { m_nLightTexture.Init( pTextureName, TEXTURE_GROUP_OTHER, true ); } V_strncpy( m_textureName, pTextureName, sizeof( m_textureName ) ); } }
void CSizzPluginContext::GetSteamIDString( int userid, char *dest, int buff_size ) { if (dest && (buff_size > 0)) { int ent_index = EntIndexFromUserID(userid); if (ent_index != -1) { IPlayerInfo *pInfo = GetPlayerInfo(ent_index); if (pInfo) { const char *src = pInfo->GetNetworkIDString(); if (src) { V_strncpy(dest, src, buff_size); } } } } }