本文整理汇总了C++中ConVar::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConVar::GetString方法的具体用法?C++ ConVar::GetString怎么用?C++ ConVar::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConVar
的用法示例。
在下文中一共展示了ConVar::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TrackPlayers
void TrackPlayers()
{
if (debugoverlay == nullptr) {
Warning("debugoverlay is nullptr!\n");
return;
}
if (V_stricmp(cvar_indexes.GetString(), "all") == 0) {
for (int i = 1; i <= 32; ++i) {
debugoverlay->AddEntityTextOverlay(i, 0, cvar_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff, "#%d", i);
}
} else {
char *dup = strdup(cvar_indexes.GetString());
char *s = strtok(dup, ",");
while (s != nullptr) {
int idx = std::stoi(s, nullptr, 0);
// DevMsg("%d\n", idx);
if (idx >= 0 && idx < 2048) {
debugoverlay->AddEntityTextOverlay(idx, 0, cvar_duration.GetFloat(), 0xff, 0xff, 0xff, 0xff, "#%d", idx);
}
s = strtok(nullptr, ",");
}
free(dup);
}
}
示例2: StartSearching
//=============================================================================
void FoundPublicGames::StartSearching( void )
{
KeyValues *pKeyValuesSearch = new KeyValues( "Search" );
char const *szGameMode = m_pDataSettings->GetString( "game/mode", "" );
if ( szGameMode && *szGameMode )
pKeyValuesSearch->SetString( "game/mode", szGameMode );
char const *szCampaign = ui_public_lobby_filter_campaign.GetString();
if ( szCampaign && *szCampaign )
pKeyValuesSearch->SetString( "game/missioninfo/builtin", szCampaign );
char const *szDifficulty = ui_public_lobby_filter_difficulty2.GetString();
if ( szDifficulty && *szDifficulty && GameModeHasDifficulty( szGameMode ) )
pKeyValuesSearch->SetString( "game/difficulty", szDifficulty );
char const *szOnslaught = ui_public_lobby_filter_onslaught.GetString();
if ( szOnslaught && *szOnslaught )
pKeyValuesSearch->SetInt( "game/onslaught", 1 );
char const *szStatus = ui_public_lobby_filter_status.GetString();
if ( szStatus && *szStatus )
pKeyValuesSearch->SetString( "game/state", szStatus );
if ( !m_pSearchManager )
{
m_pSearchManager = g_pMatchFramework->GetMatchSystem()->CreateGameSearchManager( pKeyValuesSearch );
}
else
{
m_pSearchManager->EnableResultsUpdate( true, pKeyValuesSearch );
}
}
示例3: Particle_Test_Start
void Particle_Test_Start( CBasePlayer* pPlayer, const char *name, bool bStart )
{
if ( !pPlayer )
return;
int iAttachType = GetAttachTypeFromString( particle_test_attach_mode.GetString() );
if ( iAttachType < 0 )
{
Warning( "Invalid attach type specified for particle_test in cvar 'particle_test_attach_mode.\n" );
return;
}
int iAttachmentIndex = particle_test_attach_attachment.GetInt();
const char *pszParticleFile = particle_test_file.GetString();
CBaseEntity *pEntity = NULL;
while ( (pEntity = GetNextCommandEntity( pPlayer, name, pEntity )) != NULL )
{
/*
Fire the test particle system on this entity
*/
DispatchParticleEffect(
pszParticleFile,
(ParticleAttachment_t)iAttachType,
pEntity,
iAttachmentIndex,
true ); // stops existing particle systems
}
}
示例4: CL_CanUseHTTPDownload
//--------------------------------------------------------------------------------------------------------------
int CL_CanUseHTTPDownload(void)
{
if ( sv_downloadurl.GetString()[0] )
{
const char *serverMapName = va( "%s:%s", sv_downloadurl.GetString(), cl.m_szLevelName );
return !TheDownloadManager.HasMapBeenDownloadedFromServer( serverMapName );
}
return 0;
}
示例5: ChangeSpawnStatus
static void ChangeSpawnStatus(IConVar *cvar, const char *value, float flOldValue)
{
if (strcmp(value, cssdm_spawn_method.GetString()) == 0)
{
return;
}
DM_OnSetSpawnMethod(cssdm_spawn_method.GetString());
}
示例6: Bot_HandleSendCmd
void Bot_HandleSendCmd( CPluginBot *pBot )
{
if ( strlen( bot_sendcmd.GetString() ) > 0 )
{
//send the cmd from this bot
helpers->ClientCommand( pBot->m_BotEdict, bot_sendcmd.GetString() );
bot_sendcmd.SetValue("");
}
}
示例7: UpdateDebugOverlayFonts
void UpdateDebugOverlayFonts()
{
if (hFontFG == vgui::INVALID_FONT || bFGDirty) {
DevMsg("UpdateDebugOverlayFonts: regenerating FG font\n");
hFontFG = g_pVGuiSurface->CreateFont();
const char *name = cvar_fg_name.GetString();
int tall = cvar_fg_tall.GetInt();
int weight = cvar_fg_weight.GetInt();
int blur = cvar_fg_blur.GetInt();
int scanlines = cvar_fg_scanlines.GetInt();
int flags = vgui::ISurface::FONTFLAG_NONE;
if (cvar_fg_italic .GetBool()) flags |= vgui::ISurface::FONTFLAG_ITALIC;
if (cvar_fg_underline .GetBool()) flags |= vgui::ISurface::FONTFLAG_UNDERLINE;
if (cvar_fg_strikeout .GetBool()) flags |= vgui::ISurface::FONTFLAG_STRIKEOUT;
if (cvar_fg_antialias .GetBool()) flags |= vgui::ISurface::FONTFLAG_ANTIALIAS;
if (cvar_fg_dropshadow.GetBool()) flags |= vgui::ISurface::FONTFLAG_DROPSHADOW;
if (cvar_fg_outline .GetBool()) flags |= vgui::ISurface::FONTFLAG_OUTLINE;
bool bFGOK = g_pVGuiSurface->SetFontGlyphSet(hFontFG, name, tall, weight, blur, scanlines, flags);
DevMsg("UpdateDebugOverlayFonts: FG: %-3s %08lx\n", (bFGOK ? "OK" : "BAD"), hFontFG);
bFGDirty = false;
}
if (hFontBG == vgui::INVALID_FONT || bBGDirty) {
DevMsg("UpdateDebugOverlayFonts: regenerating BG font\n");
hFontBG = g_pVGuiSurface->CreateFont();
const char *name = cvar_bg_name.GetString();
int tall = cvar_bg_tall.GetInt();
int weight = cvar_bg_weight.GetInt();
int blur = cvar_bg_blur.GetInt();
int scanlines = cvar_bg_scanlines.GetInt();
int flags = vgui::ISurface::FONTFLAG_NONE;
if (cvar_bg_italic .GetBool()) flags |= vgui::ISurface::FONTFLAG_ITALIC;
if (cvar_bg_underline .GetBool()) flags |= vgui::ISurface::FONTFLAG_UNDERLINE;
if (cvar_bg_strikeout .GetBool()) flags |= vgui::ISurface::FONTFLAG_STRIKEOUT;
if (cvar_bg_antialias .GetBool()) flags |= vgui::ISurface::FONTFLAG_ANTIALIAS;
if (cvar_bg_dropshadow.GetBool()) flags |= vgui::ISurface::FONTFLAG_DROPSHADOW;
if (cvar_bg_outline .GetBool()) flags |= vgui::ISurface::FONTFLAG_OUTLINE;
bool bBGOK = g_pVGuiSurface->SetFontGlyphSet(hFontBG, name, tall, weight, blur, scanlines, flags);
DevMsg("UpdateDebugOverlayFonts: BG: %-3s %08lx\n", (bBGOK ? "OK" : "BAD"), hFontBG);
bBGDirty = false;
}
}
示例8: OnOpen
//=============================================================================
void MainMenu::OnOpen()
{
if ( IsPC() && connect_lobby.GetString()[0] )
{
// if we were launched with "+connect_lobby <lobbyid>" on the command line, join that lobby immediately
uint64 nLobbyID = _atoi64( connect_lobby.GetString() );
if ( nLobbyID != 0 )
{
KeyValues *pSettings = KeyValues::FromString(
"settings",
" system { "
" network LIVE "
" } "
" options { "
" action joinsession "
" } "
);
pSettings->SetUint64( "options/sessionid", nLobbyID );
KeyValues::AutoDelete autodelete( pSettings );
g_pMatchFramework->MatchSession( pSettings );
}
// clear the convar so we don't try to join that lobby every time we return to the main menu
connect_lobby.SetValue( "" );
}
BaseClass::OnOpen();
SetFooterState();
#ifndef _X360
bool bSteamCloudVisible = false;
{
static CGameUIConVarRef cl_cloud_settings( "cl_cloud_settings" );
if ( cl_cloud_settings.GetInt() == -1 )
{
CBaseModPanel::GetSingleton().OpenWindow( WT_STEAMCLOUDCONFIRM, this, false );
bSteamCloudVisible = true;
}
}
if ( !bSteamCloudVisible )
{
if ( AddonAssociation::CheckAndSeeIfShouldShow() )
{
CBaseModPanel::GetSingleton().OpenWindow( WT_ADDONASSOCIATION, this, false );
}
}
#endif
}
示例9: Build
//-----------------------------------------------------------------------------
// Purpose: Builds all navigation meshes
//-----------------------------------------------------------------------------
bool CRecastMgr::Build( bool loadDefaultMeshes )
{
double fStartTime = Plat_FloatTime();
// Load map mesh
if( !LoadMapMesh() )
{
Warning("CRecastMesh::Build: failed to load map data!\n");
return false;
}
// Insert all meshes first
if( loadDefaultMeshes )
{
InitDefaultMeshes();
}
CUtlVector<CRecastMesh *> meshesToBuild;
for ( int i = m_Meshes.First(); i != m_Meshes.InvalidIndex(); i = m_Meshes.Next(i ) )
{
if( IsMeshBuildDisabled( m_Meshes[i]->GetName() ) )
continue;
meshesToBuild.AddToTail( m_Meshes[i] );
}
// Create meshes
if( recast_build_threaded.GetBool() )
{
// Build threaded
CParallelProcessor<CRecastMesh *, CFuncJobItemProcessor<CRecastMesh *>, 2 > processor;
processor.m_ItemProcessor.Init( &ThreadedBuildMesh, &PreThreadedBuildMesh, &PostThreadedBuildMesh );
processor.Run( meshesToBuild.Base(), meshesToBuild.Count(), 1, recast_build_numthreads.GetInt(), g_pThreadPool );
}
else
{
if( V_strlen( recast_build_single.GetString() ) > 0 )
{
BuildMesh( m_pMapMesh, recast_build_single.GetString() );
}
else
{
for( int i = 0; i < meshesToBuild.Count(); i++ )
{
BuildMesh( m_pMapMesh, meshesToBuild[i]->GetName() );
}
}
}
m_bLoaded = true;
DevMsg( "CRecastMgr: Finished generating %d meshes in %f seconds\n", m_Meshes.Count(), Plat_FloatTime() - fStartTime );
return true;
}
示例10: Bot_ForceFireWeapon
// If bots are being forced to fire a weapon, see if I have it
void Bot_ForceFireWeapon( CPluginBot *pBot, CBotCmd &cmd )
{
if ( Q_strlen( bot_forcefireweapon.GetString() ) > 0 )
{
pBot->m_BotInterface->SetActiveWeapon( bot_forcefireweapon.GetString() );
bot_forcefireweapon.SetValue( "" );
// Start firing
// Some weapons require releases, so randomise firing
if ( bot_forceattackon.GetBool() || (RandomFloat(0.0,1.0) > 0.5) )
{
cmd.buttons |= bot_forceattack2.GetBool() ? IN_ATTACK2 : IN_ATTACK;
}
}
}
示例11: Update
void CASW_Spawn_Manager::Update()
{
if ( m_iHordeToSpawn > 0 )
{
if ( m_vecHordePosition != vec3_origin && ( !m_batchInterval.HasStarted() || m_batchInterval.IsElapsed() ) )
{
int iToSpawn = MIN( m_iHordeToSpawn, asw_max_alien_batch.GetInt() );
int iSpawned = SpawnAlienBatch( asw_horde_class.GetString(), iToSpawn, m_vecHordePosition, m_angHordeAngle, 0 );
if (asw_director_debug.GetInt() >= 4)
Msg("spawned %d/%d %s (horde) at (%f, %f, %f)\n", iSpawned, m_iHordeToSpawn, asw_horde_class.GetString(), VectorExpand(m_vecHordePosition));
m_iHordeToSpawn -= iSpawned;
for (int i = 0; i < iSpawned; i++)
{
if (RandomFloat() < asw_horde_wanderers.GetFloat())
{
KeyValues *pWanderer = RandomWanderer();
if (pWanderer)
{
FOR_EACH_TRUE_SUBKEY(pWanderer, pNPC)
{
if (V_stricmp(pNPC->GetName(), "NPC"))
{
Warning("Spawn Manager ignoring non-NPC key in WANDERER definition: %s\n", pNPC->GetName());
continue;
}
const char *szAlienClass = pNPC->GetString("AlienClass");
if (SpawnAlienAt(szAlienClass, m_vecHordePosition + Vector(0, 0, !V_stricmp(szAlienClass, "asw_buzzer") ? 128 : 32), m_angHordeAngle, pNPC))
{
if (asw_director_debug.GetInt() >= 4)
{
Msg("spawned %s (horde wanderer) at (%f, %f, %f)\n", szAlienClass, VectorExpand(m_vecHordePosition));
}
}
}
}
else
{
const char *szAlienClass = asw_wanderer_class.GetString();
if (SpawnAlienAt(szAlienClass, m_vecHordePosition + Vector(0, 0, !V_stricmp(szAlienClass, "asw_buzzer") ? 128 : 32), m_angHordeAngle))
{
if (asw_director_debug.GetInt() >= 4)
{
Msg("spawned %s (horde wanderer) at (%f, %f, %f)\n", szAlienClass, VectorExpand(m_vecHordePosition));
}
}
}
}
}
示例12: 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);
}
}
示例13: Instructor_IsLessonLearned
bool C_SDKPlayer::Instructor_IsLessonLearned(const CLessonProgress* pLessonProgress)
{
if (!m_pInstructor)
return false;
Assert(pLessonProgress);
if (!pLessonProgress)
return true;
// Check the config for whether the lesson was learned in previous
// runs of the game.
std::string sLessonsLearned = da_instructor_lessons_learned.GetString();
std::vector<std::string> asTokens;
split_string(sLessonsLearned, ';', asTokens);
for (size_t i = 0; i < asTokens.size(); i++)
{
if (asTokens[i] == pLessonProgress->m_sLessonName.String())
return true;
}
CLesson* pLesson = m_pInstructor->GetLesson(pLessonProgress->m_sLessonName);
Assert(pLesson);
if (!pLesson)
return true;
return pLessonProgress->m_iTimesLearned >= pLesson->m_iTimesToLearn;
}
示例14: Cache_Print
/*
============
Cache_Print
============
*/
void Cache_Print (void)
{
cache_system_t *cd;
cache_system_t *sortarray[512];
int i=0,j=0;
FileHandle_t file = g_pFileSystem->Open(mem_dbgfile.GetString(), "a");
if (!file)
return;
memset(sortarray,sizeof(cache_system_t*)*512,0);
g_pFileSystem->FPrintf(file,"\nCACHE:\n");
for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next)
{
sortarray[i++]=cd;
}
//Sort the array alphabetically
qsort(sortarray,i,sizeof(cache_system_t*),CacheSystemCompare);
for(j=0;j<i;j++)
g_pFileSystem->FPrintf(file, "%16.16s : %-16s\n", Q_pretifymem(sortarray[j]->size), sortarray[j]->name);
g_pFileSystem->Close(file);
}
示例15: IsTheTarget
bool IsTheTarget(CTFPlayer *player)
{
if (player->GetTeamNumber() != TF_TEAM_RED) return false;
if (V_stristr(player->GetPlayerName(), cvar_name.GetString()) == nullptr) return false;
return true;
}