From: LegendaryGuard Date: Fri, 4 Aug 2023 23:07:08 +0000 (+0200) Subject: Wrap some statuses with parentesis to avoid possible obscure bugs X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=ff0befb7d2c673b926cbc9bf0bbf8a1e07f2aff6;p=xonotic%2Fxonotic-data.pk3dir.git Wrap some statuses with parentesis to avoid possible obscure bugs --- diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 075dfb371..0dd48716f 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -214,7 +214,7 @@ void HUD_StrafeHUD() { trace_dphitq3surfaceflags = 0; tracebox(strafeplayer.origin, strafeplayer.mins, strafeplayer.maxs, strafeplayer.origin - '0 0 1', MOVE_NOMONSTERS, strafeplayer); - onslick = trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK; + onslick = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK); } real_onslick = onslick; @@ -333,7 +333,7 @@ void HUD_StrafeHUD() } else // alternatively calculate wishdir by querying pressed keys { - if(keys & KEY_FORWARD || keys & KEY_BACKWARD) + if((keys & KEY_FORWARD) || (keys & KEY_BACKWARD)) wishangle = 45; else wishangle = 90; @@ -806,7 +806,8 @@ void HUD_StrafeHUD() slickoffset.y = cos(j * DEG2RAD) * slickrotate; traceline(traceorigin, traceorigin + slickoffset, MOVE_NOMONSTERS, strafeplayer); - if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) || trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) + if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) + || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)) slickdetected = true; if(i == 0) break; diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index b51c5761d..dde130da8 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -499,7 +499,7 @@ void HUD_Weapons() } else { - if (it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK) + if ((it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)) && !(weapons_stat & WepSet_FromWeapon(it))) { continue; diff --git a/qcsrc/client/items/items.qc b/qcsrc/client/items/items.qc index 1b03ba8fc..dba2c8ffc 100644 --- a/qcsrc/client/items/items.qc +++ b/qcsrc/client/items/items.qc @@ -75,12 +75,12 @@ void ItemSetModel(entity this, bool wantsimple) void ItemDraw(entity this) { - bool wantsimple = autocvar_cl_simple_items && this.ItemStatus & ITS_ALLOWSI; + bool wantsimple = autocvar_cl_simple_items && (this.ItemStatus & ITS_ALLOWSI); if(wantsimple != this.item_simple && this.item_simple != -1) ItemSetModel(this, wantsimple); // no bobbing applied to simple items, for consistency's sake (no visual difference between ammo and weapons) - bool animate = autocvar_cl_items_animate & 1 && this.item_simple <= 0 && (this.ItemStatus & ITS_ANIMATE1 || this.ItemStatus & ITS_ANIMATE2); + bool animate = (autocvar_cl_items_animate & 1) && this.item_simple <= 0 && ((this.ItemStatus & ITS_ANIMATE1) || (this.ItemStatus & ITS_ANIMATE2)); // rotation must be set before running physics if(!animate) @@ -201,7 +201,7 @@ void ItemDraw(entity this) if(autocvar_cl_items_animate & 2) this.alpha *= (this.wait - time) / IT_DESPAWNFX_TIME; - if(autocvar_cl_items_animate & 4 && time >= this.pointtime) + if((autocvar_cl_items_animate & 4) && time >= this.pointtime) { pointparticles(EFFECT_ITEM_DESPAWN, this.origin + '0 0 16', '0 0 0', 1); if (this.delay > 0.0625) @@ -275,7 +275,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(this.ItemStatus & ITS_GLOW) this.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT); - if(prevItemStatus & ITS_AVAILABLE && this.alpha) + if((prevItemStatus & ITS_AVAILABLE) && this.alpha) pointparticles(EFFECT_ITEM_PICKUP, (this.absmin + this.absmax) * 0.5, '0 0 0', 1); } } diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 58d497aab..5f2332c69 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -744,7 +744,7 @@ NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew) for(int i = 0; i < maxclients;) for(int f = ReadByte(), b = 0; b < 8 && i < maxclients; ++b, ++i) if(playerslots[i]) - playerslots[i].ready = f & BIT(b); + playerslots[i].ready = (f & BIT(b)); return = true; diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index b49ff60fa..a61a8bd09 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -164,8 +164,8 @@ NET_HANDLE(casings, bool isNew) return = true; - casing.silent = casing.state & 0x80; - if (casing.state & 0x40 && !autocvar_chase_active) + casing.silent = (casing.state & 0x80); + if ((casing.state & 0x40) && !autocvar_chase_active) casing.origin += autocvar_cl_gunoffset.x * v_forward - autocvar_cl_gunoffset.y * v_right + autocvar_cl_gunoffset.z * v_up; diff --git a/qcsrc/common/mapobjects/teleporters.qc b/qcsrc/common/mapobjects/teleporters.qc index b9698446c..651566c71 100644 --- a/qcsrc/common/mapobjects/teleporters.qc +++ b/qcsrc/common/mapobjects/teleporters.qc @@ -223,8 +223,8 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) if(vdist(player.velocity, >, e.speed)) player.velocity = normalize(player.velocity) * max(0, e.speed); - if(!(teleporter.classname == "trigger_teleport" && teleporter.spawnflags & TELEPORT_KEEP_SPEED) && - !(teleporter.classname == "target_teleporter" && teleporter.spawnflags & TARGET_TELEPORTER_KEEP_SPEED)) + if(!(teleporter.classname == "trigger_teleport" && (teleporter.spawnflags & TELEPORT_KEEP_SPEED)) && + !(teleporter.classname == "target_teleporter" && (teleporter.spawnflags & TARGET_TELEPORTER_KEEP_SPEED))) if(STAT(TELEPORT_MAXSPEED, player)) if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player))) player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player)); diff --git a/qcsrc/common/mapobjects/trigger/jumppads.qc b/qcsrc/common/mapobjects/trigger/jumppads.qc index 98498de1c..82f7088e5 100644 --- a/qcsrc/common/mapobjects/trigger/jumppads.qc +++ b/qcsrc/common/mapobjects/trigger/jumppads.qc @@ -249,7 +249,7 @@ bool jumppad_push(entity this, entity targ, bool is_velocity_pad) vector org = targ.origin; - if(Q3COMPAT_COMMON || this.spawnflags & PUSH_STATIC) + if(Q3COMPAT_COMMON || (this.spawnflags & PUSH_STATIC)) org = (this.absmin + this.absmax) * 0.5; bool already_pushed = false; diff --git a/qcsrc/common/mapobjects/trigger/teleport.qc b/qcsrc/common/mapobjects/trigger/teleport.qc index b581db061..cc8189a03 100644 --- a/qcsrc/common/mapobjects/trigger/teleport.qc +++ b/qcsrc/common/mapobjects/trigger/teleport.qc @@ -40,7 +40,7 @@ bool Teleport_Active(entity this, entity player) return false; // no need to call IS_OBSERVER(), observers never call use/touch functions which means this is never an observer - if(this.classname == "trigger_teleport" && this.spawnflags & TELEPORT_OBSERVERS_ONLY) + if(this.classname == "trigger_teleport" && (this.spawnflags & TELEPORT_OBSERVERS_ONLY)) return false; return true;