本文整理汇总了C++中AllocPooledString函数的典型用法代码示例。如果您正苦于以下问题:C++ AllocPooledString函数的具体用法?C++ AllocPooledString怎么用?C++ AllocPooledString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AllocPooledString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: atoi
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTeamControlPoint::KeyValue( const char *szKeyName, const char *szValue )
{
if ( !Q_strncmp( szKeyName, "team_capsound_", 14 ) )
{
int iTeam = atoi(szKeyName+14);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iszCapSound = AllocPooledString(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_model_", 11 ) )
{
int iTeam = atoi(szKeyName+11);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iszModel = AllocPooledString(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_timedpoints_", 17 ) )
{
int iTeam = atoi(szKeyName+17);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iTimedPoints = atoi(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_bodygroup_", 15 ) )
{
int iTeam = atoi(szKeyName+15);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iModelBodygroup = atoi(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_icon_", 10 ) )
{
int iTeam = atoi(szKeyName+10);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iszIcon = AllocPooledString(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_overlay_", 13 ) )
{
int iTeam = atoi(szKeyName+13);
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
m_TeamData[iTeam].iszOverlay = AllocPooledString(szValue);
}
else if ( !Q_strncmp( szKeyName, "team_previouspoint_", 19 ) )
{
int iTeam;
int iPoint = 0;
sscanf( szKeyName+19, "%d_%d", &iTeam, &iPoint );
Assert( iTeam >= 0 && iTeam < m_TeamData.Count() );
Assert( iPoint >= 0 && iPoint < MAX_PREVIOUS_POINTS );
m_TeamData[iTeam].iszPreviousPoint[iPoint] = AllocPooledString(szValue);
}
else
{
return BaseClass::KeyValue( szKeyName, szValue );
}
return true;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:63,代码来源:team_control_point.cpp
示例2: SetModelName
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CResourceChunk::Spawn( )
{
// Init model
if ( IsProcessed() )
{
SetModelName( AllocPooledString( sProcessedResourceChunkModel ) );
}
else
{
SetModelName( AllocPooledString( sResourceChunkModel ) );
}
BaseClass::Spawn();
UTIL_SetSize( this, Vector(-4,-4,-4), Vector(4,4,4) );
SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
SetSolid( SOLID_BBOX );
AddSolidFlags( FSOLID_TRIGGER );
CollisionProp()->UseTriggerBounds( true, 24 );
SetCollisionGroup( TFCOLLISION_GROUP_RESOURCE_CHUNK );
SetGravity( 1.0 );
SetFriction( 1 );
SetTouch( ChunkTouch );
SetThink( ChunkRemove );
SetNextThink( gpGlobals->curtime + random->RandomFloat( 50.0, 80.0 ) ); // Remove myself the
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:29,代码来源:resource_chunk.cpp
示例3: RunPlayerInit
bool CMapAdd::RunPlayerInit( const char *mapaddMap, const char *szLabel)
{
if(AllocPooledString(mapaddMap) == AllocPooledString("") || !mapaddMap)
return false; //Failed to load!
if(!szLabel)
szLabel = "Init";
//FileHandle_t fh = filesystem->Open(szMapadd,"r","MOD");
// Open the mapadd data file, and abort if we can't
KeyValues *pMapAdd = new KeyValues( "MapAdd" );
if(pMapAdd->LoadFromFile( filesystem, mapaddMap, "MOD" ))
{
KeyValues *pMapAdd2 = pMapAdd->FindKey(szLabel);
if(pMapAdd2)
{
KeyValues *pMapAddEnt = pMapAdd2->GetFirstTrueSubKey();
while (pMapAddEnt)
{
HandlePlayerEntity(pMapAddEnt, false);
pMapAddEnt = pMapAddEnt->GetNextTrueSubKey(); //Got to keep this!
}
}
}
pMapAdd->deleteThis();
return true;
}
开发者ID:sirmastercombat,项目名称:SirMasters_Mod,代码行数:25,代码来源:mapadd.cpp
示例4: DoEntFire
static void DoEntFire( const char *pszTarget, const char *pszAction, const char *pszValue, float delay, HSCRIPT hActivator, HSCRIPT hCaller )
{
const char *target = "", *action = "Use";
variant_t value;
target = STRING( AllocPooledString( pszTarget ) );
// Don't allow them to run anything on a point_servercommand unless they're the host player. Otherwise they can ent_fire
// and run any command on the server. Admittedly, they can only do the ent_fire if sv_cheats is on, but
// people complained about users resetting the rcon password if the server briefly turned on cheats like this:
// give point_servercommand
// ent_fire point_servercommand command "rcon_password mynewpassword"
if ( gpGlobals->maxClients > 1 && V_stricmp( target, "point_servercommand" ) == 0 )
{
return;
}
if ( *pszAction )
{
action = STRING( AllocPooledString( pszAction ) );
}
if ( *pszValue )
{
value.SetString( AllocPooledString( pszValue ) );
}
if ( delay < 0 )
{
delay = 0;
}
g_EventQueue.AddEvent( target, action, value, delay, ToEnt(hActivator), ToEnt(hCaller) );
}
开发者ID:SCell555,项目名称:hl2-asw-port,代码行数:32,代码来源:vscript_server.cpp
示例5: DoEntFireByInstanceHandle
//--------------------------------------------------------------------------------------------------
// Use an entity's script instance to add an entity IO event (used for firing events on unnamed entities from vscript)
//--------------------------------------------------------------------------------------------------
static void DoEntFireByInstanceHandle( HSCRIPT hTarget, const char *pszAction, const char *pszValue, float delay, HSCRIPT hActivator, HSCRIPT hCaller )
{
const char *action = "Use";
variant_t value;
if ( *pszAction )
{
action = STRING( AllocPooledString( pszAction ) );
}
if ( *pszValue )
{
value.SetString( AllocPooledString( pszValue ) );
}
if ( delay < 0 )
{
delay = 0;
}
CBaseEntity* pTarget = ToEnt(hTarget);
if ( !pTarget )
{
Warning( "VScript error: DoEntFire was passed an invalid entity instance.\n" );
return;
}
g_EventQueue.AddEvent( pTarget, action, value, delay, ToEnt(hActivator), ToEnt(hCaller) );
}
开发者ID:SCell555,项目名称:hl2-asw-port,代码行数:31,代码来源:vscript_server.cpp
示例6: 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
示例7: m_szHexname
TrackInfo_t::TrackInfo_t( const char *szFilename, const char *szHexname, const char *szAlbum, const char *szArtist, const char *szGenre )
: m_szHexname( AllocPooledString( szHexname ) )
, m_szFilename( AllocPooledString( szFilename ))
, m_szAlbum( szAlbum )
, m_szArtist( szArtist )
, m_szGenre( szGenre )
, m_bIsMarkedForDeletion( false )
{}
开发者ID:Randdalf,项目名称:bliink,代码行数:8,代码来源:c_asw_jukebox.cpp
示例8: Warning
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamControlPoint::Spawn( void )
{
// Validate our default team
if ( m_iDefaultOwner < 0 || m_iDefaultOwner >= GetNumberOfTeams() )
{
Warning( "team_control_point '%s' has bad point_default_owner.\n", GetDebugName() );
m_iDefaultOwner = TEAM_UNASSIGNED;
}
#ifdef TF_DLL
if ( m_iszCaptureStartSound == NULL_STRING )
{
m_iszCaptureStartSound = AllocPooledString( "Hologram.Start" );
}
if ( m_iszCaptureEndSound == NULL_STRING )
{
m_iszCaptureEndSound = AllocPooledString( "Hologram.Stop" );
}
if ( m_iszCaptureInProgress == NULL_STRING )
{
m_iszCaptureInProgress = AllocPooledString( "Hologram.Move" );
}
if ( m_iszCaptureInterrupted == NULL_STRING )
{
m_iszCaptureInterrupted = AllocPooledString( "Hologram.Interrupted" );
}
#endif
Precache();
InternalSetOwner( m_iDefaultOwner, false ); //init the owner of this point
SetActive( !m_bStartDisabled );
BaseClass::Spawn();
SetPlaybackRate( 1.0 );
SetThink( &CTeamControlPoint::AnimThink );
SetNextThink( gpGlobals->curtime + 0.1f );
if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_MODEL ) )
{
AddEffects( EF_NODRAW );
}
if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_SHADOW ) )
{
AddEffects( EF_NOSHADOW );
}
m_flLastContestedAt = -1;
m_pCaptureInProgressSound = NULL;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:59,代码来源:team_control_point.cpp
示例9: AllocPooledString
void CASW_Holdout_Wave_Entry::LoadFromKeyValues( KeyValues *pKeys )
{
m_flSpawnDelay = pKeys->GetFloat( "SpawnDelay", 1.0f );
m_iszAlienClass = AllocPooledString( pKeys->GetString( "AlienClass" ) );
m_nQuantity = pKeys->GetInt( "Quantity", 1 );
m_flSpawnDuration = pKeys->GetFloat( "SpawnDuration", 0.0f );
m_nModifiers = pKeys->GetInt( "Modifiers", 0 ); // TODO: Turn this into a string parser for the bit flag names
m_iszSpawnGroupName = AllocPooledString( pKeys->GetString( "SpawnGroup" ) );
m_hSpawnGroup = NULL;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:10,代码来源:asw_holdout_wave.cpp
示例10:
CBaseEntity *CAI_Relationship::FindEntityForProceduralName( string_t iszName, CBaseEntity *pActivator, CBaseEntity *pCaller )
{
// Handle the activator token
if ( iszName == AllocPooledString( ACTIVATOR_KEYNAME ) )
return pActivator;
// Handle the caller token
if ( iszName == AllocPooledString( CALLER_KEYNAME ) )
return pCaller;
return NULL;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:12,代码来源:ai_relationship.cpp
示例11: AllocPooledString
bool CNPCSimpleTalker::KeyValue( const char *szKeyName, const char *szValue )
{
if (FStrEq(szKeyName, "UseSentence"))
{
m_iszUse = AllocPooledString(szValue);
}
else if (FStrEq(szKeyName, "UnUseSentence"))
{
m_iszUnUse = AllocPooledString(szValue);
}
else
return BaseClass::KeyValue( szKeyName, szValue );
return true;
}
开发者ID:Denzeriko,项目名称:hl2-mod,代码行数:15,代码来源:npc_talker.cpp
示例12: ASWGameResource
void CASW_Campaign_Save::UpdateLastCommanders()
{
// save which marines the players have selected
// add which marines he has selected
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
// first check there were some marines selected (i.e. we're not in the campaign lobby map)
int iNumMarineResources = 0;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i))
iNumMarineResources++;
}
if ( iNumMarineResources <= 0 )
return;
char buffer[256];
for (int i=0;i<ASW_NUM_MARINE_PROFILES;i++)
{
// look for a marine info for this marine
bool bFound = false;
for (int k=0;k<pGameResource->GetMaxMarineResources();k++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(k);
if (pMR && pMR->GetProfileIndex() == i && pMR->GetCommander())
{
CASW_Player *pPlayer = pMR->GetCommander();
if (pPlayer)
{
// store the commander who has this marine
Q_snprintf(buffer, sizeof(buffer), "%s%s",pPlayer->GetPlayerName(), pPlayer->GetASWNetworkID());
m_LastCommanders[i] = AllocPooledString(buffer);
m_LastMarineResourceSlot[i] = k;
m_LastPrimaryMarines[i] = pPlayer->IsPrimaryMarine(i);
bFound = true;
break;
}
}
}
if (!bFound)
{
m_LastCommanders[i] = AllocPooledString("");
m_LastMarineResourceSlot[i] = 0;
}
}
}
开发者ID:jtanx,项目名称:ch1ckenscoop,代码行数:48,代码来源:asw_campaign_save.cpp
示例13: SetWidth
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CEnvLaser::KeyValue( const char *szKeyName, const char *szValue )
{
if (FStrEq(szKeyName, "width"))
{
SetWidth( atof(szValue) );
}
else if (FStrEq(szKeyName, "NoiseAmplitude"))
{
SetNoise( atoi(szValue) );
}
else if (FStrEq(szKeyName, "TextureScroll"))
{
SetScrollRate( atoi(szValue) );
}
else if (FStrEq(szKeyName, "texture"))
{
SetModelName( AllocPooledString(szValue) );
}
else
{
BaseClass::KeyValue( szKeyName, szValue );
}
return true;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:28,代码来源:EnvLaser.cpp
示例14: infected_health
//====================================================================
// Creación en el mapa
//====================================================================
void CAP_PlayerInfected::Spawn()
{
ConVarRef infected_health("sk_infected_health");
int iMaxHealth = infected_health.GetInt() + RandomInt( 1, 5 );
CB_MeleeCharacter::SetOuter( this );
BaseClass::Spawn();
// El Director será el responsable de crearnos
// Mientras tanto seremos invisibles y no nos moveremos
AddEffects( EF_NODRAW );
AddFlag( FL_FREEZING );
SetCollisionGroup( COLLISION_GROUP_NONE );
m_takedamage = DAMAGE_NO;
// Esto hará que el Director lo tome como uno de sus hijos
SetName( AllocPooledString(DIRECTOR_CHILD_NAME) );
// Seleccionamos un color para nuestra ropa
SetClothColor();
// Establecemos la salud
SetMaxHealth( iMaxHealth );
SetHealth( iMaxHealth );
// Más información
m_iNextIdleSound = IDLE_SOUND_INTERVAL;
m_iNextAttack = ATTACK_INTERVAL;
// Solicitamos un lugar para el Spawn
RegisterThinkContext( "RequestDirectorSpawn" );
SetContextThink( &CAP_PlayerInfected::RequestDirectorSpawn, gpGlobals->curtime, "RequestDirectorSpawn" );
}
开发者ID:InfoSmart,项目名称:InSource,代码行数:36,代码来源:ap_player_infected.cpp
示例15: SetupParentsForSpawnList
void SetupParentsForSpawnList( int nEntities, HierarchicalSpawn_t *pSpawnList )
{
int nEntity;
for (nEntity = nEntities - 1; nEntity >= 0; nEntity--)
{
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
if ( pEntity )
{
if ( strchr(STRING(pEntity->m_iParent), ',') )
{
char szToken[256];
const char *pAttachmentName = nexttoken(szToken, STRING(pEntity->m_iParent), ',');
pEntity->m_iParent = AllocPooledString(szToken);
CBaseEntity *pParent = gEntList.FindEntityByName( NULL, pEntity->m_iParent );
// setparent in the spawn pass instead - so the model will have been set & loaded
pSpawnList[nEntity].m_pDeferredParent = pParent;
pSpawnList[nEntity].m_pDeferredParentAttachment = pAttachmentName;
}
else
{
CBaseEntity *pParent = gEntList.FindEntityByName( NULL, pEntity->m_iParent );
if ((pParent != NULL) && (pParent->edict() != NULL))
{
pEntity->SetParent( pParent );
}
}
}
}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:31,代码来源:mapentities.cpp
示例16: UTIL_SetModel
//-----------------------------------------------------------------------------
// Sets the model to be associated with an entity
//-----------------------------------------------------------------------------
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName )
{
// check to see if model was properly precached
int i = modelinfo->GetModelIndex( pModelName );
if ( i < 0 )
{
Error("%i - %s: UTIL_SetModel: not precached: %s\n", VFuncs::entindex(pEntity),
VFuncs::GetClassname(pEntity), pModelName);
}
VFuncs::SetModelIndex(pEntity, i);
VFuncs::SetModelName( pEntity, AllocPooledString( pModelName ) );
//VFuncs::SetModelName( pEntity, MAKE_STRING( pModelName ) );
// brush model
const model_t *mod = modelinfo->GetModel( i );
if ( mod )
{
Vector mins, maxs;
modelinfo->GetModelBounds( mod, mins, maxs );
SetMinMaxSize (pEntity, mins, maxs);
}
else
{
SetMinMaxSize (pEntity, vec3_origin, vec3_origin);
}
}
开发者ID:kila58,项目名称:sourceop,代码行数:30,代码来源:util.cpp
示例17: UTIL_PrecacheOther
//-----------------------------------------------------------------------------
// Purpose:
// Input : *szClassname -
// *modelName -
//-----------------------------------------------------------------------------
void UTIL_PrecacheOther( const char *szClassname, const char *modelName )
{
#if defined( PRECACHE_OTHER_ONCE )
// already done this one?, if not, mark as done
if ( !g_PrecacheOtherList.AddOrMarkPrecached( szClassname ) )
return;
#endif
CBaseEntity *pEntity = CreateEntityByName( szClassname );
if ( !pEntity )
{
Warning( "NULL Ent in UTIL_PrecacheOther for %s\n", szClassname );
return;
}
// If we have a specified model, set it before calling precache
if ( modelName && modelName[0] )
{
VFuncs::SetModelName(pEntity, AllocPooledString( modelName ) );
}
if (pEntity)
VFuncs::Precache( pEntity );
UTIL_RemoveImmediate( pEntity );
}
开发者ID:kila58,项目名称:sourceop,代码行数:31,代码来源:util.cpp
示例18: atoi
/**
* Parse KeyValue pairs
*/
bool CFishPool::KeyValue( const char *szKeyName, const char *szValue )
{
if (FStrEq( szKeyName, "fish_count" ))
{
m_fishCount = atoi(szValue);
return true;
}
else if (FStrEq( szKeyName, "max_range" ))
{
m_maxRange = atof(szValue);
if (m_maxRange <= 1.0f)
{
m_maxRange = 1.0f;
}
else if (m_maxRange > 255.0f)
{
// stay within 8 bits range
m_maxRange = 255.0f;
}
return true;
}
else if (FStrEq( szKeyName, "model" ))
{
PrecacheModel( szValue );
SetModelName( AllocPooledString( szValue ) );
}
return BaseClass::KeyValue( szKeyName, szValue );
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:33,代码来源:fish.cpp
示例19: GetModelName
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPointCommentaryNode::Spawn( void )
{
// No model specified?
char *szModel = (char *)STRING( GetModelName() );
if (!szModel || !*szModel)
{
szModel = "models/extras/info_speech.mdl";
SetModelName( AllocPooledString(szModel) );
}
Precache();
SetModel( szModel );
UTIL_SetSize( this, -Vector(16,16,16), Vector(16,16,16) );
SetSolid( SOLID_BBOX );
AddSolidFlags( FSOLID_CUSTOMRAYTEST | FSOLID_CUSTOMBOXTEST );
AddEffects( EF_NOSHADOW );
// Setup for animation
ResetSequence( LookupSequence("idle") );
SetThink( &CPointCommentaryNode::SpinThink );
SetNextThink( gpGlobals->curtime + 0.1f );
m_iNodeNumber = 0;
m_iNodeNumberMax = 0;
SetDisabled( m_bDisabled );
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:30,代码来源:commentarysystem.cpp
示例20: SetModelName
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::Spawn( void )
{
SetModelName( AllocPooledString("models/magnusson_device.mdl") );
BaseClass::Spawn();
// Setup for being shot by the player
m_takedamage = DAMAGE_EVENTS_ONLY;
// Ignore touches until launched.
SetTouch ( NULL );
AddFlag( FL_AIMTARGET|FL_OBJECT );
m_hParticleEffect = CreateEntityByName( "info_particle_system" );
if ( m_hParticleEffect )
{
m_hParticleEffect->KeyValue( "start_active", "1" );
m_hParticleEffect->KeyValue( "effect_name", "striderbuster_smoke" );
DispatchSpawn( m_hParticleEffect );
if ( gpGlobals->curtime > 0.2f )
{
m_hParticleEffect->Activate();
}
m_hParticleEffect->SetAbsOrigin( GetAbsOrigin() );
m_hParticleEffect->SetParent( this );
}
SetHealth( striderbuster_health.GetFloat() );
SetNextThink(gpGlobals->curtime + 0.01f);
}
开发者ID:FooGames,项目名称:SecobMod,代码行数:34,代码来源:weapon_striderbuster.cpp
注:本文中的AllocPooledString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论