本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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 );
}
示例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 );
}
示例8: ShouldHitEntity
virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
{
CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
if ( pEntity && pEntity->IsBaseObject() )
return false;
return BaseClass::ShouldHitEntity( pServerEntity, contentsMask );
}
示例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);
}
示例10: ShouldHitEntity
virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
{
CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
if ( pEntity->IsPlayer() && pEntity->GetTeamNumber() == m_iIgnoreTeam )
{
return false;
}
return true;
}
示例11: ShouldHitEntity
bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
{
CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
if ( pEntity )
{
if ( pEntity->IsPlayer() || pEntity->MyNPCPointer() )
return true;
}
return false;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}