当前位置: 首页>>代码示例>>C++>>正文


C++ FIND_ENTITY_BY_TARGETNAME函数代码示例

本文整理汇总了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 );
			}
		}
	}
}
开发者ID:6779660,项目名称:halflife,代码行数:35,代码来源:pathcorner.cpp

示例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( );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:26,代码来源:osprey.cpp

示例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;
}
开发者ID:Adidasman1,项目名称:ReGameDLL_CS,代码行数:26,代码来源:func_tank.cpp

示例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);
}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:25,代码来源:t_sub.cpp

示例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 );
		}
	}
}
开发者ID:suXinjke,项目名称:HalfPayne,代码行数:29,代码来源:subs.cpp

示例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);
		}
	}
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:25,代码来源:subs.cpp

示例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;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:48,代码来源:Scripted.cpp

示例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);
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:46,代码来源:subs.cpp

示例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));
	}
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:19,代码来源:Scripted.cpp

示例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);
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:10,代码来源:cbase.cpp

示例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;
	}
}
开发者ID:Chuvi-w,项目名称:ReGameDLL_CS,代码行数:56,代码来源:buttons.cpp

示例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);
}
开发者ID:AlexCSilva,项目名称:cs16-client,代码行数:15,代码来源:func_tank.cpp

示例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 );
}
开发者ID:6779660,项目名称:halflife,代码行数:45,代码来源:pathcorner.cpp

示例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 );
			}
		}
	}
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:18,代码来源:buttons.cpp

示例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;
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:19,代码来源:util.cpp


注:本文中的FIND_ENTITY_BY_TARGETNAME函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。