void LogPrecache( char const *soundname ) { if ( !m_bLogPrecache ) return; // Make sure we only show the message once if ( UTL_INVAL_SYMBOL != m_PrecachedScriptSounds.Find( soundname ) ) return; if (m_hPrecacheLogFile == FILESYSTEM_INVALID_HANDLE) { StartLog(); } m_PrecachedScriptSounds.AddString( soundname ); if (m_hPrecacheLogFile != FILESYSTEM_INVALID_HANDLE) { filesystem->Write("\"", 1, m_hPrecacheLogFile); filesystem->Write(soundname, Q_strlen(soundname), m_hPrecacheLogFile); filesystem->Write("\"\n", 2, m_hPrecacheLogFile); } else { Warning( "Disabling precache logging due to file i/o problem!!!\n" ); m_bLogPrecache = false; } }
//----------------------------------------------------------------------------- // Purpose: mark or add // Input : *pEntity - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CPrecacheOtherList::AddOrMarkPrecached( const char *pClassname ) { CUtlSymbol sym = m_list.Find( pClassname ); if ( sym.IsValid() ) return false; m_list.AddString( pClassname ); return true; }
void CMod::SetGameDir( const char *dir ) { CUtlSymbol lookup; lookup = g_GameDirTable.Find( dir ); if ( lookup != UTL_INVAL_SYMBOL ) { gamedir = lookup; } else { gamedir = g_GameDirTable.AddString( dir ); } }
void WaveTrace( char const *wavname, char const *funcname ) { if ( IsX360() && !IsDebug() ) { return; } static CUtlSymbolTable s_WaveTrace; // Make sure we only show the message once if ( UTL_INVAL_SYMBOL == s_WaveTrace.Find( wavname ) ) { DevMsg( "%s directly referenced wave %s (should use game_sounds.txt system instead)\n", funcname, wavname ); s_WaveTrace.AddString( wavname ); } }
//----------------------------------------------------------------------------- // Purpose: gets the length of an animation sequence, in seconds //----------------------------------------------------------------------------- float AnimationController::GetAnimationSequenceLength(const char *sequenceName) { // lookup the symbol for the name UtlSymId_t seqName = g_ScriptSymbols.Find(sequenceName); if (seqName == UTL_INVAL_SYMBOL) return 0.0f; // look through for the sequence int i; for (i = 0; i < m_Sequences.Count(); i++) { if (m_Sequences[i].name == seqName) break; } if (i >= m_Sequences.Count()) return 0.0f; // sequence found return m_Sequences[i].duration; }
//----------------------------------------------------------------------------- // Purpose: starts an animation sequence script //----------------------------------------------------------------------------- bool AnimationController::StartAnimationSequence(Panel *pWithinParent, const char *sequenceName) { Assert( pWithinParent ); if (m_bAutoReloadScript) { // Reload the script files ReloadScriptFile(); } // lookup the symbol for the name UtlSymId_t seqName = g_ScriptSymbols.Find(sequenceName); if (seqName == UTL_INVAL_SYMBOL) return false; // Msg("Starting animation sequence %s\n", sequenceName); // remove the existing command from the queue RemoveQueuedAnimationCommands(seqName, pWithinParent); // look through for the sequence int i; for (i = 0; i < m_Sequences.Count(); i++) { if (m_Sequences[i].name == seqName) break; } if (i >= m_Sequences.Count()) return false; // execute the sequence for (int cmdIndex = 0; cmdIndex < m_Sequences[i].cmdList.Count(); cmdIndex++) { ExecAnimationCommand(seqName, m_Sequences[i].cmdList[cmdIndex], pWithinParent); } return true; }
HSOUNDSCRIPTHANDLE PrecacheScriptSound( const char *soundname ) { int soundIndex = soundemitterbase->GetSoundIndex( soundname ); if ( !soundemitterbase->IsValidIndex( soundIndex ) ) { if ( Q_stristr( soundname, ".wav" ) || Q_strstr( soundname, ".mp3" ) ) { g_bPermitDirectSoundPrecache = true; CBaseEntity::PrecacheSound( soundname ); g_bPermitDirectSoundPrecache = false; return SOUNDEMITTER_INVALID_HANDLE; } #if !defined( CLIENT_DLL ) if ( soundname[ 0 ] ) { static CUtlSymbolTable s_PrecacheScriptSoundFailures; // Make sure we only show the message once if ( UTL_INVAL_SYMBOL == s_PrecacheScriptSoundFailures.Find( soundname ) ) { DevMsg( "PrecacheScriptSound '%s' failed, no such sound script entry\n", soundname ); s_PrecacheScriptSoundFailures.AddString( soundname ); } } #endif return (HSOUNDSCRIPTHANDLE)soundIndex; } #if !defined( CLIENT_DLL ) LogPrecache( soundname ); #endif InternalPrecacheWaves( soundIndex ); return (HSOUNDSCRIPTHANDLE)soundIndex; }