From bedf8cdd9dd103efab04ea92ffa95371628142de Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Tue, 1 Oct 2019 20:44:18 +0000 Subject: [PATCH] Plane check in blaster2_touch --- src/g_newweap.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/g_newweap.c b/src/g_newweap.c index db6dbff..5920e0d 100644 --- a/src/g_newweap.c +++ b/src/g_newweap.c @@ -1477,8 +1477,9 @@ blaster2_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { int mod; int damagestat; + vec3_t normal; - if (!self || !other || !plane) + if (!self || !other) { return; } @@ -1499,6 +1500,15 @@ blaster2_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT); } + if (plane) + { + VectorCopy(plane->normal, normal); + } + else + { + VectorCopy(vec3_origin, normal); + } + if (other->takedamage) { mod = MOD_BLASTER2; @@ -1521,8 +1531,9 @@ blaster2_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) self->dmg_radius, 0); } - T_Damage(other, self, self->owner, self->velocity, self->s.origin, plane->normal, + T_Damage(other, self, self->owner, self->velocity, self->s.origin, normal, self->dmg, 1, DAMAGE_ENERGY, mod); + self->owner->takedamage = damagestat; } else @@ -1534,7 +1545,7 @@ blaster2_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) } T_Damage(other, self, self->owner, self->velocity, self->s.origin, - plane->normal, self->dmg, 1, DAMAGE_ENERGY, mod); + normal, self->dmg, 1, DAMAGE_ENERGY, mod); } } else @@ -1549,7 +1560,7 @@ blaster2_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BLASTER2); gi.WritePosition(self->s.origin); - gi.WriteDir(plane->normal); + gi.WriteDir(normal); gi.multicast(self->s.origin, MULTICAST_PVS); }