Exemple #1
0
 void
 GunnerGrenade(edict_t *self)
 {
  vec3_t start;
  vec3_t forward, right;
  vec3_t aim;
  q_int32_t flash_number;

  if (!self)
  {
   return;
  }

  if (self->s.frame == FRAME_attak105)
  {
   flash_number = MZ2_GUNNER_GRENADE_1;
  }
  else if (self->s.frame == FRAME_attak108)
  {
   flash_number = MZ2_GUNNER_GRENADE_2;
  }
  else if (self->s.frame == FRAME_attak111)
  {
   flash_number = MZ2_GUNNER_GRENADE_3;
  }
  else
  {
   flash_number = MZ2_GUNNER_GRENADE_4;
  }

  AngleVectors(self->s.angles, forward, right, NULL);
  G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
    forward, right, start);

  VectorCopy(forward, aim);

  monster_fire_grenade(self, start, aim, 50, 600, flash_number);
 }
Exemple #2
0
void myGunnerGrenade (edict_t *self)
{
	int		damage, speed, flash_number;
	vec3_t	forward, start;

	// sanity check
	if (!self->enemy || !self->enemy->inuse)
		return;

	damage = 50 + 10*self->monsterinfo.level;
	speed = 600 + 30*self->monsterinfo.level;

	if (speed > 900)
		speed = 900;

	if (self->s.frame == FRAME_attak105)
		flash_number = MZ2_GUNNER_GRENADE_1;
	else
		flash_number = MZ2_GUNNER_GRENADE_4;

	MonsterAim(self, 0.8, speed, false, flash_number, forward, start);
	monster_fire_grenade(self, start, forward, damage, speed, flash_number);
}
Exemple #3
0
void GunnerGrenade (edict_t *self)
{
	vec3_t	start;
	vec3_t	forward, right;
	vec3_t	aim;
	int		flash_number;

	if (self->s.frame == FRAME_attak105)
		flash_number = MZ2_GUNNER_GRENADE_1;
	else if (self->s.frame == FRAME_attak108)
		flash_number = MZ2_GUNNER_GRENADE_2;
	else if (self->s.frame == FRAME_attak111)
		flash_number = MZ2_GUNNER_GRENADE_3;
	else // (self->s.frame == FRAME_attak114)
		flash_number = MZ2_GUNNER_GRENADE_4;

	AngleVectors (self->s.angles, forward, right, NULL);
	G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);

	//FIXME : do a spread -225 -75 75 225 degrees around forward
	VectorCopy (forward, aim);

	monster_fire_grenade (self, start, aim, 50, 600, flash_number);
}
Exemple #4
0
void
CarrierGrenade(edict_t *self)
{
	vec3_t start;
	vec3_t forward, right, up;
	vec3_t aim;
	int flash_number;
	float direction; /* from lower left to upper right, or lower right to upper left */
	float spreadR, spreadU;
	int mytime;

	if (!self)
	{
		return;
	}

	CarrierCoopCheck(self);

	if (!self->enemy)
	{
		return;
	}

	if (random() < 0.5)
	{
		direction = -1.0;
	}
	else
	{
		direction = 1.0;
	}

	mytime = (int)((level.time - self->timestamp) / 0.4);

	if (mytime == 0)
	{
		spreadR = 0.15 * direction;
		spreadU = 0.1 - 0.1 * direction;
	}
	else if (mytime == 1)
	{
		spreadR = 0;
		spreadU = 0.1;
	}
	else if (mytime == 2)
	{
		spreadR = -0.15 * direction;
		spreadU = 0.1 - -0.1 * direction;
	}
	else if (mytime == 3)
	{
		spreadR = 0;
		spreadU = 0.1;
	}
	else
	{
		/* error, shoot straight */
		spreadR = 0;
		spreadU = 0;
	}

	AngleVectors(self->s.angles, forward, right, up);
	G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_CARRIER_GRENADE],
			forward, right, start);

	VectorSubtract(self->enemy->s.origin, start, aim);
	VectorNormalize(aim);

	VectorMA(aim, spreadR, right, aim);
	VectorMA(aim, spreadU, up, aim);

	if (aim[2] > 0.15)
	{
		aim[2] = 0.15;
	}
	else if (aim[2] < -0.5)
	{
		aim[2] = -0.5;
	}

	flash_number = MZ2_GUNNER_GRENADE_1;
	monster_fire_grenade(self, start, aim, 50, 600, flash_number);
}
Exemple #5
0
void GunnerGrenade (edict_t *self)
{
	vec3_t	start,target;
	vec3_t	forward, right, up;
	vec3_t	aim;
	vec_t	monster_speed;
	int		flash_number;

	if(!self->enemy || !self->enemy->inuse)
		return;

	if (self->s.frame == FRAME_attak105)
		flash_number = MZ2_GUNNER_GRENADE_1;
	else if (self->s.frame == FRAME_attak108)
	{
		if(skill->value == 0)
			return;
		flash_number = MZ2_GUNNER_GRENADE_2;
	}
	else if (self->s.frame == FRAME_attak111)
		flash_number = MZ2_GUNNER_GRENADE_3;
	else // (self->s.frame == FRAME_attak114)
	{
		if(skill->value < 2)
			return;
		flash_number = MZ2_GUNNER_GRENADE_4;
	}

	AngleVectors (self->s.angles, forward, right, up);
	G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);

	// Lazarus - Improved gunner's grenade-aiming ability quite a bit

//	VectorCopy (forward, aim);

	// aim at enemy's feet if he's at same elevation or lower. otherwise aim at origin
	VectorCopy(self->enemy->s.origin,target);
	if(self->enemy->absmin[2] <= self->absmax[2]) target[2] = self->enemy->absmin[2];

	// Lazarus fog reduction of accuracy
	if(self->monsterinfo.visibility < FOG_CANSEEGOOD)
	{
		target[0] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility);
		target[1] += crandom() * 640 * (FOG_CANSEEGOOD - self->monsterinfo.visibility);
		target[2] += crandom() * 320 * (FOG_CANSEEGOOD - self->monsterinfo.visibility);
	}
	// Lazarus - skill level-dependent accuracy
/*	if(skill->value < 2)
	{
		float	dist;

		VectorSubtract(target, start, aim);
		dist = VectorLength (aim);
		dist = min(dist,512);

		target[0] += crandom() * dist/8 * (2 - skill->value);
		target[1] += crandom() * dist/8 * (2 - skill->value);
	} */

	// lead target... 20, 35, 50, 65 chance of leading
	if( random() < (0.2 + skill->value * 0.15) )
	{
		float	dist;
		float	time;

		VectorSubtract(target, start, aim);
		dist = VectorLength (aim);
		time = dist/GRENADE_VELOCITY;  // Not correct, but better than nothin'
		VectorMA(target, time, self->enemy->velocity, target);
	}

	AimGrenade (self, start, target, GRENADE_VELOCITY, aim);
	// Lazarus - take into account (sort of) feature of adding shooter's velocity to
	// grenade velocity
	monster_speed = VectorLength(self->velocity);
	if(monster_speed > 0) {
		vec3_t	v1;
		vec_t	delta;

		VectorCopy(self->velocity,v1);
		VectorNormalize(v1);
		delta = -monster_speed/GRENADE_VELOCITY;
		VectorMA(aim,delta,v1,aim);
		VectorNormalize(aim);
	}

	monster_fire_grenade (self, start, aim, 50, GRENADE_VELOCITY, flash_number);
}
Exemple #6
0
void
GunnerGrenade(edict_t *self)
{
	vec3_t start;
	vec3_t forward, right, up;
	vec3_t aim;
	int flash_number;
	float spread;
	float pitch = 0;
	vec3_t target;
	qboolean blindfire = false;

	if (!self)
	{
		return;
	}

	if (!self->enemy || !self->enemy->inuse)
	{
		return;
	}

	if (self->monsterinfo.aiflags & AI_MANUAL_STEERING)
	{
		blindfire = true;
	}

	if (self->s.frame == FRAME_attak105)
	{
		spread = .02;
		flash_number = MZ2_GUNNER_GRENADE_1;
	}
	else if (self->s.frame == FRAME_attak108)
	{
		spread = .05;
		flash_number = MZ2_GUNNER_GRENADE_2;
	}
	else if (self->s.frame == FRAME_attak111)
	{
		spread = .08;
		flash_number = MZ2_GUNNER_GRENADE_3;
	}
	else
	{
		self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING;
		spread = .11;
		flash_number = MZ2_GUNNER_GRENADE_4;
	}

	/* if we're shooting blind and we still can't see our enemy */
	if ((blindfire) && (!visible(self, self->enemy)))
	{
		/* and we have a valid blind_fire_target */
		if (VectorCompare(self->monsterinfo.blind_fire_target, vec3_origin))
		{
			return;
		}

		VectorCopy(self->monsterinfo.blind_fire_target, target);
	}
	else
	{
		VectorCopy(self->s.origin, target);
	}

	AngleVectors(self->s.angles, forward, right, up);
	G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
			forward, right, start);

	if (self->enemy)
	{
		float dist;

		VectorSubtract(target, self->s.origin, aim);
		dist = VectorLength(aim);

		/* aim up if they're on the same level as me and far away. */
		if ((dist > 512) && (aim[2] < 64) && (aim[2] > -64))
		{
			aim[2] += (dist - 512);
		}

		VectorNormalize(aim);
		pitch = aim[2];

		if (pitch > 0.4)
		{
			pitch = 0.4;
		}
		else if (pitch < -0.5)
		{
			pitch = -0.5;
		}
	}

	VectorMA(forward, spread, right, aim);
	VectorMA(aim, pitch, up, aim);

	monster_fire_grenade(self, start, aim, 50, 600, flash_number);
}