本文整理汇总了C++中UTIL_ScreenShake函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_ScreenShake函数的具体用法?C++ UTIL_ScreenShake怎么用?C++ UTIL_ScreenShake使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_ScreenShake函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAnimEvent
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CShambler :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case SHAM_IDLE_SOUND:
if( RANDOM_FLOAT( 0.0f, 1.0f ) > 0.8f )
EMIT_SOUND( edict(), CHAN_VOICE, "shambler/sidle.wav", 1.0, ATTN_IDLE );
break;
case SHAM_LEFT_STEP:
// dont make sound steps while shambler do melee attack
if( m_hEnemy == NULL || (m_hEnemy->pev->origin - pev->origin).Length() > 100 )
{
EMIT_SOUND( edict(), CHAN_BODY, "shambler/step1.wav", 0.6, ATTN_IDLE );
UTIL_ScreenShake( pev->origin + Vector( 0, 0, -24 ), 2.0f, 2.0f, 0.5f, 250.0f );
}
break;
case SHAM_RIGHT_STEP:
if( m_hEnemy == NULL || (m_hEnemy->pev->origin - pev->origin).Length() > 100 )
{
EMIT_SOUND( edict(), CHAN_BODY, "shambler/step2.wav", 0.6, ATTN_IDLE );
UTIL_ScreenShake( pev->origin + Vector( 0, 0, -24 ), 2.0f, 2.0f, 0.5f, 250.0f );
}
break;
case SHAM_CAST_LIGHTNING:
CastLightning ();
break;
case SHAM_BEGIN_CHARGING:
BeginCharging ();
break;
case SHAM_END_CHARGING:
EndCharging ();
break;
case SHAM_SMASH:
ShamblerSmash ();
break;
case SHAM_SMASH_SOUND:
EMIT_SOUND( edict(), CHAN_VOICE, "shambler/melee1.wav", 1.0, ATTN_NORM );
break;
case SHAM_SWING_SOUND:
EMIT_SOUND( edict(), CHAN_VOICE, "shambler/melee2.wav", 1.0, ATTN_NORM );
break;
case SHAM_SWING_LEFT:
ShamblerClaw( 250 );
break;
case SHAM_SWING_RIGHT:
ShamblerClaw( -250 );
break;
default:
CQuakeMonster::HandleAnimEvent( pEvent );
break;
}
}
示例2: SetBombOrigin
void CStickyBomb::Detonate()
{
SetBombOrigin();
ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), m_hOperator, 100, 250, true );
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 250, SHAKE_START );
UTIL_Remove( this );
}
示例3: AngleVectors
void CNPC_Gargantua::StompAttack( void )
{
trace_t trace;
Vector vecForward;
AngleVectors(GetAbsAngles(), &vecForward );
Vector vecStart = GetAbsOrigin() + Vector(0,0,60) + 35 * vecForward;
CBaseEntity* pPlayer = GetEnemy();
if ( !pPlayer )
return;
Vector vecAim = pPlayer->GetAbsOrigin() - GetAbsOrigin();
VectorNormalize( vecAim );
Vector vecEnd = (vecAim * 1024) + vecStart;
UTIL_TraceLine( vecStart, vecEnd, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace );
// NDebugOverlay::Line( vecStart, vecEnd, 255, 0, 0, false, 10.0f );
CStomp::StompCreate( vecStart, trace.endpos, 0, this );
UTIL_ScreenShake( GetAbsOrigin(), 12.0, 100.0, 2.0, 1000, SHAKE_START );
CPASAttenuationFilter filter( this );
EmitSound( filter, entindex(), "Garg.StompSound" );
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector(0,0,20), MASK_SOLID, this, COLLISION_GROUP_NONE, &trace );
if ( trace.fraction < 1.0 )
{
UTIL_DecalTrace( &trace, "SmallScorch" );
}
}
示例4: ExplosionCreate
//------------------------------------------------------------------------------
// Pow!
//------------------------------------------------------------------------------
void CQUAGrenadeHelicopter::DoExplosion( const Vector &vecOrigin, const Vector &vecVelocity )
{
ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), this, 75.0,
275.0, (SF_ENVEXPLOSION_NOSPARKS|SF_ENVEXPLOSION_NODLIGHTS|SF_ENVEXPLOSION_NODECAL|SF_ENVEXPLOSION_NOFIREBALL|SF_ENVEXPLOSION_NOPARTICLES),
55000.0 );
if ( GetShakeAmplitude() )
{
UTIL_ScreenShake( GetAbsOrigin(), GetShakeAmplitude(), 150.0, 1.0, GetShakeRadius(), SHAKE_START );
}
CEffectData data;
// If we're under water do a water explosion
if ( GetWaterLevel() != 0 && (GetWaterType() & CONTENTS_WATER) )
{
data.m_vOrigin = WorldSpaceCenter();
data.m_flMagnitude = 128;
data.m_flScale = 128;
data.m_fFlags = 0;
DispatchEffect( "WaterSurfaceExplosion", data );
}
else
{
// Otherwise do a normal explosion
data.m_vOrigin = GetAbsOrigin();
DispatchEffect( "HelicopterMegaBomb", data );
}
UTIL_Remove( this );
}
示例5: GetAttachment
void CPropThumper::Thump ( void )
{
if ( m_iHammerAttachment != -1 )
{
Vector vOrigin;
GetAttachment( m_iHammerAttachment, vOrigin );
CEffectData data;
data.m_nEntIndex = entindex();
data.m_vOrigin = vOrigin;
data.m_flScale = m_iDustScale * m_flPlaybackRate;
DispatchEffect( "ThumperDust", data );
UTIL_ScreenShake( vOrigin, 10.0 * m_flPlaybackRate, m_flPlaybackRate, m_flPlaybackRate / 2, THUMPER_RADIUS * m_flPlaybackRate, SHAKE_START, false );
}
EmitSound( "coast.thumper_dust" );
CSoundEnt::InsertSound ( SOUND_THUMPER, GetAbsOrigin(), THUMPER_RADIUS * m_flPlaybackRate, THUMPER_SOUND_DURATION, this );
if ( m_flPlaybackRate < 0.7f )
return;
if( m_iDustScale == THUMPER_MIN_SCALE )
EmitSound( "coast.thumper_hit" );
else
EmitSound( "coast.thumper_large_hit" );
}
示例6: CalcDamageForceVector
void QUA_helicopter::Event_Killed( const CTakeDamageInfo &info )
{
//m_lifeState=LIFE_DYING;
// Calculate death force
m_vecTotalBulletForce = CalcDamageForceVector( info );
CBasePlayer *pPlayer = m_hPlayer;
if ( pPlayer )
{
pPlayer->LeaveVehicle(); // Force exit vehicle
CBaseEntity *pAPC=this->GetBaseEntity();
CTakeDamageInfo playerinfo;
if (info.GetAttacker()==pAPC && info.GetInflictor()==pAPC) {
playerinfo.SetAttacker(pPlayer);
playerinfo.SetInflictor(pPlayer);
playerinfo.SetDamage(10000);
playerinfo.SetDamageType(DMG_BLAST);
} else {
playerinfo.SetAttacker(info.GetAttacker());
playerinfo.SetInflictor(info.GetInflictor());
playerinfo.SetDamage(10000);
playerinfo.SetDamageType(DMG_BLAST);
}
playerinfo.SetDamagePosition( pPlayer->WorldSpaceCenter() );
playerinfo.SetDamageForce( Vector(0,0,-1) );
pPlayer->TakeDamage( playerinfo );
m_hPlayer = NULL;
}
m_OnDeath.FireOutput( info.GetAttacker(), this );
//StopSmoking();
Vector vecAbsMins, vecAbsMaxs;
CollisionProp()->WorldSpaceAABB( &vecAbsMins, &vecAbsMaxs );
Vector vecNormalizedMins, vecNormalizedMaxs;
CollisionProp()->WorldToNormalizedSpace( vecAbsMins, &vecNormalizedMins );
CollisionProp()->WorldToNormalizedSpace( vecAbsMaxs, &vecNormalizedMaxs );
Vector vecAbsPoint;
CPASFilter filter( GetAbsOrigin() );
for (int i = 0; i < 5; i++)
{
CollisionProp()->RandomPointInBounds( vecNormalizedMins, vecNormalizedMaxs, &vecAbsPoint );
te->Explosion( filter, random->RandomFloat( 0.0, 1.0 ), &vecAbsPoint,
g_sModelIndexFireball, random->RandomInt( 4, 10 ),
random->RandomInt( 8, 15 ),
( i < 2 ) ? TE_EXPLFLAG_NODLIGHTS : TE_EXPLFLAG_NOPARTICLES | TE_EXPLFLAG_NOFIREBALLSMOKE | TE_EXPLFLAG_NODLIGHTS,
100, 0 );
}
// Aqui destruiremos todo
StopLoopingSounds();
BecomeRagdoll( info, m_vecTotalBulletForce );
UTIL_ScreenShake( vecAbsPoint, 25.0, 150.0, 1.0, 750.0f, SHAKE_START );
CreateCorpse();
//BecomeRagdoll( info, m_vecTotalBulletForce );
//BecomeRagdollOnClient(m_vecTotalBulletForce);
//Dissolve(NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL);
}
示例7: StopSound
//-----------------------------------------------------------------------------
// Creates the explosion effect
//-----------------------------------------------------------------------------
void CEnvHeadcrabCanister::Detonate( )
{
// Send the impact output
m_OnImpacted.FireOutput( this, this, 0 );
if ( !HasSpawnFlags( SF_NO_IMPACT_SOUND ) )
{
StopSound( "HeadcrabCanister.IncomingSound" );
EmitSound( "HeadcrabCanister.Explosion" );
}
// If we're supposed to be removed, do that now
if ( HasSpawnFlags( SF_REMOVE_ON_IMPACT ) )
{
SetAbsOrigin( m_vecImpactPosition );
SetModel( ENV_HEADCRABCANISTER_BROKEN_MODEL );
SetMoveType( MOVETYPE_NONE );
IncrementInterpolationFrame();
m_bLanded = true;
// Become invisible so our trail can finish up
AddEffects( EF_NODRAW );
SetSolidFlags( FSOLID_NOT_SOLID );
SetThink( &CEnvHeadcrabCanister::SUB_Remove );
SetNextThink( gpGlobals->curtime + ENV_HEADCRABCANISTER_TRAIL_TIME );
return;
}
// Test for damaging things
TestForCollisionsAgainstWorld( m_vecImpactPosition );
// Shake the screen unless flagged otherwise
if ( !HasSpawnFlags( SF_NO_SHAKE ) )
{
CBasePlayer *pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
// If the player is on foot, then do a more limited shake
float shakeRadius = ( pPlayer && pPlayer->IsInAVehicle() ) ? sk_env_headcrabcanister_shake_radius_vehicle.GetFloat() : sk_env_headcrabcanister_shake_radius.GetFloat();
UTIL_ScreenShake( m_vecImpactPosition, sk_env_headcrabcanister_shake_amplitude.GetFloat(), 150.0, 1.0, shakeRadius, SHAKE_START );
}
// Do explosion effects
if ( !HasSpawnFlags( SF_NO_IMPACT_EFFECTS ) )
{
// Normal explosion
ExplosionCreate( m_vecImpactPosition, GetAbsAngles(), this, 50.0f, 500.0f,
SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODAMAGE | SF_ENVEXPLOSION_NOSOUND, 1300.0f );
// Dust explosion
AR2Explosion *pExplosion = AR2Explosion::CreateAR2Explosion( m_vecImpactPosition );
if( pExplosion )
{
pExplosion->SetLifetime(10);
}
}
}
示例8: MESSAGE_BEGIN
/* <f69e5> ../cstrike/dlls/mortar.cpp:226 */
void CMortar::MortarExplode(void)
{
// mortar beam
MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(TE_BEAMPOINTS);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z + 1024);
WRITE_SHORT(m_spriteTexture);
WRITE_BYTE(0); // framerate
WRITE_BYTE(0); // framerate
WRITE_BYTE(1); // life
WRITE_BYTE(40); // width
WRITE_BYTE(0); // noise
WRITE_BYTE(255); // r, g, b
WRITE_BYTE(160); // r, g, b
WRITE_BYTE(100); // r, g, b
WRITE_BYTE(128); // brightness
WRITE_BYTE(0); // speed
MESSAGE_END();
TraceResult tr;
UTIL_TraceLine(pev->origin + Vector(0, 0, 1024), pev->origin - Vector(0, 0, 1024), dont_ignore_monsters, ENT(pev), &tr);
Explode(&tr, (DMG_BLAST | DMG_MORTAR));
UTIL_ScreenShake(tr.vecEndPos, 25.0, 150.0, 1.0, 750);
}
示例9: CC_Shake
//------------------------------------------------------------------------------
// Purpose: Console command to cause a screen shake.
//------------------------------------------------------------------------------
void CC_Shake( void )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
if (pPlayer)
{
UTIL_ScreenShake( pPlayer->WorldSpaceCenter(), 25.0, 150.0, 1.0, 750, SHAKE_START );
}
}
示例10: UTIL_ScreenShake
void CSDKPlayer::OnDamagedByExplosion( const CTakeDamageInfo &info )
{
if ( info.GetInflictor() && info.GetInflictor()->ClassMatches( "mortarshell" ) )
{
// No ear ringing for mortar
UTIL_ScreenShake( info.GetInflictor()->GetAbsOrigin(), 4.0, 1.0, 0.5, 1000, SHAKE_START, false );
return;
}
BaseClass::OnDamagedByExplosion( info );
}
示例11: ExplosionCreate
//-----------------------------------------------------------------------------
// Add a smoke trail since we've taken more damage
//-----------------------------------------------------------------------------
void CPropAPC::AddSmokeTrail( const Vector &vecPos )
{
// Start this trail out with a bang!
ExplosionCreate( vecPos, vec3_angle, this, 1000, 500, SF_ENVEXPLOSION_NODAMAGE |
SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE |
SF_ENVEXPLOSION_NOFIREBALLSMOKE, 0 );
UTIL_ScreenShake( vecPos, 25.0, 150.0, 1.0, 750.0f, SHAKE_START );
if ( m_nSmokeTrailCount == MAX_SMOKE_TRAILS )
return;
SmokeTrail *pSmokeTrail = SmokeTrail::CreateSmokeTrail();
if( !pSmokeTrail )
return;
// See if there's an attachment for this smoke trail
char buf[32];
Q_snprintf( buf, 32, "damage%d", m_nSmokeTrailCount );
int nAttachment = LookupAttachment( buf );
++m_nSmokeTrailCount;
pSmokeTrail->m_SpawnRate = 4;
pSmokeTrail->m_ParticleLifetime = 5.0f;
pSmokeTrail->m_StartColor.Init( 0.7f, 0.7f, 0.7f );
pSmokeTrail->m_EndColor.Init( 0.6, 0.6, 0.6 );
pSmokeTrail->m_StartSize = 32;
pSmokeTrail->m_EndSize = 64;
pSmokeTrail->m_SpawnRadius = 4;
pSmokeTrail->m_Opacity = 0.5f;
pSmokeTrail->m_MinSpeed = 16;
pSmokeTrail->m_MaxSpeed = 16;
pSmokeTrail->m_MinDirectedSpeed = 16.0f;
pSmokeTrail->m_MaxDirectedSpeed = 16.0f;
pSmokeTrail->SetLifetime( 5 );
pSmokeTrail->SetParent( this, nAttachment );
Vector vecForward( 0, 0, 1 );
QAngle angles;
VectorAngles( vecForward, angles );
if ( nAttachment == 0 )
{
pSmokeTrail->SetAbsOrigin( vecPos );
pSmokeTrail->SetAbsAngles( angles );
}
else
{
pSmokeTrail->SetLocalOrigin( vec3_origin );
pSmokeTrail->SetLocalAngles( angles );
}
pSmokeTrail->SetMoveType( MOVETYPE_NONE );
}
示例12: KillBeam
void CTripmineGrenade::DelayDeathThink( void )
{
KillBeam();
trace_t tr;
UTIL_TraceLine ( GetAbsOrigin() + m_vecDir * 8, GetAbsOrigin() - m_vecDir * 64, MASK_SOLID, this, COLLISION_GROUP_NONE, & tr);
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
ExplosionCreate( GetAbsOrigin() + m_vecDir * 8, GetAbsAngles(), m_hOwner, GetDamage(), 200,
SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);
UTIL_Remove( this );
}
示例13: ExplosionCreate
//------------------------------------------------------------------------------
// Pow!
//------------------------------------------------------------------------------
void CPropAPC2::ExplodeAndThrowChunk( const Vector &vecExplosionPos )
{
ExplosionCreate( vecExplosionPos, vec3_angle, this, 1000, 500.0f,
SF_ENVEXPLOSION_NODAMAGE | SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS |
SF_ENVEXPLOSION_NOSMOKE | SF_ENVEXPLOSION_NOFIREBALLSMOKE, 0 );
UTIL_ScreenShake( vecExplosionPos, 25.0, 150.0, 1.0, 750.0f, SHAKE_START );
// Drop a flaming, smoking chunk.
CGib *pChunk = CREATE_ENTITY( CGib, "gib" );
pChunk->Spawn( "models/gibs/hgibs.mdl" );
pChunk->SetBloodColor( DONT_BLEED );
QAngle vecSpawnAngles;
vecSpawnAngles.Random( -90, 90 );
pChunk->SetAbsOrigin( vecExplosionPos );
pChunk->SetAbsAngles( vecSpawnAngles );
int nGib = random->RandomInt( 0, APC_MAX_CHUNKS - 1 );
pChunk->Spawn( s_pChunkModelName[nGib] );
pChunk->SetOwnerEntity( this );
pChunk->m_lifeTime = random->RandomFloat( 6.0f, 8.0f );
pChunk->SetCollisionGroup( COLLISION_GROUP_DEBRIS );
IPhysicsObject *pPhysicsObject = pChunk->VPhysicsInitNormal( SOLID_VPHYSICS, pChunk->GetSolidFlags(), false );
// Set the velocity
if ( pPhysicsObject )
{
pPhysicsObject->EnableMotion( true );
Vector vecVelocity;
QAngle angles;
angles.x = random->RandomFloat( -40, 0 );
angles.y = random->RandomFloat( 0, 360 );
angles.z = 0.0f;
AngleVectors( angles, &vecVelocity );
vecVelocity *= random->RandomFloat( 300, 900 );
vecVelocity += GetAbsVelocity();
AngularImpulse angImpulse;
angImpulse = RandomAngularImpulse( -180, 180 );
pChunk->SetAbsVelocity( vecVelocity );
pPhysicsObject->SetVelocity(&vecVelocity, &angImpulse );
}
CEntityFlame *pFlame = CEntityFlame::Create( pChunk, false );
if ( pFlame != NULL )
{
pFlame->SetLifetime( pChunk->m_lifeTime );
}
pChunk->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL );
}
示例14: filter
void CNPC_Gargantua::HandleAnimEvent( animevent_t *pEvent )
{
CPASAttenuationFilter filter( this );
switch( pEvent->event )
{
case GARG_AE_SLASH_LEFT:
{
// HACKHACK!!!
CBaseEntity *pHurt = GargantuaCheckTraceHullAttack( GARG_ATTACKDIST + 10.0, sk_gargantua_dmg_slash.GetFloat(), DMG_SLASH );
if (pHurt)
{
if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) )
{
pHurt->ViewPunch( QAngle( -30, -30, 30 ) );
Vector vRight;
AngleVectors( GetAbsAngles(), NULL, &vRight, NULL );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() - vRight * 100 );
}
EmitSound( filter, entindex(), "Garg.AttackHit" );
}
else // Play a random attack miss sound
{
EmitSound( filter, entindex(),"Garg.AttackMiss" );
}
}
break;
case GARG_AE_RIGHT_FOOT:
case GARG_AE_LEFT_FOOT:
UTIL_ScreenShake( GetAbsOrigin(), 4.0, 3.0, 1.0, 1500, SHAKE_START );
EmitSound( filter, entindex(), "Garg.Footstep" );
break;
case GARG_AE_STOMP:
StompAttack();
m_seeTime = gpGlobals->curtime + 12;
break;
case GARG_AE_BREATHE:
EmitSound( filter, entindex(), "Garg.Breath" );
break;
default:
BaseClass::HandleAnimEvent(pEvent);
break;
}
}
示例15: UTIL_Remove
void CGrenadeAR2::Detonate(void)
{
if (!m_bIsLive)
{
return;
}
m_bIsLive = false;
m_takedamage = DAMAGE_NO;
if(m_hSmokeTrail)
{
UTIL_Remove(m_hSmokeTrail);
m_hSmokeTrail = NULL;
}
CPASFilter filter( GetAbsOrigin() );
te->Explosion( filter, 0.0,
&GetAbsOrigin(),
g_sModelIndexFireball,
2.0,
15,
TE_EXPLFLAG_NONE,
m_DmgRadius,
m_flDamage );
Vector vecForward = GetAbsVelocity();
VectorNormalize(vecForward);
trace_t tr;
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT,
this, COLLISION_GROUP_NONE, &tr);
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
{
// non-world needs smaller decals
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
{
UTIL_DecalTrace( &tr, "SmallScorch" );
}
}
else
{
UTIL_DecalTrace( &tr, "Scorch" );
}
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
RadiusDamage ( CTakeDamageInfo( this, GetThrower(), m_flDamage, DMG_BLAST ), GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
UTIL_Remove( this );
}