quake-hipnotic-sdk/progs/weapons.qc
1997-03-11 00:00:00 +00:00

2283 lines
48 KiB
C++

/*
*/
//jim
void( vector pos ) placebullethole;
void (entity targ, entity inflictor, entity attacker, float damage) t_damage;
void () player_run;
void(entity bomb, entity attacker, float rad, entity ignore) t_radiusdamage;
void(vector org, vector vel, float damage) spawnblood;
void() superdamagesound;
//med 10/18/96
void(float damage) spawn_touchblood;
/*
================
hipnotic weapons
================
*/
void() hip_lasertouch =
{
local vector org;
local vector spot1,spot2;
local vector oldvel;
local float mag;
local float r;
self.owner = world;
self.cnt = self.cnt + 1;
if (pointcontents(self.origin) == content_sky)
{
remove(self);
return;
}
oldvel = normalize(self.old_velocity);
spot1 = self.origin - (16*oldvel);
spot2 = self.origin + (16*oldvel);
traceline (spot1, spot2, false, self); // see through other monsters
self.origin = trace_endpos;
org = self.origin;
if (other.health)
{
if (self.lastvictim == other)
{
self.dmg = self.dmg / 2;
}
spawn_touchblood (self.dmg);
t_damage (other, self, self.lastvictim, self.dmg);
}
else if ((self.cnt == 3) || (random()<0.15))
{
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_gunshot);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
}
else
{
// self.dmg = 0.66 * self.dmg;
self.dmg = 0.9 * self.dmg;
// self.speed = 0.95 * self.speed;
self.velocity = oldvel+(2*trace_plane_normal);
self.velocity = normalize(self.velocity);
self.velocity = self.speed * self.velocity;
self.old_velocity = self.velocity;
if (self.flags & fl_onground)
self.flags = self.flags - fl_onground;
r = random();
sound (self, chan_weapon, "hipweap/laserric.wav", 1, attn_static);
/*
if (r<0.33)
sound (self, chan_weapon, "weapons/ric1.wav", 1, attn_static);
else if (r<0.66)
sound (self, chan_weapon, "weapons/ric2.wav", 1, attn_static);
else
sound (self, chan_weapon, "weapons/ric3.wav", 1, attn_static);
*/
return;
}
sound (self, chan_weapon, "enforcer/enfstop.wav", 1, attn_static);
remove(self);
};
void() hip_laserthink =
{
local float delta;
if (time>self.attack_finished)
{
remove(self);
return;
}
if (self.flags & fl_onground)
self.flags = self.flags - fl_onground;
self.velocity = self.old_velocity;
self.angles = vectoangles(self.velocity);
self.nextthink = time+0.1;
};
void(vector org, vector vec, float light) hip_launchlaser =
{
// sound (self ,chan_weapon, "weapons/shotgn2.wav", 1, attn_norm);
sound (self ,chan_weapon, "hipweap/laserg.wav", 1, attn_norm);
vec = normalize(vec);
newmis = spawn();
newmis.owner = self;
newmis.classname = "hiplaser";
newmis.lastvictim = self;
newmis.movetype = movetype_flymissile;
newmis.solid = solid_bbox;
if (light)
newmis.effects = ef_dimlight;
setmodel (newmis, "progs/lasrspik.mdl");
setsize (newmis, '0 0 0', '0 0 0');
setorigin (newmis, org);
newmis.speed = 1000;
newmis.dmg = 18;
newmis.velocity = vec * newmis.speed;
newmis.old_velocity = newmis.velocity;
newmis.angles = vectoangles(newmis.velocity);
newmis.avelocity = '0 0 400';
newmis.nextthink = time;
newmis.attack_finished = time + 5;
newmis.think = hip_laserthink;
newmis.touch = hip_lasertouch;
newmis.count = 0;
};
/*
=================
hip_firelaser
=================
*/
void(float stat) hip_firelaser =
{
local vector org;
local vector dir;
local vector out;
local float ofs;
local float aofs;
if (!self.button0)
{
player_run ();
return;
}
if (self.ammo_cells < 1)
{
self.weapon = w_bestweapon ();
w_setcurrentammo ();
return;
}
superdamagesound();
self.effects = self.effects | ef_muzzleflash;
makevectors (self.v_angle);
ofs = 6;
out = v_forward;
out_z = 0;
out = normalize(out);
org = self.origin + ((12-ofs) * v_up) + (12*out);
// org = self.origin + (1*v_forward);
dir = aim (self, 1000);
aofs = ofs * 0.707;
if (stat == 0)
{
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
org = org + (aofs*v_right);
org = org - (aofs*v_up);
hip_launchlaser(org, dir, 0);
org = org - (2*aofs*v_right);
hip_launchlaser(org, dir, 0);
}
else if (stat == 1)
{
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
org = org + (ofs*v_up);
if (random()<0.1)
{
hip_launchlaser(org, dir, 1);
newmis.dmg = 25;
}
else
hip_launchlaser(org, dir, 0);
}
self.punchangle_x = -1;
};
/*
=================
hip_hammerdamage
=================
*/
void(vector p1, vector p2, entity from, float damage) hip_hammerdamage =
{
local entity e1, e2;
local vector f;
f = p2 - p1;
normalize (f);
f_x = 0 - f_y;
f_y = f_x;
f_z = 0;
f = f*16;
e1 = e2 = world;
traceline (p1, p2, false, self);
//jim
if (trace_ent.takedamage && !trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
if (self.classname == "player")
{
if (other.classname == "player")
trace_ent.velocity_z = trace_ent.velocity_z + 400;
}
}
e1 = trace_ent;
traceline (p1 + f, p2 + f, false, self);
//jim
if (trace_ent != e1 && trace_ent.takedamage &&
!trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
}
e2 = trace_ent;
traceline (p1 - f, p2 - f, false, self);
//jim
if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage &&
!trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
}
};
/*
void() hip_diversionlightningthink =
{
local vector org,end;
if (time > self.delay)
{
remove(self);
return;
}
makevectors(self.v_angle);
org = self.origin;
end = org + v_forward*200;
// end = end + (((200*random()) - 100) * v_up);
end = end + (((400*random()) - 200) * v_right);
traceline (org, end, true, self);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_lightning2);
writeentity (msg_broadcast, self);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
writecoord (msg_broadcast, trace_endpos_x);
writecoord (msg_broadcast, trace_endpos_y);
writecoord (msg_broadcast, trace_endpos_z);
self.nextthink = time + 0.1;
};
*/
//void(entity prev, entity owner, float dst) hip_spawnmjolnirlightning;
void() hip_lightningthink =
{
local vector org;
local vector dst;
local entity head;
local entity selected;
local float cur_dist;
local float head_dist;
local vector vec;
local float dot;
local float oldstate;
local float dam;
if (time > self.delay)
{
if (self.enemy != world)
self.enemy.struck_by_mjolnir = 0;
remove(self);
return;
}
oldstate = self.state;
if (self.state==0)
{
// look in our immediate vicinity
self.enemy = world;
selected = world;
cur_dist = self.distance;
head = findradius(self.owner.origin, self.distance);
while(head)
{
if(!(head.flags & fl_notarget) && ((head.flags & fl_monster) || (head.flags & fl_client)))
{
// if (visible(head) && (head!=self.owner.owner) && (head.health>0))
if ((visible(head)) && (head!=self.owner.owner) && (head.health>0))
{
head_dist = vlen(head.origin - self.lastvictim.origin);
if ((head_dist<cur_dist) && (head.struck_by_mjolnir==0))
{
selected = head;
cur_dist = head_dist;
}
}
}
head = head.chain;
}
if (selected != world)
{
self.state = 1;
self.enemy = selected;
self.enemy.struck_by_mjolnir = 1;
}
else
{
local vector org,end;
makevectors(self.v_angle);
org = self.owner.origin;
end = org + v_forward*200;
end = end + (((400*random()) - 200) * v_right);
traceline (org, end, true, self);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_lightning2);
writeentity (msg_broadcast, self);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
writecoord (msg_broadcast, trace_endpos_x);
writecoord (msg_broadcast, trace_endpos_y);
writecoord (msg_broadcast, trace_endpos_z);
self.nextthink = time + 0.1;
// self.think = hip_diversionlightningthink;
// self.nextthink = time;
// self.delay = time + 0.30;
// self.origin = self.owner.origin;
// self.think();
return;
}
}
org = self.lastvictim.origin;
dst = self.enemy.absmin + 0.25*(self.enemy.absmax-self.enemy.absmin);
dst = dst + (random()*0.5*(self.enemy.absmax-self.enemy.absmin));
traceline (org, dst, true, self.owner.owner);
if (trace_fraction != 1.0 || self.enemy.health<=0)
{
self.enemy.struck_by_mjolnir = 0;
self.state = 0;
self.nextthink = time + 0.1;
return;
}
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_lightning2);
writeentity (msg_broadcast, self);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
writecoord (msg_broadcast, trace_endpos_x);
writecoord (msg_broadcast, trace_endpos_y);
writecoord (msg_broadcast, trace_endpos_z);
vec = normalize(self.enemy.origin - self.owner.origin);
dot = vec * self.owner.movedir;
head = self;
self = self.owner.owner;
if (oldstate==0)
dam = 80;
else
dam = 30;
if (dot>0.3)
hip_hammerdamage (org, trace_endpos, self, dam);
else
hip_hammerdamage (org, trace_endpos, self, dam*0.5);
self = head;
self.nextthink = time + 0.2;
};
void(entity prev, entity own, float dst) hip_spawnmjolnirlightning =
{
local entity light;
// spawn actual lightning
light = spawn();
light.delay = time + 0.8;
light.state = 0;
light.lastvictim = prev;
light.distance = dst;
light.owner = own;
light.v_angle = self.angles;
light.v_angle_x = 0;
light.v_angle_z = 0;
light.origin = own.origin;
light.think = hip_lightningthink;
light.nextthink = time;
};
void() hip_spawnmjolnirbase =
{
local entity light;
// spawn lightning base
light = spawn();
// light.origin = self.origin - '0 0 24' + (32*v_forward);
light.origin = trace_endpos;
light.flags = 0;
light.owner = self;
light.struck_by_mjolnir = 1;
light.think = sub_remove;
light.nextthink = time + 1;
sound (light, chan_auto, "hipweap/mjolslap.wav", 1, attn_norm);
sound (light, chan_weapon, "hipweap/mjolhit.wav", 1, attn_norm);
makevectors(self.v_angle);
light.movedir = v_forward;
hip_spawnmjolnirlightning( light, light, 350 );
hip_spawnmjolnirlightning( light, light, 350 );
hip_spawnmjolnirlightning( light, light, 350 );
hip_spawnmjolnirlightning( light, light, 350 );
};
void() hip_firemjolnirlightning =
{
local vector org;
local float cells;
// explode if under water
if (self.waterlevel > 1)
{
cells = self.ammo_cells;
self.ammo_cells = 0;
discharged = 1;
t_radiusdamage (self, self, 35*cells, world);
discharged = 0;
w_setcurrentammo ();
return;
}
// if (self.t_width < time)
// {
// sound (self, chan_weapon, "weapons/lhit.wav", 1, attn_norm);
// self.t_width = time + 0.6;
// }
// self.punchangle_x = 12;
self.currentammo = self.ammo_cells = self.ammo_cells - 15;
hip_spawnmjolnirbase();
};
void() hip_firemjolnir =
{
local vector org;
local float cells;
local float damage;
local vector source;
local vector ang;
self.attack_finished = time + 0.4;
source = self.origin + '0 0 16';
// ang = self.angles;
// ang_x = 0;
// ang_y = 0;
makevectors(self.v_angle);
traceline (source, source + v_forward*32, false, self);
if (trace_fraction == 1.0 && (self.ammo_cells >= 15))
{
source = source + v_forward*32;
traceline (source , source - v_up*50, false, self);
// dprint("fraction = ");
// dprint(ftos(trace_fraction));
// dprint("\n");
if (trace_fraction > 0.3 && trace_fraction< 1.0)
{
hip_firemjolnirlightning();
self.attack_finished = time + 1.5;
return;
}
}
org = trace_endpos - v_forward*4;
if (trace_ent.takedamage)
{
damage = 50;
if (trace_ent.classname == "monster_zombie")
damage = 70;
trace_ent.axhitme = 1;
spawnblood (org, v_forward, damage);
t_damage (trace_ent, self, self, damage);
}
else
{ // hit wall
if (trace_fraction != 1.0)
{
// sound (self, chan_weapon, "player/axhit2.wav", 1, attn_norm);
sound (self, chan_weapon, "hipweap/mjoltink.wav", 1, attn_norm);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_gunshot);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
}
else
{
sound (self, chan_weapon, "knight/sword1.wav", 1, attn_norm);
}
}
self.attack_finished = time + 0.4;
};
// called by worldspawn
void() w_precache =
{
precache_sound ("weapons/r_exp3.wav"); // new rocket explosion
precache_sound ("weapons/rocket1i.wav"); // spike gun
precache_sound ("weapons/sgun1.wav");
precache_sound ("weapons/guncock.wav"); // player shotgun
precache_sound ("weapons/ric1.wav"); // ricochet (used in c code)
precache_sound ("weapons/ric2.wav"); // ricochet (used in c code)
precache_sound ("weapons/ric3.wav"); // ricochet (used in c code)
precache_sound ("weapons/spike2.wav"); // super spikes
precache_sound ("weapons/tink1.wav"); // spikes tink (used in c code)
precache_sound ("weapons/grenade.wav"); // grenade launcher
precache_sound ("weapons/bounce.wav"); // grenade bounce
precache_sound ("weapons/shotgn2.wav"); // super shotgun
//med
precache_sound ("enforcer/enfstop.wav"); // laser cannon
//med 11/06/96
precache_sound ("knight/sword1.wav"); // laser cannon
precache_sound ("hipweap/laserg.wav"); // laser cannon
precache_sound ("hipweap/laserric.wav"); // laser cannon ricochet
precache_sound ("hipweap/proxwarn.wav"); // proximity bomb
precache_sound ("hipweap/proxbomb.wav"); // proximity bomb
//med 11/19/96
precache_sound ("hipweap/mjolhit.wav"); // mjolnir
precache_sound ("hipweap/mjolslap.wav"); // mjolnir
precache_sound ("hipweap/mjoltink.wav"); // mjolnir
};
float() crandom =
{
return 2*(random() - 0.5);
};
/*
================
w_fireaxe
================
*/
void() w_fireaxe =
{
local vector source;
local vector org;
makevectors (self.v_angle);
source = self.origin + '0 0 16';
traceline (source, source + v_forward*64, false, self);
if (trace_fraction == 1.0)
return;
org = trace_endpos - v_forward*4;
if (trace_ent.takedamage)
{
trace_ent.axhitme = 1;
spawnblood (org, '0 0 0', 20);
t_damage (trace_ent, self, self, 20);
}
else
{ // hit wall
sound (self, chan_weapon, "player/axhit2.wav", 1, attn_norm);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_gunshot);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
}
};
//============================================================================
vector() wall_velocity =
{
local vector vel;
vel = normalize (self.velocity);
vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
vel = vel + 2*trace_plane_normal;
vel = vel * 200;
return vel;
};
/*
================
spawnmeatspray
================
*/
void(vector org, vector vel) spawnmeatspray =
{
local entity missile, mpuff;
local vector org;
missile = spawn ();
missile.owner = self;
missile.movetype = movetype_bounce;
missile.solid = solid_not;
makevectors (self.angles);
missile.velocity = vel;
missile.velocity_z = missile.velocity_z + 250 + 50*random();
missile.avelocity = '3000 1000 2000';
// set missile duration
missile.nextthink = time + 1;
missile.think = sub_remove;
setmodel (missile, "progs/zom_gib.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, org);
};
/*
================
spawnblood
================
*/
void(vector org, vector vel, float damage) spawnblood =
{
particle (org, vel*0.1, 73, damage*2);
};
/*
================
spawn_touchblood
================
*/
void(float damage) spawn_touchblood =
{
local vector vel;
vel = wall_velocity () * 0.2;
spawnblood (self.origin + vel*0.01, vel, damage);
};
/*
================
spawnchunk
================
*/
void(vector org, vector vel) spawnchunk =
{
particle (org, vel*0.02, 0, 10);
};
/*
==============================================================================
multi-damage
collects multiple small damages into a single damage
==============================================================================
*/
entity multi_ent;
float multi_damage;
void() clearmultidamage =
{
multi_ent = world;
multi_damage = 0;
};
void() applymultidamage =
{
if (!multi_ent)
return;
t_damage (multi_ent, self, self, multi_damage);
};
void(entity hit, float damage) addmultidamage =
{
if (!hit)
return;
if (hit != multi_ent)
{
applymultidamage ();
multi_damage = damage;
multi_ent = hit;
}
else
multi_damage = multi_damage + damage;
};
/*
==============================================================================
bullets
==============================================================================
*/
/*
================
traceattack
================
*/
void(float damage, vector dir) traceattack =
{
local vector vel, org;
vel = normalize(dir + v_up*crandom() + v_right*crandom());
vel = vel + 2*trace_plane_normal;
vel = vel * 200;
org = trace_endpos - dir*4;
if (trace_ent.takedamage)
{
spawnblood (org, vel*0.2, damage);
addmultidamage (trace_ent, damage);
}
else
{
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_gunshot);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
}
};
/*
================
firebullets
used by shotgun, super shotgun, and enemy soldier firing
go to the trouble of combining multiple pellets into a single damage call.
================
*/
void(float shotcount, vector dir, vector spread) firebullets =
{
local vector direction;
local vector src;
//jim
local float bullet;
bullet = 0;
makevectors(self.v_angle);
src = self.origin + v_forward*10;
src_z = self.absmin_z + self.size_z * 0.7;
clearmultidamage ();
while (shotcount > 0)
{
direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
traceline (src, src + direction*2048, false, self);
if (trace_fraction != 1.0)
//jim
{
traceattack (4, direction);
if ( ( !bullet ) && ( trace_ent == world ) )
{
placebullethole( trace_endpos );
bullet = 1;
}
}
shotcount = shotcount - 1;
}
applymultidamage ();
};
/*
================
w_fireshotgun
================
*/
void() w_fireshotgun =
{
local vector dir;
sound (self, chan_weapon, "weapons/guncock.wav", 1, attn_norm);
self.punchangle_x = -2;
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
dir = aim (self, 100000);
firebullets (6, dir, '0.04 0.04 0');
};
/*
================
w_firesupershotgun
================
*/
void() w_firesupershotgun =
{
local vector dir;
if (self.currentammo == 1)
{
w_fireshotgun ();
return;
}
sound (self ,chan_weapon, "weapons/shotgn2.wav", 1, attn_norm);
self.punchangle_x = -4;
self.currentammo = self.ammo_shells = self.ammo_shells - 2;
dir = aim (self, 100000);
firebullets (14, dir, '0.14 0.08 0');
};
/*
==============================================================================
rockets
==============================================================================
*/
void() s_explode1 = [0, s_explode2] {};
void() s_explode2 = [1, s_explode3] {};
void() s_explode3 = [2, s_explode4] {};
void() s_explode4 = [3, s_explode5] {};
void() s_explode5 = [4, s_explode6] {};
void() s_explode6 = [5, sub_remove] {};
void() becomeexplosion =
{
self.movetype = movetype_none;
self.velocity = '0 0 0';
self.touch = sub_null;
setmodel (self, "progs/s_explod.spr");
self.solid = solid_not;
s_explode1 ();
};
void() t_missiletouch =
{
local float damg;
if (other == self.owner)
return; // don't explode on owner
if (pointcontents(self.origin) == content_sky)
{
remove(self);
return;
}
damg = 100 + random()*20;
if (other.health)
{
if (other.classname == "monster_shambler")
damg = damg * 0.5; // mostly immune
t_damage (other, self, self.owner, damg );
}
// don't do radius damage to the other, because all the damage
// was done in the impact
t_radiusdamage (self, self.owner, 120, other);
// sound (self, chan_weapon, "weapons/r_exp3.wav", 1, attn_norm);
self.origin = self.origin - 8*normalize(self.velocity);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_explosion);
writecoord (msg_broadcast, self.origin_x);
writecoord (msg_broadcast, self.origin_y);
writecoord (msg_broadcast, self.origin_z);
becomeexplosion ();
};
/*
================
w_firerocket
================
*/
void() w_firerocket =
{
local entity missile, mpuff;
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
sound (self, chan_weapon, "weapons/sgun1.wav", 1, attn_norm);
self.punchangle_x = -2;
missile = spawn ();
missile.owner = self;
missile.movetype = movetype_flymissile;
missile.solid = solid_bbox;
missile.classname = "missile";
// set missile speed
makevectors (self.v_angle);
missile.velocity = aim(self, 1000);
missile.velocity = missile.velocity * 1000;
missile.angles = vectoangles(missile.velocity);
missile.touch = t_missiletouch;
// set missile duration
missile.nextthink = time + 5;
missile.think = sub_remove;
setmodel (missile, "progs/missile.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + v_forward*8 + '0 0 16');
//med 11/09/96
newmis = missile;
};
/*
===============================================================================
lightning
===============================================================================
*/
/*
=================
lightningdamage
=================
*/
void(vector p1, vector p2, entity from, float damage) lightningdamage =
{
local entity e1, e2;
local vector f;
f = p2 - p1;
normalize (f);
f_x = 0 - f_y;
f_y = f_x;
f_z = 0;
f = f*16;
e1 = e2 = world;
traceline (p1, p2, false, self);
//jim
if (trace_ent.takedamage && !trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
if (self.classname == "player")
{
if (other.classname == "player")
trace_ent.velocity_z = trace_ent.velocity_z + 400;
}
}
e1 = trace_ent;
traceline (p1 + f, p2 + f, false, self);
//jim
if (trace_ent != e1 && trace_ent.takedamage &&
!trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
}
e2 = trace_ent;
traceline (p1 - f, p2 - f, false, self);
//jim
if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage &&
!trace_ent.wetsuit_finished )
{
particle (trace_endpos, '0 0 100', 225, damage*4);
t_damage (trace_ent, from, from, damage);
}
};
void() w_firelightning =
{
local vector org;
local float cells;
if (self.ammo_cells < 1)
{
self.weapon = w_bestweapon ();
w_setcurrentammo ();
return;
}
// explode if under water
if (self.waterlevel > 1)
{
cells = self.ammo_cells;
self.ammo_cells = 0;
//med 01/05/97 added discharge flag
discharged = 1;
t_radiusdamage (self, self, 35*cells, world);
discharged = 0;
w_setcurrentammo ();
return;
}
if (self.t_width < time)
{
sound (self, chan_weapon, "weapons/lhit.wav", 1, attn_norm);
self.t_width = time + 0.6;
}
self.punchangle_x = -2;
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
org = self.origin + '0 0 16';
traceline (org, org + v_forward*600, true, self);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_lightning2);
writeentity (msg_broadcast, self);
writecoord (msg_broadcast, org_x);
writecoord (msg_broadcast, org_y);
writecoord (msg_broadcast, org_z);
writecoord (msg_broadcast, trace_endpos_x);
writecoord (msg_broadcast, trace_endpos_y);
writecoord (msg_broadcast, trace_endpos_z);
lightningdamage (self.origin, trace_endpos + v_forward*4, self, 30);
};
//=============================================================================
void() grenadeexplode =
{
t_radiusdamage (self, self.owner, 120, world);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_explosion);
writecoord (msg_broadcast, self.origin_x);
writecoord (msg_broadcast, self.origin_y);
writecoord (msg_broadcast, self.origin_z);
becomeexplosion ();
};
void() grenadetouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage == damage_aim)
{
grenadeexplode();
return;
}
sound (self, chan_weapon, "weapons/bounce.wav", 1, attn_norm); // bounce sound
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
/*
================
w_firegrenade
================
*/
void() w_firegrenade =
{
local entity missile, mpuff;
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
sound (self, chan_weapon, "weapons/grenade.wav", 1, attn_norm);
self.punchangle_x = -2;
missile = spawn ();
missile.owner = self;
missile.movetype = movetype_bounce;
missile.solid = solid_bbox;
missile.classname = "grenade";
// set missile speed
makevectors (self.v_angle);
if (self.v_angle_x)
missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
else
{
missile.velocity = aim(self, 10000);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
}
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
missile.touch = grenadetouch;
// set missile duration
missile.nextthink = time + 2.5;
missile.think = grenadeexplode;
setmodel (missile, "progs/grenade.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
};
void() proximityexplode =
{
t_radiusdamage (self, self.owner, 95, world);
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_explosion);
writecoord (msg_broadcast, self.origin_x);
writecoord (msg_broadcast, self.origin_y);
writecoord (msg_broadcast, self.origin_z);
becomeexplosion ();
};
//med 10/31/96
float numproximitygrenades;
/*
================
proximitygrenadeexplode
================
*/
void() proximitygrenadeexplode =
{
self.takedamage = damage_no;
numproximitygrenades = numproximitygrenades - 1;
self.deathtype = "exploding";
self.nextthink = time + 0.1;
self.owner = self.lastvictim;
self.think = proximityexplode;
};
/*
================
proximitygrenadetouch
================
*/
void() proximitygrenadetouch =
{
if (other == self)
return;
if (other.classname == self.classname)
return;
self.movetype = movetype_toss;
if (self.state == 1)
return;
if (vlen(other.velocity) > 0)
{
proximitygrenadeexplode();
self.think();
return;
}
if (other.takedamage == damage_aim)
{
proximitygrenadeexplode();
self.think();
return;
}
sound (self, chan_weapon, "weapons/bounce.wav", 1, attn_norm); // bounce sound
self.movetype = movetype_none;
setsize (self, '-8 -8 -8', '8 8 8');
self.state = 1;
self.spawnmaster = other;
};
/*
================
proximitybomb
================
*/
void() proximitybomb =
{
local entity head;
local float blowup;
if ((time > self.delay) || (numproximitygrenades > 15) || (vlen(self.spawnmaster.velocity)>0) )
{
proximitygrenadeexplode();
self.think();
return;
}
self.owner = world;
self.takedamage = damage_yes;
head = findradius(self.origin, 140);
blowup = 0;
while (head)
{
if ((head != self) && (head.health > 0) && (head.flags & (fl_client|fl_monster)) && (head.classname!=self.classname))
blowup = 1;
if ((head.classname == self.classname) && (head.state==0))
blowup = 1;
traceline(self.origin,head.origin,true,self);
if (trace_fraction != 1.0)
blowup = 0;
if (blowup==1)
{
sound (self, chan_weapon, "hipweap/proxwarn.wav", 1, attn_norm);
proximitygrenadeexplode();
self.nextthink = time + 0.5;
return;
}
head = head.chain;
}
self.nextthink = time + 0.25;
};
/*
================
w_fireproximitygrenade
================
*/
void() w_fireproximitygrenade =
{
local entity missile, mpuff;
numproximitygrenades = numproximitygrenades + 1;
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
sound (self, chan_weapon, "hipweap/proxbomb.wav", 1, attn_norm);
self.punchangle_x = -2;
missile = spawn ();
missile.owner = self;
missile.lastvictim = self;
missile.movetype = movetype_toss;
missile.solid = solid_bbox;
missile.classname = "proximity_grenade";
missile.takedamage = damage_no;
missile.health = 5;
missile.state = 0;
// set missile speed
makevectors (self.v_angle);
if (self.v_angle_x)
missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
else
{
missile.velocity = aim(self, 10000);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
}
missile.avelocity = '100 600 100';
missile.angles = vectoangles(missile.velocity);
missile.touch = proximitygrenadetouch;
// set missile duration
missile.nextthink = time + 2;
missile.delay = time + 15 + (10*random());
missile.think = proximitybomb;
missile.th_die = proximitygrenadeexplode;
setmodel (missile, "progs/proxbomb.mdl");
setorigin (missile, self.origin);
setsize (missile, '-1 -1 -1', '1 1 1');
};
//=============================================================================
void() spike_touch;
void() superspike_touch;
/*
===============
launch_spike
used for both the player and the ogre
===============
*/
void(vector org, vector dir) launch_spike =
{
newmis = spawn ();
newmis.owner = self;
newmis.movetype = movetype_flymissile;
newmis.solid = solid_bbox;
newmis.angles = vectoangles(dir);
newmis.touch = spike_touch;
newmis.classname = "spike";
newmis.think = sub_remove;
newmis.nextthink = time + 6;
setmodel (newmis, "progs/spike.mdl");
setsize (newmis, vec_origin, vec_origin);
setorigin (newmis, org);
newmis.velocity = dir * 1000;
};
void() w_firesuperspikes =
{
local vector dir;
local entity old;
sound (self, chan_weapon, "weapons/spike2.wav", 1, attn_norm);
self.attack_finished = time + 0.2;
self.currentammo = self.ammo_nails = self.ammo_nails - 2;
dir = aim (self, 1000);
launch_spike (self.origin + '0 0 16', dir);
newmis.touch = superspike_touch;
setmodel (newmis, "progs/s_spike.mdl");
setsize (newmis, vec_origin, vec_origin);
self.punchangle_x = -2;
};
void(float ox) w_firespikes =
{
local vector dir;
local entity old;
makevectors (self.v_angle);
if (self.ammo_nails >= 2 && self.weapon == it_super_nailgun)
{
w_firesuperspikes ();
return;
}
if (self.ammo_nails < 1)
{
self.weapon = w_bestweapon ();
w_setcurrentammo ();
return;
}
sound (self, chan_weapon, "weapons/rocket1i.wav", 1, attn_norm);
self.attack_finished = time + 0.2;
self.currentammo = self.ammo_nails = self.ammo_nails - 1;
dir = aim (self, 1000);
launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
self.punchangle_x = -2;
};
.float hit_z;
void() spike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == solid_trigger)
return; // trigger field, do nothing
if (pointcontents(self.origin) == content_sky)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (9);
t_damage (other, self, self.owner, 9);
}
else
{
writebyte (msg_broadcast, svc_tempentity);
if (self.classname == "wizspike")
writebyte (msg_broadcast, te_wizspike);
else if (self.classname == "knightspike")
writebyte (msg_broadcast, te_knightspike);
else
writebyte (msg_broadcast, te_spike);
writecoord (msg_broadcast, self.origin_x);
writecoord (msg_broadcast, self.origin_y);
writecoord (msg_broadcast, self.origin_z);
}
remove(self);
};
void() superspike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == solid_trigger)
return; // trigger field, do nothing
if (pointcontents(self.origin) == content_sky)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (18);
t_damage (other, self, self.owner, 18);
}
else
{
writebyte (msg_broadcast, svc_tempentity);
writebyte (msg_broadcast, te_superspike);
writecoord (msg_broadcast, self.origin_x);
writecoord (msg_broadcast, self.origin_y);
writecoord (msg_broadcast, self.origin_z);
}
remove(self);
};
/*
===============================================================================
player weapon use
===============================================================================
*/
//med 10/18/96 added hipweapons
void() w_setcurrentammo =
{
player_run (); // get out of any weapon firing states
self.items = self.items - ( self.items & (it_shells | it_nails | it_rockets | it_cells) );
if (self.weapon == it_axe)
{
self.currentammo = 0;
self.weaponmodel = "progs/v_axe.mdl";
self.weaponframe = 0;
}
else if (self.weapon == it_shotgun)
{
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot.mdl";
self.weaponframe = 0;
self.items = self.items | it_shells;
}
else if (self.weapon == it_super_shotgun)
{
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot2.mdl";
self.weaponframe = 0;
self.items = self.items | it_shells;
}
else if (self.weapon == it_nailgun)
{
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail.mdl";
self.weaponframe = 0;
self.items = self.items | it_nails;
}
else if (self.weapon == it_super_nailgun)
{
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail2.mdl";
self.weaponframe = 0;
self.items = self.items | it_nails;
}
//med
else if (self.weapon == it_laser_cannon)
{
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_laserg.mdl";
self.weaponframe = 0;
self.items = self.items | it_cells;
}
else if (self.weapon == it_grenade_launcher)
{
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock.mdl";
self.weaponframe = 0;
self.items = self.items | it_rockets;
}
else if (self.weapon == it_rocket_launcher)
{
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock2.mdl";
self.weaponframe = 0;
self.items = self.items | it_rockets;
}
else if (self.weapon == it_lightning)
{
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_light.mdl";
self.weaponframe = 0;
self.items = self.items | it_cells;
}
//med
else if (self.weapon == it_mjolnir)
{
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_hammer.mdl";
self.weaponframe = 0;
self.items = self.items | it_cells;
}
//med
else if (self.weapon == it_proximity_gun)
{
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_prox.mdl";
self.weaponframe = 0;
self.items = self.items | it_rockets;
}
else
{
self.currentammo = 0;
self.weaponmodel = "";
self.weaponframe = 0;
}
};
float() w_bestweapon =
{
local float it;
it = self.items;
if (self.waterlevel <= 1 && self.ammo_cells >= 1 && (it & it_lightning) )
return it_lightning;
//med
else if(self.ammo_cells >= 1 && (it & it_laser_cannon) )
return it_laser_cannon;
else if(self.ammo_nails >= 2 && (it & it_super_nailgun) )
return it_super_nailgun;
else if(self.ammo_shells >= 2 && (it & it_super_shotgun) )
return it_super_shotgun;
else if(self.ammo_nails >= 1 && (it & it_nailgun) )
return it_nailgun;
else if(self.ammo_shells >= 1 && (it & it_shotgun) )
return it_shotgun;
//med
else if( it & it_mjolnir )
return it_mjolnir;
/*
if(self.ammo_rockets >= 1 && (it & it_rocket_launcher) )
return it_rocket_launcher;
else if(self.ammo_rockets >= 1 && (it & it_grenade_launcher) )
return it_grenade_launcher;
*/
return it_axe;
};
float() w_checknoammo =
{
if (self.currentammo > 0)
return true;
if (self.weapon == it_axe)
return true;
//med
if (self.weapon == it_mjolnir)
{
return true;
}
self.weapon = w_bestweapon ();
w_setcurrentammo ();
// drop the weapon down
return false;
};
/*
============
w_attack
an attack impulse can be triggered now
============
*/
void() player_axe1;
void() player_axeb1;
void() player_axec1;
void() player_axed1;
void() player_shot1;
void() player_nail1;
void() player_light1;
void() player_rocket1;
//med
void() player_laser1;
void() player_hammer1;
void() player_mjolnir1;
void() w_attack =
{
local float r;
if (!w_checknoammo ())
return;
makevectors (self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up
if (self.weapon == it_axe)
{
sound (self, chan_weapon, "weapons/ax1.wav", 1, attn_norm);
r = random();
if (r < 0.25)
player_axe1 ();
else if (r<0.5)
player_axeb1 ();
else if (r<0.75)
player_axec1 ();
else
player_axed1 ();
self.attack_finished = time + 0.5;
}
else if (self.weapon == it_shotgun)
{
player_shot1 ();
w_fireshotgun ();
self.attack_finished = time + 0.5;
}
else if (self.weapon == it_super_shotgun)
{
player_shot1 ();
w_firesupershotgun ();
self.attack_finished = time + 0.7;
}
else if (self.weapon == it_nailgun)
{
player_nail1 ();
}
else if (self.weapon == it_super_nailgun)
{
player_nail1 ();
}
else if (self.weapon == it_grenade_launcher)
{
player_rocket1();
w_firegrenade();
self.attack_finished = time + 0.6;
}
else if (self.weapon == it_rocket_launcher)
{
player_rocket1();
w_firerocket();
self.attack_finished = time + 0.8;
}
else if (self.weapon == it_lightning)
{
player_light1();
self.attack_finished = time + 0.1;
sound (self, chan_auto, "weapons/lstart.wav", 1, attn_norm);
}
//med
else if (self.weapon == it_laser_cannon)
{
player_laser1();
}
//med
else if (self.weapon == it_mjolnir)
{
if (self.ammo_cells < 30)
player_hammer1();
else
player_mjolnir1();
self.attack_finished = time + 0.8;
}
//med
else if (self.weapon == it_proximity_gun)
{
player_rocket1();
w_fireproximitygrenade();
self.attack_finished = time + 0.6;
}
};
/*
============
w_changeweapon
============
*/
//med 10/18/96 added hipweapons
void() w_changeweapon =
{
local float it, am, fl;
local float oldimpulse;
it = self.items;
am = 0;
//med
if (self.impulse == 1)
{
fl = it_axe;
}
else if (self.impulse == 2)
{
fl = it_shotgun;
if (self.ammo_shells < 1)
am = 1;
}
else if (self.impulse == 3)
{
fl = it_super_shotgun;
if (self.ammo_shells < 2)
am = 1;
}
else if (self.impulse == 4)
{
fl = it_nailgun;
if (self.ammo_nails < 1)
am = 1;
}
//med
else if (self.impulse == 5)
{
fl = it_super_nailgun;
if (self.ammo_nails < 2)
am = 1;
}
//med
else if (self.impulse == 6)
{
if (self.weapon == it_grenade_launcher)
{
fl = it_proximity_gun;
}
else
{
fl = it_grenade_launcher;
}
if (self.ammo_rockets < 1)
am = 1;
}
else if (self.impulse == 7)
{
fl = it_rocket_launcher;
if (self.ammo_rockets < 1)
am = 1;
}
//med
else if (self.impulse == 8)
{
fl = it_lightning;
if (self.ammo_cells < 1)
am = 1;
}
else if (self.impulse == 225)
{
fl = it_laser_cannon;
if (self.ammo_cells < 1)
am = 1;
}
else if (self.impulse == 226)
{
fl = it_mjolnir;
}
//med
oldimpulse = self.impulse;
self.impulse = 0;
if (!(self.items & fl))
{
//med
if (fl == it_grenade_launcher)
{
fl = it_proximity_gun;
if (!(self.items & fl))
{
sprint (self, "no weapon.\n");
return;
}
if (self.ammo_rockets < 1)
am = 1;
else
am = 0;
}
else
{
sprint (self, "no weapon.\n");
return;
}
}
if (am)
{ // don't have the ammo
sprint (self, "not enough ammo.\n");
return;
}
//
// set weapon, set ammo
//
self.weapon = fl;
w_setcurrentammo ();
};
/*
============
cheatcommand
============
*/
void() cheatcommand =
{
if (deathmatch || coop)
return;
self.ammo_rockets = 100;
self.ammo_nails = 200;
self.ammo_shells = 100;
self.items = self.items |
it_axe |
it_shotgun |
it_super_shotgun |
it_nailgun |
it_super_nailgun |
it_grenade_launcher |
it_rocket_launcher |
it_key1 | it_key2;
self.ammo_cells = 200;
self.items = self.items | it_lightning;
//med
self.items = self.items | it_laser_cannon;
self.items = self.items | it_mjolnir;
self.items = self.items | it_proximity_gun;
self.weapon = it_rocket_launcher;
self.impulse = 0;
w_setcurrentammo ();
};
/*
============
cycleweaponcommand
go to the next weapon with ammo
============
*/
void() cycleweaponcommand =
{
local float it, am;
it = self.items;
self.impulse = 0;
while (1)
{
am = 0;
//med
if (self.weapon == it_mjolnir)
{
self.weapon = it_axe;
}
else if (self.weapon == it_axe)
{
self.weapon = it_shotgun;
if (self.ammo_shells < 1)
am = 1;
}
else if (self.weapon == it_shotgun)
{
self.weapon = it_super_shotgun;
if (self.ammo_shells < 2)
am = 1;
}
else if (self.weapon == it_super_shotgun)
{
self.weapon = it_nailgun;
if (self.ammo_nails < 1)
am = 1;
}
else if (self.weapon == it_nailgun)
{
self.weapon = it_super_nailgun;
if (self.ammo_nails < 2)
am = 1;
}
else if (self.weapon == it_super_nailgun)
{
self.weapon = it_grenade_launcher;
if (self.ammo_rockets < 1)
am = 1;
}
//med
else if (self.weapon == it_grenade_launcher)
{
self.weapon = it_proximity_gun;
if (self.ammo_rockets < 1)
am = 1;
}
//med
else if (self.weapon == it_proximity_gun)
{
self.weapon = it_rocket_launcher;
if (self.ammo_rockets < 1)
am = 1;
}
else if (self.weapon == it_rocket_launcher)
{
self.weapon = it_lightning;
if (self.ammo_cells < 1)
am = 1;
}
else if (self.weapon == it_lightning)
{
self.weapon = it_laser_cannon;
if (self.ammo_cells < 1)
am = 1;
}
else if (self.weapon == it_laser_cannon)
{
self.weapon = it_mjolnir;
}
if ( (self.items & self.weapon) && am == 0)
{
w_setcurrentammo ();
return;
}
}
};
/*
============
cycleweaponreversecommand
go to the prev weapon with ammo
============
*/
void() cycleweaponreversecommand =
{
local float it, am;
it = self.items;
self.impulse = 0;
while (1)
{
am = 0;
//med
if (self.weapon == it_mjolnir)
{
self.weapon = it_laser_cannon;
if (self.ammo_cells < 1)
am = 1;
}
//med
else if (self.weapon == it_laser_cannon)
{
self.weapon = it_lightning;
if (self.ammo_cells < 1)
am = 1;
}
else if (self.weapon == it_lightning)
{
self.weapon = it_rocket_launcher;
if (self.ammo_rockets < 1)
am = 1;
}
else if (self.weapon == it_rocket_launcher)
{
self.weapon = it_proximity_gun;
if (self.ammo_rockets < 1)
am = 1;
}
else if (self.weapon == it_proximity_gun)
{
self.weapon = it_grenade_launcher;
if (self.ammo_rockets < 1)
am = 1;
}
else if (self.weapon == it_grenade_launcher)
{
self.weapon = it_super_nailgun;
if (self.ammo_nails < 2)
am = 1;
}
else if (self.weapon == it_super_nailgun)
{
self.weapon = it_nailgun;
if (self.ammo_nails < 1)
am = 1;
}
else if (self.weapon == it_nailgun)
{
self.weapon = it_super_shotgun;
if (self.ammo_shells < 2)
am = 1;
}
else if (self.weapon == it_super_shotgun)
{
self.weapon = it_shotgun;
if (self.ammo_shells < 1)
am = 1;
}
else if (self.weapon == it_shotgun)
{
self.weapon = it_axe;
}
else if (self.weapon == it_axe)
{
self.weapon = it_mjolnir;
}
if ( (it & self.weapon) && am == 0)
{
w_setcurrentammo ();
return;
}
}
};
/*
============
serverflagscommand
just for development
============
*/
void() serverflagscommand =
{
serverflags = serverflags * 2 + 1;
};
void() quadcheat =
{
if (deathmatch || coop)
return;
self.super_time = 1;
self.super_damage_finished = time + 30;
self.items = self.items | it_quad;
bprint ("quad cheat\n");
};
//med
void() wetsuitcheat =
{
if (deathmatch || coop)
return;
self.items2 = self.items2 | hip_it_wetsuit;
self.wetsuit_time = 1;
self.wetsuit_finished = time + 30;
bprint( "wetsuit cheat\n" );
};
//med
void() empathyshieldscheat =
{
if (deathmatch || coop)
return;
self.items2 = self.items2 | hip_it_empathy_shields;
self.empathy_time = 1;
self.empathy_finished = time + 30;
bprint( "empathy shields cheat\n" );
};
void() dumpentities =
{
local entity head;
local float i;
i = 1;
head = nextent(world);
while (head!=world)
{
dprint(ftos(i));
dprint(" ");
dprint(head.classname);
dprint("\n");
head = nextent(head);
i = i + 1;
}
};
void() dumpliveentities =
{
local entity head;
local float i;
i = 1;
head = nextent(world);
while (head!=world)
{
if (head.health > 0)
{
dprint(ftos(i));
dprint(" ");
dprint(head.classname);
dprint(" ");
dprint(vtos(head.origin));
dprint("\n");
dprint("--------------------\n");
}
head = nextent(head);
i = i + 1;
}
};
void() genocide =
{
local entity head;
if (deathmatch || coop)
return;
bprint("genocide!\n");
head = nextent(world);
while (head!=world)
{
if ((head.health > 0) && (head.flags & fl_monster))
{
t_damage(head,world,world,head.health+10);
}
head = nextent(head);
}
};
float dump_coord;
void () toggledump =
{
dump_coord = 1 - dump_coord;
if (dump_coord == 1)
bprint("dumping player location\n");
};
void () dumpcoordinates =
{
local entity pl;
pl = checkclient();
if (pl)
{
bprint("player: ");
bprint(vtos(pl.origin));
bprint("\n");
}
};
/*
============
impulsecommands
============
*/
void() impulsecommands =
{
if (self.impulse >= 1 && self.impulse <= 8)
w_changeweapon ();
if (self.impulse >= 225 && self.impulse <= 226)
w_changeweapon ();
if (self.impulse == 9)
cheatcommand ();
if (self.impulse == 10)
cycleweaponcommand ();
if (self.impulse == 11)
serverflagscommand ();
if (self.impulse == 12)
cycleweaponreversecommand ();
//jim
if ( self.impulse == 200 )
wetsuitcheat();
//med
if ( self.impulse == 201 )
empathyshieldscheat();
if ( self.impulse == 205 )
genocide();
if ( self.impulse == 206 )
toggledump();
if ( self.impulse == 202 )
dumpentities();
if ( self.impulse == 203 )
dumpliveentities();
if (self.impulse == 255)
quadcheat ();
if (dump_coord == 1)
dumpcoordinates();
self.impulse = 0;
};
/*
============
w_weaponframe
called every frame so impulse events can be handled as well as possible
============
*/
void() w_weaponframe =
{
if (time < self.attack_finished)
return;
impulsecommands ();
// check for attack
if (self.button0)
{
superdamagesound ();
w_attack ();
}
};
/*
========
superdamagesound
plays sound if needed
========
*/
void() superdamagesound =
{
if (self.super_damage_finished > time)
{
if (self.super_sound < time)
{
self.super_sound = time + 1;
sound (self, chan_body, "items/damage3.wav", 1, attn_norm);
}
}
return;
};