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


C++ EntityFromEntityHandle函数代码示例

本文整理汇总了C++中EntityFromEntityHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ EntityFromEntityHandle函数的具体用法?C++ EntityFromEntityHandle怎么用?C++ EntityFromEntityHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了EntityFromEntityHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EntityFromEntityHandle

//-----------------------------------------------------------------------------
// Purpose:
// Input  : *pHandleEntity -
//			contentsMask -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CASW_Trace_Filter_Doors::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
    if ( !StandardFilterRules( pHandleEntity, contentsMask ) )
        return false;

    // Don't test if the game code tells us we should ignore this collision...
    CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
    const CBaseEntity *pEntPass = EntityFromEntityHandle( m_pPassEnt );

    // don't hurt ourself
    if ( pEntPass == pEntity )
        return false;

    if ( !pEntity || pEntity->Classify() != CLASS_ASW_DOOR )
        return false;

    CASW_Door *pDoor = assert_cast<CASW_Door*>( pEntity );
    if ( !pDoor )
        return false;

    if ( m_bRequireLockedOrSealed )
    {
        if ( pDoor->GetSealAmount() > 0 || !pDoor->IsAutoOpen() )
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    return true;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:40,代码来源:asw_trace_filter_doors.cpp

示例2: EntityFromEntityHandle

//-----------------------------------------------------------------------------
// The trace filter!
//-----------------------------------------------------------------------------
bool CTraceFilterSimple::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
    if(m_pPassEnt)
    {
        // Don't test if the game code tells us we should ignore this collision...
        CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
        CBaseEntity *pPass = EntityFromEntityHandle( (CBaseEntity *)m_pPassEnt );
        if(VFuncs::entindex(pEntity) != VFuncs::entindex(pPass))
            return true;
    }

    return false;
}
开发者ID:kila58,项目名称:sourceop,代码行数:16,代码来源:util.cpp

示例3: StandardFilterRules

//-----------------------------------------------------------------------------
// A standard filter to be applied to just about everything.
//-----------------------------------------------------------------------------
bool StandardFilterRules( IHandleEntity *pHandleEntity, int fContentsMask )
{
	CBaseEntity *pCollide = EntityFromEntityHandle( pHandleEntity );

	// Static prop case...
	if ( !pCollide )
		return true;

	SolidType_t solid = pCollide->GetSolid();
	const model_t *pModel = pCollide->GetModel();

	if ( ( modelinfo->GetModelType( pModel ) != mod_brush ) || (solid != SOLID_BSP && solid != SOLID_VPHYSICS) )
	{
		if ( (fContentsMask & CONTENTS_MONSTER) == 0 )
			return false;
	}

	// This code is used to cull out tests against see-thru entities
	if ( !(fContentsMask & CONTENTS_WINDOW) && pCollide->IsTransparent() )
		return false;

	// FIXME: this is to skip BSP models that are entities that can be 
	// potentially moved/deleted, similar to a monster but doors don't seem to 
	// be flagged as monsters
	// FIXME: the FL_WORLDBRUSH looked promising, but it needs to be set on 
	// everything that's actually a worldbrush and it currently isn't
	if ( !(fContentsMask & CONTENTS_MOVEABLE) && (pCollide->GetMoveType() == MOVETYPE_PUSH))// !(touch->flags & FL_WORLDBRUSH) )
		return false;

	return true;
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:34,代码来源:util_shared.cpp

示例4: EntityFromEntityHandle

//-----------------------------------------------------------------------------
// The trace filter!
//-----------------------------------------------------------------------------
bool CTraceFilterSimple::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
	if ( !StandardFilterRules( pHandleEntity, contentsMask ) )
		return false;

	if ( m_pPassEnt )
	{
		if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt ) )
		{
			return false;
		}
	}

	// Don't test if the game code tells us we should ignore this collision...
	CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
	if ( !pEntity )
		return false;
	if ( !pEntity->ShouldCollide( m_collisionGroup, contentsMask ) )
		return false;
	if ( pEntity && !g_pGameRules->ShouldCollide( m_collisionGroup, pEntity->GetCollisionGroup() ) )
		return false;
	if ( m_pExtraShouldHitCheckFunction &&
		(! ( m_pExtraShouldHitCheckFunction( pHandleEntity, contentsMask ) ) ) )
		return false;

	return true;
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:30,代码来源:util_shared.cpp

示例5: ShouldHitEntity

	bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
	{
		CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
		if ( !pEntity )
			return false;

		// Check parents against each other
		// NOTE: Don't let siblings/parents collide.
		if ( UTIL_EntityHasMatchingRootParent( m_pRootParent, pEntity ) )
			return false;

		if ( m_checkHash )
		{
			if ( g_EntityCollisionHash->IsObjectPairInHash( m_pEntity, pEntity ) )
				return false;
		}

#ifndef CLIENT_DLL
		if ( m_pEntity->IsNPC() )
		{
			if ( NPC_CheckBrushExclude( m_pEntity, pEntity ) )
				 return false;

		}
#endif

		return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask );
	}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:28,代码来源:util_shared.cpp

示例6: Assert

bool CASWTraceFilterShot::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
	Assert( pHandleEntity );
	if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt2 ) )
		return false;
	
	CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );

	// don't collide with other projectiles
	if ( dynamic_cast<CASW_Flamer_Projectile*>( pEntity ) != NULL )
		return false;

	if ( dynamic_cast<CASW_Extinguisher_Projectile*>( pEntity ) != NULL )
		return false;

	if ( pEntity && pEntity->Classify() == CLASS_ASW_MARINE )
	{
		if ( m_bSkipMarines )
			return false;

		CASW_Marine *pMarine = assert_cast<CASW_Marine*>( pEntity );
		if ( m_bSkipRollingMarines && pMarine->GetCurrentMeleeAttack() && pMarine->GetCurrentMeleeAttack()->m_nAttackID == CASW_Melee_System::s_nRollAttackID )
			return false;

		if ( m_bSkipMarinesReflectingProjectiles && pMarine->IsReflectingProjectiles() )
			return false;
	}

	if ( m_bSkipAliens && pEntity && IsAlienClass( pEntity->Classify() ) )
		return false;

	return BaseClass::ShouldHitEntity( pHandleEntity, contentsMask );
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:33,代码来源:asw_trace_filter_shot.cpp

示例7: ShouldHitEntity

	virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
	{
		static const char *ppszIgnoredClasses[] = 
		{
			"weapon_*",
			"item_*",
			"prop_ragdoll",
			"prop_dynamic",
			"prop_static",
			"prop_physics",
			"npc_bullseye",  // Tracker 15335
		};

		CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );

		// Tracker 15335:  Never impact decals against entities which are not rendering, either.
		if ( pEntity->IsEffectActive( EF_NODRAW ) )
			return false;

		for ( int i = 0; i < ARRAYSIZE(ppszIgnoredClasses); i++ )
		{
			if ( pEntity->ClassMatches( ppszIgnoredClasses[i] ) )
				return false;
		}

		if ( modelinfo->GetModelType( pEntity->GetModel() ) != mod_brush )
			return false;

		return CTraceFilterSimple::ShouldHitEntity( pServerEntity, contentsMask );
	}
开发者ID:DeadFuze,项目名称:swarm-sdk,代码行数:30,代码来源:world.cpp

示例8: ShouldHitEntity

	virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
	{
		CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );

		if ( pEntity && pEntity->IsBaseObject() )
			return false;

		return BaseClass::ShouldHitEntity( pServerEntity, contentsMask );
	}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:9,代码来源:tf_weapon_flamethrower.cpp

示例9: DETOUR_DECL_MEMBER

	DETOUR_DECL_MEMBER(bool, CTraceFilterDeflection_ShouldHitEntity, IHandleEntity *pHandleEntity, int contentsMask)
	{
		if (cvar_fix.GetBool()) {
			CBaseEntity *pEntity = EntityFromEntityHandle(pHandleEntity);
			if (pEntity == nullptr) return false;
			
			if (pEntity->IsPlayer()) return false;
		}
		
		return DETOUR_MEMBER_CALL(CTraceFilterDeflection_ShouldHitEntity)(pHandleEntity, contentsMask);
	}
开发者ID:sigsegv-mvm,项目名称:sigsegv-mvm,代码行数:11,代码来源:deflect_angle_v2.cpp

示例10: ShouldHitEntity

	virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
	{
		CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );

		if ( pEntity->IsPlayer() && pEntity->GetTeamNumber() == m_iIgnoreTeam )
		{
			return false;
		}

		return true;
	}
开发者ID:Navton,项目名称:TF2Classic,代码行数:11,代码来源:tf_weaponbase_gun.cpp

示例11: ShouldHitEntity

	bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
	{
		CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
		if ( pEntity )
		{
			if ( pEntity->IsPlayer() || pEntity->MyNPCPointer() )
				return true;
		}

		return false;
	}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:11,代码来源:EnvBeam.cpp

示例12: ShouldHitEntity

	virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
	{
		C_BaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
		if( pEntity &&
			( dynamic_cast<C_BaseViewModel *>( pEntity ) != NULL ) ||
			( dynamic_cast<C_BasePlayer *>( pEntity ) != NULL ) )
		{
			return false;
		}
		else
		{
			return true;
		}
	}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:14,代码来源:c_te_hl2mp_shotgun_shot.cpp

示例13: PassServerEntityFilter

//-----------------------------------------------------------------------------
//
// Shared client/server trace filter code
//
//-----------------------------------------------------------------------------
bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass ) 
{
	if ( !pPass )
		return true;

	if ( pTouch == pPass )
		return false;

	const CBaseEntity *pEntTouch = EntityFromEntityHandle( pTouch );
	const CBaseEntity *pEntPass = EntityFromEntityHandle( pPass );
	if ( !pEntTouch || !pEntPass )
		return true;

	// don't clip against own missiles
	if ( pEntTouch->GetOwnerEntity() == pEntPass )
		return false;
	
	// don't clip against owner
	if ( pEntPass->GetOwnerEntity() == pEntTouch )
		return false;	


	return true;
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:29,代码来源:util_shared.cpp

示例14: EntityFromEntityHandle

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pHandleEntity - 
//			contentsMask - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CASW_Trace_Filter_Door_Crush::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
	if ( !StandardFilterRules( pHandleEntity, contentsMask ) )
		return false;

	if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt ) )
		return false;

	// Don't test if the game code tells us we should ignore this collision...
	CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );
	
	if ( pEntity )
	{
		//Msg("%f CASW_Trace_Filter_Door_Crush::ShouldHitEntity %s\n", gpGlobals->curtime, pEntity->GetClassname());
		if ( !pEntity->ShouldCollide( m_collisionGroup, contentsMask ) )
			return false;
		
		if ( !g_pGameRules->ShouldCollide( m_collisionGroup, pEntity->GetCollisionGroup() ) )
			return false;

		if ( pEntity->Classify() == CLASS_ASW_DOOR )
			return false;

		if ( pEntity->m_takedamage == DAMAGE_NO )
			return false;

		// Translate the vehicle into its driver for damage
		if ( pEntity->GetServerVehicle() != NULL )
		{
			CBaseEntity *pDriver = pEntity->GetServerVehicle()->GetPassenger();

			if ( pDriver != NULL )
			{
				pEntity = pDriver;
			}
		}

		Vector	attackDir = pEntity->WorldSpaceCenter() - m_dmgInfo->GetAttacker()->WorldSpaceCenter();
		VectorNormalize( attackDir );
	
		pEntity->TakeDamage( *m_dmgInfo );

		//CalculateMeleeDamageForce( &info, attackDir, info.GetAttacker()->WorldSpaceCenter(), m_flForceScale );
		return true;
	}

	return false;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:54,代码来源:asw_trace_filter_door_crush.cpp

示例15: ShouldHitEntity

		virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
		{
			if ( !PassServerEntityFilter( pHandleEntity, m_pPassEnt ) )
				return false;
			CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity );

			if ( pEntity )
			{
				if ( g_pGameRules->ShouldCollide( m_collisionGroupAlreadyChecked, pEntity->GetCollisionGroup() ) )
					return false;
				if ( g_pGameRules->ShouldCollide( m_newCollisionGroup, pEntity->GetCollisionGroup() ) )
					return true;
			}

			return false;
		}
开发者ID:Randdalf,项目名称:bliink,代码行数:16,代码来源:sdk_basegrenade_projectile.cpp


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