本文整理匯總了C++中AllocPooledString函數的典型用法代碼示例。如果您正苦於以下問題:C++ AllocPooledString函數的具體用法?C++ AllocPooledString怎麽用?C++ AllocPooledString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AllocPooledString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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
}
示例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;
}
示例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) );
}
示例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) );
}
示例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
}
示例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 )
{}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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" );
}
示例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 );
}
}
}
}
}