2003-10-24 21:43:32 +00:00
|
|
|
#include "common.qh"
|
2003-10-27 22:27:29 +00:00
|
|
|
#include "misc.qh"
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
#include "weapon.qh"
|
|
|
|
#include "damage.qh"
|
|
|
|
|
|
|
|
#include "effect.qh"
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_w_axe_deathmsg =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local float r;
|
|
|
|
local string att_nname, def_nname;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
r = random ();
|
|
|
|
|
|
|
|
def_nname = name (self);
|
|
|
|
att_nname = name (self.dmg_attacker);
|
|
|
|
|
|
|
|
if (r < 0.25)
|
|
|
|
bprint (PRINT_DEATH, def_nname, " gets chopped down to size by ",
|
|
|
|
att_nname, ".\n");
|
|
|
|
else if (r < 0.5)
|
|
|
|
bprint (PRINT_DEATH, att_nname, " mames ", def_nname,
|
|
|
|
" with a rusty axe.\n");
|
|
|
|
else if (r < 0.75)
|
|
|
|
bprint (PRINT_DEATH, def_nname, " loses his scalp to ", att_nname,
|
|
|
|
".\n");
|
|
|
|
else
|
|
|
|
bprint (PRINT_DEATH, att_nname, "'s axe penetrates ", def_nname,
|
|
|
|
" straight to the bone.\n");
|
2003-10-24 21:43:32 +00:00
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_w_axe_fire =
|
2003-10-24 21:43:32 +00:00
|
|
|
{
|
2004-02-08 07:34:17 +00:00
|
|
|
local vector source;
|
2003-10-24 21:43:32 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
source = shootorigin (self);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
makevectors (self.v_angle);
|
2004-02-08 07:34:17 +00:00
|
|
|
traceline (source, source + v_forward * 64, FALSE, self);
|
2003-10-24 21:43:32 +00:00
|
|
|
if (trace_fraction == 1.0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ghost_inflictor.classname = "AXE";
|
|
|
|
ghost_inflictor.dmg = 20;
|
|
|
|
ghost_inflictor.mass = ghost_inflictor.mass * 8;
|
2004-02-08 07:34:17 +00:00
|
|
|
ghost_inflictor.velocity = v_forward * 1000;
|
2003-10-24 21:43:32 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
damage_attack (ghost_inflictor);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
if (!damage (trace_ent, self, ghost_inflictor, ghost_inflictor.dmg,
|
|
|
|
_w_axe_deathmsg)) {
|
2003-10-24 21:43:32 +00:00
|
|
|
/* We hit the world. */
|
2004-02-08 07:34:17 +00:00
|
|
|
sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
|
|
|
|
effect_gun_spark (trace_endpos, v_forward * 250, 3);
|
2003-10-24 21:43:32 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_w_axe_think_1 =
|
|
|
|
{
|
|
|
|
self.weaponframe++;
|
2003-10-24 21:43:32 +00:00
|
|
|
if (self.weaponframe == 3)
|
|
|
|
_w_axe_fire();
|
|
|
|
if (self.weaponframe <= 1 || self.weaponframe > 4) {
|
|
|
|
self.weaponframe = 0;
|
|
|
|
self.w_think = NOTHING_function;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_w_axe_think_2 =
|
|
|
|
{
|
|
|
|
self.weaponframe++;
|
2003-10-24 21:43:32 +00:00
|
|
|
if (self.weaponframe == 7)
|
|
|
|
_w_axe_fire();
|
|
|
|
if (self.weaponframe <= 5 || self.weaponframe > 8) {
|
|
|
|
self.weaponframe = 0;
|
|
|
|
self.w_think = NOTHING_function;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* WEAPON 1 axe */
|
2004-02-08 07:34:17 +00:00
|
|
|
float (float action)
|
|
|
|
w_axe =
|
|
|
|
{
|
|
|
|
switch (action) {
|
|
|
|
case WEAPON_AMMO:
|
2003-10-24 21:43:32 +00:00
|
|
|
return 0;
|
2004-02-08 07:34:17 +00:00
|
|
|
case WEAPON_WEIGHT:
|
2003-10-24 21:43:32 +00:00
|
|
|
return 1;
|
2004-02-08 07:34:17 +00:00
|
|
|
case WEAPON_SELECTABLE:
|
2003-10-24 21:43:32 +00:00
|
|
|
return TRUE;
|
2004-02-08 07:34:17 +00:00
|
|
|
case WEAPON_FIRE:
|
2003-10-24 21:43:32 +00:00
|
|
|
self.attack_finished = time + 0.5;
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
if (random() < 0.5) {
|
|
|
|
self.weaponframe = 1;
|
|
|
|
self.w_think = _w_axe_think_1;
|
|
|
|
} else {
|
|
|
|
self.weaponframe = 5;
|
|
|
|
self.w_think = _w_axe_think_2;
|
|
|
|
}
|
|
|
|
self.w_thought = TRUE;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
self.mdl_func (MDL_FUNC_FIRE, 0);
|
|
|
|
break;
|
|
|
|
case WEAPON_SELECT:
|
2003-10-24 21:43:32 +00:00
|
|
|
self.weaponmodel = "progs/v_axe.mdl";
|
|
|
|
self.weaponframe = 0;
|
|
|
|
self.mdl_mod = (self.mdl_mod & ~MDL_MOD_WEP_MASK) | MDL_MOD_WEP_AXE;
|
2004-02-08 07:34:17 +00:00
|
|
|
weaponprint ("Axe");
|
|
|
|
break;
|
|
|
|
case WEAPON_INIT:
|
|
|
|
precache_model ("progs/v_axe.mdl");
|
|
|
|
precache_sound ("player/axhit1.wav");
|
|
|
|
precache_sound ("player/axhit2.wav");
|
|
|
|
precache_sound ("weapons/ax1.wav");
|
|
|
|
break;
|
2003-10-24 21:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|