本文整理汇总了C++中G_SoundOnEnt函数的典型用法代码示例。如果您正苦于以下问题:C++ G_SoundOnEnt函数的具体用法?C++ G_SoundOnEnt怎么用?C++ G_SoundOnEnt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_SoundOnEnt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MineMonster_TryDamage
//---------------------------------------------------------
void MineMonster_TryDamage( gentity_t *enemy, int damage )
{
vec3_t end, dir;
trace_t tr;
if ( !enemy )
{
return;
}
AngleVectors( NPC->client->ps.viewangles, dir, NULL, NULL );
VectorMA( NPC->currentOrigin, MIN_DISTANCE, dir, end );
// Should probably trace from the mouth, but, ah well.
gi.trace( &tr, NPC->currentOrigin, vec3_origin, vec3_origin, end, NPC->s.number, MASK_SHOT, (EG2_Collision)0, 0 );
if ( tr.entityNum >= 0 && tr.entityNum < ENTITYNUM_NONE )
{
G_Damage( &g_entities[tr.entityNum], NPC, NPC, dir, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE );
G_SoundOnEnt( NPC, CHAN_VOICE_ATTEN, va("sound/chars/mine/misc/bite%i.wav", Q_irand(1,4)));
}
else
{
G_SoundOnEnt( NPC, CHAN_VOICE_ATTEN, va("sound/chars/mine/misc/miss%i.wav", Q_irand(1,4)));
}
}
示例2: G_DroidSounds
void G_DroidSounds( gentity_t *self )
{
if ( self->client )
{//make the noises
if ( TIMER_Done( self, "patrolNoise" ) && !Q_irand( 0, 20 ) )
{
switch( self->client->NPC_class )
{
case CLASS_R2D2: // droid
G_SoundOnEnt(self, CHAN_AUTO, va("sound/chars/r2d2/misc/r2d2talk0%d.wav",Q_irand(1, 3)) );
break;
case CLASS_R5D2: // droid
G_SoundOnEnt(self, CHAN_AUTO, va("sound/chars/r5d2/misc/r5talk%d.wav",Q_irand(1, 4)) );
break;
case CLASS_PROBE: // droid
G_SoundOnEnt(self, CHAN_AUTO, va("sound/chars/probe/misc/probetalk%d.wav",Q_irand(1, 3)) );
break;
case CLASS_MOUSE: // droid
G_SoundOnEnt(self, CHAN_AUTO, va("sound/chars/mouse/misc/mousego%d.wav",Q_irand(1, 3)) );
break;
case CLASS_GONK: // droid
G_SoundOnEnt(self, CHAN_AUTO, va("sound/chars/gonk/misc/gonktalk%d.wav",Q_irand(1, 2)) );
break;
default:
break;
}
TIMER_Set( self, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
}
示例3: ImperialProbe_Patrol
void ImperialProbe_Patrol( void ) {
ImperialProbe_MaintainHeight();
if ( NPC_CheckPlayerTeamStealth() ) {
NPC_UpdateAngles( qtrue, qtrue );
return;
}
//If we have somewhere to go, then do that
if ( !NPC->enemy ) {
NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_RUN1, SETANIM_FLAG_NORMAL );
if ( UpdateGoal() ) {
//start loop sound once we move
NPC->s.loopSound = G_SoundIndex( "sound/chars/probe/misc/probedroidloop" );
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
//randomly talk
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/probe/misc/probetalk%d", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else // He's got an enemy. Make him angry.
{
G_SoundOnEnt( NPC, CHAN_AUTO, "sound/chars/probe/misc/anger1" );
TIMER_Set( NPC, "angerNoise", Q_irand( 2000, 4000 ) );
//NPCInfo->behaviorState = BS_HUNT_AND_KILL;
}
NPC_UpdateAngles( qtrue, qtrue );
}
示例4: Droid_Patrol
void Droid_Patrol( void ) {
NPC->pos1.yaw = AngleNormalize360( NPC->pos1.yaw );
if ( NPC->client && NPC->client->NPC_class != CLASS_GONK ) {
if ( NPC->client->NPC_class != CLASS_R5D2 ) { //he doesn't have an eye.
R2D2_PartsMove(); // Get his eye moving.
}
R2D2_TurnAnims();
}
//If we have somewhere to go, then do that
if ( UpdateGoal() ) {
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
if ( NPC->client && NPC->client->NPC_class == CLASS_MOUSE ) {
NPCInfo->desiredYaw += sinf( level.time*.5f ) * 25; // Weaves side to side a little
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/mouse/misc/mousego%d.wav", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else if ( NPC->client && NPC->client->NPC_class == CLASS_R2D2 ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/r2d2/misc/r2d2talk0%d.wav", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
else if ( NPC->client && NPC->client->NPC_class == CLASS_R5D2 ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/r5d2/misc/r5talk%d.wav", Q_irand( 1, 4 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
if ( NPC->client && NPC->client->NPC_class == CLASS_GONK ) {
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/gonk/misc/gonktalk%d.wav", Q_irand( 1, 2 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
// else
// {
// R5D2_LookAround();
// }
}
NPC_UpdateAngles( qtrue, qtrue );
}
示例5: G_ATSTCheckPain
void G_ATSTCheckPain( gentity_t *self, gentity_t *other, int damage )
{
//int newBolt;
//int hitLoc = gPainHitLoc;
if ( rand() & 1 )
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged1" );
}
else
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged2" );
}
}
示例6: G_ATSTCheckPain
void G_ATSTCheckPain( gentity_t *self, gentity_t *other, int damage )
{
//int newBolt;
//int hitLoc = gPainHitLoc;
if ( rand() & 1 )
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged1" );
}
else
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged2" );
}
/*
if ((hitLoc==HL_ARM_LT) && (self->locationDamage[HL_ARM_LT] > LEFT_ARM_HEALTH))
{
if (self->locationDamage[hitLoc] >= LEFT_ARM_HEALTH) // Blow it up?
{
newBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*flash3" );
if ( newBolt != -1 )
{
// G_PlayEffect( "small_chunks", self->playerModel, self->genericBolt1, self->s.number);
ATST_PlayEffect( self, trap_G2API_AddBolt(self->ghoul2, 0, "*flash3"), "env/med_explode2" );
//G_PlayEffectID( G_EffectIndex("blaster/smoke_bolton"), self->playerModel, newBolt, self->s.number);
//Maybe bother with this some other time.
}
NPC_SetSurfaceOnOff( self, "head_light_blaster_cann", TURN_OFF );
}
}
else if ((hitLoc==HL_ARM_RT) && (self->locationDamage[HL_ARM_RT] > RIGHT_ARM_HEALTH)) // Blow it up?
{
if (self->locationDamage[hitLoc] >= RIGHT_ARM_HEALTH)
{
newBolt = trap_G2API_AddBolt( self->ghoul2, 0, "*flash4" );
if ( newBolt != -1 )
{
// G_PlayEffect( "small_chunks", self->playerModel, self->genericBolt2, self->s.number);
ATST_PlayEffect( self, trap_G2API_AddBolt(self->ghoul2, 0, "*flash4"), "env/med_explode2" );
//G_PlayEffect( "blaster/smoke_bolton", self->playerModel, newBolt, self->s.number);
}
NPC_SetSurfaceOnOff( self, "head_concussion_charger", TURN_OFF );
}
}
*/
}
示例7: RT_FlyStop
void RT_FlyStop( gentity_t *self )
{
self->client->ps.gravity = g_gravity->value;
self->svFlags &= ~SVF_CUSTOM_GRAVITY;
self->client->moveType = MT_RUNJUMP;
//Stop the effect
self->client->jetPackTime = 0;
if ( self->genericBolt1 != -1 )
{
G_StopEffect("rockettrooper/flameNEW", self->playerModel, self->genericBolt1, self->s.number );
}
if ( self->genericBolt2 != -1 )
{
G_StopEffect("rockettrooper/flameNEW", self->playerModel, self->genericBolt2, self->s.number );
}
//stop jet loop sound
self->s.loopSound = 0;
G_SoundOnEnt( self, CHAN_ITEM, "sound/chars/boba/bf_land.wav" );
if ( self->NPC )
{
self->count = 0; // SEEKER shot ammo count
TIMER_Set( self, "jetRecharge", Q_irand( 1000, 5000 ) );
TIMER_Set( self, "jumpChaseDebounce", Q_irand( 500, 2000 ) );
}
}
示例8: NPC_Sentry_Patrol
/*
-------------------------
NPC_Sentry_Patrol
-------------------------
*/
void NPC_Sentry_Patrol( void ) {
Sentry_MaintainHeight();
//If we have somewhere to go, then do that
if ( !NPC->enemy ) {
if ( NPC_CheckPlayerTeamStealth() ) {
//NPC_AngerSound();
NPC_UpdateAngles( qtrue, qtrue );
return;
}
if ( UpdateGoal() ) {
//start loop sound once we move
ucmd.buttons |= BUTTON_WALKING;
NPC_MoveToGoal( qtrue );
}
//randomly talk
if ( TIMER_Done( NPC, "patrolNoise" ) ) {
G_SoundOnEnt( NPC, CHAN_AUTO, va( "sound/chars/sentry/misc/talk%d", Q_irand( 1, 3 ) ) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) );
}
}
NPC_UpdateAngles( qtrue, qtrue );
}
示例9: 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
}
}
}
示例10: 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
}
}
}
示例11: Boba_DoFlameThrower
void Boba_DoFlameThrower( gentity_t *self )
{
if ( self->s.number < MAX_CLIENTS )
{
if ( self->client )
{
if ( !self->client->ps.forcePowerDuration[FP_LIGHTNING] )
{
NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCELIGHTNING_HOLD, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
self->client->ps.torsoAnimTimer = BOBA_FLAMEDURATION;
G_SoundOnEnt( self, CHAN_WEAPON, "sound/weapons/boba/bf_flame.mp3" );
G_PlayEffect( G_EffectIndex("boba/fthrw"), self->playerModel, self->genericBolt3, self->s.number, self->s.origin, 1 );
self->client->ps.forcePowerDuration[FP_LIGHTNING] = 1;
}
Boba_FireFlameThrower( self );
}
return;
}
if (!(NPCInfo->aiFlags&NPCAI_FLAMETHROW) && TIMER_Done(self, "nextAttackDelay"))
{
Boba_StartFlameThrower( self );
}
if ( (NPCInfo->aiFlags&NPCAI_FLAMETHROW))
{
Boba_FireFlameThrower( self );
}
}
示例12: Sentry_RangedAttack
/*
-------------------------
Sentry_RangedAttack
-------------------------
*/
void Sentry_RangedAttack( qboolean visible, qboolean advance ) {
if ( TIMER_Done( NPC, "attackDelay" ) && NPC->attackDebounceTime < level.time && visible ) // Attack?
{
if ( NPCInfo->burstCount > 6 ) {
if ( !NPC->fly_sound_debounce_time ) {//delay closing down to give the player an opening
NPC->fly_sound_debounce_time = level.time + Q_irand( 500, 2000 );
}
else if ( NPC->fly_sound_debounce_time < level.time ) {
NPCInfo->localState = LSTATE_ACTIVE;
NPC->fly_sound_debounce_time = NPCInfo->burstCount = 0;
TIMER_Set( NPC, "attackDelay", Q_irand( 2000, 3500 ) );
NPC->flags |= FL_SHIELDED;
NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_FLY_SHIELDED, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD );
G_SoundOnEnt( NPC, CHAN_AUTO, "sound/chars/sentry/misc/sentry_shield_close" );
}
}
else {
Sentry_Fire();
}
}
if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) {
Sentry_Hunt( visible, advance );
}
}
示例13: NPC_Sentry_Pain
/*
-------------------------
NPC_Sentry_Pain
-------------------------
*/
void NPC_Sentry_Pain( gentity_t *self, gentity_t *inflictor, gentity_t *other, vec3_t point, int damage, int mod,int hitLoc )
{
NPC_Pain( self, inflictor, other, point, damage, mod );
if ( mod == MOD_DEMP2 || mod == MOD_DEMP2_ALT )
{
self->NPC->burstCount = 0;
TIMER_Set( self, "attackDelay", Q_irand( 9000, 12000) );
self->flags |= FL_SHIELDED;
NPC_SetAnim( self, SETANIM_BOTH, BOTH_FLY_SHIELDED, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
G_SoundOnEnt( self, CHAN_AUTO, "sound/chars/sentry/misc/sentry_pain" );
self->NPC->localState = LSTATE_ACTIVE;
}
// You got hit, go after the enemy
// if (self->NPC->localState == LSTATE_ASLEEP)
// {
// G_Sound( self, G_SoundIndex("sound/chars/sentry/misc/shieldsopen.wav"));
//
// self->flags &= ~FL_SHIELDED;
// NPC_SetAnim( self, SETANIM_BOTH, BOTH_POWERUP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
// self->NPC->localState = LSTATE_WAKEUP;
// }
}
示例14: G_ATSTCheckPain
void G_ATSTCheckPain( gentity_t *self, gentity_t *other, const vec3_t point, int damage, int mod,int hitLoc )
{
int newBolt;
if ( rand() & 1 )
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged1" );
}
else
{
G_SoundOnEnt( self, CHAN_LESS_ATTEN, "sound/chars/atst/atst_damaged2" );
}
if ((hitLoc==HL_ARM_LT) && (self->locationDamage[HL_ARM_LT] > LEFT_ARM_HEALTH))
{
if (self->locationDamage[hitLoc] >= LEFT_ARM_HEALTH) // Blow it up?
{
newBolt = gi.G2API_AddBolt( &self->ghoul2[self->playerModel], "*flash3" );
if ( newBolt != -1 )
{
// G_PlayEffect( "small_chunks", self->playerModel, self->genericBolt1, self->s.number);
ATST_PlayEffect( self, self->genericBolt1, "env/med_explode2" );
G_PlayEffect( G_EffectIndex("blaster/smoke_bolton"), self->playerModel, newBolt, self->s.number, point);
}
gi.G2API_SetSurfaceOnOff( &self->ghoul2[self->playerModel], "head_light_blaster_cann", TURN_OFF );
}
}
else if ((hitLoc==HL_ARM_RT) && (self->locationDamage[HL_ARM_RT] > RIGHT_ARM_HEALTH)) // Blow it up?
{
if (self->locationDamage[hitLoc] >= RIGHT_ARM_HEALTH)
{
newBolt = gi.G2API_AddBolt( &self->ghoul2[self->playerModel], "*flash4" );
if ( newBolt != -1 )
{
// G_PlayEffect( "small_chunks", self->playerModel, self->genericBolt2, self->s.number);
ATST_PlayEffect( self, self->genericBolt2, "env/med_explode2" );
G_PlayEffect( G_EffectIndex("blaster/smoke_bolton"), self->playerModel, newBolt, self->s.number, point);
}
gi.G2API_SetSurfaceOnOff( &self->ghoul2[self->playerModel], "head_concussion_charger", TURN_OFF );
}
}
}
示例15: Sentry_AttackDecision
/*
-------------------------
Sentry_AttackDecision
-------------------------
*/
void Sentry_AttackDecision( void )
{
float distance;
qboolean visible;
qboolean advance;
// Always keep a good height off the ground
Sentry_MaintainHeight();
NPC->s.loopSound = G_SoundIndex( "sound/chars/sentry/misc/sentry_hover_2_lp" );
//randomly talk
if ( TIMER_Done(NPC,"patrolNoise") )
{
if (TIMER_Done(NPC,"angerNoise"))
{
G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/sentry/misc/talk%d", Q_irand(1, 3)) );
TIMER_Set( NPC, "patrolNoise", Q_irand( 4000, 10000 ) );
}
}
// He's dead.
if (NPC->enemy->health<1)
{
NPC->enemy = NULL;
Sentry_Idle();
return;
}
// If we don't have an enemy, just idle
if ( NPC_CheckEnemyExt(qfalse) == qfalse )
{
Sentry_Idle();
return;
}
// Rate our distance to the target and visibilty
distance = (int) DistanceHorizontalSquared( NPC->r.currentOrigin, NPC->enemy->r.currentOrigin );
visible = NPC_ClearLOS4( NPC->enemy );
advance = (qboolean)(distance > MIN_DISTANCE_SQR);
// If we cannot see our target, move to see it
if ( visible == qfalse )
{
if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES )
{
Sentry_Hunt( visible, advance );
return;
}
}
NPC_FaceEnemy( qtrue );
Sentry_RangedAttack( visible, advance );
}