2003-10-24 21:43:32 +00:00
|
|
|
#include "common.qh"
|
|
|
|
|
|
|
|
#include "damage.qh"
|
|
|
|
#include "effect.qh"
|
|
|
|
#include "mdl.qh"
|
|
|
|
|
2003-10-27 22:27:29 +00:00
|
|
|
#include "misc.qh"
|
|
|
|
|
2003-10-24 21:43:32 +00:00
|
|
|
#include "bodyque.qh"
|
|
|
|
|
|
|
|
float _bodyque_current;
|
|
|
|
entity bodyque_head;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
bodyque_init =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local float i;
|
|
|
|
local entity e;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
e = bodyque_head = spawn ("BODYQUE");
|
2003-10-24 21:43:32 +00:00
|
|
|
bodyque_head.owner = bodyque_head;
|
2004-02-08 07:34:17 +00:00
|
|
|
for (i = 1; i < CONFIG_BODYQUE_MAX; i++) {
|
|
|
|
bodyque_head.owner = spawn ("BODYQUE");
|
2003-10-24 21:43:32 +00:00
|
|
|
bodyque_head.owner.chain = bodyque_head;
|
|
|
|
bodyque_head = bodyque_head.owner;
|
|
|
|
}
|
|
|
|
e.chain = bodyque_head;
|
|
|
|
bodyque_head.owner = e;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
precache_sound ("zombie/z_miss.wav");
|
2003-10-24 21:43:32 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
precache_sound ("player/gib.wav");
|
|
|
|
precache_sound ("player/udeath.wav");
|
2003-10-24 21:43:32 +00:00
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_bodyque_fade_think =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local vector org;
|
|
|
|
|
|
|
|
if (self.mdl_think) {
|
2004-02-08 07:34:17 +00:00
|
|
|
if (!self.mdl_thought)
|
|
|
|
self.mdl_think ();
|
2003-10-24 21:43:32 +00:00
|
|
|
self.mdl_thought = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
org = self.origin;
|
|
|
|
org_z = org_z + self.maxs_z;
|
2004-02-08 07:34:17 +00:00
|
|
|
if (pointcontents (org) == CONTENT_SOLID) {
|
2003-10-24 21:43:32 +00:00
|
|
|
_bodyque_current = _bodyque_current - 1;
|
2004-02-08 07:34:17 +00:00
|
|
|
remove (self);
|
2003-10-24 21:43:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_bodyque_fade_from_reality =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local entity new_bodyque;
|
|
|
|
|
|
|
|
if (_bodyque_current >= CONFIG_BODYQUE_FADE_MAX)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_bodyque = spawn("BODYQUE");
|
|
|
|
|
|
|
|
// Link the new entity in, let the old one fade
|
|
|
|
if (bodyque_head.owner != bodyque_head) {
|
|
|
|
new_bodyque.owner = bodyque_head.owner;
|
|
|
|
new_bodyque.chain = bodyque_head.chain;
|
|
|
|
|
|
|
|
new_bodyque.owner.chain = new_bodyque;
|
|
|
|
new_bodyque.chain.owner = new_bodyque;
|
|
|
|
} else {
|
|
|
|
// This happens if CONFIG_BODYQUE_MAX == 1
|
|
|
|
new_bodyque.owner = new_bodyque;
|
|
|
|
new_bodyque.chain = new_bodyque;
|
|
|
|
}
|
|
|
|
|
|
|
|
bodyque_head.movetype = MOVETYPE_NOCLIP;
|
|
|
|
bodyque_head.think = _bodyque_fade_think;
|
|
|
|
bodyque_head.nextthink = time + 0.1;
|
|
|
|
bodyque_head.velocity = '0 0 -10';
|
|
|
|
|
|
|
|
bodyque_head = new_bodyque;
|
|
|
|
|
|
|
|
_bodyque_current = _bodyque_current + 1;
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_bodyque_think =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
if (self.mdl_think) {
|
2004-02-08 07:34:17 +00:00
|
|
|
if (!self.mdl_thought)
|
|
|
|
self.mdl_think ();
|
2003-10-24 21:43:32 +00:00
|
|
|
self.mdl_thought = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
entity (entity body)
|
|
|
|
bodyque_que =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local entity ret;
|
|
|
|
|
|
|
|
if (bodyque_head.count)
|
2004-02-08 07:34:17 +00:00
|
|
|
_bodyque_fade_from_reality ();
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
ret = bodyque_head;
|
|
|
|
|
|
|
|
bodyque_head.deadflag = DEAD_DEAD;
|
|
|
|
|
|
|
|
bodyque_head.count = TRUE;
|
|
|
|
bodyque_head.model = body.model;
|
|
|
|
bodyque_head.modelindex = body.modelindex;
|
|
|
|
bodyque_head.mins = body.mins;
|
|
|
|
bodyque_head.maxs = body.maxs;
|
|
|
|
bodyque_head.size = body.size;
|
|
|
|
bodyque_head.angles = body.angles;
|
|
|
|
bodyque_head.frame = body.frame;
|
|
|
|
bodyque_head.colormap = body.colormap;
|
|
|
|
bodyque_head.movetype = body.movetype;
|
|
|
|
bodyque_head.velocity = body.velocity;
|
|
|
|
bodyque_head.avelocity = body.avelocity;
|
|
|
|
bodyque_head.health = body.health;
|
|
|
|
bodyque_head.mass = body.mass;
|
|
|
|
|
|
|
|
bodyque_head.solid = SOLID_NOT;
|
|
|
|
bodyque_head.movetype = MOVETYPE_BOUNCE;
|
|
|
|
|
|
|
|
bodyque_head.takedamage = DAMAGE_NO;
|
|
|
|
|
|
|
|
bodyque_head.mdl_func = body.mdl_func;
|
|
|
|
bodyque_head.mdl_mod = body.mdl_mod;
|
|
|
|
bodyque_head.mdl_think = body.mdl_think;
|
|
|
|
bodyque_head.mdl_thought = body.mdl_thought;
|
|
|
|
|
|
|
|
setorigin(bodyque_head, body.origin);
|
|
|
|
setsize(bodyque_head, body.mins, body.maxs);
|
|
|
|
|
|
|
|
bodyque_head.think = _bodyque_think;
|
|
|
|
bodyque_head.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
bodyque_head = bodyque_head.owner;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
};
|