当前位置: 首页>>代码示例>>C++>>正文


C++ Q_stristr函数代码示例

本文整理汇总了C++中Q_stristr函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_stristr函数的具体用法?C++ Q_stristr怎么用?C++ Q_stristr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Q_stristr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetPathSettings

void SetPathSettings( )
{
	char pPathBuf[ MAX_PATH*32 ];
	if ( GetVConfigRegistrySetting( "PATH", pPathBuf, sizeof(pPathBuf) ) )
	{
		Q_FixSlashes( pPathBuf );
		const char *pPath = pPathBuf;
		const char *pFound = Q_stristr( pPath, VPROJECT_BIN_PATH );
		int nLen = Q_strlen( VPROJECT_BIN_PATH );
		while ( pFound )
		{
			if ( pFound[nLen] == '\\' )
			{
				++nLen;
			}
			if ( !pFound[nLen] || pFound[nLen] == ';' )
				return;

			pPath += nLen;
			pFound = Q_stristr( pPath, VPROJECT_BIN_PATH );
		}

		Q_strncat( pPathBuf, ";%VPROJECT%\\..\\bin", sizeof(pPathBuf) );
	}
	else
	{
		Q_strncpy( pPathBuf, "%VPROJECT%\\..\\bin", sizeof(pPathBuf) );
	}

	SetVConfigRegistrySetting( "PATH", pPathBuf, false );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:31,代码来源:main.cpp

示例2: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: Starts the effect
// Input  : *pParticleMgr - 
//			*pArgs - 
//-----------------------------------------------------------------------------
void C_SmokeStack::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
	pParticleMgr->AddEffect( &m_ParticleEffect, this );
	
	// Figure out the material name.
	char str[512] = "unset_material";
	const model_t *pModel = modelinfo->GetModel( m_iMaterialModel );
	if ( pModel )
	{
		Q_strncpy( str, modelinfo->GetModelName( pModel ), sizeof( str ) );

		// Get rid of the extension because the material system doesn't want it.
		char *pExt = Q_stristr( str, ".vmt" );
		if ( pExt )
			pExt[0] = 0;
	}

	m_MaterialHandle[0] = m_ParticleEffect.FindOrAddMaterial( str );

	int iCount = 1;
	char szNames[512];

	int iLength = Q_strlen( str );
	str[iLength-1] = '\0';

	Q_snprintf( szNames, sizeof( szNames ), "%s%d.vmt", str, iCount );

	while ( filesystem->FileExists( VarArgs( "materials/%s", szNames ) ) && iCount < SMOKESTACK_MAX_MATERIALS )
	{
		char *pExt = Q_stristr( szNames, ".vmt" );
		if ( pExt )
			pExt[0] = 0;

		m_MaterialHandle[iCount] = m_ParticleEffect.FindOrAddMaterial( szNames );
		iCount++;
	}

	m_iMaxFrames = iCount-1;

	m_ParticleSpawn.Init( mat_reduceparticles.GetBool() ? m_Rate / 4 : m_Rate ); // Obey mat_reduceparticles in episodic

	m_InvLifetime = m_Speed / m_JetLength;

	m_pParticleMgr = pParticleMgr;

	// Figure out how we need to draw.
	IMaterial *pMaterial = pParticleMgr->PMaterialToIMaterial( m_MaterialHandle[0] );
	if( pMaterial )
	{
		m_Renderer.Init( pParticleMgr, pMaterial );
	}
	
	QueueLightParametersInRenderer();

	// For the first N seconds, always simulate so it can build up the smokestack.
	// Afterwards, we set it to freeze when it's not being rendered.
	m_ParticleEffect.SetAlwaysSimulate( true );
	SetNextClientThink( gpGlobals->curtime + 5 );
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:64,代码来源:c_smokestack.cpp

示例3: if

void CHL2MP_Player::SetupPlayerSoundsByModel( const char *pModelName )
{
	if ( Q_stristr( pModelName, "models/human") )
		m_iPlayerSoundType = (int)PLAYER_SOUNDS_CITIZEN;
	else if ( Q_stristr(pModelName, "police" ) )
		m_iPlayerSoundType = (int)PLAYER_SOUNDS_METROPOLICE;
	else if ( Q_stristr(pModelName, "combine" ) )
		m_iPlayerSoundType = (int)PLAYER_SOUNDS_COMBINESOLDIER;
}
开发者ID:Orygin,项目名称:BisounoursParty,代码行数:9,代码来源:hl2mp_player.cpp

示例4: MP3_GetPlaylistSongs

int MP3_GetPlaylistSongs(mp3_tracks_t *songList, char *filter)
{
	int current, length, i;
	int playlist_size = 0, tracknum = 0, songCount = 0;
	char *s;

	if (!MP3_IsPlayerRunning())
		return 0;

	MP3_GetPlaylistInfo(&current, &length);
	for (i = 0 ; i < length; i ++) {
		s = qxmms_remote_get_playlist_title(XMMS_SESSION, i);
		if(!s)
			continue;
		if(!Q_stristr(s, filter)) {
			qg_free(s);
			continue;
		}
		qg_free(s);
		songCount++;
	}

	if(!songCount)
		return 0;

	songList->name = Z_TagMalloc (sizeof(char *) * songCount, TAG_MP3LIST);
	songList->num = Z_TagMalloc (sizeof(int) * songCount, TAG_MP3LIST);

	for (i = 0 ; i < length; i ++) {
		s = qxmms_remote_get_playlist_title(XMMS_SESSION, i);

		tracknum++;
		if(!s)
			continue;
		if(!Q_stristr(s, filter)) {
			qg_free(s);
			continue;
		}

		if (strlen(s) >= MP3_MAXSONGTITLE-1)
			s[MP3_MAXSONGTITLE-1] = 0;

		COM_MakePrintable(s);
		songList->num[playlist_size] = tracknum;
		songList->name[playlist_size++] = CopyString(va("%i. %s", tracknum, s), TAG_MP3LIST);
		qg_free(s);

		if(playlist_size >= songCount)
			break;
	}

	return playlist_size;
}
开发者ID:hifi-unmaintained,项目名称:aprq2,代码行数:53,代码来源:xmms.c

示例5: EmitAmbientSound

    void EmitAmbientSound(int entindex, const Vector &origin, const char *pSample, float volume, soundlevel_t soundlevel, int flags, int pitch, float soundtime /*= 0.0f*/, float *duration /*=NULL*/)
    {
#ifdef STAGING_ONLY
        if ( sv_snd_filter.GetString()[ 0 ] && !V_stristr( pSample, sv_snd_filter.GetString() ))
        {
            return;
        }
#endif // STAGING_ONLY

#if !defined( CLIENT_DLL )
        CUtlVector< Vector > dummyorigins;

        // Loop through all registered microphones and tell them the sound was just played
        // NOTE: This means that pitch shifts/sound changes on the original ambient will not be reflected in the re-broadcasted sound
        bool bSwallowed = CEnvMicrophone::OnSoundPlayed(
            entindex,
            pSample,
            soundlevel,
            volume,
            flags,
            pitch,
            &origin,
            soundtime,
            dummyorigins);
        if (bSwallowed)
            return;
#endif

        if (pSample && (Q_stristr(pSample, ".wav") || Q_stristr(pSample, ".mp3")))
        {
#if defined( CLIENT_DLL )
            enginesound->EmitAmbientSound( pSample, volume, pitch, flags, soundtime );
#else
            engine->EmitAmbientSound(entindex, origin, pSample, volume, soundlevel, flags, pitch, soundtime);
#endif

            if (duration)
            {
                *duration = enginesound->GetSoundDuration(pSample);
            }

            TraceEmitSound("EmitAmbientSound:  Raw wave emitted '%s' (ent %i)\n",
                pSample, entindex);
        }
        else
        {
            EmitAmbientSound(entindex, origin, pSample, volume, flags, pitch, soundtime, duration);
        }
    }
开发者ID:Yosam02,项目名称:game,代码行数:49,代码来源:SoundEmitterSystem.cpp

示例6: StopSound

	void StopSound( int iEntIndex, int iChannel, const char *pSample )
	{
		if ( pSample && ( Q_stristr( pSample, ".wav" ) || Q_stristr( pSample, ".mp3" ) || pSample[0] == '!' ) )
		{
			enginesound->StopSound( iEntIndex, iChannel, pSample );

			TraceEmitSound( "StopSound:  Raw wave stopped '%s' (ent %i)\n",
				pSample, iEntIndex );
		}
		else
		{
			// Look it up in sounds.txt and ignore other parameters
			StopSound( iEntIndex, pSample );
		}
	}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:15,代码来源:SoundEmitterSystem.cpp

示例7: edict

void CHL2MP_Player::SetPlayerTeamModel( void )
{
	const char *szModelName = NULL;
	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 || ValidatePlayerModel( szModelName ) == false )
	{
		szModelName = "models/Combine_Soldier.mdl";
		m_iModelType = TEAM_COMBINE;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	if ( GetTeamNumber() == TEAM_COMBINE )
	{
		if ( Q_stristr( szModelName, "models/human") )
		{
			int nHeads = ARRAYSIZE( g_ppszRandomCombineModels );
		
			g_iLastCombineModel = ( g_iLastCombineModel + 1 ) % nHeads;
			szModelName = g_ppszRandomCombineModels[g_iLastCombineModel];
		}

		m_iModelType = TEAM_COMBINE;
	}
	else if ( GetTeamNumber() == TEAM_REBELS )
	{
		if ( !Q_stristr( szModelName, "models/human") )
		{
			int nHeads = ARRAYSIZE( g_ppszRandomCitizenModels );

			g_iLastCitizenModel = ( g_iLastCitizenModel + 1 ) % nHeads;
			szModelName = g_ppszRandomCitizenModels[g_iLastCitizenModel];
		}

		m_iModelType = TEAM_REBELS;
	}
	
	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
开发者ID:hlstriker,项目名称:source-sdk-2013,代码行数:48,代码来源:hl2mp_player.cpp

示例8: UpdateAvatarEffect

void UpdateAvatarEffect(void)
{
	if(!haptics->HasDevice())
		return;

	Vector vel;
	Vector vvel;
	Vector evel;
	QAngle eye;
	C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
	if(!pPlayer)
		return;

	eye = pPlayer->GetAbsAngles();

	if(pPlayer->IsInAVehicle() && pPlayer->GetVehicle())
	{
		pPlayer->GetVehicle()->GetVehicleEnt()->EstimateAbsVelocity(vvel);
		eye = pPlayer->GetVehicle()->GetVehicleEnt()->EyeAngles();

		if(!Q_stristr(pPlayer->GetVehicle()->GetVehicleEnt()->GetClassname(),"choreo"))
		{
			eye[YAW] += 90;
		}
		


	}
	else
	{
		vel = pPlayer->GetAbsVelocity();
	}

	Vector PlayerVel = pPlayer->GetAbsVelocity();

	//Choreo vehicles use player avatar and don't produce their own velocity
	if(!pPlayer->GetVehicle() || abs(vvel.Length()) == 0 )
	{
		vel = PlayerVel;
	}
	else
		vel = vvel;


	
	VectorYawRotate(vel, -90 -eye[YAW], vel );

	vel.y = -vel.y;
	vel.z = -vel.z;
	
	switch(pPlayer->GetMoveType()) {
		case MOVETYPE_NOCLIP:
			vel *= hap_noclip_avatar_scale.GetFloat();
			break;
		default:
			break;
	}

	haptics->UpdateAvatarVelocity(vel);
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:60,代码来源:haptic_utils.cpp

示例9: HandleMPIDisconnect

void HandleMPIDisconnect( int procID, const char *pReason )
{
	int nLiveWorkers = VMPI_GetCurrentNumberOfConnections() - g_nDisconnects - 1;

	// We ran into the size limit before and it wasn't readily apparent that the size limit had
	// been breached, so make sure to show errors about invalid packet sizes..
	bool bOldSuppress = g_bSuppressPrintfOutput;
	g_bSuppressPrintfOutput = ( Q_stristr( pReason, "invalid packet size" ) == 0 );

		Warning( "\n\n--- WARNING: lost connection to '%s' (%s).\n", VMPI_GetMachineName( procID ), pReason );
		
		if ( g_bMPIMaster )
		{
			Warning( "%d workers remain.\n\n", nLiveWorkers );

			++g_nDisconnects;
			/*
			if ( VMPI_GetCurrentNumberOfConnections() - g_nDisconnects <= 1 )
			{
				Error( "All machines disconnected!" );
			}
			*/
		}
		else
		{
			VMPI_HandleAutoRestart();
			Error( "Worker quitting." );
		}
	
	g_bSuppressPrintfOutput = bOldSuppress;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:31,代码来源:vmpi_tools_shared.cpp

示例10: LookupSequence

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_NPC_Puppet::AccumulateLayers( CStudioHdr *hdr, Vector pos[], Quaternion q[], float poseparam[], float currentTime, int boneMask )
{
	if ( m_hAnimationTarget == NULL )
		return;

	C_BaseAnimatingOverlay *pTarget = dynamic_cast<C_BaseAnimatingOverlay *>( m_hAnimationTarget->GetBaseAnimating() );
	if ( pTarget == NULL )
		return;

	// resort the layers
	int layer[MAX_OVERLAYS];
	int i;
	for (i = 0; i < MAX_OVERLAYS; i++)
	{
		layer[i] = MAX_OVERLAYS;
	}
	for (i = 0; i < pTarget->m_AnimOverlay.Count(); i++)
	{
		if (pTarget->m_AnimOverlay[i].m_nOrder < MAX_OVERLAYS)
		{
			layer[pTarget->m_AnimOverlay[i].m_nOrder] = i;
		}
	}

	int j;
	for (j = 0; j < MAX_OVERLAYS; j++)
	{
		i = layer[ j ];
		if (i < pTarget->m_AnimOverlay.Count())
		{
			float fWeight = pTarget->m_AnimOverlay[i].m_flWeight;

			if (fWeight > 0)
			{
				const char *pSequenceName = pTarget->GetSequenceName( pTarget->m_AnimOverlay[i].m_nSequence );

				int nSequence = LookupSequence( pSequenceName );
				if ( nSequence >= 0 )
				{
					float fCycle = pTarget->m_AnimOverlay[ i ].m_flCycle;

					fCycle = ClampCycle( fCycle, IsSequenceLooping( nSequence ) );

					if (fWeight > 1)
						fWeight = 1;

					AccumulatePose( hdr, NULL, pos, q, nSequence, fCycle, poseparam, boneMask, fWeight, currentTime );

#if _DEBUG
					if (Q_stristr( hdr->pszName(), r_sequence_debug.GetString()) != NULL)
					{
						DevMsgRT( "%6.2f : %30s : %5.3f : %4.2f : %1d\n", currentTime, hdr->pSeqdesc( nSequence ).pszLabel(), fCycle, fWeight, i );
					}
#endif

				}
			}
		}
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:63,代码来源:c_npc_puppet.cpp

示例11: DoesPathExistAlready

bool DoesPathExistAlready( const char *pPathEnvVar, const char *pTestPath )
{
	// Fix the slashes in the input arguments.
	char correctedPathEnvVar[8192], correctedTestPath[MAX_PATH];
	Q_strncpy( correctedPathEnvVar, pPathEnvVar, sizeof( correctedPathEnvVar ) );
	Q_FixSlashes( correctedPathEnvVar );
	pPathEnvVar = correctedPathEnvVar;

	Q_strncpy( correctedTestPath, pTestPath, sizeof( correctedTestPath ) );
	Q_FixSlashes( correctedTestPath );
	if ( strlen( correctedTestPath ) > 0 && PATHSEPARATOR( correctedTestPath[strlen(correctedTestPath)-1] ) )
		correctedTestPath[ strlen(correctedTestPath) - 1 ] = 0;

	pTestPath = correctedTestPath;

	const char *pCurPos = pPathEnvVar;
	while ( 1 )
	{
		const char *pTestPos = Q_stristr( pCurPos, pTestPath );
		if ( !pTestPos )
			return false;

		// Ok, we found pTestPath in the path, but it's only valid if it's followed by an optional slash and a semicolon.
		pTestPos += strlen( pTestPath );
		if ( pTestPos[0] == 0 || pTestPos[0] == ';' || (PATHSEPARATOR( pTestPos[0] ) && pTestPos[1] == ';') )
			return true;
	
		// Advance our marker..
		pCurPos = pTestPos;
	}
}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:31,代码来源:filesystem_init.cpp

示例12: AllocPooledString

//-----------------------------------------------------------------------------
// Purpose: Setup the patch
// Input  : nEntIndex - index of the edict that owns the sound channel
//			channel - This is a sound channel (CHAN_ITEM, CHAN_STATIC)
//			*pSoundName - string name of the wave "weapons/sound.wav"
//			attenuation - attenuation of this sound (not animated)
//-----------------------------------------------------------------------------
void CSoundPatch::Init( IRecipientFilter *pFilter, CBaseEntity *pEnt, int channel, const char *pSoundName, 
			soundlevel_t soundlevel )
{
	m_hEnt = pEnt;
	m_entityChannel = channel;
	m_iszSoundName = AllocPooledString( pSoundName );
	m_volume.SetValue( 0 );
	m_soundlevel = soundlevel;
	m_pitch.SetValue( 0 );
	m_isPlaying = false;
	m_shutdownTime = 0;
	m_flLastTime = 0;
	m_Filter.Init( pFilter );

	// Get the volume from the script
	CSoundParameters params;
	if ( !Q_stristr( pSoundName, ".wav" ) &&
		CBaseEntity::GetParametersForSound( pSoundName, params ) )
	{
		m_flScriptVolume = params.volume;
	}
	else
	{
		m_flScriptVolume = 1.0;
	}

#ifdef _DEBUG
	m_iszClassName = AllocPooledString( pEnt->GetClassname() );
#endif
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:37,代码来源:soundenvelope.cpp

示例13: Interpolator_CurveTypeForName

// Turn enum into string and vice versa
int Interpolator_CurveTypeForName( const char *name )
{
	char sz[ 128 ];
	Q_strncpy( sz, name, sizeof( sz ) );

	int leftcurve = 0;
	int rightcurve = 0;

	int skip = Q_strlen( "curve_" );

	if ( !Q_strnicmp( sz, "curve_", skip ) )
	{
		char *p = sz + skip;
		char *second = Q_stristr( p, "_to_curve_" );
		
		char save = *second;
		*second = 0;

		leftcurve = Interpolator_InterpolatorForName( p );

		*second = save;

		p = second + Q_strlen( "_to_curve_" );

		rightcurve = Interpolator_InterpolatorForName( p );
	}

	return MAKE_CURVE_TYPE( leftcurve, rightcurve );
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:30,代码来源:interpolatortypes.cpp

示例14: fixBadWords

char* fixBadWords(char *str)
{
	char *at;
	char wordBuf[4096];
	int cIndex;
	int i;

	for( i=0;i<numWords;++i )
	{
		at = str;

		while( ( at = (char *)Q_stristr( at, badWords[i] ) ) )
		{
#ifndef min
#define min(a, b)	(a) < (b) ? a : b
#endif
			cIndex = min( strspn( at, "ABCDEFGHIIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ), sizeof( wordBuf ) - 1 );
			memcpy( wordBuf, at, cIndex );
			wordBuf[cIndex] = '\0';

			if( ( Q_stricmp(badWords[i], wordBuf) == 0 ) && ( at == str || ( at[-1] == ' ' ) || ( at > ( str + 1 ) && at[-2] == '^' ) ) )
				Com_Memset( at, ' ', cIndex );

			++at;
		}	
	}

	return str;
}
开发者ID:Mixone-FinallyHere,项目名称:SmokinGuns,代码行数:29,代码来源:cl_cgame.c

示例15: HapticsEnteredVehicle

void HapticsEnteredVehicle(C_BaseEntity* vehicle, C_BaseCombatCharacter *pPassenger )
{
	if(!vehicle)
		return;

	// NVNT notify haptics system of navigation change.

	C_PropVehicleDriveable* drivable = dynamic_cast<C_PropVehicleDriveable*>(vehicle);
	bool hasgun = false;
	if(drivable)
		hasgun = drivable->HasGun();





	if(Q_stristr(vehicle->GetClassname(),"airboat"))
	{
		haptics->ProcessHapticEvent(2,"Movement","airboat");
		if(hasgun)
			haptics->SetNavigationClass("vehicle_gun");
		else
			haptics->SetNavigationClass("vehicle_airboat");
	}
	else if(Q_stristr(vehicle->GetClassname(),"jeepepisodic"))
	{
		haptics->ProcessHapticEvent(2,"Movement","BaseVehicle");
		haptics->SetNavigationClass("vehicle_nogun");
	}
	else if(Q_stristr(vehicle->GetClassname(),"jeep"))
	{
		haptics->ProcessHapticEvent(2,"Movement","BaseVehicle");
		haptics->SetNavigationClass("vehicle_gun");
	}
	else if(Q_stristr(vehicle->GetClassname(),"choreo"))
	{
		haptics->ProcessHapticEvent(2,"Movement","ChoreoVehicle");
		haptics->SetNavigationClass("vehicle_gun_nofix");//Give this a bit of aiming
	}
	else
	{
		haptics->ProcessHapticEvent(2,"Movement","BaseVehicle");
		haptics->SetNavigationClass("vehicle_nogun");
	}

	Msg("VehicleType:%s:\n",vehicle->GetClassname());
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:47,代码来源:haptic_utils.cpp


注:本文中的Q_stristr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。