コード例 #1
0
ファイル: g_cmds.cpp プロジェクト: archSeer/OpenJK
void G_TauntSound( gentity_t *ent, int taunt )
{
	switch ( taunt )
	{
	case TAUNT_TAUNT:
	default:
		if ( Q_irand( 0, 1 ) )
		{
			G_SpeechEvent( ent, Q_irand( EV_ANGER1, EV_ANGER3 ) );
		}
		else
		{
			G_SpeechEvent( ent, Q_irand( EV_TAUNT1, EV_TAUNT3 ) );
		}
		break;
	case TAUNT_BOW:
		break;
	case TAUNT_MEDITATE:
		break;
	case TAUNT_FLOURISH:
		if ( Q_irand( 0, 1 ) )
		{
			G_SpeechEvent( ent, Q_irand( EV_DEFLECT1, EV_DEFLECT3 ) );
		}
		else
		{
			G_SpeechEvent( ent, Q_irand( EV_GLOAT1, EV_GLOAT3 ) );
		}
		break;
	case TAUNT_GLOAT:
		G_SpeechEvent( ent, Q_irand( EV_VICTORY1, EV_VICTORY3 ) );
		break;
	}
}
コード例 #2
0
ファイル: NPC_sounds.cpp プロジェクト: Arbixal/OpenJK
void G_AddVoiceEvent( gentity_t *self, int event, int speakDebounceTime )
{
	if ( !self->NPC )
	{
		return;
	}

	if ( !self->client || self->client->ps.pm_type >= PM_DEAD )
	{
		return;
	}

	if ( self->NPC->blockedSpeechDebounceTime > level.time )
	{
		return;
	}

	if ( Q3_TaskIDPending( self, TID_CHAN_VOICE ) )
	{
		return;
	}

	if ( self->client && self->client->NPC_class == CLASS_SABOTEUR )
	{
		if ( self->client->ps.powerups[PW_CLOAKED]
			|| self->client->ps.powerups[PW_UNCLOAKING] > level.time )
		{//I'm cloaked (or still decloaking), so don't talk and give away my position...
			//don't make any combat voice noises, but still make pain and death sounds
			if ( (event >= EV_ANGER1 && event <= EV_VICTORY3) 
				|| (event >= EV_CHASE1 && event <= EV_SUSPICIOUS5) )
			{
				return;
			}
			
			if ( event >= EV_GIVEUP1 && event <= EV_SUSPICIOUS5 )
			{
				return;
			}
		}
	}	

	if ( (self->NPC->scriptFlags&SCF_NO_COMBAT_TALK) && ( (event >= EV_ANGER1 && event <= EV_VICTORY3) || (event >= EV_CHASE1 && event <= EV_SUSPICIOUS5) ) )//(event < EV_FF_1A || event > EV_FF_3C) && (event < EV_RESPOND1 || event > EV_MISSION3) )
	{
		return;
	}
	
	if ( (self->NPC->scriptFlags&SCF_NO_ALERT_TALK) && (event >= EV_GIVEUP1 && event <= EV_SUSPICIOUS5) )
	{
		return;
	}
	//FIXME: Also needs to check for teammates. Don't want
	//		everyone babbling at once

	//NOTE: was losing too many speech events, so we do it directly now, screw networking!
	//G_AddEvent( self, event, 0 );
	G_SpeechEvent( self, event );

	//won't speak again for 5 seconds (unless otherwise specified)
	self->NPC->blockedSpeechDebounceTime = level.time + ((speakDebounceTime==0) ? 5000 : speakDebounceTime);
}
コード例 #3
0
ファイル: NPC_sounds.c プロジェクト: ForcePush/OJPRPFZ
//RACC - NPC version of G_AddEvent for sound useage.  
//seems to do some checking to prevent event spamming
void G_AddVoiceEvent( gentity_t *self, int event, int speakDebounceTime )
{
	if ( !self->NPC )
	{
		return;
	}

	if ( !self->client || self->client->ps.pm_type >= PM_DEAD )
	{
		return;
	}

	if ( self->NPC->blockedSpeechDebounceTime > level.time )
	{
		return;
	}

	if ( trap_ICARUS_TaskIDPending( self, TID_CHAN_VOICE ) )
	{
		return;
	}

	
	if ( (self->NPC->scriptFlags&SCF_NO_COMBAT_TALK) && ( (event >= EV_ANGER1 && event <= EV_VICTORY3) || (event >= EV_CHASE1 && event <= EV_SUSPICIOUS5) ) )//(event < EV_FF_1A || event > EV_FF_3C) && (event < EV_RESPOND1 || event > EV_MISSION3) )
	{
		return;
	}
	
	if ( (self->NPC->scriptFlags&SCF_NO_ALERT_TALK) && (event >= EV_GIVEUP1 && event <= EV_SUSPICIOUS5) )
	{
		return;
	}
	//FIXME: Also needs to check for teammates. Don't want
	//		everyone babbling at once

	//NOTE: was losing too many speech events, so we do it directly now, screw networking!
	//G_AddEvent( self, event, 0 );
	G_SpeechEvent( self, event );

	//won't speak again for 5 seconds (unless otherwise specified)
	self->NPC->blockedSpeechDebounceTime = level.time + ((speakDebounceTime==0) ? 5000 : speakDebounceTime);
}