//----------------------------------------------------------------------------- // Purpose: // Input : *soundname - // params - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CSoundEmitterSystemBase::GetParametersForSound( const char *soundname, CSoundParameters& params ) { int index = GetSoundIndex( soundname ); if ( index == -1 ) { DevMsg( "CSoundEmitterSystemBase::GetParametersForSound: No such sound %s\n", soundname ); return false; } CSoundParametersInternal *internal = InternalGetParametersForSound( index ); if ( !internal ) { Assert( 0 ); DevMsg( "CSoundEmitterSystemBase::GetParametersForSound: No such sound %s\n", soundname ); return false; } params.channel = internal->channel; params.volume = RandomInterval( internal->volume ); params.pitch = RandomInterval( internal->pitch ); params.pitchlow = internal->pitch.start; params.pitchhigh = params.pitchlow + internal->pitch.range; params.count = internal->soundnames.Count(); params.soundname[ 0 ] = 0; if ( params.count >= 1 ) { CUtlSymbol sym = internal->soundnames[ random->RandomInt( 0, params.count - 1 ) ]; Q_strncpy( params.soundname, m_Waves.String( sym ), sizeof( params.soundname ) ); } params.soundlevel = (soundlevel_t)(int)RandomInterval( internal->soundlevel ); params.play_to_owner_only = internal->play_to_owner_only; if ( !params.soundname[ 0 ] ) { DevMsg( "CSoundEmitterSystemBase::GetParametersForSound: sound %s has no wave or rndwave key!\n", soundname ); return false; } if ( internal->had_missing_wave_files && params.soundname[ 0 ] != CHAR_SENTENCE ) { char testfile[ 256 ]; Q_snprintf( testfile, sizeof( testfile ), "sound/%s", PSkipSoundChars( params.soundname ) ); if ( !filesystem->FileExists( testfile ) ) { DevMsg( "CSoundEmitterSystemBase::GetParametersForSound: sound '%s' references wave '%s' which doesn't exist on disk!\n", soundname, params.soundname ); return false; } } return true; }
float AI_Response::GetPreDelay() const { if ( m_Params.flags & AI_ResponseParams::RG_DELAYBEFORESPEAK ) { interval_t temp; m_Params.predelay.ToInterval( temp ); return RandomInterval( temp ); } return 0.0f; }
float AI_Response::GetWeaponDelay( void ) const { if ( m_Params.flags & AI_ResponseParams::RG_WEAPONDELAY ) { interval_t temp; m_Params.weapondelay.ToInterval( temp ); return RandomInterval( temp ); } return 0.0f; }
float AI_Response::GetRespeakDelay( void ) const { if ( m_Params.flags & AI_ResponseParams::RG_RESPEAKDELAY ) { interval_t temp; m_Params.respeakdelay.ToInterval( temp ); return RandomInterval( temp ); } return 0.0f; }