本文整理汇总了C++中G_PlayEffect函数的典型用法代码示例。如果您正苦于以下问题:C++ G_PlayEffect函数的具体用法?C++ G_PlayEffect怎么用?C++ G_PlayEffect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_PlayEffect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GM_CreateExplosion
//-----------------------------------------------------------------
static void GM_CreateExplosion( gentity_t *self, const int boltID, qboolean doSmall = qfalse )
{
if ( boltID >=0 )
{
mdxaBone_t boltMatrix;
vec3_t org, dir;
gi.G2API_GetBoltMatrix( self->ghoul2, self->playerModel,
boltID,
&boltMatrix, self->currentAngles, self->currentOrigin, (cg.time?cg.time:level.time),
NULL, self->s.modelScale );
gi.G2API_GiveMeVectorFromMatrix( boltMatrix, ORIGIN, org );
gi.G2API_GiveMeVectorFromMatrix( boltMatrix, NEGATIVE_Y, dir );
if ( doSmall )
{
G_PlayEffect( "env/small_explode2", org, dir );
}
else
{
G_PlayEffect( "env/med_explode2", org, dir );
}
}
}
示例2: G_MissileReflectEffect
void G_MissileReflectEffect( gentity_t *ent, vec3_t org, vec3_t dir )
#endif // _IMMERSION
{
//FIXME: have an EV_BOUNCE_MISSILE event that checks the s.weapon and does the appropriate effect
switch( ent->s.weapon )
{
case WP_BOWCASTER:
#ifdef _IMMERSION
G_PlayEffect( "bowcaster/deflect", hitEntNum, ent->currentOrigin, dir );
#else
G_PlayEffect( "bowcaster/deflect", ent->currentOrigin, dir );
#endif // _IMMERSION
break;
case WP_BLASTER:
case WP_BRYAR_PISTOL:
case WP_BLASTER_PISTOL:
default:
#ifdef _IMMERSION
G_PlayEffect( "blaster/deflect", hitEntNum, ent->currentOrigin, dir );
#else
G_PlayEffect( "blaster/deflect", ent->currentOrigin, dir );
#endif // _IMMERSION
break;
}
}
示例3: RT_FlyStart
void RT_FlyStart( gentity_t *self )
{//switch to seeker AI for a while
if ( TIMER_Done( self, "jetRecharge" )
&& !RT_Flying( self ) )
{
self->client->ps.gravity = 0;
self->svFlags |= SVF_CUSTOM_GRAVITY;
self->client->moveType = MT_FLYSWIM;
//Inform NPC_HandleAIFlags we want to fly
self->NPC->aiFlags |= NPCAI_FLY;
self->lastInAirTime = level.time;
//start jet effect
self->client->jetPackTime = Q3_INFINITE;
if ( self->genericBolt1 != -1 )
{
G_PlayEffect( G_EffectIndex( "rockettrooper/flameNEW" ), self->playerModel, self->genericBolt1, self->s.number, self->currentOrigin, qtrue, qtrue );
}
if ( self->genericBolt2 != -1 )
{
G_PlayEffect( G_EffectIndex( "rockettrooper/flameNEW" ), self->playerModel, self->genericBolt2, self->s.number, self->currentOrigin, qtrue, qtrue );
}
//take-off sound
G_SoundOnEnt( self, CHAN_ITEM, "sound/chars/boba/bf_blast-off.wav" );
//jet loop sound
self->s.loopSound = G_SoundIndex( "sound/chars/boba/bf_jetpack_lp.wav" );
if ( self->NPC )
{
self->count = Q3_INFINITE; // SEEKER shot ammo count
}
}
}
示例4: thermalDetonatorExplode
//---------------------------------------------------------
void thermalDetonatorExplode( gentity_t *ent )
//---------------------------------------------------------
{
if ( !ent->count )
{
G_Sound( ent, G_SoundIndex( "sound/weapons/thermal/warning.wav" ) );
ent->count = 1;
ent->nextthink = level.time + 800;
ent->svFlags |= SVF_BROADCAST;//so everyone hears/sees the explosion?
}
else
{
vec3_t pos;
VectorSet( pos, ent->currentOrigin[0], ent->currentOrigin[1], ent->currentOrigin[2] + 8 );
ent->takedamage = qfalse; // don't allow double deaths!
G_RadiusDamage( ent->currentOrigin, ent->owner, weaponData[WP_THERMAL].splashDamage, weaponData[WP_THERMAL].splashRadius, NULL, MOD_EXPLOSIVE_SPLASH );
G_PlayEffect( "thermal/explosion", ent->currentOrigin );
G_PlayEffect( "thermal/shockwave", ent->currentOrigin );
G_FreeEntity( ent );
}
}
示例5: Boba_FlyStart
void Boba_FlyStart( gentity_t *self )
{//switch to seeker AI for a while
if ( TIMER_Done( self, "jetRecharge" )
&& !Boba_Flying( self ) )
{
self->client->ps.gravity = 0;
self->svFlags |= SVF_CUSTOM_GRAVITY;
self->client->moveType = MT_FLYSWIM;
//start jet effect
self->client->jetPackTime = level.time + Q_irand( 3000, 10000 );
if ( self->genericBolt1 != -1 )
{
G_PlayEffect( G_EffectIndex( "boba/jetSP" ), self->playerModel, self->genericBolt1, self->s.number, self->currentOrigin, qtrue, qtrue );
}
if ( self->genericBolt2 != -1 )
{
G_PlayEffect( G_EffectIndex( "boba/jetSP" ), self->playerModel, self->genericBolt2, self->s.number, self->currentOrigin, qtrue, qtrue );
}
//take-off sound
G_SoundOnEnt( self, CHAN_ITEM, "sound/chars/boba/bf_blast-off.wav" );
//jet loop sound
self->s.loopSound = G_SoundIndex( "sound/chars/boba/bf_jetpack_lp.wav" );
if ( self->NPC )
{
self->count = Q3_INFINITE; // SEEKER shot ammo count
}
}
}
示例6: G_MissileBounceEffect
//-------------------------------------------------------------------------
void G_MissileBounceEffect( gentity_t *ent, vec3_t org, vec3_t dir, qboolean hitWorld )
{
//FIXME: have an EV_BOUNCE_MISSILE event that checks the s.weapon and does the appropriate effect
switch( ent->s.weapon )
{
case WP_BOWCASTER:
if ( hitWorld )
{
G_PlayEffect( "bowcaster/bounce_wall", org, dir );
}
else
{
G_PlayEffect( "bowcaster/deflect", ent->currentOrigin, dir );
}
break;
case WP_BLASTER:
case WP_BRYAR_PISTOL:
case WP_BLASTER_PISTOL:
G_PlayEffect( "blaster/deflect", ent->currentOrigin, dir );
break;
default:
{
gentity_t *tent = G_TempEntity( org, EV_GRENADE_BOUNCE );
VectorCopy( dir, tent->pos1 );
tent->s.weapon = ent->s.weapon;
}
break;
}
}
示例7: Droid_Spin
/*
-------------------------
void Droid_Spin( void )
-------------------------
*/
void Droid_Spin( void )
{
vec3_t dir = {0,0,1};
R2D2_TurnAnims();
// Head is gone, spin and spark
if ( NPC->client->NPC_class == CLASS_R5D2 )
{
// No head?
if (gi.G2API_GetSurfaceRenderStatus( &NPC->ghoul2[NPC->playerModel], "head" ))
{
if (TIMER_Done(NPC,"smoke") && !TIMER_Done(NPC,"droidsmoketotal"))
{
TIMER_Set( NPC, "smoke", 100);
G_PlayEffect( "droid_smoke" , NPC->currentOrigin,dir);
}
if (TIMER_Done(NPC,"droidspark"))
{
TIMER_Set( NPC, "droidspark", Q_irand(100,500));
G_PlayEffect( "spark", NPC->currentOrigin,dir);
}
ucmd.forwardmove = Q_irand( -64, 64);
if (TIMER_Done(NPC,"roam"))
{
TIMER_Set( NPC, "roam", Q_irand( 250, 1000 ) );
NPCInfo->desiredYaw = Q_irand( 0, 360 ); // Go in random directions
}
}
else
{
if (TIMER_Done(NPC,"roam"))
{
NPCInfo->localState = LSTATE_NONE;
}
else
{
NPCInfo->desiredYaw = AngleNormalize360(NPCInfo->desiredYaw + 40); // Spin around
}
}
}
else
{
if (TIMER_Done(NPC,"roam"))
{
NPCInfo->localState = LSTATE_NONE;
}
else
{
NPCInfo->desiredYaw = AngleNormalize360(NPCInfo->desiredYaw + 40); // Spin around
}
}
NPC_UpdateAngles( qtrue, qtrue );
}
示例8: WP_FireScepter
void WP_FireScepter( gentity_t *ent, qboolean alt_fire )
{//just a straight beam
int damage = 1;
vec3_t start, end;
trace_t tr;
gentity_t *traceEnt = NULL, *tent;
float shotRange = 8192;
qboolean render_impact = qtrue;
VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );
WP_MissileTargetHint(ent, start, forwardVec);
VectorMA( start, shotRange, forwardVec, end );
gi.trace( &tr, start, NULL, NULL, end, ent->s.number, MASK_SHOT, G2_RETURNONHIT, 10 );
traceEnt = &g_entities[tr.entityNum];
if ( tr.surfaceFlags & SURF_NOIMPACT )
{
render_impact = qfalse;
}
// always render a shot beam, doing this the old way because I don't much feel like overriding the effect.
tent = G_TempEntity( tr.endpos, EV_DISRUPTOR_MAIN_SHOT );
tent->svFlags |= SVF_BROADCAST;
VectorCopy( muzzle, tent->s.origin2 );
if ( render_impact )
{
if ( tr.entityNum < ENTITYNUM_WORLD && traceEnt->takedamage )
{
// Create a simple impact type mark that doesn't last long in the world
G_PlayEffect( G_EffectIndex( "disruptor/flesh_impact" ), tr.endpos, tr.plane.normal );
int hitLoc = G_GetHitLocFromTrace( &tr, MOD_DISRUPTOR );
G_Damage( traceEnt, ent, ent, forwardVec, tr.endpos, damage, DAMAGE_EXTRA_KNOCKBACK, MOD_DISRUPTOR, hitLoc );
}
else
{
G_PlayEffect( G_EffectIndex( "disruptor/wall_impact" ), tr.endpos, tr.plane.normal );
}
}
/*
shotDist = shotRange * tr.fraction;
for ( dist = 0; dist < shotDist; dist += 64 )
{
//FIXME: on a really long shot, this could make a LOT of alerts in one frame...
VectorMA( start, dist, forwardVec, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
VectorMA( start, shotDist-4, forwardVec, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
*/
}
示例9: fx_explosion_trail_think
//----------------------------------------------------------
void fx_explosion_trail_think( gentity_t *ent )
{
vec3_t origin;
trace_t tr;
if ( ent->spawnflags & 1 ) // gravity
{
ent->s.pos.trType = TR_GRAVITY;
}
else
{
ent->s.pos.trType = TR_LINEAR;
}
EvaluateTrajectory( &ent->s.pos, level.time, origin );
gi.trace( &tr, ent->currentOrigin, vec3_origin, vec3_origin, origin,
ent->owner ? ent->owner->s.number : ENTITYNUM_NONE, ent->clipmask, G2_RETURNONHIT, 10 );
if ( tr.fraction < 1.0f )
{
// never explode or bounce on sky
if ( !( tr.surfaceFlags & SURF_NOIMPACT ))
{
if ( ent->splashDamage && ent->splashRadius )
{
G_RadiusDamage( tr.endpos, ent, ent->splashDamage, ent->splashRadius, ent, MOD_EXPLOSIVE_SPLASH );
}
}
if ( ent->fullName )
{
// fxFile2....in other words, impact fx
G_PlayEffect( ent->fullName, tr.endpos, tr.plane.normal );
}
if ( VALIDSTRING( ent->soundSet ) == true )
{
G_AddEvent( ent, EV_BMODEL_SOUND, CAS_GetBModelSound( ent->soundSet, BMS_END ));
}
G_FreeEntity( ent );
return;
}
G_RadiusDamage( origin, ent, ent->damage, ent->radius, ent, MOD_EXPLOSIVE_SPLASH );
// call the effect with the desired position and orientation
G_PlayEffect( ent->fxID, origin, ent->currentAngles );
ent->nextthink = level.time + 50;
gi.linkentity( ent );
}
示例10: SandCreature_MoveEffect
void SandCreature_MoveEffect( void )
{
vec3_t up = {0,0,1};
vec3_t org = {NPC->currentOrigin[0], NPC->currentOrigin[1], NPC->absmin[2]+2};
float playerDist = Distance( player->currentOrigin, NPC->currentOrigin );
if ( playerDist < 256 )
{
CGCam_Shake( 0.75f*playerDist/256.0f, 250 );
}
if ( level.time-NPC->client->ps.lastStationary > 2000 )
{//first time moving for at least 2 seconds
//clear speakingtime
TIMER_Set( NPC, "speaking", -level.time );
}
if ( TIMER_Done( NPC, "breaching" )
&& TIMER_Done( NPC, "breachDebounce" )
&& TIMER_Done( NPC, "pain" )
&& TIMER_Done( NPC, "attacking" )
&& !Q_irand( 0, 10 ) )
{//Breach!
//FIXME: only do this while moving forward?
trace_t trace;
//make him solid here so he can be hit/gets blocked on stuff. Check clear first.
gi.trace( &trace, NPC->currentOrigin, NPC->mins, NPC->maxs, NPC->currentOrigin, NPC->s.number, MASK_NPCSOLID, (EG2_Collision)0, 0 );
if ( !trace.allsolid && !trace.startsolid )
{
NPC->clipmask = MASK_NPCSOLID;//turn solid for a little bit
NPC->contents = CONTENTS_BODY;
//NPC->takedamage = qtrue;//can be shot?
//FIXME: Breach sound?
//FIXME: Breach effect?
NPC_SetAnim( NPC, SETANIM_LEGS, BOTH_WALK2, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_RESTART );
TIMER_Set( NPC, "breaching", NPC->client->ps.legsAnimTimer );
TIMER_Set( NPC, "breachDebounce", NPC->client->ps.legsAnimTimer+Q_irand( 0, 10000 ) );
}
}
if ( !TIMER_Done( NPC, "breaching" ) )
{//different effect when breaching
//FIXME: make effect
G_PlayEffect( G_EffectIndex( "env/sand_move_breach" ), org, up );
}
else
{
G_PlayEffect( G_EffectIndex( "env/sand_move" ), org, up );
}
NPC->s.loopSound = G_SoundIndex( "sound/chars/sand_creature/slither.wav" );
}
示例11: RT_JetPackEffect
void RT_JetPackEffect( int duration )
{
if ( NPC->genericBolt1 != -1 )
{
G_PlayEffect( G_EffectIndex( "rockettrooper/flameNEW" ), NPC->playerModel, NPC->genericBolt1, NPC->s.number, NPC->currentOrigin, duration, qtrue );
}
if ( NPC->genericBolt2 != -1 )
{
G_PlayEffect( G_EffectIndex( "rockettrooper/flameNEW" ), NPC->playerModel, NPC->genericBolt2, NPC->s.number, NPC->currentOrigin, duration, qtrue );
}
//take-off sound
G_SoundOnEnt( NPC, CHAN_ITEM, "sound/chars/boba/bf_blast-off.wav" );
}
示例12: G_MissileReflectEffect
void G_MissileReflectEffect( gentity_t *ent, vec3_t org, vec3_t dir )
{
//FIXME: have an EV_BOUNCE_MISSILE event that checks the s.weapon and does the appropriate effect
switch( ent->s.weapon )
{
case WP_BOWCASTER:
G_PlayEffect( "bowcaster/deflect", ent->currentOrigin, dir );
break;
case WP_BLASTER:
case WP_BRYAR_PISTOL:
default:
G_PlayEffect( "blaster/deflect", ent->currentOrigin, dir );
break;
}
}
示例13: Remote_Fire
/*
-------------------------
Remote_Fire
-------------------------
*/
void Remote_Fire (void)
{
vec3_t delta1, enemy_org1, muzzle1;
vec3_t angleToEnemy1;
static vec3_t forward, vright, up;
static vec3_t muzzle;
gentity_t *missile;
CalcEntitySpot( NPC->enemy, SPOT_HEAD, enemy_org1 );
VectorCopy( NPC->currentOrigin, muzzle1 );
VectorSubtract (enemy_org1, muzzle1, delta1);
vectoangles ( delta1, angleToEnemy1 );
AngleVectors (angleToEnemy1, forward, vright, up);
missile = CreateMissile( NPC->currentOrigin, forward, 1000, 10000, NPC );
G_PlayEffect( "bryar/muzzle_flash", NPC->currentOrigin, forward );
missile->classname = "briar";
missile->s.weapon = WP_BRYAR_PISTOL;
missile->damage = 10;
missile->dflags = DAMAGE_DEATH_KNOCKBACK;
missile->methodOfDeath = MOD_ENERGY;
missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
}
示例14: turret_head_think
//-----------------------------------------------------
void turret_head_think( gentity_t *self )
//-----------------------------------------------------
{
gentity_t *top = &g_entities[self->r.ownerNum];
if ( !top )
{
return;
}
if ( self->painDebounceTime > level.time )
{
vec3_t v_up;
VectorSet( v_up, 0, 0, 1 );
G_PlayEffect( EFFECT_SPARKS, self->r.currentOrigin, v_up );
if ( Q_irand( 0, 3) )
{//25% chance of still firing
return;
}
}
// if it's time to fire and we have an enemy, then gun 'em down! pushDebounce time controls next fire time
if ( self->enemy && self->setTime < level.time && self->attackDebounceTime < level.time )
{
vec3_t fwd, org;
// set up our next fire time
self->setTime = level.time + self->wait;
VectorCopy( top->r.currentOrigin, org );
org[2] += top->r.maxs[2]-8;
AngleVectors( top->r.currentAngles, fwd, NULL, NULL );
VectorMA( org, START_DIS, fwd, org );
turret_fire( top, org, fwd );
self->fly_sound_debounce_time = level.time;//used as lastShotTime
}
}
示例15: NoghriGasCloudThink
void NoghriGasCloudThink( gentity_t *self )
{
self->nextthink = level.time + FRAMETIME;
AddSightEvent( self->owner, self->currentOrigin, 200, AEL_DANGER, 50 );
if ( self->fx_time < level.time )
{
vec3_t up = {0,0,1};
G_PlayEffect( "noghri_stick/gas_cloud", self->currentOrigin, up );
self->fx_time = level.time + 250;
}
if ( level.time - self->s.time <= 2500 )
{
if ( !Q_irand( 0, 3-g_spskill->integer ) )
{
G_RadiusDamage( self->currentOrigin, self->owner, Q_irand( 1, 4 ), self->splashRadius,
self->owner, self->splashMethodOfDeath );
}
}
if ( level.time - self->s.time > 3000 )
{
G_FreeEntity( self );
}
}