From 7fdbf7937f5130e5cd6a3431a57aceed909e2a66 Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 6 May 2015 20:55:32 +1000 Subject: [PATCH] Use the BIT macro --- qcsrc/client/csqc_constants.qh | 82 +++++++++---------- qcsrc/client/csqcmodel_hooks.qc | 32 ++++---- qcsrc/client/main.qc | 16 ++-- qcsrc/common/animdecide.qh | 22 ++--- qcsrc/common/constants.qh | 26 +++--- qcsrc/common/csqcmodel_settings.qh | 50 +++++------ qcsrc/common/weapons/weapon/arc.qc | 12 +-- qcsrc/lib/csqcmodel/common.qh | 18 ++-- qcsrc/lib/csqcmodel/interpolate.qh | 22 ++--- qcsrc/server/bot/bot.qh | 24 +++--- qcsrc/server/bot/scripting.qc | 22 ++--- qcsrc/server/bot/waypoints.qh | 16 ++-- qcsrc/server/command/vote.qc | 30 +++---- qcsrc/server/constants.qh | 14 ++-- qcsrc/server/defs.qh | 22 ++--- qcsrc/server/g_hook.qh | 10 +-- qcsrc/server/g_models.qc | 4 +- qcsrc/server/item_key.qc | 12 +-- qcsrc/server/miscfunctions.qh | 8 +- .../mutators/mutator/mutator_superspec.qc | 18 ++-- qcsrc/server/pathlib/pathlib.qh | 18 ++-- qcsrc/server/t_items.qh | 28 +++---- 22 files changed, 253 insertions(+), 253 deletions(-) diff --git a/qcsrc/client/csqc_constants.qh b/qcsrc/client/csqc_constants.qh index 584f001f8..d70de9cb3 100644 --- a/qcsrc/client/csqc_constants.qh +++ b/qcsrc/client/csqc_constants.qh @@ -2,16 +2,16 @@ #define CLIENT_CSQC_CONSTANTS // Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask) -const int MASK_ENGINE = 1; -const int MASK_ENGINEVIEWMODELS = 2; -const int MASK_NORMAL = 4; +const int MASK_ENGINE = BIT(0); +const int MASK_ENGINEVIEWMODELS = BIT(1); +const int MASK_NORMAL = BIT(2); // Renderflag Constants (used for CSQC entities) -const int RF_VIEWMODEL = 1; -const int RF_EXTERNALMODEL = 2; -const int RF_DEPTHHACK = 4; -const int RF_ADDITIVE = 8; -const int RF_USEAXIS = 16; +const int RF_VIEWMODEL = BIT(0); +const int RF_EXTERNALMODEL = BIT(1); +const int RF_DEPTHHACK = BIT(2); +const int RF_ADDITIVE = BIT(3); +const int RF_USEAXIS = BIT(4); // Viewflag Constants (use with R_SetView) const int VF_MIN = 1; //(vector) @@ -59,21 +59,21 @@ const vector VEC_HULL_MIN = '-16 -16 -24'; const vector VEC_HULL_MAX = '16 16 32'; // Effect Constants -const int EF_NODRAW = 16; -const int EF_ADDITIVE = 32; -const int EF_BLUE = 64; -const int EF_RED = 128; -const int EF_FULLBRIGHT = 512; -const int EF_FLAME = 1024; -const int EF_STARDUST = 2048; -const int EF_NOSHADOW = 4096; -const int EF_NODEPTHTEST = 8192; +const int EF_NODRAW = BIT(4); +const int EF_ADDITIVE = BIT(5); +const int EF_BLUE = BIT(6); +const int EF_RED = BIT(7); +const int EF_FULLBRIGHT = BIT(9); +const int EF_FLAME = BIT(10); +const int EF_STARDUST = BIT(11); +const int EF_NOSHADOW = BIT(12); +const int EF_NODEPTHTEST = BIT(13); // Quake Player Flag Constants -const int PFL_ONGROUND = 1; -const int PFL_CROUCH = 2; -const int PFL_DEAD = 4; -const int PFL_GIBBED = 8; +const int PFL_ONGROUND = BIT(0); +const int PFL_CROUCH = BIT(1); +const int PFL_DEAD = BIT(2); +const int PFL_GIBBED = BIT(3); // Quake Temporary Entity Constants const int TE_SPIKE = 0; @@ -104,25 +104,25 @@ const int FILE_APPEND = 1; const int FILE_WRITE = 2; // Button values used by input_buttons -const int BUTTON_ATTACK = 1; -const int BUTTON_JUMP = 2; -const int BUTTON_3 = 4; -const int BUTTON_4 = 8; -const int BUTTON_5 = 16; -const int BUTTON_6 = 32; -const int BUTTON7 = 64; -const int BUTTON8 = 128; -const int BUTTON_USE = 256; -const int BUTTON_CHAT = 512; -const int BUTTON_PRYDONCURSOR = 1024; -const int BUTTON_9 = 2048; -const int BUTTON_10 = 4096; -const int BUTTON_11 = 8192; -const int BUTTON_12 = 16384; -const int BUTTON_13 = 32768; -const int BUTTON_14 = 65536; -const int BUTTON_15 = 131072; -const int BUTTON_16 = 262144; +const int BUTTON_ATTACK = BIT(0); +const int BUTTON_JUMP = BIT(1); +const int BUTTON_3 = BIT(2); +const int BUTTON_4 = BIT(3); +const int BUTTON_5 = BIT(4); +const int BUTTON_6 = BIT(5); +const int BUTTON7 = BIT(6); +const int BUTTON8 = BIT(7); +const int BUTTON_USE = BIT(8); +const int BUTTON_CHAT = BIT(9); +const int BUTTON_PRYDONCURSOR = BIT(10); +const int BUTTON_9 = BIT(11); +const int BUTTON_10 = BIT(12); +const int BUTTON_11 = BIT(13); +const int BUTTON_12 = BIT(14); +const int BUTTON_13 = BIT(15); +const int BUTTON_14 = BIT(16); +const int BUTTON_15 = BIT(17); +const int BUTTON_16 = BIT(18); const int SOLID_NOT = 0; // no interaction with other objects const int SOLID_TRIGGER = 1; // touch on edge, but not blocking @@ -140,6 +140,6 @@ const int MOVE_WORLDONLY = 3; const int CAMERA_FREE = 1; const int CAMERA_CHASE = 2; -const int EF_NOMODELFLAGS = 8388608; +const int EF_NOMODELFLAGS = BIT(23); #endif diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 6e7e5a8de..e2e0e9341 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -462,22 +462,22 @@ void CSQCModel_AutoTagIndex_Apply(void) } // FEATURE: EF_NODRAW workalike -const int EF_BRIGHTFIELD = 1; -const int EF_BRIGHTLIGHT = 4; -const int EF_DIMLIGHT = 8; -const int EF_DOUBLESIDED = 32768; -const int EF_NOSELFSHADOW = 65536; -const int EF_DYNAMICMODELLIGHT = 131072; -const int EF_RESTARTANIM_BIT = 1048576; -const int EF_TELEPORT_BIT = 2097152; -const int MF_ROCKET = 1; // leave a trail -const int MF_GRENADE = 2; // leave a trail -const int MF_GIB = 4; // leave a trail -const int MF_ROTATE = 8; // rotate (bonus items) -const int MF_TRACER = 16; // green split trail -const int MF_ZOMGIB = 32; // small blood trail -const int MF_TRACER2 = 64; // orange split trail -const int MF_TRACER3 = 128; // purple trail +const int EF_BRIGHTFIELD = BIT(0); +const int EF_BRIGHTLIGHT = BIT(2); +const int EF_DIMLIGHT = BIT(3); +const int EF_DOUBLESIDED = BIT(15); +const int EF_NOSELFSHADOW = BIT(16); +const int EF_DYNAMICMODELLIGHT = BIT(17); +const int EF_RESTARTANIM_BIT = BIT(20); +const int EF_TELEPORT_BIT = BIT(21); +const int MF_ROCKET = BIT(0); // leave a trail +const int MF_GRENADE = BIT(1); // leave a trail +const int MF_GIB = BIT(2); // leave a trail +const int MF_ROTATE = BIT(3); // rotate (bonus items) +const int MF_TRACER = BIT(4); // green split trail +const int MF_ZOMGIB = BIT(5); // small blood trail +const int MF_TRACER2 = BIT(6); // orange split trail +const int MF_TRACER3 = BIT(7); // purple trail .int csqcmodel_effects; .int csqcmodel_modelflags; .int csqcmodel_traileffect; diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index bcbe32bb9..d43c0bbbe 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -558,7 +558,7 @@ void Ent_Nagger() int nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS - if(!(nags & 4)) + if(!(nags & BIT(2))) { if(vote_called_vote) strunzone(vote_called_vote); @@ -570,7 +570,7 @@ void Ent_Nagger() vote_active = 1; } - if(nags & 64) + if(nags & BIT(6)) { vote_yescount = ReadByte(); vote_nocount = ReadByte(); @@ -578,7 +578,7 @@ void Ent_Nagger() vote_highlighted = ReadChar(); } - if(nags & 128) + if(nags & BIT(7)) { if(vote_called_vote) strunzone(vote_called_vote); @@ -600,11 +600,11 @@ void Ent_Nagger() } } - ready_waiting = (nags & 1); - ready_waiting_for_me = (nags & 2); - vote_waiting = (nags & 4); - vote_waiting_for_me = (nags & 8); - warmup_stage = (nags & 16); + ready_waiting = (nags & BIT(0)); + ready_waiting_for_me = (nags & BIT(1)); + vote_waiting = (nags & BIT(2)); + vote_waiting_for_me = (nags & BIT(3)); + warmup_stage = (nags & BIT(4)); } void Ent_EliminatedPlayers() diff --git a/qcsrc/common/animdecide.qh b/qcsrc/common/animdecide.qh index d122b6a36..521c6ab98 100644 --- a/qcsrc/common/animdecide.qh +++ b/qcsrc/common/animdecide.qh @@ -62,19 +62,19 @@ void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int // explicit anim states (networked) void animdecide_setstate(entity e, int newstate, float restart); -const int ANIMSTATE_DEAD1 = 1; // base frames: die1 -const int ANIMSTATE_DEAD2 = 2; // base frames: die2 -const int ANIMSTATE_DUCK = 4; // turns walk into duckwalk, jump into duckjump, etc. -const int ANIMSTATE_FROZEN = 8; // force idle -const int ANIMSTATE_FOLLOW = 16; // also force idle +const int ANIMSTATE_DEAD1 = BIT(0); // base frames: die1 +const int ANIMSTATE_DEAD2 = BIT(1); // base frames: die2 +const int ANIMSTATE_DUCK = BIT(2); // turns walk into duckwalk, jump into duckjump, etc. +const int ANIMSTATE_FROZEN = BIT(3); // force idle +const int ANIMSTATE_FOLLOW = BIT(4); // also force idle // implicit anim states (inferred from velocity, etc.) -const int ANIMIMPLICITSTATE_INAIR = 1; -const int ANIMIMPLICITSTATE_FORWARD = 2; -const int ANIMIMPLICITSTATE_BACKWARDS = 4; -const int ANIMIMPLICITSTATE_LEFT = 8; -const int ANIMIMPLICITSTATE_RIGHT = 16; -const int ANIMIMPLICITSTATE_JUMPRELEASED = 32; +const int ANIMIMPLICITSTATE_INAIR = BIT(0); +const int ANIMIMPLICITSTATE_FORWARD = BIT(1); +const int ANIMIMPLICITSTATE_BACKWARDS = BIT(2); +const int ANIMIMPLICITSTATE_LEFT = BIT(3); +const int ANIMIMPLICITSTATE_RIGHT = BIT(4); +const int ANIMIMPLICITSTATE_JUMPRELEASED = BIT(5); // explicit actions (networked); negative values are for lower body void animdecide_setaction(entity e, float action, float restart); diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index a4329ad44..254246bdf 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -136,14 +136,14 @@ const int SPRITERULE_SPECTATOR = 2; /////////////////////////// // keys pressed -const int KEY_FORWARD = 1; -const int KEY_BACKWARD = 2; -const int KEY_LEFT = 4; -const int KEY_RIGHT = 8; -const int KEY_JUMP = 16; -const int KEY_CROUCH = 32; -const int KEY_ATCK = 64; -const int KEY_ATCK2 = 128; +const int KEY_FORWARD = BIT(0); +const int KEY_BACKWARD = BIT(1); +const int KEY_LEFT = BIT(2); +const int KEY_RIGHT = BIT(3); +const int KEY_JUMP = BIT(4); +const int KEY_CROUCH = BIT(5); +const int KEY_ATCK = BIT(6); +const int KEY_ATCK2 = BIT(7); /////////////////////////// // cvar constants @@ -169,27 +169,27 @@ const int MAPVOTE_COUNT = 30; /** * Lower scores are better (e.g. suicides) */ -const int SFL_LOWER_IS_BETTER = 1; +const int SFL_LOWER_IS_BETTER = BIT(0); /** * Don't show zero values as scores */ -const int SFL_HIDE_ZERO = 2; +const int SFL_HIDE_ZERO = BIT(1); /** * Allow a column to be hidden (do not automatically add it even if it is a sorting key) */ -const int SFL_ALLOW_HIDE = 16; +const int SFL_ALLOW_HIDE = BIT(4); /** * Display as a rank (with st, nd, rd, th suffix) */ -const int SFL_RANK = 32; +const int SFL_RANK = BIT(5); /** * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!) */ -const int SFL_TIME = 64; +const int SFL_TIME = BIT(6); // not an extra constant yet #define SFL_ZERO_IS_WORST SFL_TIME diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 256142759..eacc1947e 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -32,37 +32,37 @@ // add properties you want networked to CSQC here #define CSQCMODEL_EXTRAPROPERTIES \ - CSQCMODEL_PROPERTY(1, int, ReadShort, WriteShort, colormap) \ - CSQCMODEL_PROPERTY(2, int, ReadInt24_t, WriteInt24_t, effects) \ - CSQCMODEL_PROPERTY(4, int, ReadByte, WriteByte, modelflags) \ - CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \ - CSQCMODEL_PROPERTY(16, int, ReadByte, WriteByte, skin) \ - CSQCMODEL_PROPERTY(32, float, ReadApproxPastTime, WriteApproxPastTime, death_time) \ - CSQCMODEL_PROPERTY(64, float, ReadByte, WriteByte, solid) \ + CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \ + CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \ + CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \ + CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, alpha, 254, -1, 254) \ + CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, skin) \ + CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \ + CSQCMODEL_PROPERTY(BIT(6), float, ReadByte, WriteByte, solid) \ CSQCMODEL_IF(!isplayer) \ - CSQCMODEL_PROPERTY(128, TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_y, 254, -1, 254) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_z, 254, -1, 254) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_x, 254, -1, 254) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_y, 254, -1, 254) \ - CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_z, 254, -1, 254) \ + CSQCMODEL_PROPERTY(BIT(7), TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_y, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_z, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_x, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_y, 254, -1, 254) \ + CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_z, 254, -1, 254) \ CSQCMODEL_ENDIF \ CSQCMODEL_IF(isplayer) \ - CSQCMODEL_PROPERTY(128, int, ReadByte, WriteByte, anim_state) \ - CSQCMODEL_PROPERTY(128, float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \ + CSQCMODEL_PROPERTY(BIT(7), int, ReadByte, WriteByte, anim_state) \ + CSQCMODEL_PROPERTY(BIT(7), float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \ CSQCMODEL_IF(!islocalplayer) \ - CSQCMODEL_PROPERTY(256, float, ReadChar, WriteChar, anim_lower_action) \ - CSQCMODEL_PROPERTY(256, float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \ + CSQCMODEL_PROPERTY(BIT(8), float, ReadChar, WriteChar, anim_lower_action) \ + CSQCMODEL_PROPERTY(BIT(8), float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \ CSQCMODEL_ENDIF \ - CSQCMODEL_PROPERTY(512, float, ReadChar, WriteChar, anim_upper_action) \ - CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \ + CSQCMODEL_PROPERTY(BIT(9), float, ReadChar, WriteChar, anim_upper_action) \ + CSQCMODEL_PROPERTY(BIT(9), float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \ CSQCMODEL_ENDIF \ - CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \ - CSQCMODEL_PROPERTY(2048, int, ReadByte, WriteByte, traileffect) \ - CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255) \ - CSQCMODEL_PROPERTY(8192, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \ - CSQCMODEL_PROPERTY(16384, TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) + CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \ + CSQCMODEL_PROPERTY(BIT(11), int, ReadByte, WriteByte, traileffect) \ + CSQCMODEL_PROPERTY_SCALED(BIT(12), float, ReadByte, WriteByte, scale, 16, 0, 255) \ + CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \ + CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) // TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody // add hook function calls here diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 8d8f4c43b..b05132cb1 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -74,12 +74,12 @@ const int ARC_BT_BURST_HEAL = 0x12; const int ARC_BT_BURST_HIT = 0x13; const int ARC_BT_BURSTMASK = 0x10; -const int ARC_SF_SETTINGS = 1; -const int ARC_SF_START = 2; -const int ARC_SF_WANTDIR = 4; -const int ARC_SF_BEAMDIR = 8; -const int ARC_SF_BEAMTYPE = 16; -const int ARC_SF_LOCALMASK = 14; +const int ARC_SF_SETTINGS = BIT(0); +const int ARC_SF_START = BIT(1); +const int ARC_SF_WANTDIR = BIT(2); +const int ARC_SF_BEAMDIR = BIT(3); +const int ARC_SF_BEAMTYPE = BIT(4); +const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR; #endif #ifdef SVQC ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) diff --git a/qcsrc/lib/csqcmodel/common.qh b/qcsrc/lib/csqcmodel/common.qh index 884977f90..e922453af 100644 --- a/qcsrc/lib/csqcmodel/common.qh +++ b/qcsrc/lib/csqcmodel/common.qh @@ -54,15 +54,15 @@ IN THE SOFTWARE.\ .float frame2time; .float lerpfrac; -const int CSQCMODEL_PROPERTY_FRAME = 8388608; -const int CSQCMODEL_PROPERTY_TELEPORTED = 4194304; // the "teleport bit" cancelling interpolation -const int CSQCMODEL_PROPERTY_MODELINDEX = 2097152; -const int CSQCMODEL_PROPERTY_ORIGIN = 1048576; -const int CSQCMODEL_PROPERTY_YAW = 524288; -const int CSQCMODEL_PROPERTY_PITCHROLL = 262144; -const int CSQCMODEL_PROPERTY_FRAME2 = 131072; -const int CSQCMODEL_PROPERTY_LERPFRAC = 65536; -const int CSQCMODEL_PROPERTY_SIZE = 32768; +const int CSQCMODEL_PROPERTY_FRAME = BIT(23); +const int CSQCMODEL_PROPERTY_TELEPORTED = BIT(22); // the "teleport bit" cancelling interpolation +const int CSQCMODEL_PROPERTY_MODELINDEX = BIT(21); +const int CSQCMODEL_PROPERTY_ORIGIN = BIT(20); +const int CSQCMODEL_PROPERTY_YAW = BIT(19); +const int CSQCMODEL_PROPERTY_PITCHROLL = BIT(18); +const int CSQCMODEL_PROPERTY_FRAME2 = BIT(17); +const int CSQCMODEL_PROPERTY_LERPFRAC = BIT(BIT(4)); +const int CSQCMODEL_PROPERTY_SIZE = BIT(15); #define ALLPROPERTIES_COMMON \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, int, ReadByte, WriteByte, frame) \ diff --git a/qcsrc/lib/csqcmodel/interpolate.qh b/qcsrc/lib/csqcmodel/interpolate.qh index e07ad4ade..92ec58f0b 100644 --- a/qcsrc/lib/csqcmodel/interpolate.qh +++ b/qcsrc/lib/csqcmodel/interpolate.qh @@ -23,17 +23,17 @@ #define LIB_CSQCMODEL_INTERPOLATE_H .int iflags; -const int IFLAG_VELOCITY = 1; -const int IFLAG_ANGLES = 2; -const int IFLAG_AUTOANGLES = 4; -const int IFLAG_VALID = 8; -const int IFLAG_PREVALID = 16; -const int IFLAG_TELEPORTED = 32; -const int IFLAG_AUTOVELOCITY = 64; -const int IFLAG_V_ANGLE = 128; -const int IFLAG_V_ANGLE_X = 256; -const int IFLAG_ORIGIN = 512; -#define IFLAG_INTERNALMASK (IFLAG_VALID | IFLAG_PREVALID) +const int IFLAG_VELOCITY = BIT(0); +const int IFLAG_ANGLES = BIT(1); +const int IFLAG_AUTOANGLES = BIT(2); +const int IFLAG_VALID = BIT(3); +const int IFLAG_PREVALID = BIT(4); +const int IFLAG_TELEPORTED = BIT(5); +const int IFLAG_AUTOVELOCITY = BIT(6); +const int IFLAG_V_ANGLE = BIT(7); +const int IFLAG_V_ANGLE_X = BIT(8); +const int IFLAG_ORIGIN = BIT(9); +const int IFLAG_INTERNALMASK = IFLAG_VALID | IFLAG_PREVALID; // call this BEFORE reading an entity update void InterpolateOrigin_Undo(); diff --git a/qcsrc/server/bot/bot.qh b/qcsrc/server/bot/bot.qh index d5a279400..2ae70728a 100644 --- a/qcsrc/server/bot/bot.qh +++ b/qcsrc/server/bot/bot.qh @@ -4,18 +4,18 @@ * Globals and Fields */ -const int AI_STATUS_ROAMING = 1; // Bot is just crawling the map. No enemies at sight -const int AI_STATUS_ATTACKING = 2; // There are enemies at sight -const int AI_STATUS_RUNNING = 4; // Bot is bunny hopping -const int AI_STATUS_DANGER_AHEAD = 8; // There is lava/slime/trigger_hurt ahead -const int AI_STATUS_OUT_JUMPPAD = 16; // Trying to get out of a "vertical" jump pad -const int AI_STATUS_OUT_WATER = 32; // Trying to get out of water -const int AI_STATUS_WAYPOINT_PERSONAL_LINKING = 64; // Waiting for the personal waypoint to be linked -const int AI_STATUS_WAYPOINT_PERSONAL_GOING = 128; // Going to a personal waypoint -const int AI_STATUS_WAYPOINT_PERSONAL_REACHED = 256; // Personal waypoint reached -const int AI_STATUS_JETPACK_FLYING = 512; -const int AI_STATUS_JETPACK_LANDING = 1024; -const int AI_STATUS_STUCK = 2048; // Cannot reach any goal +const int AI_STATUS_ROAMING = BIT(0); // Bot is just crawling the map. No enemies at sight +const int AI_STATUS_ATTACKING = BIT(1); // There are enemies at sight +const int AI_STATUS_RUNNING = BIT(2); // Bot is bunny hopping +const int AI_STATUS_DANGER_AHEAD = BIT(3); // There is lava/slime/trigger_hurt ahead +const int AI_STATUS_OUT_JUMPPAD = BIT(4); // Trying to get out of a "vertical" jump pad +const int AI_STATUS_OUT_WATER = BIT(5); // Trying to get out of water +const int AI_STATUS_WAYPOINT_PERSONAL_LINKING = BIT(6); // Waiting for the personal waypoint to be linked +const int AI_STATUS_WAYPOINT_PERSONAL_GOING = BIT(7); // Going to a personal waypoint +const int AI_STATUS_WAYPOINT_PERSONAL_REACHED = BIT(8); // Personal waypoint reached +const int AI_STATUS_JETPACK_FLYING = BIT(9); +const int AI_STATUS_JETPACK_LANDING = BIT(10); +const int AI_STATUS_STUCK = BIT(11); // Cannot reach any goal .float isbot; // true if this client is actually a bot .int aistatus; diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index c3484e1d4..76cda90d9 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -815,17 +815,17 @@ float bot_cmd_aimtarget() .int bot_cmd_keys; const int BOT_CMD_KEY_NONE = 0; -const int BOT_CMD_KEY_FORWARD = 1; -const int BOT_CMD_KEY_BACKWARD = 2; -const int BOT_CMD_KEY_RIGHT = 4; -const int BOT_CMD_KEY_LEFT = 8; -const int BOT_CMD_KEY_JUMP = 16; -const int BOT_CMD_KEY_ATTACK1 = 32; -const int BOT_CMD_KEY_ATTACK2 = 64; -const int BOT_CMD_KEY_USE = 128; -const int BOT_CMD_KEY_HOOK = 256; -const int BOT_CMD_KEY_CROUCH = 512; -const int BOT_CMD_KEY_CHAT = 1024; +const int BOT_CMD_KEY_FORWARD = BIT(0); +const int BOT_CMD_KEY_BACKWARD = BIT(1); +const int BOT_CMD_KEY_RIGHT = BIT(2); +const int BOT_CMD_KEY_LEFT = BIT(3); +const int BOT_CMD_KEY_JUMP = BIT(4); +const int BOT_CMD_KEY_ATTACK1 = BIT(5); +const int BOT_CMD_KEY_ATTACK2 = BIT(6); +const int BOT_CMD_KEY_USE = BIT(7); +const int BOT_CMD_KEY_HOOK = BIT(8); +const int BOT_CMD_KEY_CROUCH = BIT(9); +const int BOT_CMD_KEY_CHAT = BIT(10); float bot_presskeys() {SELFPARAM(); diff --git a/qcsrc/server/bot/waypoints.qh b/qcsrc/server/bot/waypoints.qh index fde524bb9..8e0dd0fe6 100644 --- a/qcsrc/server/bot/waypoints.qh +++ b/qcsrc/server/bot/waypoints.qh @@ -4,14 +4,14 @@ * Globals and Fields */ -const int WAYPOINTFLAG_GENERATED = 8388608; -const int WAYPOINTFLAG_ITEM = 4194304; -const int WAYPOINTFLAG_TELEPORT = 2097152; -const int WAYPOINTFLAG_NORELINK = 1048576; -const int WAYPOINTFLAG_PERSONAL = 524288; -const int WAYPOINTFLAG_PROTECTED = 262144; // Useless WP detection never kills these. -const int WAYPOINTFLAG_USEFUL = 131072; // Useless WP detection temporary flag. -const int WAYPOINTFLAG_DEAD_END = 65536; // Useless WP detection temporary flag. +const int WAYPOINTFLAG_GENERATED = BIT(23); +const int WAYPOINTFLAG_ITEM = BIT(22); +const int WAYPOINTFLAG_TELEPORT = BIT(21); +const int WAYPOINTFLAG_NORELINK = BIT(20); +const int WAYPOINTFLAG_PERSONAL = BIT(19); +const int WAYPOINTFLAG_PROTECTED = BIT(18); // Useless WP detection never kills these. +const int WAYPOINTFLAG_USEFUL = BIT(17); // Useless WP detection temporary flag. +const int WAYPOINTFLAG_DEAD_END = BIT(16); // Useless WP detection temporary flag. // fields you can query using prvm_global server to get some statistics about waypoint linking culling float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 77c0a3560..da9be11ff 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -42,31 +42,31 @@ bool Nagger_SendEntity(entity this, entity to, float sendflags) nags = 0; if(readycount) { - nags |= 1; + nags |= BIT(0); if(to.ready == 0) - nags |= 2; + nags |= BIT(1); } if(vote_called) { - nags |= 4; + nags |= BIT(2); if(to.vote_selection == 0) - nags |= 8; + nags |= BIT(3); } if(warmup_stage) - nags |= 16; + nags |= BIT(4); - if(sendflags & 64) - nags |= 64; + if(sendflags & BIT(6)) + nags |= BIT(6); - if(sendflags & 128) - nags |= 128; + if(sendflags & BIT(7)) + nags |= BIT(7); if(!(nags & 4)) // no vote called? send no string - nags &= ~(64 | 128); + nags &= ~(BIT(6) | BIT(7)); WriteByte(MSG_ENTITY, nags); - if(nags & 64) + if(nags & BIT(6)) { WriteByte(MSG_ENTITY, vote_accept_count); WriteByte(MSG_ENTITY, vote_reject_count); @@ -74,7 +74,7 @@ bool Nagger_SendEntity(entity this, entity to, float sendflags) WriteChar(MSG_ENTITY, to.vote_selection); } - if(nags & 128) + if(nags & BIT(7)) WriteString(MSG_ENTITY, vote_called_display); if(nags & 1) @@ -99,19 +99,19 @@ void Nagger_Init() void Nagger_VoteChanged() { if(nagger) - nagger.SendFlags |= 128; + nagger.SendFlags |= BIT(7); } void Nagger_VoteCountChanged() { if(nagger) - nagger.SendFlags |= 64; + nagger.SendFlags |= BIT(6); } void Nagger_ReadyCounted() { if(nagger) - nagger.SendFlags |= 1; + nagger.SendFlags |= BIT(0); } // If the vote_caller is still here, return their name, otherwise vote_caller_name diff --git a/qcsrc/server/constants.qh b/qcsrc/server/constants.qh index ac6be94dd..6de55189f 100644 --- a/qcsrc/server/constants.qh +++ b/qcsrc/server/constants.qh @@ -1,13 +1,13 @@ #ifndef SERVER_CONSTANTS_H #define SERVER_CONSTANTS_H -const int FL_WEAPON = 8192; -const int FL_POWERUP = 16384; -const int FL_PROJECTILE = 32768; -const int FL_TOSSED = 65536; -const int FL_NO_WEAPON_STAY = 131072; -const int FL_SPAWNING = 262144; -const int FL_PICKUPITEMS = 524288; +const int FL_WEAPON = BIT(13); +const int FL_POWERUP = BIT(14); +const int FL_PROJECTILE = BIT(15); +const int FL_TOSSED = BIT(BIT(4)); +const int FL_NO_WEAPON_STAY = BIT(17); +const int FL_SPAWNING = BIT(18); +const int FL_PICKUPITEMS = BIT(19); const int SVC_SOUND = 6; const int SVC_STOPSOUND = 16; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 463d0bc8f..4f7900149 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -532,17 +532,17 @@ typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t; string modname; .float missile_flags; -const int MIF_SPLASH = 2; -const int MIF_ARC = 4; -const int MIF_PROXY = 8; -const int MIF_GUIDED_MANUAL = 16; -const int MIF_GUIDED_HEAT = 32; -const int MIF_GUIDED_LASER = 64; -const int MIF_GUIDED_AI = 128; -const int MIF_GUIDED_TAG = 128; -#define MIF_GUIDED_ALL (MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG) -#define MIF_GUIDED_TRACKING (MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG) -#define MIF_GUIDED_CONFUSABLE (MIF_GUIDED_HEAT | MIF_GUIDED_AI) +const int MIF_SPLASH = BIT(1); +const int MIF_ARC = BIT(2); +const int MIF_PROXY = BIT(3); +const int MIF_GUIDED_MANUAL = BIT(4); +const int MIF_GUIDED_HEAT = BIT(5); +const int MIF_GUIDED_LASER = BIT(6); +const int MIF_GUIDED_AI = BIT(7); +const int MIF_GUIDED_TAG = BIT(7); +const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; +const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; +const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI; #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false) #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false) diff --git a/qcsrc/server/g_hook.qh b/qcsrc/server/g_hook.qh index 140a93cfd..2a2d566b3 100644 --- a/qcsrc/server/g_hook.qh +++ b/qcsrc/server/g_hook.qh @@ -8,11 +8,11 @@ void SetGrappleHookBindings(); // (note: you can change the hook impulse #'s to whatever you please) .float hook_time; -const float HOOK_FIRING = 1; -const float HOOK_REMOVING = 2; -const float HOOK_PULLING = 4; -const float HOOK_RELEASING = 8; -const float HOOK_WAITING_FOR_RELEASE = 16; +const float HOOK_FIRING = BIT(0); +const float HOOK_REMOVING = BIT(1); +const float HOOK_PULLING = BIT(2); +const float HOOK_RELEASING = BIT(3); +const float HOOK_WAITING_FOR_RELEASE = BIT(4); .float hook_state; void GrappleHookInit(); diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 8bc538736..f9f4083e3 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -26,13 +26,13 @@ void g_model_setcolormaptoactivator (void) } else self.colormap = floor(random() * 256); - self.colormap |= 1024; // RENDER_COLORMAPPED + self.colormap |= BIT(10); // RENDER_COLORMAPPED } void g_clientmodel_setcolormaptoactivator (void) {SELFPARAM(); g_model_setcolormaptoactivator(); - self.SendFlags |= (8 | 1); + self.SendFlags |= (BIT(3) | BIT(0)); } void g_clientmodel_use(void) diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 8c5a06b32..5ab3c8df2 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -167,32 +167,32 @@ spawnfunc(item_key) // find default netname and colormod switch(self.itemkeys) { - case 1: + case BIT(0): _netname = "GOLD key"; _colormod = '1 .9 0'; break; - case 2: + case BIT(1): _netname = "SILVER key"; _colormod = '.9 .9 .9'; break; - case 4: + case BIT(2): _netname = "BRONZE key"; _colormod = '.6 .25 0'; break; - case 8: + case BIT(3): _netname = "RED keycard"; _colormod = '.9 0 0'; break; - case 16: + case BIT(4): _netname = "BLUE keycard"; _colormod = '0 0 .9'; break; - case 32: + case BIT(5): _netname = "GREEN keycard"; _colormod = '0 .9 0'; break; diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 8d23f5111..3ca3ea673 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -425,10 +425,10 @@ void readlevelcvars(void) // hack float precache_sound_index (string s) = #19; -const float SND_VOLUME = 1; -const float SND_ATTENUATION = 2; -const float SND_LARGEENTITY = 8; -const float SND_LARGESOUND = 16; +const float SND_VOLUME = BIT(0); +const float SND_ATTENUATION = BIT(1); +const float SND_LARGEENTITY = BIT(3); +const float SND_LARGESOUND = BIT(4); const float INITPRIO_FIRST = 0; const float INITPRIO_GAMETYPE = 0; diff --git a/qcsrc/server/mutators/mutator/mutator_superspec.qc b/qcsrc/server/mutators/mutator/mutator_superspec.qc index 00ebbafe0..416df75b4 100644 --- a/qcsrc/server/mutators/mutator/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator/mutator_superspec.qc @@ -4,15 +4,15 @@ REGISTER_MUTATOR(superspec, cvar("g_superspectate")); #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1" #define _ISLOCAL ((edict_num(1) == self) ? true : false) -const float ASF_STRENGTH = 1; -const float ASF_SHIELD = 2; -const float ASF_MEGA_AR = 4; -const float ASF_MEGA_HP = 8; -const float ASF_FLAG_GRAB = 16; -const float ASF_OBSERVER_ONLY = 32; -const float ASF_SHOWWHAT = 64; -const float ASF_SSIM = 128; -const float ASF_FOLLOWKILLER = 256; +const float ASF_STRENGTH = BIT(0); +const float ASF_SHIELD = BIT(1); +const float ASF_MEGA_AR = BIT(2); +const float ASF_MEGA_HP = BIT(3); +const float ASF_FLAG_GRAB = BIT(4); +const float ASF_OBSERVER_ONLY = BIT(5); +const float ASF_SHOWWHAT = BIT(6); +const float ASF_SSIM = BIT(7); +const float ASF_FOLLOWKILLER = BIT(8); const float ASF_ALL = 0xFFFFFF; .float autospec_flags; diff --git a/qcsrc/server/pathlib/pathlib.qh b/qcsrc/server/pathlib/pathlib.qh index d88a43ed8..765fe2a7f 100644 --- a/qcsrc/server/pathlib/pathlib.qh +++ b/qcsrc/server/pathlib/pathlib.qh @@ -31,15 +31,15 @@ entity start_node; .float pathlib_node_c; const float pathlib_node_edgeflag_unknown = 0; -const float pathlib_node_edgeflag_left = 2; -const float pathlib_node_edgeflag_right = 4; -const float pathlib_node_edgeflag_forward = 8; -const float pathlib_node_edgeflag_back = 16; -const float pathlib_node_edgeflag_backleft = 32; -const float pathlib_node_edgeflag_backright = 64; -const float pathlib_node_edgeflag_forwardleft = 128; -const float pathlib_node_edgeflag_forwardright = 256; -const float pathlib_node_edgeflag_none = 512; +const float pathlib_node_edgeflag_left = BIT(1); +const float pathlib_node_edgeflag_right = BIT(2); +const float pathlib_node_edgeflag_forward = BIT(3); +const float pathlib_node_edgeflag_back = BIT(4); +const float pathlib_node_edgeflag_backleft = BIT(5); +const float pathlib_node_edgeflag_backright = BIT(6); +const float pathlib_node_edgeflag_forwardleft = BIT(7); +const float pathlib_node_edgeflag_forwardright = BIT(8); +const float pathlib_node_edgeflag_none = BIT(9); .float pathlib_node_edgeflags; float pathlib_open_cnt; diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 8195d250d..45b5f9e9c 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -4,20 +4,20 @@ const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking -const int ISF_LOCATION = 2; -const int ISF_MODEL = 4; -const int ISF_STATUS = 8; - const int ITS_STAYWEP = 1; - const int ITS_ANIMATE1 = 2; - const int ITS_ANIMATE2 = 4; - const int ITS_AVAILABLE = 8; - const int ITS_ALLOWFB = 16; - const int ITS_ALLOWSI = 32; - const int ITS_POWERUP = 64; -const int ISF_COLORMAP = 16; -const int ISF_DROP = 32; -const int ISF_ANGLES = 64; -const int ISF_SIZE = 128; +const int ISF_LOCATION = BIT(1); +const int ISF_MODEL = BIT(2); +const int ISF_STATUS = BIT(3); + const int ITS_STAYWEP = BIT(0); + const int ITS_ANIMATE1 = BIT(1); + const int ITS_ANIMATE2 = BIT(2); + const int ITS_AVAILABLE = BIT(3); + const int ITS_ALLOWFB = BIT(4); + const int ITS_ALLOWSI = BIT(5); + const int ITS_POWERUP = BIT(6); +const int ISF_COLORMAP = BIT(4); +const int ISF_DROP = BIT(5); +const int ISF_ANGLES = BIT(6); +const int ISF_SIZE = BIT(7); .int ItemStatus; -- 2.39.2