本文整理汇总了C++中UTIL_PointContents函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_PointContents函数的具体用法?C++ UTIL_PointContents怎么用?C++ UTIL_PointContents使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_PointContents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOwner
//-----------------------------------------------------------------------------
// Purpose:
// Input : &traceHit -
//-----------------------------------------------------------------------------
bool CBaseHL2MPBludgeonWeapon::ImpactWater( const Vector &start, const Vector &end )
{
//FIXME: This doesn't handle the case of trying to splash while being underwater, but that's not going to look good
// right now anyway...
// We must start outside the water
if ( UTIL_PointContents( start ) & (CONTENTS_WATER|CONTENTS_SLIME))
return false;
// We must end inside of water
if ( !(UTIL_PointContents( end ) & (CONTENTS_WATER|CONTENTS_SLIME)))
return false;
trace_t waterTrace;
UTIL_TraceLine( start, end, (CONTENTS_WATER|CONTENTS_SLIME), GetOwner(), COLLISION_GROUP_NONE, &waterTrace );
if ( waterTrace.fraction < 1.0f )
{
#ifndef CLIENT_DLL
CEffectData data;
data.m_fFlags = 0;
data.m_vOrigin = waterTrace.endpos;
data.m_vNormal = waterTrace.plane.normal;
data.m_flScale = 8.0f;
// See if we hit slime
if ( waterTrace.contents & CONTENTS_SLIME )
{
data.m_fFlags |= FX_WATER_IN_SLIME;
}
DispatchEffect( "watersplash", data );
#endif
}
return true;
}
示例2: GetBuilder
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CObjectSentrygun::OnGoActive( void )
{
/*
CTFPlayer *pBuilder = GetBuilder();
Assert( pBuilder );
if ( !pBuilder )
return;
*/
SetModel( SENTRY_MODEL_LEVEL_1 );
m_iState.Set( SENTRY_STATE_SEARCHING );
// Orient it
QAngle angles = GetAbsAngles();
m_vecCurAngles.y = UTIL_AngleMod( angles.y );
m_iRightBound = UTIL_AngleMod( (int)angles.y - 50 );
m_iLeftBound = UTIL_AngleMod( (int)angles.y + 50 );
if ( m_iRightBound > m_iLeftBound )
{
m_iRightBound = m_iLeftBound;
m_iLeftBound = UTIL_AngleMod( (int)angles.y - 50);
}
// Start it rotating
m_vecGoalAngles.y = m_iRightBound;
m_vecGoalAngles.x = m_vecCurAngles.x = 0;
m_bTurningRight = true;
EmitSound( "Building_Sentrygun.Built" );
// if our eye pos is underwater, we're waterlevel 3, else 0
bool bUnderwater = ( UTIL_PointContents( EyePosition() ) & MASK_WATER ) ? true : false;
SetWaterLevel( ( bUnderwater ) ? 3 : 0 );
m_iAmmoShells = m_iMaxAmmoShells;
// Init attachments for level 1 sentry gun
m_iAttachments[SENTRYGUN_ATTACHMENT_MUZZLE] = LookupAttachment( "muzzle" );
m_iAttachments[SENTRYGUN_ATTACHMENT_MUZZLE_ALT] = 0;
m_iAttachments[SENTRYGUN_ATTACHMENT_ROCKET_L] = 0;
m_iAttachments[SENTRYGUN_ATTACHMENT_ROCKET_R] = 0;
BaseClass::OnGoActive();
}
示例3: UTIL_PointContents
void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
{
pev->model = 0;
pev->solid = SOLID_NOT;
pev->takedamage = DAMAGE_NO;
if (pTrace->flFraction != 1)
pev->origin = pTrace->vecEndPos + (pTrace->vecPlaneNormal * (pev->dmg - 24) * 0.6);
int iContents = UTIL_PointContents(pev->origin);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3);
entvars_t *pevOwner;
if (pev->owner)
pevOwner = VARS(pev->owner);
else
pevOwner = NULL;
pev->owner = NULL;
RadiusFlash(pev->origin, pev, pevOwner, 4);
if (RANDOM_FLOAT(0, 1) < 0.5)
UTIL_DecalTrace(pTrace, DECAL_SCORCH1);
else
UTIL_DecalTrace(pTrace, DECAL_SCORCH2);
float flRndSound = RANDOM_FLOAT(0, 1);
switch (RANDOM_LONG(0, 1))
{
case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/flashbang-1.wav", 0.55, ATTN_NORM); break;
case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/flashbang-2.wav", 0.55, ATTN_NORM); break;
}
pev->effects |= EF_NODRAW;
SetThink(&CGrenade::Smoke);
pev->velocity = g_vecZero;
pev->nextthink = gpGlobals->time + 0.3;
if (iContents != CONTENTS_WATER)
{
int sparkCount = RANDOM_LONG(0, 3);
for (int i = 0; i < sparkCount; i++)
Create("spark_shower", pev->origin, pTrace->vecPlaneNormal, NULL);
}
}
示例4: SG_Smoke
void CGrenade::SG_Smoke( void )
{
if( UTIL_PointContents( pev->origin ) == CONTENTS_WATER )
{
UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 );
}
else
{
UTIL_MakeVectors( pev->angles );
Vector randomDir = gpGlobals->v_forward * RANDOM_FLOAT( 3, 8 );
m_fLightSmoke = (int)(( ( m_fLightSmoke * 180 / M_PI ) + 30 )) % 360;
// TODO: Check me.
PLAYBACK_EVENT_FULL( 0,
NULL,
m_usEvent,
0.0,
pev->origin,
m_SGExplosionPos,
randomDir.x * cos( 180 / M_PI ) - randomDir.y * cos( 180 / M_PI ),
randomDir.x * sin( 180 / M_PI ) + randomDir.y * sin( 180 / M_PI ),
cos( 180 / M_PI ) * 100.0,
4,
m_bSGMulti,
6 );
}
if( m_SGSmoke <= 20 )
{
pev->nextthink = gpGlobals->time + 1.0;
SetThink( &CGrenade::SG_Smoke );
++m_SGSmoke;
}
else
{
pev->effects |= EF_NODRAW;
// TODO: Implements this.
//TheBots->RemoveGrenade( this );
UTIL_Remove( this );
}
}
示例5: SG_Smoke
void CGrenade::SG_Smoke(void)
{
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
{
Vector vecDir;
float interval[2];
int maxSmokePuffs;
UTIL_MakeVectors(pev->angles);
vecDir = gpGlobals->v_forward * RANDOM_FLOAT(3, 8);
maxSmokePuffs = (int)(RANDOM_FLOAT(1.5, 3.5) * 100);
interval[0] = vecDir.x * cos((float)m_angle * (180 / M_PI)) - vecDir.y * sin((float)m_angle * (180 / M_PI));
interval[1] = vecDir.x * sin((float)m_angle * (180 / M_PI)) + vecDir.y * cos((float)m_angle * (180 / M_PI));
m_angle = (m_angle + 30) % 360;
PLAYBACK_EVENT_FULL(0, NULL, m_usEvent, 0, pev->origin, m_vSmokeDetonate, interval[0], interval[1], maxSmokePuffs, 4, m_bLightSmoke, 6);
}
else
{
UTIL_Bubbles(pev->origin - Vector(64, 64, 64), pev->origin + Vector(64, 64, 64), 100);
}
if (m_SGSmoke <= 20)
{
pev->nextthink = gpGlobals->time + 1.0;
SetThink(&CGrenade::SG_Smoke);
m_SGSmoke++;
}
else
{
pev->effects |= EF_NODRAW;
// TODO: Implement me
// TheBots->CBotManager::RemoveGrenade( this );
UTIL_Remove(this);
}
}
示例6: VARS
void CSunOfGod::Animate( void )
{
entvars_t *pevOwner = VARS( pev->owner );
if ( UTIL_PointContents(pev->origin) == CONTENT_WATER )
{
FX_Trail( pev->origin, entindex(), PROJ_SUNOFGOD_DETONATE_WATER );
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg/3, pev->dmg/3, CLASS_NONE, DMG_NUKE | DMG_NEVERGIB);
UTIL_Remove( this );
return;
}
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg/50, 180, CLASS_NONE, DMG_NUKE | DMG_NEVERGIB);
pev->frags--;
if (pev->frags <= 0)
Detonate( );
pev->nextthink = gpGlobals->time + 0.1;
}
示例7: Smoke
void CGrenade::Smoke(void)
{
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
{
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, pev->origin);
WRITE_BYTE(TE_SMOKE);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexSmoke);
WRITE_BYTE(25);
WRITE_BYTE(6);
MESSAGE_END();
}
else
UTIL_Bubbles(pev->origin - Vector(64, 64, 64), pev->origin + Vector(64, 64, 64), 100);
UTIL_Remove(this);
}
示例8: Vector
void CGrenade::Smoke3_A(void)
{
if (UTIL_PointContents(pev->origin) != CONTENTS_WATER)
{
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, pev->origin);
WRITE_BYTE(TE_SMOKE);
WRITE_COORD(pev->origin.x + RANDOM_FLOAT(-128, 128));
WRITE_COORD(pev->origin.y + RANDOM_FLOAT(-128, 128));
WRITE_COORD(pev->origin.z + RANDOM_FLOAT(-10, 10));
WRITE_SHORT(g_sModelIndexSmoke);
WRITE_BYTE(15 + RANDOM_FLOAT(0, 10));
WRITE_BYTE(12);
MESSAGE_END();
}
else
UTIL_Bubbles(pev->origin - Vector(64, 64, 64), pev->origin + Vector(64, 64, 64), 100);
UTIL_Remove(this);
}
示例9: UTIL_PointContents
void CShockBeam::Explode()
{
const Contents contents = UTIL_PointContents( GetAbsOrigin() );
if( m_pSprite )
{
UTIL_Remove( m_pSprite );
m_pSprite = nullptr;
}
if( m_pBeam1 )
{
UTIL_Remove( m_pBeam1 );
m_pBeam1 = nullptr;
}
if( m_pBeam2 )
{
UTIL_Remove( m_pBeam2 );
m_pBeam2 = nullptr;
}
SetDamage( 40 );
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, GetAbsOrigin() );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD_VECTOR( GetAbsOrigin() );
WRITE_BYTE( 8 );
WRITE_BYTE( 0 );
WRITE_BYTE( 253 );
WRITE_BYTE( 253 );
WRITE_BYTE( 5 );
WRITE_BYTE( 10 );
MESSAGE_END();
SetOwner( nullptr );
EMIT_SOUND_DYN(
this, CHAN_WEAPON,
"weapons/shock_impact.wav",
UTIL_RandomFloat( 0.8, 0.9 ), ATTN_NORM, 0, PITCH_NORM );
}
示例10: Smoke
void CGrenade::Smoke( void )
{
if (UTIL_PointContents ( pev->origin ) == CONTENTS_WATER)
{
UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 );
}
else
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( (pev->dmg - 50) * 0.80 ); // scale * 10
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
}
UTIL_Remove( this );
}
示例11: RocketTouch
//=========================================================
void CQuakeRocket::RocketTouch ( CBaseEntity *pOther )
{
// Remove if we've hit skybrush
if ( UTIL_PointContents(pev->origin) == CONTENT_SKY )
{
UTIL_Remove( this );
return;
}
// Do touch damage
float flDmg = RANDOM_FLOAT( 100, 120 );
CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner);
if (pOther->pev->health)
pOther->TakeDamage( pev, pOwner->pev, flDmg, DMG_BULLET );
// Don't do radius damage to the other, because all the damage was done in the impact
Q_RadiusDamage(this, pOwner, 120, pOther);
// Finish and remove
Explode();
}
示例12: UTIL_PointContents
void CCrossbowBolt::ExplodeThink( void )
{
int iContents = UTIL_PointContents ( pev->origin );
int iScale;
pev->dmg = 40;
iScale = 10;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_EXPLOSION);
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
if (iContents != CONTENTS_WATER)
{
WRITE_SHORT( g_sModelIndexFireball );
}
else
{
WRITE_SHORT( g_sModelIndexWExplosion );
}
WRITE_BYTE( iScale ); // scale * 10
WRITE_BYTE( 15 ); // framerate
WRITE_BYTE( TE_EXPLFLAG_NONE );
MESSAGE_END();
entvars_t *pevOwner;
if ( pev->owner )
pevOwner = VARS( pev->owner );
else
pevOwner = NULL;
pev->owner = NULL; // can't traceline attack owner if this is set
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
UTIL_Remove(this);
}
示例13: AI_TraceLine
// Эффект пыли для шагов крематора (аналогично шагам страйдера или охотника, но в меньших масштабах
void CNPC_Cremator::FootstepEffect( const Vector &origin )
{
trace_t tr;
AI_TraceLine( origin, origin - Vector(0,0,0), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
float yaw = random->RandomInt(0,0);
for ( int i = 0; i < 2; i++ )
{
if ( UTIL_PointContents( tr.endpos + Vector( 0, 0, 1 ) ) & MASK_WATER )
{
float flWaterZ = UTIL_FindWaterSurface( tr.endpos, tr.endpos.z, tr.endpos.z + 100.0f );
CEffectData data;
data.m_fFlags = 0;
data.m_vOrigin = tr.endpos;
data.m_vOrigin.z = flWaterZ;
data.m_vNormal = Vector( 0, 0, 1 );
data.m_flScale = random->RandomFloat( 10.0, 14.0 );
// Если крематор идет по неглубокой воде, образуются всплески.
DispatchEffect( "watersplash", data );
}
else
{
Vector dir = UTIL_YawToVector( yaw + i*180 ) * 10;
VectorNormalize( dir );
dir.z = 0.25;
VectorNormalize( dir );
g_pEffects->Dust( tr.endpos, dir, 12, 50 );
/*g_pEffects->FootprintDecal( tr.endpos, dir, 12, 50 );
virtual void FootprintDecal( IRecipientFilter& filer, float delay, const Vector *origin, const Vector* right,
int entity, int index, unsigned char materialType ) = 0;
virtual void Dust( IRecipientFilter& filer, float delay,
const Vector &pos, const Vector &dir, float size, float speed ) = 0;*/
}
}
}
示例14: AngleVectors
//-----------------------------------------------------------------------------
// Purpose: Return true if we found a valid placement point
//-----------------------------------------------------------------------------
bool CWeaponBaseCombatObject::GetPlacePosition( CBaseTFPlayer *pBuilder, Vector *vecPlaceOrigin, QAngle *angPlaceAngles )
{
Vector vecForward;
QAngle vecAngles = vec3_angle;
vecAngles.y = pBuilder->EyeAngles().y;
AngleVectors( vecAngles, &vecForward, NULL, NULL);
*vecPlaceOrigin = pBuilder->WorldSpaceCenter() + (vecForward * ((m_vecBuildMaxs.x - m_vecBuildMins.x) + 32));
if ( UTIL_PointContents( *vecPlaceOrigin ) != CONTENTS_EMPTY )
return false;
// Room to fit?
trace_t tr;
UTIL_TraceHull( *vecPlaceOrigin, *vecPlaceOrigin + Vector(0,0,-64), m_vecBuildMins, m_vecBuildMaxs, MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
if ( tr.allsolid || tr.startsolid )
return false;
if ( tr.fraction == 1.0 )
return false;
*vecPlaceOrigin = tr.endpos;
//VectorAngles( tr.plane.normal, *angPlaceAngles );
*angPlaceAngles = QAngle(0,0,0);
return true;
}
示例15: Smoke
void CGrenade::Smoke( void )
{
if (UTIL_PointContents ( pev->origin ) == CONTENTS_WATER)
{
UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 );
}
else
{
float theDamageModifier;
int theUpgradeLevel = AvHPlayerUpgrade::GetWeaponUpgrade(this->pev->iuser3, this->pev->iuser4, &theDamageModifier);
int theDamage = this->pev->dmg*theDamageModifier;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( (theDamage - 50) * 0.80 ); // scale * 10
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
}
UTIL_Remove( this );
}