Merge pull request #33 from BjossiAlfreds/pvs

Code fixes to address PVS report
This commit is contained in:
Yamagi 2019-10-03 10:07:13 +02:00 committed by GitHub
commit 21bb7b1c9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 124 additions and 302 deletions

View file

@ -299,9 +299,6 @@ DBall_ChangeKnockback(edict_t *targ, edict_t *attacker, int knockback, int mod)
case MOD_SSHOTGUN:
knockback = knockback / 3;
break;
case MOD_MACHINEGUN:
knockback = (knockback * 3) / 2;
break;
case MOD_HYPERBLASTER:
knockback *= 4;
break;
@ -316,6 +313,7 @@ DBall_ChangeKnockback(edict_t *targ, edict_t *attacker, int knockback, int mod)
knockback /= 2;
break;
case MOD_R_SPLASH:
case MOD_MACHINEGUN:
knockback = (knockback * 3) / 2;
break;
case MOD_RAILGUN:

View file

@ -18,11 +18,6 @@ int tag_count;
void
Tag_PlayerDeath(edict_t *targ, edict_t *inflictor /* unused */, edict_t *attacker /* unused */)
{
if (!targ)
{
return;
}
if (tag_token && targ && (targ == tag_owner))
{
Tag_DropToken(targ, FindItem("Tag Token"));
@ -67,11 +62,6 @@ Tag_KillItBonus(edict_t *self)
void
Tag_PlayerDisconnect(edict_t *self)
{
if (!self)
{
return;
}
if (tag_token && self && (self == tag_owner))
{
Tag_DropToken(self, FindItem("Tag Token"));

View file

@ -425,18 +425,13 @@ infront(edict_t *self, edict_t *other)
float dot;
vec3_t forward;
if ((self == NULL) || (other == NULL))
if (!self || !other)
{
return false;
}
AngleVectors(self->s.angles, forward, NULL, NULL);
if ((self == NULL) || (other == NULL))
{
return false;
}
VectorSubtract(other->s.origin, self->s.origin, vec);
VectorNormalize(vec);
dot = DotProduct(vec, forward);
@ -942,10 +937,6 @@ M_CheckAttack(edict_t *self)
{
chance = 0.4;
}
else if (enemy_range == RANGE_MELEE)
{
chance = 0.2;
}
else if (enemy_range == RANGE_NEAR)
{
chance = 0.1;
@ -994,7 +985,7 @@ M_CheckAttack(edict_t *self)
}
/* if enemy is tesla, never strafe */
if ((self->enemy) && (self->enemy->classname) &&
if ((self->enemy->classname) &&
(!strcmp(self->enemy->classname, "tesla")))
{
strafe_chance = 0;
@ -1225,7 +1216,7 @@ ai_checkattack(edict_t *self, float dist)
}
else if (self->monsterinfo.aiflags & AI_MEDIC)
{
if (!(self->enemy->inuse) || (self->enemy->health > 0))
if (self->enemy->health > 0)
{
hesDeadJim = true;
}
@ -1441,25 +1432,13 @@ ai_run(edict_t *self, float dist)
return;
}
if (coop && coop->value)
if (visible(self, realEnemy))
{
/* if we're in coop, check my real enemy first..
if I SEE him, set gotcha to true */
if (self->enemy && visible(self, realEnemy))
{
gotcha = true;
}
else /* otherwise, let FindTarget bump us out of hint paths, if appropriate */
{
FindTarget(self);
}
gotcha = true;
}
else
else if (coop->value)
{
if (self->enemy && visible(self, realEnemy))
{
gotcha = true;
}
FindTarget(self);
}
/* if we see the player, stop following hintpaths. */
@ -1749,8 +1728,5 @@ ai_run(edict_t *self, float dist)
G_FreeEdict(tempgoal);
if (self)
{
self->goalentity = save;
}
self->goalentity = save;
}

View file

@ -1224,7 +1224,7 @@ Cmd_Ent_Count_f(edict_t *ent)
void
Cmd_PlayerList_f(edict_t *ent)
{
int i;
int i, text_len;
char st[80];
char text[1400];
edict_t *e2;
@ -1235,7 +1235,7 @@ Cmd_PlayerList_f(edict_t *ent)
}
/* connect time, ping, score, name */
*text = 0;
*text = '\0';
for (i = 0, e2 = g_edicts + 1; i < maxclients->value; i++, e2++)
{
@ -1251,9 +1251,11 @@ Cmd_PlayerList_f(edict_t *ent)
e2->client->pers.netname,
e2->client->resp.spectator ? " (spectator)" : "");
if (strlen(text) + strlen(st) > sizeof(text) - 50)
text_len = strlen(text);
if ((text_len + strlen(st)) > (sizeof(text) - 50))
{
sprintf(text + strlen(text), "And more...\n");
snprintf(text + text_len, sizeof(text) - text_len, "And more...\n");
gi.cprintf(ent, PRINT_HIGH, "%s", text);
return;
}

View file

@ -475,7 +475,7 @@ M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor)
and can't see who you should be mad at (attacker)
attack the tesla also, target the tesla if it's
a "new" tesla */
if ((inflictor) && (!strcmp(inflictor->classname, "tesla")))
if (!strcmp(inflictor->classname, "tesla"))
{
new_tesla = MarkTeslaArea(targ, inflictor);
@ -515,7 +515,7 @@ M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor)
{
percentHealth = (float)(targ->health) / (float)(targ->max_health);
if (targ->enemy->inuse && (percentHealth > 0.33))
if (percentHealth > 0.33)
{
return;
}
@ -607,7 +607,7 @@ M_ReactToDamage(edict_t *targ, edict_t *attacker, edict_t *inflictor)
}
}
/* otherwise get mad at whoever they are mad at (help our buddy) unless it is us! */
else if (attacker->enemy && (attacker->enemy != targ))
else if (attacker->enemy)
{
if (targ->enemy && targ->enemy->client)
{

View file

@ -603,7 +603,7 @@ plat_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_CRUSH);
/* if it's still there, nuke it */
if (other)
if (other->inuse)
{
/* Hack for entity without it's origin near the model */
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
@ -715,7 +715,6 @@ plat_spawn_inside_trigger(edict_t *ent)
tmin[0] = ent->mins[0] + 25;
tmin[1] = ent->mins[1] + 25;
tmin[2] = ent->mins[2];
tmax[0] = ent->maxs[0] - 25;
tmax[1] = ent->maxs[1] - 25;
@ -1201,7 +1200,7 @@ plat2_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_CRUSH);
/* if it's still there, nuke it */
if (other && other->inuse)
if (other->inuse)
{
BecomeExplosion1(other);
}
@ -1631,10 +1630,7 @@ SP_func_rotating(edict_t *ent)
ent->use = rotating_use;
if (ent->dmg)
{
ent->blocked = rotating_blocked;
}
ent->blocked = rotating_blocked;
if (ent->spawnflags & 1)
{
@ -2449,7 +2445,7 @@ door_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_CRUSH);
/* if it's still there, nuke it */
if (other)
if (other->inuse)
{
/* Hack for entitiy without their origin near the model */
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
@ -2891,7 +2887,7 @@ smart_water_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_LAVA);
/* if it's still there, nuke it */
if (other && other->inuse)
if (other->inuse)
{
BecomeExplosion1(other);
}
@ -2944,10 +2940,6 @@ SP_func_water(edict_t *self)
break;
case 1: /* water */
self->moveinfo.sound_start = gi.soundindex("world/mov_watr.wav");
self->moveinfo.sound_end = gi.soundindex("world/stp_watr.wav");
break;
case 2: /* lava */
self->moveinfo.sound_start = gi.soundindex("world/mov_watr.wav");
self->moveinfo.sound_end = gi.soundindex("world/stp_watr.wav");
@ -3044,7 +3036,7 @@ train_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_CRUSH);
/* if it's still there, nuke it */
if (other)
if (other->inuse)
{
/* Hack for entity without an origin near the model */
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
@ -3785,7 +3777,7 @@ door_secret_blocked(edict_t *self, edict_t *other)
vec3_origin, 100000, 1, 0, MOD_CRUSH);
/* if it's still there, nuke it */
if (other)
if (other->inuse)
{
/* Hack for entities without their origin near the model */
VectorMA(other->absmin, 0.5, other->size, other->s.origin);

View file

@ -584,7 +584,7 @@ Pickup_Nuke(edict_t *ent, edict_t *other)
return false;
}
if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
if ((coop->value) && (ent->item->flags & IT_STAY_COOP))
{
return false;
}
@ -1209,6 +1209,11 @@ Drop_Ammo(edict_t *ent, gitem_t *item)
void
MegaHealth_think(edict_t *self)
{
if (!self)
{
return;
}
if (self->owner->health > self->owner->max_health)
{
self->nextthink = level.time + 1;
@ -1216,11 +1221,6 @@ MegaHealth_think(edict_t *self)
return;
}
if (!self)
{
return;
}
if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
{
SetRespawn(self, 20);

View file

@ -124,7 +124,7 @@ gib_touch(edict_t *self, edict_t *other /* unused */, cplane_t *plane, csurface_
{
vec3_t normal_angles, right;
if (!self || !plane)
if (!self)
{
return;
}
@ -864,18 +864,13 @@ SP_func_wall(edict_t *self)
void
func_object_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf /* unused */)
{
if (!self || !other || !plane)
if (!self || !other)
{
return;
}
/* only squash thing we fall on top of */
if (!plane)
{
return;
}
if (plane->normal[2] < 1.0)
if (plane && plane->normal[2] < 1.0)
{
return;
}
@ -996,7 +991,6 @@ func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker,
int count;
int mass;
edict_t *master;
qboolean done = false;
if (!self || !inflictor || !attacker)
{
@ -1067,24 +1061,18 @@ func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker,
if (self->flags & FL_TEAMSLAVE)
{
if (self->teammaster)
master = self->teammaster;
/* because mappers (other than jim (usually)) are stupid.... */
while (master)
{
master = self->teammaster;
/* because mappers (other than jim (usually)) are stupid.... */
if (master && master->inuse)
if (master->teamchain == self)
{
while (!done)
{
if (master->teamchain == self)
{
master->teamchain = self->teamchain;
done = true;
}
master = master->teamchain;
}
master->teamchain = self->teamchain;
break;
}
master = master->teamchain;
}
}
@ -1291,7 +1279,7 @@ barrel_explode(edict_t *self)
ThrowDebris(self, "models/objects/debris3/tris.md2", spd, org);
/* a bunch of little chunks */
spd = 2 * self->dmg / 200;
spd = 2.0 * (float)self->dmg / 200.0;
org[0] = self->s.origin[0] + crandom() * self->size[0];
org[1] = self->s.origin[1] + crandom() * self->size[1];
org[2] = self->s.origin[2] + crandom() * self->size[2];

View file

@ -1220,10 +1220,7 @@ SpawnBadArea(vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner)
badarea->nextthink = level.time + lifespan;
}
if (owner)
{
badarea->owner = owner;
}
badarea->owner = owner;
return badarea;
}

View file

@ -37,7 +37,7 @@ use_target_steam(edict_t *self, edict_t *other, edict_t *activator /* unused */)
static int nextid;
vec3_t point;
if (!self || !other)
if (!self)
{
return;
}
@ -72,10 +72,11 @@ use_target_steam(edict_t *self, edict_t *other, edict_t *activator /* unused */)
VectorMA(self->s.origin, self->plat2flags * 0.5, self->movedir, point);
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_STEAM);
if (self->wait > 100)
{
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_STEAM);
gi.WriteShort(nextid);
gi.WriteByte(self->count);
gi.WritePosition(self->s.origin);
@ -83,20 +84,18 @@ use_target_steam(edict_t *self, edict_t *other, edict_t *activator /* unused */)
gi.WriteByte(self->sounds & 0xff);
gi.WriteShort((short int)(self->plat2flags));
gi.WriteLong((int)(self->wait));
gi.multicast(self->s.origin, MULTICAST_PVS);
}
else
{
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_STEAM);
gi.WriteShort((short int)-1);
gi.WriteByte(self->count);
gi.WritePosition(self->s.origin);
gi.WriteDir(self->movedir);
gi.WriteByte(self->sounds & 0xff);
gi.WriteShort((short int)(self->plat2flags));
gi.multicast(self->s.origin, MULTICAST_PVS);
}
gi.multicast(self->s.origin, MULTICAST_PVS);
}
void

View file

@ -46,7 +46,7 @@ flechette_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
{
vec3_t dir;
if (!self || !other || !plane || !surf)
if (!self || !other || !plane)
{
return;
}
@ -75,14 +75,7 @@ flechette_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
}
else
{
if (!plane)
{
VectorClear(dir);
}
else
{
VectorScale(plane->normal, 256, dir);
}
VectorScale(plane->normal, 256, dir);
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_FLECHETTE);
@ -124,7 +117,7 @@ fire_flechette(edict_t *self, vec3_t start, vec3_t dir, int damage,
flechette->owner = self;
flechette->touch = flechette_touch;
flechette->nextthink = level.time + 8000 / speed;
flechette->nextthink = level.time + (8000.0f / (float)speed);
flechette->think = G_FreeEdict;
flechette->dmg = damage;
flechette->dmg_radius = kick;
@ -379,7 +372,7 @@ prox_land(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
int stick_ok = 0;
vec3_t land_point;
if (!ent || !other || !plane || !surf)
if (!ent || !other || !plane)
{
return;
}
@ -401,8 +394,7 @@ prox_land(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
return;
}
if ((other->svflags & SVF_MONSTER) || other->client ||
(other->svflags & SVF_DAMAGEABLE))
if ((other->svflags & (SVF_MONSTER|SVF_DAMAGEABLE)) || other->client)
{
if (other != ent->teammaster)
{
@ -747,7 +739,7 @@ void
nuke_die(edict_t *self, edict_t *inflictor /* unused */,
edict_t *attacker, int damage, vec3_t point)
{
if (!self || !attacker)
if (!self)
{
return;
}
@ -1485,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 || !surf)
if (!self || !other)
{
return;
}
@ -1507,21 +1500,28 @@ 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)
{
/* the only time players will be firing blaster2
bolts will be from the defender sphere. */
if (self->owner->client)
{
mod = MOD_DEFENDER_SPHERE;
}
else
{
mod = MOD_BLASTER2;
}
mod = MOD_BLASTER2;
if (self->owner)
{
/* the only time players will be firing blaster2
bolts will be from the defender sphere. */
if (self->owner->client)
{
mod = MOD_DEFENDER_SPHERE;
}
damagestat = self->owner->takedamage;
self->owner->takedamage = DAMAGE_NO;
@ -1531,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
@ -1544,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
@ -1559,16 +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);
if (!plane)
{
gi.WriteDir(vec3_origin);
}
else
{
gi.WriteDir(plane->normal);
}
gi.WriteDir(normal);
gi.multicast(self->s.origin, MULTICAST_PVS);
}
@ -1758,7 +1750,7 @@ tracker_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
float damagetime;
if (!self || !other || !surf || !plane)
if (!self || !other || !plane)
{
return;
}
@ -1813,7 +1805,6 @@ tracker_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
}
tracker_explode(self, plane);
return;
}
void
@ -1868,7 +1859,7 @@ fire_tracker(edict_t *self, vec3_t start, vec3_t dir, int damage,
edict_t *bolt;
trace_t tr;
if (!self || !enemy)
if (!self)
{
return;
}

View file

@ -172,10 +172,7 @@ sphere_chase(edict_t *self, int stupidChase)
}
/* if moving, hunter sphere uses active sound */
if (!stupidChase)
{
self->s.sound = gi.soundindex("spheres/h_active.wav");
}
self->s.sound = gi.soundindex("spheres/h_active.wav");
}
else
{
@ -183,10 +180,7 @@ sphere_chase(edict_t *self, int stupidChase)
vectoangles2(dir, self->s.angles);
/* if not moving, hunter sphere uses lurk sound */
if (!stupidChase)
{
self->s.sound = gi.soundindex("spheres/h_lurk.wav");
}
self->s.sound = gi.soundindex("spheres/h_lurk.wav");
VectorClear(self->velocity);
}
@ -199,7 +193,7 @@ sphere_fire(edict_t *self, edict_t *enemy)
vec3_t dest;
vec3_t dir;
if (!self || !enemy)
if (!self)
{
return;
}
@ -227,7 +221,7 @@ void
sphere_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;
}
@ -452,7 +446,7 @@ hunter_pain(edict_t *self, edict_t *other, float kick, int damage)
VectorSubtract(other->s.origin, self->s.origin, dir);
dist = VectorLength(dir);
if (owner && (dist >= 192))
if (dist >= 192)
{
/* detach owner from body and send him flying */
owner->movetype = MOVETYPE_FLYMISSILE;

View file

@ -110,6 +110,7 @@ StringToFilter(char *s, ipfilter_t *f)
s++;
}
/* PVS NOTE: maybe use memcpy here? */
f->mask = *(unsigned *)m;
f->compare = *(unsigned *)b;
@ -150,6 +151,7 @@ SV_FilterPacket(char *from)
i++, p++;
}
/* PVS NOTE: maybe use memcpy here? */
in = *(unsigned *)m;
for (i = 0; i < numipfilters; i++)
@ -245,6 +247,7 @@ SVCmd_ListIP_f(void)
for (i = 0; i < numipfilters; i++)
{
/* PVS NOTE: maybe use memcpy here? */
*(unsigned *)b = ipfilters[i].compare;
gi.cprintf(NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
}
@ -284,6 +287,7 @@ SVCmd_WriteIP_f(void)
for (i = 0; i < numipfilters; i++)
{
/* PVS NOTE: maybe use memcpy here? */
*(unsigned *)b = ipfilters[i].compare;
fprintf(f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
}

View file

@ -392,7 +392,7 @@ SP_target_explosion(edict_t *ent)
void
use_target_changelevel(edict_t *self, edict_t *other, edict_t *activator)
{
if (!self || !other || !activator)
if (!self || !other)
{
return;
}

View file

@ -597,7 +597,6 @@ SP_turret_driver(edict_t *self)
void
turret_brain_think(edict_t *self)
{
vec3_t target;
vec3_t dir;
vec3_t endpos;
float reaction_time;
@ -631,6 +630,9 @@ turret_brain_think(edict_t *self)
self->monsterinfo.trail_time = level.time;
self->monsterinfo.aiflags &= ~AI_LOST_SIGHT;
VectorAdd(self->enemy->absmax, self->enemy->absmin, endpos);
VectorScale(endpos, 0.5, endpos);
}
else
{
@ -656,8 +658,7 @@ turret_brain_think(edict_t *self)
}
/* let the turret know where we want it to aim */
VectorCopy(endpos, target);
VectorSubtract(target, self->target_ent->s.origin, dir);
VectorSubtract(endpos, self->target_ent->s.origin, dir);
vectoangles(dir, self->target_ent->move_angles);
/* decide if we should shoot */

View file

@ -285,11 +285,6 @@ G_UseTargets(edict_t *ent, edict_t *activator)
t->think = Think_Delay;
t->activator = activator;
if (!activator)
{
gi.dprintf("Think_Delay with no activator\n");
}
t->message = ent->message;
t->target = ent->target;
t->killtarget = ent->killtarget;

View file

@ -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;

View file

@ -756,7 +756,6 @@ void cleanupHealTarget(edict_t *ent);
#define DEFAULT_BULLET_VSPREAD 500
#define DEFAULT_SHOTGUN_HSPREAD 1000
#define DEFAULT_SHOTGUN_VSPREAD 500
#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12
#define DEFAULT_SHOTGUN_COUNT 12
#define DEFAULT_SSHOTGUN_COUNT 20

View file

@ -790,10 +790,6 @@ Boss2_CheckAttack(edict_t *self)
{
chance = 0.4;
}
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR)
{
chance = 0.8;

View file

@ -807,10 +807,6 @@ Jorg_CheckAttack(edict_t *self)
{
chance = 0.4;
}
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR)
{
chance = 0.4;

View file

@ -990,10 +990,6 @@ Makron_CheckAttack(edict_t *self)
{
chance = 0.4;
}
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR)
{
chance = 0.4;

View file

@ -1436,10 +1436,6 @@ Carrier_CheckAttack(edict_t *self)
{
chance = 0.4;
}
else if (enemy_range == RANGE_MELEE)
{
chance = 0.8;
}
else if (enemy_range == RANGE_NEAR)
{
chance = 0.8;

View file

@ -330,11 +330,6 @@ InfantryMachineGun(edict_t *self)
return;
}
if (!self->enemy || !self->enemy->inuse)
{
return;
}
/* new attack start frame */
if (self->s.frame == FRAME_attak104)
{
@ -343,7 +338,7 @@ InfantryMachineGun(edict_t *self)
G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
forward, right, start);
if (self->enemy)
if (self->enemy && self->enemy->inuse)
{
VectorMA(self->enemy->s.origin, -0.2, self->enemy->velocity, target);
target[2] += self->enemy->viewheight;

View file

@ -18,7 +18,6 @@ edict_t *new_bad;
* Returns false if any part of the bottom of the
* entity is off an edge that is not a staircase.
*/
int c_yes, c_no;
qboolean
M_CheckBottom(edict_t *ent)
@ -60,11 +59,9 @@ M_CheckBottom(edict_t *ent)
}
}
c_yes++;
return true; /* we got out easy */
realcheck:
c_no++;
start[2] = mins[2];
/* the midpoint must be within 16 of the bottom */
@ -132,7 +129,6 @@ realcheck:
}
}
c_yes++;
return true;
}
@ -449,34 +445,13 @@ SV_movestep(edict_t *ent, vec3_t move, qboolean relink)
if (!current_bad && new_bad)
{
if (new_bad->owner)
if (new_bad->owner && !strcmp(new_bad->owner->classname, "tesla"))
{
if (!strcmp(new_bad->owner->classname, "tesla"))
if (!ent->enemy || !ent->enemy->inuse ||
!ent->enemy->client || !visible(ent, ent->enemy))
{
if ((!(ent->enemy)) || (!(ent->enemy->inuse)))
{
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
else if (!strcmp(ent->enemy->classname, "telsa"))
{
}
else if ((ent->enemy) && (ent->enemy->client))
{
if (visible(ent, ent->enemy))
{
}
else
{
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
}
else
{
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
TargetTesla(ent, new_bad->owner);
ent->monsterinfo.aiflags |= AI_BLOCKED;
}
}

View file

@ -676,14 +676,11 @@ supertankMachineGun(edict_t *self)
G_ProjectSource(self->s.origin, monster_flash_offset[flash_number],
forward, right, start);
if (self->enemy)
{
VectorCopy(self->enemy->s.origin, vec);
VectorMA(vec, 0, self->enemy->velocity, vec);
vec[2] += self->enemy->viewheight;
VectorSubtract(vec, start, forward);
VectorNormalize(forward);
}
VectorCopy(self->enemy->s.origin, vec);
VectorMA(vec, 0, self->enemy->velocity, vec);
vec[2] += self->enemy->viewheight;
VectorSubtract(vec, start, forward);
VectorNormalize(forward);
monster_fire_bullet(self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD,
DEFAULT_BULLET_VSPREAD, flash_number);

View file

@ -526,7 +526,7 @@ TurretFire(edict_t *self)
VectorCopy(self->enemy->s.origin, end);
/* aim for the head. */
if ((self->enemy) && (self->enemy->client))
if (self->enemy->client)
{
end[2] += self->enemy->viewheight;
}

View file

@ -1712,42 +1712,6 @@ ThrowWidowGibReal(edict_t *self, char *gibname, int damage, int type,
gi.linkentity(gib);
}
void
BloodFountain(edict_t *self, int number, vec3_t startpos, int damage)
{
int n;
vec3_t vd;
vec3_t origin, size, velocity;
if (!self)
{
return;
}
return;
for (n = 0; n < number; n++)
{
if (startpos)
{
VectorCopy(startpos, origin);
}
else
{
VectorScale(self->size, 0.5, size);
VectorAdd(self->absmin, size, origin);
origin[0] = origin[0] + crandom() * size[0];
origin[1] = origin[1] + crandom() * size[1];
origin[2] = origin[2] + crandom() * size[2];
}
WidowVelocityForDamage(damage, vd);
VectorMA(self->velocity, 1.0, vd, velocity);
velocity[0] *= 2;
velocity[1] *= 2;
}
}
void
ThrowSmallStuff(edict_t *self, vec3_t point)
{

View file

@ -325,7 +325,7 @@ ClientObituary(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker
self->enemy = attacker;
if (attacker && attacker->client)
if (attacker->client)
{
switch (mod)
{
@ -589,7 +589,7 @@ LookAtKiller(edict_t *self, edict_t *inflictor, edict_t *attacker)
{
vec3_t dir;
if (!self || !inflictor || !attacker)
if (!self)
{
return;
}
@ -833,7 +833,6 @@ InitClientPersistant(gclient_t *client)
client->pers.max_prox = 50;
client->pers.max_tesla = 50;
client->pers.max_flechettes = 200;
client->pers.max_flechettes = 200;
client->pers.max_rounds = 100;
client->pers.connected = true;

View file

@ -537,7 +537,7 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int F
{
int n;
if (!ent || !pause_frames || !fire)
if (!ent || !fire)
{
return;
}
@ -1711,16 +1711,8 @@ weapon_shotgun_fire(edict_t *ent)
kick *= damage_multiplier;
}
if (deathmatch->value)
{
fire_shotgun(ent, start, forward, damage, kick, 500, 500,
DEFAULT_DEATHMATCH_SHOTGUN_COUNT, MOD_SHOTGUN);
}
else
{
fire_shotgun(ent, start, forward, damage, kick, 500, 500,
DEFAULT_SHOTGUN_COUNT, MOD_SHOTGUN);
}
fire_shotgun(ent, start, forward, damage, kick, 500, 500,
DEFAULT_SHOTGUN_COUNT, MOD_SHOTGUN);
/* send muzzle flash */
gi.WriteByte(svc_muzzleflash);

View file

@ -206,7 +206,6 @@ extern void WidowExplosion1 ( edict_t * self ) ;
extern void WidowExplode ( edict_t * self ) ;
extern void ThrowMoreStuff ( edict_t * self , vec3_t point ) ;
extern void ThrowSmallStuff ( edict_t * self , vec3_t point ) ;
extern void BloodFountain ( edict_t * self , int number , vec3_t startpos , int damage ) ;
extern void ThrowWidowGibReal ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean sized , int hitsound , qboolean fade ) ;
extern void ThrowWidowGibSized ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , int hitsound , qboolean fade ) ;
extern void ThrowWidowGibLoc ( edict_t * self , char * gibname , int damage , int type , vec3_t startpos , qboolean fade ) ;

View file

@ -206,7 +206,6 @@
{"WidowExplode", (byte *)WidowExplode},
{"ThrowMoreStuff", (byte *)ThrowMoreStuff},
{"ThrowSmallStuff", (byte *)ThrowSmallStuff},
{"BloodFountain", (byte *)BloodFountain},
{"ThrowWidowGibReal", (byte *)ThrowWidowGibReal},
{"ThrowWidowGibSized", (byte *)ThrowWidowGibSized},
{"ThrowWidowGibLoc", (byte *)ThrowWidowGibLoc},

View file

@ -57,7 +57,7 @@ RotatePointAroundVector(vec3_t dst, const vec3_t dir,
im[2][1] = m[1][2];
memset(zrot, 0, sizeof(zrot));
zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F;
zrot[1][1] = zrot[2][2] = 1.0F;
zrot[0][0] = (float)cos(DEG2RAD(degrees));
zrot[0][1] = (float)sin(DEG2RAD(degrees));
@ -851,6 +851,7 @@ Swap_Init(void)
byte swaptest[2] = {1, 0};
/* set the byte swapping variables in a portable manner */
/* PVS NOTE: maybe use memcpy instead? */
if (*(short *)swaptest == 1)
{
bigendien = false;
@ -1072,7 +1073,7 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
len = vsnprintf(bigbuffer, 0x10000, fmt, argptr);
va_end(argptr);
if ((len >= size) || (len == size))
if (len >= size)
{
Com_Printf("Com_sprintf: overflow\n");
@ -1325,7 +1326,7 @@ Info_SetValueForKey(char *s, char *key, char *value)
Info_RemoveKey(s, key);
if (!value || !strlen(value))
if (*value == '\0')
{
return;
}