本文整理汇总了C++中FIND_ENTITY_BY_TARGETNAME函数的典型用法代码示例。如果您正苦于以下问题:C++ FIND_ENTITY_BY_TARGETNAME函数的具体用法?C++ FIND_ENTITY_BY_TARGETNAME怎么用?C++ FIND_ENTITY_BY_TARGETNAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FIND_ENTITY_BY_TARGETNAME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Link
void CPathTrack :: Link( void )
{
edict_t *pentTarget;
if ( !FStringNull(pev->target) )
{
pentTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING(pev->target) );
if ( !FNullEnt(pentTarget) )
{
m_pnext = CPathTrack::Instance( pentTarget );
if ( m_pnext ) // If no next pointer, this is the end of a path
{
m_pnext->SetPrevious( this );
}
}
else
ALERT( at_console, "Dead end link %s\n", STRING(pev->target) );
}
// Find "alternate" path
if ( m_altName )
{
pentTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING(m_altName) );
if ( !FNullEnt(pentTarget) )
{
m_paltpath = CPathTrack::Instance( pentTarget );
if ( m_paltpath ) // If no next pointer, this is the end of a path
{
m_paltpath->SetPrevious( this );
}
}
}
}
示例2: StudioFrameAdvance
void COsprey::FlyThink( void )
{
StudioFrameAdvance( );
pev->nextthink = gpGlobals->time + 0.1;
if ( m_pGoalEnt == NULL && !FStringNull(pev->target) )// this monster has a target
{
m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( pev->target ) ) );
UpdateGoal( );
}
if (gpGlobals->time > m_startTime + m_dTime)
{
if (m_pGoalEnt->pev->speed == 0)
{
SetThink( DeployThink );
}
do {
m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( m_pGoalEnt->pev->target ) ) );
} while (m_pGoalEnt->pev->speed < 400 && !HasDead());
UpdateGoal( );
}
Flight( );
ShowDamage( );
}
示例3: FIND_ENTITY_BY_TARGETNAME
/* <8dd79> ../cstrike/dlls/func_tank.cpp:821 */
CLaser *CFuncTankLaser::GetLaser(void)
{
if (m_pLaser != NULL)
{
return m_pLaser;
}
edict_t *pentLaser;
pentLaser = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->message));
while (!FNullEnt(pentLaser))
{
// Found the landmark
if (FClassnameIs(pentLaser, "env_laser"))
{
m_pLaser = (CLaser *)CBaseEntity::Instance(pentLaser);
break;
}
else
pentLaser = FIND_ENTITY_BY_TARGETNAME(pentLaser, STRING(pev->message));
}
return m_pLaser;
}
示例4: ChangeSub
void CTriggerSubModel :: ChangeSub ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( FStringNull ( pev->target ) )
return;
edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->target) );
if ( FNullEnt(pentTarget) )
{
ALERT ( at_console, "CTriggerSubModel : pas d'entite s appelant %s\n", STRING(pev->target) );
return;
}
CBaseEntity *pTarget = Instance( pentTarget );
if ( pTarget->MyMonsterPointer() == NULL )
{
ALERT ( at_console, "CTriggerSubModel : %s n est pas un monstre\n", STRING(pev->target) );
return;
}
CBaseMonster *pMonster = (CBaseMonster*)pTarget;
pMonster->SetBodygroup( m_iBodygroup, m_iSubmodel);
}
示例5: FireTargets
void FireTargets( const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
edict_t *pentTarget = NULL;
if ( !targetName )
return;
ALERT( at_aiconsole, "Firing: (%s)\n", targetName );
for (;;)
{
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, targetName);
if (FNullEnt(pentTarget))
break;
CBaseEntity *pTarget = CBaseEntity::Instance( pentTarget );
if ( pTarget && !(pTarget->pev->flags & FL_KILLME) ) // Don't use dying ents
{
ALERT( at_aiconsole, "Found: %s, firing (%s)\n", STRING(pTarget->pev->classname), targetName );
if ( strcmp( STRING( pCaller->pev->classname ), "func_breakable" ) == 0 ) {
CBaseEntity *breakable = CBaseEntity::Instance( pCaller->pev );
if ( breakable->killedOrCausedByPlayer ) {
pTarget->auxOwner = breakable->auxOwner;
pTarget->killedOrCausedByPlayer = true;
}
}
pTarget->Use( pActivator, pCaller, useType, value );
}
}
}
示例6: FireTargets
void FireTargets(const char *targetName, CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
edict_t *pentTarget = NULL;
if (!targetName)
return;
ALERT(at_aiconsole, "Firing: (%s)\n", targetName);
while (1)
{
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, targetName);
if (FNullEnt(pentTarget))
break;
CBaseEntity *pTarget = CBaseEntity::Instance(pentTarget);
if (pTarget && !(pTarget->pev->flags & FL_KILLME))
{
ALERT(at_aiconsole, "Found: %s, firing (%s)\n", STRING(pTarget->pev->classname), targetName);
pTarget->Use(pActivator, pCaller, useType, value);
}
}
}
示例7: FIND_ENTITY_BY_TARGETNAME
// find a viable entity
int CCineMonster::FindEntity(void)
{
edict_t *pentTarget;
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
m_hTargetEnt = NULL;
CBaseMonster *pTarget = NULL;
while(!FNullEnt(pentTarget))
{
if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
{
pTarget = GetMonsterPointer(pentTarget);
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_BY_NAME))
{
m_hTargetEnt = pTarget;
return TRUE;
}
ALERT(at_console, "Found %s, but can't play!\n", STRING(m_iszEntity));
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
pTarget = NULL;
}
if(!pTarget)
{
CBaseEntity *pEntity = NULL;
while((pEntity = UTIL_FindEntityInSphere(pEntity, pev->origin, m_flRadius)) != NULL)
{
if(FClassnameIs(pEntity->pev, STRING(m_iszEntity)))
{
if(FBitSet(pEntity->pev->flags, FL_MONSTER))
{
pTarget = pEntity->MyMonsterPointer();
if(pTarget && pTarget->CanPlaySequence(FCanOverrideState(), SS_INTERRUPT_IDLE))
{
m_hTargetEnt = pTarget;
return TRUE;
}
}
}
}
}
pTarget = NULL;
m_hTargetEnt = NULL;
return FALSE;
}
示例8: GetClassPtr
void CBaseDelay::SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value)
{
if (FStringNull(pev->target) && !m_iszKillTarget)
return;
if (m_flDelay != 0)
{
CBaseDelay *pTemp = GetClassPtr((CBaseDelay *)NULL);
if (pTemp->pev->classname)
RemoveEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME);
pTemp->pev->classname = MAKE_STRING("DelayedUse");
AddEntityHashValue(pTemp->pev, STRING(pTemp->pev->classname), CLASSNAME);
pTemp->pev->nextthink = gpGlobals->time + m_flDelay;
pTemp->SetThink(&CBaseDelay::DelayThink);
pTemp->pev->button = (int)useType;
pTemp->m_iszKillTarget = m_iszKillTarget;
pTemp->m_flDelay = 0;
pTemp->pev->target = pev->target;
if (pActivator && pActivator->IsPlayer())
pTemp->pev->owner = pActivator->edict();
else
pTemp->pev->owner = NULL;
return;
}
if (m_iszKillTarget)
{
ALERT(at_aiconsole, "KillTarget: %s\n", STRING(m_iszKillTarget));
edict_t *pentKillTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszKillTarget));
while (!FNullEnt(pentKillTarget))
{
UTIL_Remove(CBaseEntity::Instance(pentKillTarget));
ALERT(at_aiconsole, "killing %s\n", STRING(pentKillTarget->v.classname));
pentKillTarget = FIND_ENTITY_BY_TARGETNAME(pentKillTarget, STRING(m_iszKillTarget));
}
}
if (!FStringNull(pev->target))
FireTargets(STRING(pev->target), pActivator, this, useType, value);
}
示例9: ALERT
// find all the cinematic entities with my targetname and stop them from playing
void CCineMonster::CancelScript(void)
{
ALERT(at_aiconsole, "Cancelling script: %s\n", STRING(m_iszPlay));
if(!pev->targetname)
{
ScriptEntityCancel(edict());
return;
}
edict_t *pentCineTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->targetname));
while(!FNullEnt(pentCineTarget))
{
ScriptEntityCancel(pentCineTarget);
pentCineTarget = FIND_ENTITY_BY_TARGETNAME(pentCineTarget, STRING(pev->targetname));
}
}
示例10: FIND_ENTITY_BY_TARGETNAME
CBaseEntity *CBaseEntity::GetNextTarget(void)
{
if(FStringNull(pev->target))
return NULL;
edict_t *pTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target));
if(FNullEnt(pTarget))
return NULL;
return Instance(pTarget);
}
示例11: assert
// Button has returned to start state. Quiesce it.
void CBaseButton::ButtonBackHome()
{
assert(m_toggle_state == TS_GOING_DOWN);
m_toggle_state = TS_AT_BOTTOM;
if (pev->spawnflags & SF_BUTTON_TOGGLE
#ifdef REGAMEDLL_FIXES
&& m_hActivator
#endif
)
{
//EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), 1, ATTN_NORM);
SUB_UseTargets(m_hActivator, USE_TOGGLE, 0);
}
if (!FStringNull(pev->target))
{
edict_t *pentTarget = NULL;
while ((pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target))) != NULL)
{
if (FNullEnt(pentTarget))
break;
if (!FClassnameIs(pentTarget, "multisource"))
continue;
CBaseEntity *pTarget = CBaseEntity::Instance(pentTarget);
if (pTarget != NULL)
{
pTarget->Use(m_hActivator, this, USE_TOGGLE, 0);
}
}
}
// Re-instate touch method, movement cycle is complete.
// this button only works if USED, not touched!
if (!(pev->spawnflags & SF_BUTTON_TOUCH_ONLY))
{
// All buttons are now use only
SetTouch(NULL);
}
else
SetTouch(&CBaseButton::ButtonTouch);
// reset think for a sparking button
if (pev->spawnflags & SF_BUTTON_SPARK_IF_OFF)
{
SetThink(&CBaseButton::ButtonSpark);
// no hurry.
pev->nextthink = gpGlobals->time + 0.5f;
}
}
示例12: FIND_ENTITY_BY_TARGETNAME
void CFuncTankControls::Think(void)
{
edict_t *pTarget = NULL;
do pTarget = FIND_ENTITY_BY_TARGETNAME(pTarget, STRING(pev->target));
while (!FNullEnt(pTarget) && strncmp(STRING(pTarget->v.classname), "func_tank", 9));
if (FNullEnt(pTarget))
{
ALERT(at_console, "No tank %s\n", STRING(pev->target));
return;
}
m_pTank = (CFuncTank*)Instance(pTarget);
}
示例13: Touch
void CPathCorner :: Touch( CBaseEntity *pOther )
{
entvars_t* pevToucher = pOther->pev;
if ( FBitSet ( pevToucher->flags, FL_MONSTER ) )
{// monsters don't navigate path corners based on touch anymore
return;
}
// If OTHER isn't explicitly looking for this path_corner, bail out
if ( pOther->m_pGoalEnt != this )
{
return;
}
// If OTHER has an enemy, this touch is incidental, ignore
if ( !FNullEnt(pevToucher->enemy) )
{
return; // fighting, not following a path
}
// UNDONE: support non-zero flWait
/*
if (m_flWait != 0)
ALERT(at_warning, "Non-zero path-cornder waits NYI");
*/
// Find the next "stop" on the path, make it the goal of the "toucher".
if (FStringNull(pev->target))
{
ALERT(at_warning, "PathCornerTouch: no next stop specified");
}
pOther->m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->target) ) );
// If "next spot" was not found (does not exist - level design error)
if ( !pOther->m_pGoalEnt )
{
ALERT(at_console, "PathCornerTouch--%s couldn't find next stop in path: %s", STRING(pev->classname), STRING(pev->target));
return;
}
// Turn towards the next stop in the path.
pevToucher->ideal_yaw = UTIL_VecToYaw ( pOther->m_pGoalEnt->pev->origin - pevToucher->origin );
}
示例14: FIND_ENTITY_BY_TARGETNAME
void CMomentaryRotButton::UpdateTarget( float value )
{
if (!FStringNull(pev->target))
{
edict_t* pentTarget = NULL;
for (;;)
{
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->target));
if (FNullEnt(pentTarget))
break;
CBaseEntity *pEntity = CBaseEntity::Instance(pentTarget);
if ( pEntity )
{
pEntity->Use( this, this, USE_SET, value );
}
}
}
}
示例15: UTIL_IsMasterTriggered
bool UTIL_IsMasterTriggered( string_t sMaster, const CBaseEntity* const pActivator )
{
if (sMaster)
{
edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(sMaster));
if ( !FNullEnt(pentTarget) )
{
CBaseEntity *pMaster = CBaseEntity::Instance(pentTarget);
if ( pMaster && (pMaster->ObjectCaps() & FCAP_MASTER) )
return pMaster->IsTriggered( pActivator );
}
ALERT(at_console, "Master was null or not a master!\n");
}
// if this isn't a master entity, just say yes.
return true;
}