From 4a429e7e57032bd2d2e0a82d75e076c160355c9d Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Tue, 24 Sep 2019 18:05:59 +0000 Subject: [PATCH] Investigated PVS report for g_weapon and addressed its points --- src/g_weapon.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/g_weapon.c b/src/g_weapon.c index b84a8cf..7af9a04 100644 --- a/src/g_weapon.c +++ b/src/g_weapon.c @@ -347,7 +347,7 @@ blaster_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { int mod; - if (!self || !other || !plane || !surf) + if (!self || !other || !plane) { return; } @@ -387,16 +387,7 @@ blaster_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) gi.WriteByte(svc_temp_entity); gi.WriteByte(TE_BLASTER); gi.WritePosition(self->s.origin); - - if (!plane) - { - gi.WriteDir(vec3_origin); - } - else - { - gi.WriteDir(plane->normal); - } - + gi.WriteDir(plane->normal); gi.multicast(self->s.origin, MULTICAST_PVS); } @@ -550,7 +541,7 @@ Grenade_Explode(edict_t *ent) void Grenade_Touch(edict_t *ent, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf) { - if (!ent || !other || !surf) + if (!ent || !other) { return; } @@ -696,7 +687,7 @@ rocket_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) vec3_t origin; int n; - if (!ent || !other || !plane || !surf) + if (!ent || !other || !plane) { return; } @@ -789,7 +780,7 @@ fire_rocket(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, rocket->s.modelindex = gi.modelindex("models/objects/rocket/tris.md2"); rocket->owner = self; rocket->touch = rocket_touch; - rocket->nextthink = level.time + 8000 / speed; + rocket->nextthink = level.time + (8000.0f / (float)speed); rocket->think = G_FreeEdict; rocket->dmg = damage; rocket->radius_dmg = radius_damage; @@ -947,7 +938,7 @@ bfg_explode(edict_t *self) void bfg_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) { - if (!self || !other || !plane || !surf) + if (!self || !other || !plane) { return; } @@ -1127,7 +1118,7 @@ fire_bfg(edict_t *self, vec3_t start, vec3_t dir, int damage, bfg->s.modelindex = gi.modelindex("sprites/s_bfg1.sp2"); bfg->owner = self; bfg->touch = bfg_touch; - bfg->nextthink = level.time + 8000 / speed; + bfg->nextthink = level.time + (8000.0f / (float)speed); bfg->think = G_FreeEdict; bfg->radius_dmg = damage; bfg->dmg_radius = damage_radius;