mirror of https://github.com/yquake2/rogue.git
Parasite doesn't leech through walls anymore
The problem was that its head was too close to/in the wall, so the trace towards the player (to decide if he's reachable) started *in* the wall, so the wall itself wasn't hit/detected. Now the trace start is 8 units behind the head and it seems to work. Fixes #9
This commit is contained in:
parent
cf6bf166ff
commit
000da6a653
|
@ -470,7 +470,7 @@ parasite_drain_attack_ok(vec3_t start, vec3_t end)
|
||||||
void
|
void
|
||||||
parasite_drain_attack(edict_t *self)
|
parasite_drain_attack(edict_t *self)
|
||||||
{
|
{
|
||||||
vec3_t offset, start, f, r, end, dir;
|
vec3_t offset, start, origStart, f, r, end, dir;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
int damage;
|
int damage;
|
||||||
|
|
||||||
|
@ -484,6 +484,19 @@ parasite_drain_attack(edict_t *self)
|
||||||
G_ProjectSource(self->s.origin, offset, f, r, start);
|
G_ProjectSource(self->s.origin, offset, f, r, start);
|
||||||
|
|
||||||
VectorCopy(self->enemy->s.origin, end);
|
VectorCopy(self->enemy->s.origin, end);
|
||||||
|
VectorSubtract(end, start, dir);
|
||||||
|
|
||||||
|
{
|
||||||
|
// will use the original startPoint for the actual effect etc,
|
||||||
|
// the modified start is just for the traces
|
||||||
|
VectorCopy(start, origStart);
|
||||||
|
vec3_t dir2; // need normalized dir for offset
|
||||||
|
VectorCopy(dir, dir2);
|
||||||
|
VectorNormalize(dir2);
|
||||||
|
// start = start - 8*dir => move start back a bit
|
||||||
|
// so trace doesn't start in wall in case parasite is too close to wall
|
||||||
|
VectorMA(start, -8.0f, dir2, start);
|
||||||
|
}
|
||||||
|
|
||||||
if (!parasite_drain_attack_ok(start, end))
|
if (!parasite_drain_attack_ok(start, end))
|
||||||
{
|
{
|
||||||
|
@ -527,11 +540,10 @@ parasite_drain_attack(edict_t *self)
|
||||||
gi.WriteByte(svc_temp_entity);
|
gi.WriteByte(svc_temp_entity);
|
||||||
gi.WriteByte(TE_PARASITE_ATTACK);
|
gi.WriteByte(TE_PARASITE_ATTACK);
|
||||||
gi.WriteShort(self - g_edicts);
|
gi.WriteShort(self - g_edicts);
|
||||||
gi.WritePosition(start);
|
gi.WritePosition(origStart);
|
||||||
gi.WritePosition(end);
|
gi.WritePosition(end);
|
||||||
gi.multicast(self->s.origin, MULTICAST_PVS);
|
gi.multicast(self->s.origin, MULTICAST_PVS);
|
||||||
|
|
||||||
VectorSubtract(start, end, dir);
|
|
||||||
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin,
|
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin,
|
||||||
damage, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
|
damage, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue