diff --git a/src/game/g_ai.c b/src/game/g_ai.c index 9f9dd628..5ae89d11 100644 --- a/src/game/g_ai.c +++ b/src/game/g_ai.c @@ -806,10 +806,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; @@ -1319,8 +1315,5 @@ ai_run(edict_t *self, float dist) G_FreeEdict(tempgoal); - if (self) - { - self->goalentity = save; - } + self->goalentity = save; } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index ef36d851..e0bf3286 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -146,7 +146,7 @@ Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker, } /* medics won't heal monsters that they kill themselves */ - if (attacker && attacker->classname && strcmp(attacker->classname, "monster_medic") == 0) + if (attacker->classname && strcmp(attacker->classname, "monster_medic") == 0) { targ->owner = attacker; } @@ -490,7 +490,7 @@ M_ReactToDamage(edict_t *targ, edict_t *attacker) } /* 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) { @@ -655,12 +655,6 @@ T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, /* treat cheat/powerup savings the same as armor */ asave += save; - /* team damage avoidance */ - if (!(dflags & DAMAGE_NO_PROTECTION) && false) - { - return; - } - /* do the damage */ if (take) { diff --git a/src/game/g_func.c b/src/game/g_func.c index 18d930bc..3f2b9cea 100644 --- a/src/game/g_func.c +++ b/src/game/g_func.c @@ -568,7 +568,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); @@ -659,7 +659,7 @@ plat_spawn_inside_trigger(edict_t *ent) tmin[0] = ent->mins[0] + 25; tmin[1] = ent->mins[1] + 25; - tmin[2] = ent->mins[2]; + // tmin[2] = ent->mins[2]; tmax[0] = ent->maxs[0] - 25; tmax[1] = ent->maxs[1] - 25; @@ -932,11 +932,6 @@ SP_func_rotating(edict_t *ent) ent->use = rotating_use; - if (ent->dmg) - { - ent->blocked = rotating_blocked; - } - if (ent->spawnflags & 1) { ent->use(ent, NULL, NULL); @@ -1602,7 +1597,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); @@ -2035,10 +2030,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"); @@ -2134,7 +2125,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); @@ -2831,7 +2822,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); diff --git a/src/game/g_items.c b/src/game/g_items.c index 129a2aa3..e20752b5 100644 --- a/src/game/g_items.c +++ b/src/game/g_items.c @@ -1301,13 +1301,13 @@ Drop_Item(edict_t *ent, gitem_t *item) dropped->s.effects = item->world_model_flags; dropped->s.renderfx = RF_GLOW; - if (randk() > 0.5) + if (frandk() > 0.5) { - dropped->s.angles[1] += randk()*45; + dropped->s.angles[1] += frandk()*45; } else { - dropped->s.angles[1] -= randk()*45; + dropped->s.angles[1] -= frandk()*45; } VectorSet (dropped->mins, -16, -16, -16); diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 561948e2..0b2abf29 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -138,7 +138,7 @@ gib_think(edict_t *self) void gib_touch(edict_t *self, edict_t *other /* unused */, cplane_t *plane, csurface_t *surf /* unused */) { - if (!self || !plane) + if (!self) { return; } @@ -892,13 +892,9 @@ void func_object_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf /* unused */) { - if (!self || !other || !plane) - { - return; - } - /* only squash thing we fall on top of */ - if (!plane) + + if (!self || !other || !plane) { return; } diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index b39507d3..19a41347 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -85,8 +85,8 @@ StringToFilter(char *s, ipfilter_t *f) { char num[128]; int i, j; - byte b[4]; - byte m[4]; + YQ2_ALIGNAS_TYPE(unsigned) byte b[4]; + YQ2_ALIGNAS_TYPE(unsigned) byte m[4]; if (!s || !f) { @@ -141,7 +141,7 @@ SV_FilterPacket(char *from) { int i; unsigned in; - byte m[4]; + YQ2_ALIGNAS_TYPE(unsigned) byte m[4]; char *p; if (!from) @@ -259,7 +259,7 @@ void SVCmd_ListIP_f(void) { int i; - byte b[4]; + YQ2_ALIGNAS_TYPE(unsigned) byte b[4]; gi.cprintf(NULL, PRINT_HIGH, "Filter list:\n"); @@ -276,7 +276,7 @@ SVCmd_WriteIP_f(void) { FILE *f; char name[MAX_OSPATH]; - byte b[4]; + YQ2_ALIGNAS_TYPE(unsigned) byte b[4]; int i; cvar_t *game; diff --git a/src/game/g_target.c b/src/game/g_target.c index f728c31f..25730d7b 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -415,7 +415,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; } diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 9b4310ea..beb4753f 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -216,7 +216,7 @@ G_UseTargets(edict_t *ent, edict_t *activator) { edict_t *t; - if (!ent || !activator) + if (!ent) { return; } @@ -242,6 +242,11 @@ G_UseTargets(edict_t *ent, edict_t *activator) return; } + if (!activator) + { + return; + } + /* print the message */ if ((ent->message) && !(activator->svflags & SVF_MONSTER)) { diff --git a/src/game/monster/boss2/boss2.c b/src/game/monster/boss2/boss2.c index 20783208..0aa7e60e 100644 --- a/src/game/monster/boss2/boss2.c +++ b/src/game/monster/boss2/boss2.c @@ -742,10 +742,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; diff --git a/src/game/monster/boss3/boss31.c b/src/game/monster/boss3/boss31.c index 60d163de..bb8a2351 100644 --- a/src/game/monster/boss3/boss31.c +++ b/src/game/monster/boss3/boss31.c @@ -842,10 +842,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; diff --git a/src/game/monster/boss3/boss32.c b/src/game/monster/boss3/boss32.c index bd644811..07458e73 100644 --- a/src/game/monster/boss3/boss32.c +++ b/src/game/monster/boss3/boss32.c @@ -1015,10 +1015,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; diff --git a/src/game/monster/gladiator/gladiator.c b/src/game/monster/gladiator/gladiator.c index a8e74c24..7fa2f36c 100644 --- a/src/game/monster/gladiator/gladiator.c +++ b/src/game/monster/gladiator/gladiator.c @@ -193,11 +193,6 @@ GaldiatorMelee(edict_t *self) return; } - if (!self) - { - return; - } - VectorSet(aim, MELEE_DISTANCE, self->mins[0], -4); if (fire_hit(self, aim, (20 + (randk() % 5)), 300)) diff --git a/src/game/monster/insane/insane.c b/src/game/monster/insane/insane.c index 7d18137e..0b6e1f00 100644 --- a/src/game/monster/insane/insane.c +++ b/src/game/monster/insane/insane.c @@ -644,9 +644,7 @@ insane_run(edict_t *self) { self->monsterinfo.currentmove = &insane_move_runcrawl; } - else - - if (random() <= 0.5) /* Else, mix it up */ + else if (frandk() <= 0.5) /* Else, mix it up */ { self->monsterinfo.currentmove = &insane_move_run_normal; } diff --git a/src/game/monster/misc/move.c b/src/game/monster/misc/move.c index d58edad5..2dcf6909 100644 --- a/src/game/monster/misc/move.c +++ b/src/game/monster/misc/move.c @@ -383,11 +383,6 @@ M_ChangeYaw(edict_t *ent) return; } - if (!ent) - { - return; - } - current = anglemod(ent->s.angles[YAW]); ideal = ent->ideal_yaw; @@ -500,11 +495,6 @@ SV_NewChaseDir(edict_t *actor, edict_t *enemy, float dist) return; } - if (!enemy) - { - return; - } - olddir = anglemod((int)(actor->ideal_yaw / 45) * 45); turnaround = anglemod(olddir - 180); diff --git a/src/game/player/client.c b/src/game/player/client.c index 7981e28f..292c6ba6 100644 --- a/src/game/player/client.c +++ b/src/game/player/client.c @@ -801,7 +801,7 @@ LookAtKiller(edict_t *self, edict_t *inflictor, edict_t *attacker) { vec3_t dir; - if (!self || !inflictor || !attacker) + if (!self) { return; }