Exemple #1
0
/*
-------------------------
Sentry_Hunt
-------------------------
*/
void Sentry_Hunt( qboolean visible, qboolean advance ) {
    float	distance, speed;
    vector3	forward;

    //If we're not supposed to stand still, pursue the player
    if ( NPCInfo->standTime < level.time ) {
        // Only strafe when we can see the player
        if ( visible ) {
            Sentry_Strafe();
            return;
        }
    }

    //If we don't want to advance, stop here
    if ( !advance && visible )
        return;

    //Only try and navigate if the player is visible
    if ( visible == qfalse ) {
        // Move towards our goal
        NPCInfo->goalEntity = NPC->enemy;
        NPCInfo->goalRadius = 12;

        //Get our direction from the navigator if we can't see our target
        if ( NPC_GetMoveDirection( &forward, &distance ) == qfalse )
            return;
    }
    else {
        VectorSubtract( &NPC->enemy->r.currentOrigin, &NPC->r.currentOrigin, &forward );
        VectorNormalize( &forward );
    }

    speed = SENTRY_FORWARD_BASE_SPEED + SENTRY_FORWARD_MULTIPLIER * g_spSkill.integer;
    VectorMA( &NPC->client->ps.velocity, speed, &forward, &NPC->client->ps.velocity );
}
Exemple #2
0
/*
-------------------------
Sentry_Hunt
-------------------------
*/
void Sentry_Hunt( qboolean visible, qboolean advance )
{
	float	speed;
	vec3_t	forward;

	//If we're not supposed to stand still, pursue the player
	if ( NPCInfo->standTime < level.time )
	{
		// Only strafe when we can see the player
		if ( visible )
		{
			Sentry_Strafe();
			return;
		}
	}

	//If we don't want to advance, stop here
	if ( !advance && visible )
		return;

	//Only try and navigate if the player is visible
	if ( visible == qfalse )
	{
		// Move towards our goal
		NPCInfo->goalEntity = NPC->enemy;
		NPCInfo->goalRadius = 12;

		NPC_MoveToGoal(qtrue);
		return;
	}
	else
	{
		VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward );
		/*distance = */VectorNormalize( forward );
	}

	speed = SENTRY_FORWARD_BASE_SPEED + SENTRY_FORWARD_MULTIPLIER * g_spskill->integer;
	VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity );
}