本文整理汇总了C++中G_AddVoiceEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ G_AddVoiceEvent函数的具体用法?C++ G_AddVoiceEvent怎么用?C++ G_AddVoiceEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_AddVoiceEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NPC_PlayConfusionSound
void NPC_PlayConfusionSound( gentity_t *self )
{
if ( self->health > 0 )
{
if ( self->enemy ||//was mad
!TIMER_Done( self, "enemyLastVisible" ) ||//saw something suspicious
self->client->renderInfo.lookTarget == 0//was looking at player
)
{
self->NPC->blockedSpeechDebounceTime = 0;//make sure we say this
G_AddVoiceEvent( self, Q_irand( EV_CONFUSE2, EV_CONFUSE3 ), 2000 );
}
else if ( self->NPC && self->NPC->investigateDebounceTime+self->NPC->pauseTime > level.time )//was checking something out
{
self->NPC->blockedSpeechDebounceTime = 0;//make sure we say this
G_AddVoiceEvent( self, EV_CONFUSE1, 2000 );
}
//G_AddVoiceEvent( self, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 );
}
//reset him to be totally unaware again
TIMER_Set( self, "enemyLastVisible", 0 );
self->NPC->tempBehavior = BS_DEFAULT;
//self->NPC->behaviorState = BS_PATROL;
G_ClearEnemy( self );//FIXME: or just self->enemy = NULL;?
self->NPC->investigateCount = 0;
}
示例2: G_CheckCharmed
//[CoOp]
//[SPPortComplete]
void G_CheckCharmed( gentity_t *self )
{
if ( self
&& self->client
&& self->client->playerTeam == NPCTEAM_PLAYER
&& self->NPC
&& self->NPC->charmedTime
&& (self->NPC->charmedTime < level.time ||self->health <= 0) )
{//we were charmed, set us back!
//NOTE: presumptions here...
team_t savTeam = self->client->enemyTeam;
self->client->enemyTeam = self->client->playerTeam;
self->client->playerTeam = savTeam;
self->client->leader = NULL;
self->NPC->charmedTime = 0;
if ( self->health > 0 )
{
if ( self->NPC->tempBehavior == BS_FOLLOW_LEADER )
{
self->NPC->tempBehavior = BS_DEFAULT;
}
G_ClearEnemy( self );
//say something to let player know you've snapped out of it
G_AddVoiceEvent( self, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 );
}
}
}
示例3: NPC_Respond
void NPC_Respond( gentity_t *self, int userNum )
{
int event;
if ( self->NPC->behaviorState == BS_FORMATION )
{
event = Q_irand(EV_MISSION1, EV_MISSION3);
}
else
{
if ( Q_irand( 0, 1 ) )
{
event = Q_irand(EV_RESPOND1, EV_RESPOND3);
}
else
{
event = Q_irand(EV_BUSY1, EV_BUSY3);
}
if( !Q_irand( 0, 1 ) )
{//set looktarget to them for a second or two
NPC_TempLookTarget( self, userNum, 1000, 3000 );
}
}
G_AddVoiceEvent( self, event, 3000 );
}
示例4: NPC_Grenadier_Pain
void NPC_Grenadier_Pain( gentity_t *self, gentity_t *attacker, int damage ) {
self->NPC->localState = LSTATE_UNDERFIRE;
TIMER_Set( self, "duck", -1 );
TIMER_Set( self, "stand", 2000 );
NPC_Pain( self, attacker, damage );
if ( !damage && self->health > 0 ) {//FIXME: better way to know I was pushed
G_AddVoiceEvent( self, Q_irand( EV_PUSHED1, EV_PUSHED3 ), 2000 );
}
}
示例5: NPC_Sniper_Pain
void NPC_Sniper_Pain( gentity_t *self, gentity_t *inflictor, gentity_t *other, vec3_t point, int damage, int mod )
{
self->NPC->localState = LSTATE_UNDERFIRE;
TIMER_Set( self, "duck", -1 );
TIMER_Set( self, "stand", 2000 );
NPC_Pain( self, inflictor, other, point, damage, mod );
if ( !damage && self->health > 0 )
{//FIXME: better way to know I was pushed
G_AddVoiceEvent( self, Q_irand(EV_PUSHED1, EV_PUSHED3), 2000 );
}
}
示例6: NPC_Grenadier_PlayConfusionSound
void NPC_Grenadier_PlayConfusionSound( gentity_t *self ) {//FIXME: make this a custom sound in sound set
if ( self->health > 0 ) {
G_AddVoiceEvent( self, Q_irand( EV_CONFUSE1, EV_CONFUSE3 ), 2000 );
}
//reset him to be totally unaware again
TIMER_Set( self, "enemyLastVisible", 0 );
TIMER_Set( self, "flee", 0 );
self->NPC->squadState = SQUAD_IDLE;
self->NPC->tempBehavior = BS_DEFAULT;
//self->NPC->behaviorState = BS_PATROL;
G_ClearEnemy( self );//FIXME: or just self->enemy = NULL;?
self->NPC->investigateCount = 0;
}
示例7: NPC_CheckCharmed
void NPC_CheckCharmed( void )
{
if ( NPCInfo->charmedTime && NPCInfo->charmedTime < level.time && NPC->client )
{//we were charmed, set us back!
NPC->client->playerTeam = NPC->genericValue1;
NPC->client->enemyTeam = NPC->genericValue2;
NPC->s.teamowner = NPC->genericValue3;
NPC->client->leader = NULL;
if ( NPCInfo->tempBehavior == BS_FOLLOW_LEADER )
{
NPCInfo->tempBehavior = BS_DEFAULT;
}
G_ClearEnemy( NPC );
NPCInfo->charmedTime = 0;
//say something to let player know you've snapped out of it
G_AddVoiceEvent( NPC, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 );
}
}
示例8: NPC_CheckCharmed
void NPC_CheckCharmed( void )
{
if ( NPC->client->playerTeam == TEAM_PLAYER && NPCInfo->charmedTime && NPCInfo->charmedTime < level.time && NPC->client )
{//we were charmed, set us back!
//NOTE: presumptions here...
team_t savTeam = NPC->client->enemyTeam;
NPC->client->enemyTeam = NPC->client->playerTeam;
NPC->client->playerTeam = savTeam;
NPC->client->leader = NULL;
if ( NPCInfo->tempBehavior == BS_FOLLOW_LEADER )
{
NPCInfo->tempBehavior = BS_DEFAULT;
}
G_ClearEnemy( NPC );
NPCInfo->charmedTime = 0;
//say something to let player know you've snapped out of it
G_AddVoiceEvent( NPC, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 );
}
}
示例9: NPC_HandleAIFlags
void NPC_HandleAIFlags (void)
{
//FIXME: make these flags checks a function call like NPC_CheckAIFlagsAndTimers
if ( NPCInfo->aiFlags & NPCAI_LOST )
{//Print that you need help!
//FIXME: shouldn't remove this just yet if cg_draw needs it
NPCInfo->aiFlags &= ~NPCAI_LOST;
if ( NPCInfo->goalEntity && NPCInfo->goalEntity == NPC->enemy )
{//We can't nav to our enemy
//Drop enemy and see if we should search for him
NPC_LostEnemyDecideChase();
}
}
//been told to play a victory sound after a delay
if ( NPCInfo->greetingDebounceTime && NPCInfo->greetingDebounceTime < level.time )
{
G_AddVoiceEvent( NPC, Q_irand(EV_VICTORY1, EV_VICTORY3), Q_irand( 2000, 4000 ) );
NPCInfo->greetingDebounceTime = 0;
}
if ( NPCInfo->ffireCount > 0 )
{
if ( NPCInfo->ffireFadeDebounce < level.time )
{
NPCInfo->ffireCount--;
NPCInfo->ffireFadeDebounce = level.time + 3000;
}
}
if ( d_patched.integer )
{//use patch-style navigation
if ( NPCInfo->consecutiveBlockedMoves > 20 )
{//been stuck for a while, try again?
NPCInfo->consecutiveBlockedMoves = 0;
}
}
}
示例10: NPC_Surrender
void NPC_Surrender( void )
{//FIXME: say "don't shoot!" if we weren't already surrendering
if ( NPC->client->ps.weaponTime || PM_InKnockDown( &NPC->client->ps ) )
{
return;
}
if ( NPC->s.weapon != WP_NONE &&
NPC->s.weapon != WP_MELEE &&
NPC->s.weapon != WP_SABER )
{
WP_DropWeapon( NPC, NULL );
}
if ( NPCInfo->surrenderTime < level.time - 5000 )
{//haven't surrendered for at least 6 seconds, tell them what you're doing
//FIXME: need real dialogue EV_SURRENDER
NPCInfo->blockedSpeechDebounceTime = 0;//make sure we say this
G_AddVoiceEvent( NPC, Q_irand( EV_PUSHED1, EV_PUSHED3 ), 3000 );
}
NPC_SetAnim( NPC, SETANIM_TORSO, TORSO_SURRENDER_START, SETANIM_FLAG_HOLD|SETANIM_FLAG_OVERRIDE );
NPC->client->ps.torsoAnimTimer = 1000;
NPCInfo->surrenderTime = level.time + 1000;//stay surrendered for at least 1 second
//FIXME: while surrendering, make a big sight/sound alert? Or G_AlertTeam?
}
示例11: NPC_Respond
//.........这里部分代码省略.........
event = Q_irand( EV_COVER1, EV_COVER5 );
}
}
else if ( !Q_irand( 0, 3 ) )
{
event = Q_irand( EV_SIGHT2, EV_SIGHT3 );
}
else if ( !Q_irand( 0, 1 ) )
{
event = Q_irand( EV_SOUND1, EV_SOUND3 );
}
else if ( !Q_irand( 0, 2 ) )
{
event = EV_LOST1;
}
else if ( !Q_irand( 0, 1 ) )
{
event = EV_ESCAPING2;
}
else
{
event = EV_GIVEUP4;
}
}
else
{//variant2
if ( self->enemy )
{
if ( Q_irand( 0, 9 ) > 6 )
{
event = Q_irand( EV_CHASE1, EV_CHASE3 );
}
else if ( Q_irand( 0, 6 ) > 4 )
{
event = Q_irand( EV_OUTFLANK1, EV_OUTFLANK2 );
}
else
{
event = Q_irand( EV_COVER1, EV_COVER5 );
}
}
else if ( !Q_irand( 0, 3 ) )
{
event = Q_irand( EV_SIGHT1, EV_SIGHT2 );
}
else if ( !Q_irand( 0, 1 ) )
{
event = Q_irand( EV_SOUND1, EV_SOUND3 );
}
else if ( !Q_irand( 0, 2 ) )
{
event = EV_LOST1;
}
else if ( !Q_irand( 0, 1 ) )
{
event = EV_GIVEUP3;
}
else
{
event = EV_CONFUSE1;
}
}
break;
case CLASS_R2D2: // droid
G_Sound(self, G_SoundIndex(va("sound/chars/r2d2/misc/r2d2talk0%d.wav",Q_irand(1, 3))));
break;
case CLASS_R5D2: // droid
G_Sound(self, G_SoundIndex(va("sound/chars/r5d2/misc/r5talk%d.wav",Q_irand(1, 4))));
break;
case CLASS_MOUSE: // droid
G_Sound(self, G_SoundIndex(va("sound/chars/mouse/misc/mousego%d.wav",Q_irand(1, 3))));
break;
case CLASS_GONK: // droid
G_Sound(self, G_SoundIndex(va("sound/chars/gonk/misc/gonktalk%d.wav",Q_irand(1, 2))));
break;
case CLASS_JAWA:
G_SoundOnEnt(self, CHAN_VOICE, va("sound/chars/jawa/misc/chatter%d.wav",Q_irand(1, 6)) );
if ( self->NPC )
{
self->NPC->blockedSpeechDebounceTime = level.time + 2000;
}
break;
default:
break;
}
if ( event != -1 )
{
//hack here because we reuse some "combat" and "extra" sounds
qboolean addFlag = (qboolean)((self->NPC->scriptFlags&SCF_NO_COMBAT_TALK) != 0);
self->NPC->scriptFlags &= ~SCF_NO_COMBAT_TALK;
G_AddVoiceEvent( self, event, 3000 );
if ( addFlag )
{
self->NPC->scriptFlags |= SCF_NO_COMBAT_TALK;
}
}
}
示例12: NPC_ChoosePainAnimation
void NPC_ChoosePainAnimation( gentity_t *self, gentity_t *other, const vec3_t point, int damage, int mod, int hitLoc, int voiceEvent = -1 )
{
//If we've already taken pain, then don't take it again
if ( level.time < self->painDebounceTime && mod != MOD_ELECTROCUTE && mod != MOD_MELEE )
{//FIXME: if hit while recoving from losing a saber lock, we should still play a pain anim?
return;
}
int pain_anim = -1;
float pain_chance;
if ( self->s.weapon == WP_THERMAL && self->client->fireDelay > 0 )
{//don't interrupt thermal throwing anim
return;
}
else if (self->client->ps.powerups[PW_GALAK_SHIELD])
{
return;
}
else if ( self->client->NPC_class == CLASS_GALAKMECH )
{
if ( hitLoc == HL_GENERIC1 )
{//hit the antenna!
pain_chance = 1.0f;
self->s.powerups |= ( 1 << PW_SHOCKED );
self->client->ps.powerups[PW_SHOCKED] = level.time + Q_irand( 500, 2500 );
}
else if ( self->client->ps.powerups[PW_GALAK_SHIELD] )
{//shield up
return;
}
else if ( self->health > 200 && damage < 100 )
{//have a *lot* of health
pain_chance = 0.05f;
}
else
{//the lower my health and greater the damage, the more likely I am to play a pain anim
pain_chance = (200.0f-self->health)/100.0f + damage/50.0f;
}
}
else if ( self->client && self->client->playerTeam == TEAM_PLAYER && other && !other->s.number )
{//ally shot by player always complains
pain_chance = 1.1f;
}
else
{
if ( other && (other->s.weapon == WP_SABER || mod == MOD_ELECTROCUTE || mod == MOD_CRUSH/*FIXME:MOD_FORCE_GRIP*/) )
{
if ( self->client->ps.weapon == WP_SABER
&& other->s.number < MAX_CLIENTS )
{//hmm, shouldn't *always* react to damage from player if I have a saber
pain_chance = 1.05f - ((self->NPC->rank)/(float)RANK_CAPTAIN);
}
else
{
pain_chance = 1.0f;//always take pain from saber
}
}
else if ( mod == MOD_GAS )
{
pain_chance = 1.0f;
}
else if ( mod == MOD_MELEE )
{//higher in rank (skill) we are, less likely we are to be fazed by a punch
pain_chance = 1.0f - ((RANK_CAPTAIN-self->NPC->rank)/(float)RANK_CAPTAIN);
}
else if ( self->client->NPC_class == CLASS_PROTOCOL )
{
pain_chance = 1.0f;
}
else
{
pain_chance = NPC_GetPainChance( self, damage );
}
if ( self->client->NPC_class == CLASS_DESANN )
{
pain_chance *= 0.5f;
}
}
//See if we're going to flinch
if ( Q_flrand(0.0f, 1.0f) < pain_chance )
{
//Pick and play our animation
if ( (self->client->ps.eFlags&EF_FORCE_GRIPPED) )
{
G_AddVoiceEvent( self, Q_irand(EV_CHOKE1, EV_CHOKE3), 0 );
}
else if ( mod == MOD_GAS )
{
//SIGH... because our choke sounds are inappropriately long, I have to debounce them in code!
if ( TIMER_Done( self, "gasChokeSound" ) )
{
TIMER_Set( self, "gasChokeSound", Q_irand( 1000, 2000 ) );
G_AddVoiceEvent( self, Q_irand(EV_CHOKE1, EV_CHOKE3), 0 );
}
}
else if ( (self->client->ps.eFlags&EF_FORCE_DRAINED) )
{
NPC_SetPainEvent( self );
//.........这里部分代码省略.........
示例13: NPC_HandleAIFlags
void NPC_HandleAIFlags (void)
{
//FIXME: make these flags checks a function call like NPC_CheckAIFlagsAndTimers
if ( NPCInfo->aiFlags & NPCAI_LOST )
{//Print that you need help!
//FIXME: shouldn't remove this just yet if cg_draw needs it
NPCInfo->aiFlags &= ~NPCAI_LOST;
/*
if ( showWaypoints )
{
Q3_DebugPrint(WL_WARNING, "%s can't navigate to target %s (my wp: %d, goal wp: %d)\n", NPC->targetname, NPCInfo->goalEntity->targetname, NPC->waypoint, NPCInfo->goalEntity->waypoint );
}
*/
if ( NPCInfo->goalEntity && NPCInfo->goalEntity == NPC->enemy )
{//We can't nav to our enemy
//Drop enemy and see if we should search for him
NPC_LostEnemyDecideChase();
}
}
if ( NPCInfo->aiFlags & NPCAI_AWAITING_COMM )
{
if(NPCInfo->commWaitTime < level.time)
{
//FIXME: we shouldn't assume team_leader, we should remember who sent this hail!
NPC_SetSayState(NPC, NPC->client->team_leader, Q_irand(SAY_BADHAIL1, SAY_BADHAIL4));
NPCInfo->aiFlags &= ~NPCAI_AWAITING_COMM;
}
}
/*
NPCInfo->canShove = qfalse;
//flag never gets set in current nav implementation
if (NPCInfo->aiFlags & NPCAI_BLOCKED)
{
NPCInfo->consecutiveBlockedMoves++;
NPCInfo->blockedDebounceTime = level.time + 1000;//Remember you were blocked for a whole second
//If totally blocked, should we see if we can jump the obstacle?
if(NPCInfo->blockingEntNum == ENTITYNUM_WORLD)//WORLD
{//Can't go anywhere
G_ActivateBehavior( NPC, BSET_STUCK);
//If you're in formation, what do we do here?
}
else
{
gentity_t *blocker = &g_entities[NPCInfo->blockingEntNum];
if( NPCInfo->consecutiveBlockedMoves > 10 )
{//Okay, shove them out of the way!
if(NPCInfo->shoveCount > 3)
{//Already tried shoving 4 times, just stand here
NPCInfo->canShove = qfalse;
}
else
{
NPCInfo->canShove = qtrue;
}
}
if(blocker->client && blocker->client->playerTeam == NPC->client->playerTeam)
{//Should we ask it to get out of the way?
//FIXME: NPC_SetSayBState(NPC, blocker, Q_irand(SAY_MOVEIT1, SAY_MOVEIT4);// ?
if(NPCInfo->blockedSpeechDebounceTime < level.time)
{
if ( NPC->behaviorSet[BSET_BLOCKED] )
{
G_ActivateBehavior( NPC, BSET_BLOCKED);
}
else
{
G_AddVoiceEvent( NPC, Q_irand(EV_BLOCKED1, EV_BLOCKED3), 0 );
}
#ifdef _DEBUG
//gi.Printf( "%s: 'Hey, %s, move it!'\n", NPC->targetname, blocker->targetname );
#endif
//NPCInfo->blockedSpeechDebounceTime = level.time + 10000;//FIXME: make a define
//Ok, need to make it get out of the way...
}
}
else if((blocker->client || blocker->takedamage) && blocker->health > 0 && blocker->health < 200 )
{//Attack it!? Set enemy and temp behavior? Hmm...
//Careful, what if it's explosive?
G_SetEnemy( NPC, blocker );
if( NPCInfo->consecutiveBlockedMoves == 30 )
{//Blocked for three seconds straight
G_ActivateBehavior( NPC, BSET_BLOCKED);
}
}
}
}
else if(NPCInfo->blockedDebounceTime < level.time)
{//Only clear if haven't been blocked for a whole second
NPCInfo->consecutiveBlockedMoves = 0;
NPCInfo->shoveCount = 0;
}
if(NPCInfo->shoveDebounce < level.time)
{//We have shoved for 1 second at least
//.........这里部分代码省略.........
示例14: NPC_ChoosePainAnimation
//.........这里部分代码省略.........
pain_chance = 1.0f - ((RANK_CAPTAIN-self->NPC->rank)/(float)RANK_CAPTAIN);
}
else if ( self->client->NPC_class == CLASS_PROTOCOL )
{
pain_chance = 1.0f;
}
else
{
pain_chance = NPC_GetPainChance( self, damage );
}
if ( self->client->NPC_class == CLASS_DESANN )
{
pain_chance *= 0.5f;
}
}
//See if we're going to flinch
if ( random() < pain_chance )
{
int animLength;
//Pick and play our animation
if ( self->client->ps.fd.forceGripBeingGripped < level.time )
{ //not being force-gripped or force-drained
if ( /*G_CheckForStrongAttackMomentum( self ) //rwwFIXMEFIXME: Is this needed?
||*/ PM_SpinningAnim( self->client->ps.legsAnim )
|| BG_SaberInSpecialAttack( self->client->ps.torsoAnim )
|| PM_InKnockDown( &self->client->ps )
|| PM_RollingAnim( self->client->ps.legsAnim )
|| (BG_FlippingAnim( self->client->ps.legsAnim )&&!PM_InCartwheel( self->client->ps.legsAnim )) )
{ //strong attacks, rolls, knockdowns, flips and spins cannot be interrupted by pain
}
else
{ //play an anim
int parts;
if ( self->client->NPC_class == CLASS_GALAKMECH )
{ //only has 1 for now
//FIXME: never plays this, it seems...
pain_anim = BOTH_PAIN1;
}
else if ( mod == MOD_MELEE )
{
pain_anim = BG_PickAnim( self->localAnimIndex, BOTH_PAIN2, BOTH_PAIN3 );
}
else if ( self->s.weapon == WP_SABER )
{ //temp HACK: these are the only 2 pain anims that look good when holding a saber
pain_anim = BG_PickAnim( self->localAnimIndex, BOTH_PAIN2, BOTH_PAIN3 );
}
/*
else if ( mod != MOD_ELECTROCUTE )
{
pain_anim = G_PickPainAnim( self, point, damage, hitLoc );
}
*/
if ( pain_anim == -1 )
{
pain_anim = BG_PickAnim( self->localAnimIndex, BOTH_PAIN1, BOTH_PAIN18 );
}
self->client->ps.fd.saberAnimLevel = FORCE_LEVEL_1;//next attack must be a quick attack
self->client->ps.saberMove = LS_READY;//don't finish whatever saber move you may have been in
parts = SETANIM_BOTH;
if ( BG_CrouchAnim( self->client->ps.legsAnim ) || PM_InCartwheel( self->client->ps.legsAnim ) )
{
parts = SETANIM_LEGS;
}
if (pain_anim != -1)
{
NPC_SetAnim( self, parts, pain_anim, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
}
}
if ( voiceEvent != -1 )
{
G_AddVoiceEvent( self, voiceEvent, Q_irand( 2000, 4000 ) );
}
else
{
NPC_SetPainEvent( self );
}
}
else
{
G_AddVoiceEvent( self, Q_irand(EV_CHOKE1, EV_CHOKE3), 0 );
}
//Setup the timing for it
/*
if ( mod == MOD_ELECTROCUTE )
{
self->painDebounceTime = level.time + 4000;
}
*/
animLength = bgAllAnims[self->localAnimIndex].anims[pain_anim].numFrames * fabs((float)(bgHumanoidAnimations[pain_anim].frameLerp));
self->painDebounceTime = level.time + animLength;
self->client->ps.weaponTime = 0;
}
}
示例15: NPC_HandleAIFlags
void NPC_HandleAIFlags (void)
{
//FIXME: make these flags checks a function call like NPC_CheckAIFlagsAndTimers
if ( NPCInfo->aiFlags & NPCAI_LOST )
{//Print that you need help!
//FIXME: shouldn't remove this just yet if cg_draw needs it
NPCInfo->aiFlags &= ~NPCAI_LOST;
/*
if ( showWaypoints )
{
Q3_DebugPrint(WL_WARNING, "%s can't navigate to target %s (my wp: %d, goal wp: %d)\n", NPC->targetname, NPCInfo->goalEntity->targetname, NPC->waypoint, NPCInfo->goalEntity->waypoint );
}
*/
if ( NPCInfo->goalEntity && NPCInfo->goalEntity == NPC->enemy )
{//We can't nav to our enemy
//Drop enemy and see if we should search for him
NPC_LostEnemyDecideChase();
}
}
//MRJ Request:
/*
if ( NPCInfo->aiFlags & NPCAI_GREET_ALLIES && !NPC->enemy )//what if "enemy" is the greetEnt?
{//If no enemy, look for teammates to greet
//FIXME: don't say hi to the same guy over and over again.
if ( NPCInfo->greetingDebounceTime < level.time )
{//Has been at least 2 seconds since we greeted last
if ( !NPCInfo->greetEnt )
{//Find a teammate whom I'm facing and who is facing me and within 128
NPCInfo->greetEnt = NPC_PickAlly( qtrue, 128, qtrue, qtrue );
}
if ( NPCInfo->greetEnt && !Q_irand(0, 5) )
{//Start greeting someone
qboolean greeted = qfalse;
//TODO: If have a greetscript, run that instead?
//FIXME: make them greet back?
if( !Q_irand( 0, 2 ) )
{//Play gesture anim (press gesture button?)
greeted = qtrue;
NPC_SetAnim( NPC, SETANIM_TORSO, Q_irand( BOTH_GESTURE1, BOTH_GESTURE3 ), SETANIM_FLAG_NORMAL|SETANIM_FLAG_HOLD );
//NOTE: play full-body gesture if not moving?
}
if( !Q_irand( 0, 2 ) )
{//Play random voice greeting sound
greeted = qtrue;
//FIXME: need NPC sound sets
//G_AddVoiceEvent( NPC, Q_irand(EV_GREET1, EV_GREET3), 2000 );
}
if( !Q_irand( 0, 1 ) )
{//set looktarget to them for a second or two
greeted = qtrue;
NPC_TempLookTarget( NPC, NPCInfo->greetEnt->s.number, 1000, 3000 );
}
if ( greeted )
{//Did at least one of the things above
//Don't greet again for 2 - 4 seconds
NPCInfo->greetingDebounceTime = level.time + Q_irand( 2000, 4000 );
NPCInfo->greetEnt = NULL;
}
}
}
}
*/
//been told to play a victory sound after a delay
if ( NPCInfo->greetingDebounceTime && NPCInfo->greetingDebounceTime < level.time )
{
G_AddVoiceEvent( NPC, Q_irand(EV_VICTORY1, EV_VICTORY3), Q_irand( 2000, 4000 ) );
NPCInfo->greetingDebounceTime = 0;
}
if ( NPCInfo->ffireCount > 0 )
{
if ( NPCInfo->ffireFadeDebounce < level.time )
{
NPCInfo->ffireCount--;
//Com_Printf( "drop: %d < %d\n", NPCInfo->ffireCount, 3+((2-g_spSkill.integer)*2) );
NPCInfo->ffireFadeDebounce = level.time + 3000;
}
}
if ( d_patched.integer )
{//use patch-style navigation
if ( NPCInfo->consecutiveBlockedMoves > 20 )
{//been stuck for a while, try again?
NPCInfo->consecutiveBlockedMoves = 0;
}
}
}