コード例 #1
0
ファイル: weapon.c プロジェクト: yquake2/zaero
void Weapon_HyperBlaster_Fire (edict_t *ent)
{
	float	rotation;
	vec3_t	offset;
	int		effect;
	int		damage;

	ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav");

	if (!(ent->client->buttons & BUTTON_ATTACK))
	{
		ent->client->ps.gunframe++;
	}
	else
	{
		if (! ent->client->pers.inventory[ent->client->ammo_index] )
		{
			if (level.time >= ent->pain_debounce_time)
			{
				gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
				ent->pain_debounce_time = level.time + 1;
			}
			NoAmmoWeaponChange (ent);
		}
		else
		{
			rotation = (ent->client->ps.gunframe - 5) * 2*M_PI/6;
			offset[0] = -4 * sin(rotation);
			offset[1] = 0;
			offset[2] = 4 * cos(rotation);

			if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9))
				effect = EF_HYPERBLASTER;
			else
				effect = 0;
			if (deathmatch->value)
				damage = 15;
			else
				damage = 20;
			if(Blaster_Fire (ent, offset, damage, true, effect))
				if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
					ent->client->pers.inventory[ent->client->ammo_index]--;

			// play quad damage sound
			playQuadSound(ent);
		}

		ent->client->ps.gunframe++;
		if (ent->client->ps.gunframe == 12 && ent->client->pers.inventory[ent->client->ammo_index])
			ent->client->ps.gunframe = 6;
	}

	if (ent->client->ps.gunframe == 12)
	{
		gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
		ent->client->weapon_sound = 0;
	}

}
コード例 #2
0
ファイル: p_weapon.c プロジェクト: ZwS/qudos
void Weapon_Blaster_Fire (edict_t *ent)
{
	int		damage;

	if (deathmatch->value)
		damage = 15;
	else
		damage = 10;
	Blaster_Fire (ent, vec3_origin, damage, false, EF_BLASTER);
	ent->client->ps.gunframe++;
}
コード例 #3
0
ファイル: p_weapon.c プロジェクト: AndreyNazarov/opentdm
void Weapon_Blaster_Fire (edict_t *ent)
{
	int		damage;

	damage = 15;

	Blaster_Fire (ent, vec3_origin, damage, false, EF_BLASTER);
	TDM_WeaponFired (ent);

	ent->client->ps.gunframe++;
}
コード例 #4
0
ファイル: p_weapon.c プロジェクト: Chromozon/Quake2_Giex-G10
void Weapon_Blaster_Fire (edict_t *ent) {
	int index;
	int item = getWornItem(ent, GIEX_ITEM_WEAPON);
	iteminfo_t *info = getWornItemInfo(ent, 0);
	int c = getBlasterConsumption(ent, item, info);

	ent->client->ps.gunframe++;

	index = ITEM_INDEX(FindItem("Blaster cells"));
	if (ent->client->pers.inventory[index] >= c) {
		ent->client->pers.inventory[index] -= c;
	} else {
		return;
	}

	Blaster_Fire (ent, vec3_origin, getBlasterDamage(ent, item, info), getBlasterSpeed(ent, item, info), false, EF_BLASTER);
}
コード例 #5
0
ファイル: p_weapon.c プロジェクト: AndreyNazarov/opentdm
void Weapon_HyperBlaster_Fire (edict_t *ent)
{
	float	rotation;
	vec3_t	offset;
	int		effect;
	int		damage;

	ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav");

	if (!(ent->client->buttons & BUTTON_ATTACK))
	{
		ent->client->ps.gunframe++;
	}
	else
	{
		if (! ent->client->inventory[ent->client->ammo_index] )
		{
			if (level.framenum >= ent->pain_debounce_framenum)
			{
				gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
				ent->pain_debounce_framenum = level.framenum + SECS_TO_FRAMES(1);
			}
			NoAmmoWeaponChange (ent);
		}
		else
		{
			rotation = (ent->client->ps.gunframe - 5) * 2*M_PI/6;
			offset[0] = -4 * sin(rotation);
			offset[1] = 0;
			offset[2] = 4 * cos(rotation);

			if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9))
				effect = EF_HYPERBLASTER;
			else
				effect = 0;

			damage = 15;

			Blaster_Fire (ent, offset, damage, true, effect);
			TDM_WeaponFired (ent);

			if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
				ent->client->inventory[ent->client->ammo_index]--;

			ent->client->anim_priority = ANIM_ATTACK;
			if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
			{
				ent->s.frame = FRAME_crattak1 - 1;
				ent->client->anim_end = FRAME_crattak9;
			}
			else
			{
				ent->s.frame = FRAME_attack1 - 1;
				ent->client->anim_end = FRAME_attack8;
			}
		}

		ent->client->ps.gunframe++;
		if (ent->client->ps.gunframe == 12 && ent->client->inventory[ent->client->ammo_index])
			ent->client->ps.gunframe = 6;
	}

	if (ent->client->ps.gunframe == 12)
	{
		gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
		ent->client->weapon_sound = 0;
	}

}
コード例 #6
0
ファイル: p_weapon.c プロジェクト: Chromozon/Quake2_Giex-G10
void Weapon_HyperBlaster_Fire (edict_t *ent) {
	float	rotation;
	vec3_t	offset;
	int		damage;
	iteminfo_t *info = getWornItemInfo(ent, 0);

	if ((ent->client->silencer_shots > 0) && (ent->client->pers.skill[58]> 6)) {
		ent->client->silencer_shots -= 5;
	} else {
		ent->client->weapon_sound = gi.soundindex("weapons/hyprbl1a.wav");
	}

	if (!(ent->client->buttons & BUTTON_ATTACK))
	{
		ent->client->ps.gunframe++;
	}
	else
	{
		if (! ent->client->pers.inventory[ent->client->ammo_index] )
		{
			if (level.time >= ent->pain_debounce_time)
			{
				gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
				ent->pain_debounce_time = level.time + 1;
			}
			NoAmmoWeaponChange (ent);
		} else if ((ent->client->ps.gunframe != 11) || (info->arg3 < 6)) {
			int amount = (int) ceil(info->arg8 + info->arg9 * ent->client->pers.skill[15]);
			rotation = (ent->client->ps.gunframe - 5) * 2*M_PI/6;
			offset[0] = -4 * sin(rotation);
			offset[1] = 0;
			offset[2] = 4 * cos(rotation);

			damage = info->arg1 + info->arg2 * ent->client->pers.skill[1];

			Blaster_Fire (ent, offset, damage, info->arg6 + info->arg7 * ent->client->pers.skill[7], true, 0);
			ent->client->pers.inventory[ent->client->ammo_index]--;

			ent->client->anim_priority = ANIM_ATTACK;
			if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
			{
				ent->s.frame = FRAME_crattak1 - 1;
				ent->client->anim_end = FRAME_crattak9;
			}
			else
			{
				ent->s.frame = FRAME_attack1 - 1;
				ent->client->anim_end = FRAME_attack8;
			}
		}

		ent->client->ps.gunframe++;
		if (ent->client->ps.gunframe == 12 && ent->client->pers.inventory[ent->client->ammo_index])
			ent->client->ps.gunframe = 6;
	}

	if (ent->client->ps.gunframe == 12)
	{
		gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
		ent->client->weapon_sound = 0;
	}

}
コード例 #7
0
ファイル: weapon.c プロジェクト: greck2908/qengine
void Weapon_HyperBlaster_Fire(edict_t *ent)
{
  float rotation;
  vec3_t offset;
  int effect;
  int damage;

  if (!ent) {
    return;
  }

  ent->client->weapon_sound = SV_SoundIndex("weapons/hyprbl1a.wav");

  if (!(ent->client->buttons & BUTTON_ATTACK)) {
    ent->client->ps.gunframe++;
  } else {
    if (!ent->client->pers.inventory[ent->client->ammo_index]) {
      if (level.time >= ent->pain_debounce_time) {
        PF_StartSound(ent, CHAN_VOICE, SV_SoundIndex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
        ent->pain_debounce_time = level.time + 1;
      }

      NoAmmoWeaponChange(ent);
    } else {
      rotation = (ent->client->ps.gunframe - 5) * 2 * M_PI / 6;
      offset[0] = -4 * sin(rotation);
      offset[1] = 0;
      offset[2] = 4 * cos(rotation);

      if ((ent->client->ps.gunframe == 6) || (ent->client->ps.gunframe == 9)) {
        effect = EF_HYPERBLASTER;
      } else {
        effect = 0;
      }

      if (deathmatch->value) {
        damage = 15;
      } else {
        damage = 20;
      }

      Blaster_Fire(ent, offset, damage, true, effect);

      if (!((int) dmflags->value & DF_INFINITE_AMMO)) {
        ent->client->pers.inventory[ent->client->ammo_index]--;
      }

      ent->client->anim_priority = ANIM_ATTACK;

      if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) {
        ent->s.frame = FRAME_crattak1 - 1;
        ent->client->anim_end = FRAME_crattak9;
      } else {
        ent->s.frame = FRAME_attack1 - 1;
        ent->client->anim_end = FRAME_attack8;
      }
    }

    ent->client->ps.gunframe++;

    if ((ent->client->ps.gunframe == 12) && ent->client->pers.inventory[ent->client->ammo_index]) {
      ent->client->ps.gunframe = 6;
    }
  }

  if (ent->client->ps.gunframe == 12) {
    PF_StartSound(ent, CHAN_AUTO, SV_SoundIndex("weapons/hyprbd1a.wav"), 1, ATTN_NORM, 0);
    ent->client->weapon_sound = 0;
  }
}