本文整理汇总了C++中EHANDLE::entindex方法的典型用法代码示例。如果您正苦于以下问题:C++ EHANDLE::entindex方法的具体用法?C++ EHANDLE::entindex怎么用?C++ EHANDLE::entindex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EHANDLE
的用法示例。
在下文中一共展示了EHANDLE::entindex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Activate
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CAmbientGeneric::Activate( void )
{
BaseClass::Activate();
// Initialize sound source. If no source was given, or source can't be found
// then this is the source
if (m_hSoundSource == NULL)
{
if (m_sSourceEntName != NULL_STRING)
{
m_hSoundSource = gEntList.FindEntityByName( NULL, m_sSourceEntName );
if ( m_hSoundSource != NULL )
{
m_nSoundSourceEntIndex = m_hSoundSource->entindex();
}
}
if (m_hSoundSource == NULL)
{
m_hSoundSource = this;
m_nSoundSourceEntIndex = entindex();
}
else
{
if ( !FBitSet( m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE ) )
{
AddEFlags( EFL_FORCE_CHECK_TRANSMIT );
}
}
}
// If active start the sound
if ( m_fActive )
{
int flags = SND_SPAWNING;
// If we are loading a saved game, we can't write into the init/signon buffer here, so just issue
// as a regular sound message...
if ( gpGlobals->eLoadType == MapLoad_Transition ||
gpGlobals->eLoadType == MapLoad_LoadGame ||
g_pGameRules->InRoundRestart() )
{
flags = SND_NOFLAGS;
}
// Tracker 76119: 8/12/07 ywb:
// Make sure pitch and volume are set up to the correct value (especially after restoring a .sav file)
flags |= ( SND_CHANGE_PITCH | SND_CHANGE_VOL );
// Don't bother sending over to client if volume is zero, though
if ( m_dpv.vol > 0 )
{
SendSound( (SoundFlags_t)flags );
}
SetNextThink( gpGlobals->curtime + 0.1f );
}
}
示例2: Activate
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CAmbientGeneric::Activate( void )
{
BaseClass::Activate();
// Initialize sound source. If no source was given, or source can't be found
// then this is the source
if (m_hSoundSource == NULL)
{
if (m_sSourceEntName != NULL_STRING)
{
m_hSoundSource = gEntList.FindEntityByName( NULL, m_sSourceEntName );
if ( m_hSoundSource != NULL )
{
m_nSoundSourceEntIndex = m_hSoundSource->entindex();
}
}
if (m_hSoundSource == NULL)
{
m_hSoundSource = this;
m_nSoundSourceEntIndex = entindex();
}
else
{
if ( !FBitSet( m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE ) )
{
AddEFlags( EFL_FORCE_CHECK_TRANSMIT );
}
}
}
// If active start the sound
if ( m_fActive )
{
SoundFlags_t flags = SND_SPAWNING;
// If we are loading a saved game, we can't write into the init/signon buffer here, so just issue
// as a regular sound message...
if ( gpGlobals->eLoadType == MapLoad_Transition ||
gpGlobals->eLoadType == MapLoad_LoadGame ||
g_pGameRules->InRoundRestart() )
{
flags = SND_NOFLAGS;
}
SendSound( flags );
SetNextThink( gpGlobals->curtime + 0.1f );
}
}
示例3: Activate
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CAmbientGeneric::Activate( void )
{
BaseClass::Activate();
// Initialize sound source. If no source was given, or source can't be found
// then this is the source
if (m_hSoundSource == NULL)
{
if (m_sSourceEntName != NULL_STRING)
{
m_hSoundSource = gEntList.FindEntityByName( NULL, m_sSourceEntName );
if ( m_hSoundSource != NULL )
{
m_nSoundSourceEntIndex = m_hSoundSource->entindex();
}
}
if (m_hSoundSource == NULL)
{
m_hSoundSource = this;
m_nSoundSourceEntIndex = entindex();
}
else
{
if ( !FBitSet( m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE ) )
{
AddEFlags( EFL_FORCE_CHECK_TRANSMIT );
}
}
}
#ifdef PORTAL
// This is the only way we can silence the radio sound from the first room without touching them map -- jdw
if ( PortalGameRules() && PortalGameRules()->ShouldRemoveRadio() )
{
if ( V_strcmp( STRING( gpGlobals->mapname ), "testchmb_a_00" ) == 0 ||
V_strcmp( STRING( gpGlobals->mapname ), "testchmb_a_11" ) == 0 ||
V_strcmp( STRING( gpGlobals->mapname ), "testchmb_a_14" ) == 0 )
{
if ( V_strcmp( STRING( GetEntityName() ), "radio_sound" ) == 0 )
{
UTIL_Remove( this );
return;
}
}
}
#endif // PORTAL
// If active start the sound
if ( m_fActive )
{
int flags = SND_SPAWNING;
// If we are loading a saved game, we can't write into the init/signon buffer here, so just issue
// as a regular sound message...
if ( gpGlobals->eLoadType == MapLoad_Transition ||
gpGlobals->eLoadType == MapLoad_LoadGame ||
g_pGameRules->InRoundRestart() )
{
flags = SND_NOFLAGS;
}
// Tracker 76119: 8/12/07 ywb:
// Make sure pitch and volume are set up to the correct value (especially after restoring a .sav file)
flags |= ( SND_CHANGE_PITCH | SND_CHANGE_VOL );
// Don't bother sending over to client if volume is zero, though
if ( m_dpv.vol > 0 )
{
SendSound( (SoundFlags_t)flags );
}
SetNextThink( gpGlobals->curtime + 0.1f );
}
}
示例4: ClientThink
void C_SDKRagdoll::ClientThink( void )
{
SetNextClientThink( CLIENT_THINK_ALWAYS );
if ( m_bFadingOut == true )
{
int iAlpha = GetRenderColor().a;
int iFadeSpeed = 600.0f;
iAlpha = max( iAlpha - ( iFadeSpeed * gpGlobals->frametime ), 0 );
SetRenderMode( kRenderTransAlpha );
SetRenderColorA( iAlpha );
if ( iAlpha == 0 )
{
Release();
}
return;
}
for( int iClient = 1; iClient <= gpGlobals->maxClients; ++iClient )
{
C_SDKPlayer *pEnt = static_cast< C_SDKPlayer *> ( UTIL_PlayerByIndex( iClient ) );
if(!pEnt || !pEnt->IsPlayer())
continue;
if ( m_hPlayer == NULL )
continue;
if ( pEnt->entindex() == m_hPlayer->entindex() )
continue;
if ( pEnt->GetHealth() <= 0 )
continue;
#if defined ( SDK_USE_PRONE )
if ( pEnt->m_Shared.IsProne() == false )
continue;
#endif
Vector vTargetOrigin = pEnt->GetAbsOrigin();
Vector vMyOrigin = GetAbsOrigin();
Vector vDir = vTargetOrigin - vMyOrigin;
if ( vDir.Length() > cl_ragdoll_pronecheck_distance.GetInt() )
continue;
SetNextClientThink( CLIENT_THINK_ALWAYS );
m_bFadingOut = true;
return;
}
//Tony; this is kind of silly, because.. whats the point of fading out?
// if the player is looking at us, delay the fade
if ( IsRagdollVisible() )
{
StartFadeOut( 5.0 );
return;
}
if ( m_fDeathTime > gpGlobals->curtime )
return;
Release(); // Die
}
示例5: EntIndex
//-----------------------------------------------------------------------------
// Returns the ent index
//-----------------------------------------------------------------------------
inline int CSoundPatch::EntIndex() const
{
Assert( !m_hEnt.IsValid() || m_hEnt.Get() );
return m_hEnt.Get() ? m_hEnt->entindex() : -1;
}