Ejemplo n.º 1
0
void weapon_grenade_fire (edict_t *ent, qboolean held)
{
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	int		damage = 125;
	float	timer;
	int		speed;
	float	radius;

	radius = damage+40;
	if (is_quad)
		damage *= 4;

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = ent->client->grenade_time - level.time;
	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);

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

	ent->client->grenade_time = level.time + 1.0;

	// play quad damage sound
	playQuadSound(ent);
}
Ejemplo n.º 2
0
Archivo: p_weapon.c Proyecto: qbism/tmg
void weapon_grenade_fire (edict_t *ent, qboolean held)
{
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	int		damage = (int)g_damage->value;
	float	timer;
	int		speed;
	float	radius;

	radius = damage+40;
	if (is_quad)
		damage *= 4;

//DB
  if (is_strength)
		damage *= 2;
//DB

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = ent->client->grenade_time - level.time;
	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
//RAV
	//allow for camper checking
	ent->client->check_camping = true;
//
	if (! ( dmflag & DF_INFINITE_AMMO ) )
		ent->client->pers.inventory[ent->client->ammo_index]--;

	ent->client->grenade_time = level.time + 1.0;
}
Ejemplo n.º 3
0
void Cmd_Bandage_f(edict_t * ent)
{

    if ((ent->client->bleeding != 0 || ent->client->leg_damage != 0)
            && ent->client->bandaging != 1)
        ent->client->reload_attempts = 0;	// prevent any further reloading

    if ((ent->client->weaponstate == WEAPON_READY || ent->client->weaponstate == WEAPON_END_MAG)
            && (ent->client->bleeding != 0 || ent->client->leg_damage != 0)
            && ent->client->bandaging != 1) {

        // zucc - check if they have a primed grenade

        if (ent->client->curr_weap == GRENADE_NUM
                && ((ent->client->ps.gunframe >= GRENADE_IDLE_FIRST
                     && ent->client->ps.gunframe <= GRENADE_IDLE_LAST)
                    || (ent->client->ps.gunframe >= GRENADE_THROW_FIRST
                        && ent->client->ps.gunframe <= GRENADE_THROW_LAST)))
        {
            int damage;

            ent->client->ps.gunframe = 0;

            if (use_classic->value)
                damage = 170;
            else
                damage = GRENADE_DAMRAD;

            if(ent->client->quad_framenum > level.framenum)
                damage *= 1.5f;

            fire_grenade2(ent, ent->s.origin, vec3_origin, damage, 0, 2, damage * 2, false);

            INV_AMMO(ent, GRENADE_NUM)--;
            if (INV_AMMO(ent, GRENADE_NUM) <= 0) {
                ent->client->newweapon = GET_ITEM(MK23_NUM);
            }
        }

        ent->client->bandaging = 1;
        ent->client->resp.sniper_mode = SNIPER_1X;
        ent->client->ps.fov = 90;
        ent->client->desired_fov = 90;
        if (ent->client->pers.weapon)
            ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
        gi.cprintf(ent, PRINT_HIGH, "You've started bandaging\n");

    } else if (ent->client->bandaging == 1)
        gi.cprintf(ent, PRINT_HIGH, "Already bandaging\n");
    //FIREBLADE 12/26/98 - fix inappropriate message
    else if (ent->client->bleeding == 0 && ent->client->leg_damage == 0)
        gi.cprintf(ent, PRINT_HIGH, "No need to bandage\n");
    else
        gi.cprintf(ent, PRINT_HIGH, "Can't bandage now\n");
    //FIREBLADE
}
Ejemplo n.º 4
0
void weapon_grenade_fire (edict_t *ent, qboolean held)
{
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	int		damage = 125;
	float	timer;
	int		speed;
	float	radius;

	radius = damage+40;

	if (is_quad)
	{
		//r1: prevent quad on someone making grenades into quad grenades on death explode
		if (is_quad == ent || g_bugs->value >= 1)
			damage *= 4;
	}

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = (ent->client->grenade_framenum - level.framenum) * FRAMETIME;
	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
	TDM_WeaponFired (ent);

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

	ent->client->grenade_framenum = level.framenum + SECS_TO_FRAMES(1);

	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
	{
		return;
	}

	if (ent->health <= 0)
		return;

	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		ent->client->anim_priority = ANIM_ATTACK;
		ent->s.frame = FRAME_crattak1-1;
		ent->client->anim_end = FRAME_crattak3;
	}
	else
	{
		ent->client->anim_priority = ANIM_REVERSE;
		ent->s.frame = FRAME_wave08;
		ent->client->anim_end = FRAME_wave01;
	}
}
Ejemplo n.º 5
0
void weapon_grenade_fire (edict_t *ent, qboolean held)
{
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	//WF
//	int		damage = 125;
	int		damage = grenade_damage->value;
	//WF
	float	timer;
	int		speed;
	float	radius;

	//WF
//	radius = damage+40;
	radius = grenade_damage->value;
	//WF
	if (is_quad)
		damage *= 4;

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = ent->client->grenade_time - level.time;
	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);

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

	ent->client->grenade_time = level.time + 1.0;

	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
	{
		return;
	}

	if (ent->health <= 0)
		return;

	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		ent->client->anim_priority = ANIM_ATTACK;
		ent->s.frame = FRAME_crattak1-1;
		ent->client->anim_end = FRAME_crattak3;
	}
	else
	{
		ent->client->anim_priority = ANIM_REVERSE;
		ent->s.frame = FRAME_wave08;
		ent->client->anim_end = FRAME_wave01;
	}
}
Ejemplo n.º 6
0
void weapon_grenade_fire (edict_t *ent, qboolean held) {
	vec3_t	offset;
	vec3_t	forward, right;
	vec3_t	start;
	int		damage = 125;
	float	timer;
	int		speed;
	float	radius;
	iteminfo_t *info = getWornItemInfo(ent, 0);

	damage = info->arg1 + info->arg2 * ent->client->pers.skill[1];
	radius = info->arg6 + info->arg7 * ent->client->pers.skill[1];
	damage = applyWeaponBonuses(ent, damage, 1);

	VectorSet(offset, 8, 8, ent->viewheight-8);
	AngleVectors (ent->client->v_angle, forward, right, NULL);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

	timer = ent->client->grenade_time - level.time;
	speed = GRENADE_MINSPEED + ((GRENADE_TIMER + info->arg10) - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
	speed *= info->arg8 + info->arg9 * ent->client->pers.skill[8];
	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);

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

	ent->client->grenade_time = level.time + 1.0;

	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
	{
		return;
	}

	if (ent->health <= 0)
		return;

	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) {
		ent->client->anim_priority = ANIM_ATTACK;
		ent->s.frame = FRAME_crattak1-1;
		ent->client->anim_end = FRAME_crattak3;
	} else {
		ent->client->anim_priority = ANIM_REVERSE;
		ent->s.frame = FRAME_wave08;
		ent->client->anim_end = FRAME_wave01;
	}
}