From 971eb36c4ccfde80cd46767b0c20e2d97350821e Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 24 Jan 2015 18:05:57 +1100 Subject: [PATCH] Turn #define'd constants into actual constants --- qcsrc/client/Defs.qc | 4 +- qcsrc/client/View.qc | 14 +- qcsrc/client/csqc_constants.qc | 14 +- qcsrc/client/hud.qc | 10 +- qcsrc/client/hud.qh | 8 +- qcsrc/client/main.qh | 32 ++-- qcsrc/client/mapvoting.qc | 2 +- qcsrc/client/miscfunctions.qc | 2 +- qcsrc/client/movetypes.qc | 2 +- qcsrc/client/player_skeleton.qc | 6 +- qcsrc/client/teamradar.qh | 2 +- qcsrc/client/tuba.qc | 6 +- qcsrc/common/animdecide.qc | 8 +- qcsrc/common/animdecide.qh | 34 ++-- qcsrc/common/command/markup.qh | 2 +- qcsrc/common/command/rpn.qh | 2 +- qcsrc/common/command/shared_defs.qh | 4 +- qcsrc/common/constants.qh | 105 +++++------ qcsrc/common/csqcmodel_settings.qh | 2 +- qcsrc/common/monsters/monsters.qh | 10 +- qcsrc/common/notifications.qh | 58 +++--- qcsrc/common/playerstats.qh | 18 +- qcsrc/common/urllib.qc | 4 +- qcsrc/common/util.qc | 4 +- qcsrc/common/util.qh | 18 +- qcsrc/common/weapons/config.qh | 2 +- qcsrc/common/weapons/w_arc.qc | 34 ++-- qcsrc/common/weapons/w_shockwave.qc | 8 +- qcsrc/csqcmodellib/cl_player.qc | 4 +- qcsrc/csqcmodellib/cl_player.qh | 12 +- qcsrc/csqcmodellib/common.qh | 18 +- qcsrc/csqcmodellib/interpolate.qh | 20 +-- qcsrc/csqcmodellib/settings.qh | 2 +- qcsrc/dpdefs/csprogsdefs.qc | 14 +- qcsrc/dpdefs/menudefs.qc | 4 +- qcsrc/menu/item/inputbox.c | 2 +- qcsrc/menu/xonotic/charmap.c | 4 +- qcsrc/menu/xonotic/keybinder.c | 4 +- qcsrc/menu/xonotic/languagelist.c | 10 +- qcsrc/menu/xonotic/playerlist.c | 10 +- qcsrc/menu/xonotic/playermodel.c | 16 +- qcsrc/menu/xonotic/serverlist.c | 10 +- qcsrc/menu/xonotic/skinlist.c | 10 +- qcsrc/server/antilag.qc | 2 +- qcsrc/server/bot/havocbot/role_onslaught.qc | 8 +- qcsrc/server/bot/scripting.qc | 102 +++++------ qcsrc/server/cheats.qc | 18 +- qcsrc/server/command/common.qh | 16 +- qcsrc/server/command/getreplies.qh | 6 +- qcsrc/server/command/sv_cmd.qh | 4 +- qcsrc/server/command/vote.qh | 22 +-- qcsrc/server/defs.qh | 48 ++--- qcsrc/server/g_world.qc | 2 +- qcsrc/server/ipban.qc | 2 +- qcsrc/server/mapvoting.qh | 2 +- qcsrc/server/miscfunctions.qc | 24 +-- qcsrc/server/mutators/base.qc | 2 +- qcsrc/server/mutators/base.qh | 26 +-- qcsrc/server/mutators/gamemode_assault.qh | 10 +- qcsrc/server/mutators/gamemode_ca.qc | 2 +- qcsrc/server/mutators/gamemode_ctf.qh | 72 ++++---- qcsrc/server/mutators/gamemode_cts.qh | 8 +- qcsrc/server/mutators/gamemode_domination.qh | 10 +- qcsrc/server/mutators/gamemode_freezetag.qc | 6 +- qcsrc/server/mutators/gamemode_invasion.qh | 2 +- qcsrc/server/mutators/gamemode_keepaway.qh | 6 +- qcsrc/server/mutators/gamemode_keyhunt.qc | 14 +- qcsrc/server/mutators/gamemode_lms.qh | 4 +- qcsrc/server/mutators/gamemode_nexball.qc | 12 +- qcsrc/server/mutators/gamemode_nexball.qh | 20 +-- qcsrc/server/mutators/gamemode_race.qh | 8 +- qcsrc/server/mutators/mutator_buffs.qh | 4 +- qcsrc/server/mutators/mutator_new_toys.qc | 6 +- qcsrc/server/mutators/mutator_superspec.qc | 26 +-- qcsrc/server/pathlib.qc | 2 +- qcsrc/server/pathlib/main.qc | 2 +- qcsrc/server/pathlib/pathlib.qh | 26 +-- qcsrc/server/playerdemo.qc | 6 +- qcsrc/server/portals.qc | 4 +- qcsrc/server/race.qc | 2 +- qcsrc/server/scores.qc | 4 +- qcsrc/server/t_items.qh | 40 ++--- qcsrc/server/t_plats.qc | 4 +- qcsrc/server/t_teleporters.qc | 12 +- .../server/tturrets/include/turrets_early.qh | 166 +++++++++--------- qcsrc/server/tturrets/units/unit_ewheel.qc | 10 +- qcsrc/server/tturrets/units/unit_walker.qc | 28 +-- qcsrc/server/vehicles/bumblebee.qc | 10 +- qcsrc/server/vehicles/racer.qc | 4 +- qcsrc/server/vehicles/raptor.qc | 12 +- qcsrc/server/vehicles/spiderbot.qc | 10 +- qcsrc/server/vehicles/vehicles_def.qh | 6 +- qcsrc/warpzonelib/mathlib.qh | 36 ++-- 93 files changed, 703 insertions(+), 730 deletions(-) diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 24a5fbfc0..0be5dc97d 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -235,8 +235,8 @@ float servertime, serverprevtime, serverdeltatime; float ticrate; .float damageforcescale; -#define MIN_DAMAGEEXTRARADIUS 2 -#define MAX_DAMAGEEXTRARADIUS 16 +const float MIN_DAMAGEEXTRARADIUS = 2; +const float MAX_DAMAGEEXTRARADIUS = 16; .float damageextraradius; .void(float thisdmg, float hittype, vector org, vector thisforce) event_damage; diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 310b47d70..d3e60207c 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -230,10 +230,10 @@ float wcross_ring_prev; entity trueaim; entity trueaim_rifle; -#define SHOTTYPE_HITTEAM 1 -#define SHOTTYPE_HITOBSTRUCTION 2 -#define SHOTTYPE_HITWORLD 3 -#define SHOTTYPE_HITENEMY 4 +const float SHOTTYPE_HITTEAM = 1; +const float SHOTTYPE_HITOBSTRUCTION = 2; +const float SHOTTYPE_HITWORLD = 3; +const float SHOTTYPE_HITENEMY = 4; void TrueAim_Init() { @@ -373,7 +373,7 @@ void CSQC_RAPTOR_HUD(); vector freeze_org, freeze_ang; entity nightvision_noise, nightvision_noise2; -#define MAX_TIME_DIFF 5 +const float MAX_TIME_DIFF = 5; float pickup_crosshair_time, pickup_crosshair_size; float hitindication_crosshair_size; float use_vortex_chargepool; @@ -963,8 +963,8 @@ void UpdateCrosshair() } } -#define BUTTON_3 4 -#define BUTTON_4 8 +const float BUTTON_3 = 4; +const float BUTTON_4 = 8; float cl_notice_run(); float prev_myteam; void CSQC_UpdateView(float w, float h) diff --git a/qcsrc/client/csqc_constants.qc b/qcsrc/client/csqc_constants.qc index 919fbc768..1794d6e42 100644 --- a/qcsrc/client/csqc_constants.qc +++ b/qcsrc/client/csqc_constants.qc @@ -1,5 +1,3 @@ -#define world world - // Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask) const float MASK_ENGINE = 1; const float MASK_ENGINEVIEWMODELS = 2; @@ -123,12 +121,12 @@ const float BUTTON_14 = 65536; const float BUTTON_15 = 131072; const float BUTTON_16 = 262144; -#define SOLID_NOT 0 // no interaction with other objects -#define SOLID_TRIGGER 1 // touch on edge, but not blocking -#define SOLID_BBOX 2 // touch on edge, block -#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground -#define SOLID_BSP 4 // bsp clip, touch on edge, block -#define SOLID_CORPSE 5 // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters) +const float SOLID_NOT = 0; // no interaction with other objects +const float SOLID_TRIGGER = 1; // touch on edge, but not blocking +const float SOLID_BBOX = 2; // touch on edge, block +const float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground +const float SOLID_BSP = 4; // bsp clip, touch on edge, block +const float SOLID_CORPSE = 5; // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters) const float MOVE_NORMAL = 0; // same as FALSE const float MOVE_NOMONSTERS = 1; // same as TRUE diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 21dd0222b..23751b275 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2068,8 +2068,8 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) { float score; entity tm = world, pl; -#define SCOREPANEL_MAX_ENTRIES 6 -#define SCOREPANEL_ASPECTRATIO 2 + float SCOREPANEL_MAX_ENTRIES = 6; + float SCOREPANEL_ASPECTRATIO = 2; float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize_y/mySize_x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES); vector fontsize = '1 1 0' * (mySize_y/entries); @@ -4085,9 +4085,9 @@ void HUD_Physics(void) // CenterPrint (#16) // -#define CENTERPRINT_MAX_MSGS 10 -#define CENTERPRINT_MAX_ENTRIES 50 -#define CENTERPRINT_SPACING 0.7 +const float CENTERPRINT_MAX_MSGS = 10; +const float CENTERPRINT_MAX_ENTRIES = 50; +const float CENTERPRINT_SPACING = 0.7; float cpm_index; string centerprint_messages[CENTERPRINT_MAX_MSGS]; float centerprint_msgID[CENTERPRINT_MAX_MSGS]; diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index d56caf133..a4f9d4c76 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -1,6 +1,6 @@ -#define HUD_PANEL_MAX 24 +const float HUD_PANEL_MAX = 24; entity hud_panel[HUD_PANEL_MAX]; -#define HUD_PANEL_FIRST 0 +const float HUD_PANEL_FIRST = 0; float HUD_PANEL_NUM; float HUD_PANEL_LAST; @@ -338,8 +338,8 @@ panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_bo HUD_Panel_GetBorder() \ } ENDS_WITH_CURLY_BRACE -#define NOTIFY_MAX_ENTRIES 10 -#define NOTIFY_ICON_MARGIN 0.02 +const float NOTIFY_MAX_ENTRIES = 10; +const float NOTIFY_ICON_MARGIN = 0.02; float notify_index; float notify_count; diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index c9aa2fb40..87163482b 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -1,7 +1,7 @@ // -------------------------------------------------------------------------- // MENU Functionality -#define DATABUF_PING 0 +const float DATABUF_PING = 0; #define DATABUF_CAPTURES (1*maxclients) #define DATABUF_DEATHS (2*maxclients) #define DATABUF_RETURNS (3*maxclients) @@ -38,25 +38,25 @@ float gametype; //.float ctf_state; //.float health; -#define FONT_DEFAULT 0 -#define FONT_USER 8 +float FONT_DEFAULT = 0; +float FONT_USER = 8; // -------------------------------------------------------------------------- // Scoreboard stuff -#define MAX_HUD_FIELDS 16 +const float MAX_HUD_FIELDS = 16; -#define SP_END -1 +const float SP_END = -1; -#define SP_PING -2 -#define SP_NAME -3 -#define SP_KDRATIO -4 -#define SP_CLRATIO -5 -#define SP_PL -6 -#define SP_FRAGS -7 -#define SP_SUM -8 +const float SP_PING = -2; +const float SP_NAME = -3; +const float SP_KDRATIO = -4; +const float SP_CLRATIO = -5; +const float SP_PL = -6; +const float SP_FRAGS = -7; +const float SP_SUM = -8; -#define SP_SEPARATOR -100 +const float SP_SEPARATOR = -100; float hud_field[MAX_HUD_FIELDS + 1]; float hud_size[MAX_HUD_FIELDS + 1]; @@ -126,14 +126,14 @@ vector camera_direction; void centerprint_hud(string strMessage); void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num); -#define ALPHA_MIN_VISIBLE 0.003 +const float ALPHA_MIN_VISIBLE = 0.003; float armorblockpercent; //hooks float calledhooks; -#define HOOK_START 1 -#define HOOK_END 2 +const float HOOK_START = 1; +const float HOOK_END = 2; .float ping, ping_packetloss, ping_movementloss; diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 3f30a6a72..ac8d47552 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -494,7 +494,7 @@ void MapVote_ReadMask() } } -#define NUM_SSDIRS 4 +const float NUM_SSDIRS = 4; string ssdirs[NUM_SSDIRS]; float n_ssdirs; void MapVote_Init() diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 8b674e782..f14499f0e 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -646,7 +646,7 @@ void draw_endBoldFont() } -#define MAX_ACCURACY_LEVELS 10 +const float MAX_ACCURACY_LEVELS = 10; float acc_lev[MAX_ACCURACY_LEVELS]; vector acc_col[MAX_ACCURACY_LEVELS]; float acc_col_loadtime; diff --git a/qcsrc/client/movetypes.qc b/qcsrc/client/movetypes.qc index 3d5c43509..1c3487aca 100644 --- a/qcsrc/client/movetypes.qc +++ b/qcsrc/client/movetypes.qc @@ -277,7 +277,7 @@ float _Movetype_PushEntity(vector push, float failonstartsolid) // SV_PushEntity return trace_fraction; } -#define MAX_CLIP_PLANES 5 +const float MAX_CLIP_PLANES = 5; void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss { if(self.move_flags & FL_ONGROUND) diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index ad5e23aa8..bec9c9ebe 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -1,8 +1,8 @@ .float skeleton_info_modelindex; .float skeleton_info_skin; -#define BONETYPE_LOWER 0 -#define BONETYPE_UPPER 1 -#define MAX_BONES 128 +const float BONETYPE_LOWER = 0; +const float BONETYPE_UPPER = 1; +const float MAX_BONES = 128; .float skeleton_bonetype[MAX_BONES]; .float skeleton_numbones; diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index 2dbdf8965..35ae44385 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -1,4 +1,4 @@ -#define MAX_TEAMRADAR_TIMES 32 +const float MAX_TEAMRADAR_TIMES = 32; // to make entities have dots on the team radar .float teamradar_icon; diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index 73d72b61e..cf8f881a0 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -1,6 +1,6 @@ -#define TUBA_MIN -18 -#define TUBA_MAX 27 -#define TUBA_INSTRUMENTS 3 +const float TUBA_MIN = -18; +const float TUBA_MAX = 27; +const float TUBA_INSTRUMENTS = 3; #define TUBA_STARTNOTE(i,n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav") .float note; // note diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index d2b849f58..ca37d2b9e 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -75,10 +75,10 @@ void animdecide_load_if_needed(entity e) e.anim_melee_z = 0.001; } -#define ANIMPRIO_IDLE 0 -#define ANIMPRIO_ACTIVE 1 -#define ANIMPRIO_CROUCH 2 -#define ANIMPRIO_DEAD 3 +const float ANIMPRIO_IDLE = 0; +const float ANIMPRIO_ACTIVE = 1; +const float ANIMPRIO_CROUCH = 2; +const float ANIMPRIO_DEAD = 3; vector animdecide_getupperanim(entity e) { diff --git a/qcsrc/common/animdecide.qh b/qcsrc/common/animdecide.qh index b9d5260e6..cef7adddf 100644 --- a/qcsrc/common/animdecide.qh +++ b/qcsrc/common/animdecide.qh @@ -23,25 +23,25 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f // explicit anim states (networked) void animdecide_setstate(entity e, float newstate, float restart); -#define ANIMSTATE_DEAD1 1 // base frames: die1 -#define ANIMSTATE_DEAD2 2 // base frames: die2 -#define ANIMSTATE_DUCK 4 // turns walk into duckwalk, jump into duckjump, etc. -#define ANIMSTATE_FROZEN 8 // force idle +const float ANIMSTATE_DEAD1 = 1; // base frames: die1 +const float ANIMSTATE_DEAD2 = 2; // base frames: die2 +const float ANIMSTATE_DUCK = 4; // turns walk into duckwalk, jump into duckjump, etc. +const float ANIMSTATE_FROZEN = 8; // force idle // implicit anim states (inferred from velocity, etc.) -#define ANIMIMPLICITSTATE_INAIR 1 -#define ANIMIMPLICITSTATE_FORWARD 2 -#define ANIMIMPLICITSTATE_BACKWARDS 4 -#define ANIMIMPLICITSTATE_LEFT 8 -#define ANIMIMPLICITSTATE_RIGHT 16 -#define ANIMIMPLICITSTATE_JUMPRELEASED 32 +const float ANIMIMPLICITSTATE_INAIR = 1; +const float ANIMIMPLICITSTATE_FORWARD = 2; +const float ANIMIMPLICITSTATE_BACKWARDS = 4; +const float ANIMIMPLICITSTATE_LEFT = 8; +const float ANIMIMPLICITSTATE_RIGHT = 16; +const float ANIMIMPLICITSTATE_JUMPRELEASED = 32; // explicit actions (networked); negative values are for lower body void animdecide_setaction(entity e, float action, float restart); -#define ANIMACTION_JUMP -1 // jump -#define ANIMACTION_DRAW 1 // draw -#define ANIMACTION_PAIN1 2 // pain -#define ANIMACTION_PAIN2 3 // pain -#define ANIMACTION_SHOOT 4 // shoot -#define ANIMACTION_TAUNT 5 // taunt -#define ANIMACTION_MELEE 6 // melee +const float ANIMACTION_JUMP = -1; // jump +const float ANIMACTION_DRAW = 1; // draw +const float ANIMACTION_PAIN1 = 2; // pain +const float ANIMACTION_PAIN2 = 3; // pain +const float ANIMACTION_SHOOT = 4; // shoot +const float ANIMACTION_TAUNT = 5; // taunt +const float ANIMACTION_MELEE = 6; // melee diff --git a/qcsrc/common/command/markup.qh b/qcsrc/common/command/markup.qh index 6cf09d3ed..4193691b5 100644 --- a/qcsrc/common/command/markup.qh +++ b/qcsrc/common/command/markup.qh @@ -3,7 +3,7 @@ // Last updated: December 28th, 2011 // ========================================================== -#define NUM_MARKUPS 41 +const float NUM_MARKUPS = 41; float markup_init; string markup_from[NUM_MARKUPS]; string markup_to[NUM_MARKUPS]; diff --git a/qcsrc/common/command/rpn.qh b/qcsrc/common/command/rpn.qh index 91b1dd9b9..d182264c4 100644 --- a/qcsrc/common/command/rpn.qh +++ b/qcsrc/common/command/rpn.qh @@ -3,7 +3,7 @@ // Last updated: December 28th, 2011 // ========================================================= -#define MAX_RPN_STACK 16 +const float MAX_RPN_STACK = 16; float rpn_db; float rpn_error; float rpn_sp; diff --git a/qcsrc/common/command/shared_defs.qh b/qcsrc/common/command/shared_defs.qh index f06ee3239..9e9e6da41 100644 --- a/qcsrc/common/command/shared_defs.qh +++ b/qcsrc/common/command/shared_defs.qh @@ -4,5 +4,5 @@ // ========================================================= // identifiers for subfunction requests by the command code structure -#define CMD_REQUEST_COMMAND 1 -#define CMD_REQUEST_USAGE 2 \ No newline at end of file +const float CMD_REQUEST_COMMAND = 1; +const float CMD_REQUEST_USAGE = 2; \ No newline at end of file diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 8586cffa9..083de41b6 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -1,28 +1,3 @@ -// COMMIT-TODO: Update if necessary before committing -// Revision 1: additional statistics sent (flag caps, returns, deaths) -// Revision 2: Mapvote preview pictures -// Revision 3: optimized map vote protocol -// Revision 4: CSQC config var system -// Revision 5: mapvote time fix -// Revision 6: more robust against packet loss/delays, also show not yet connected clients -// Revision 7: packet loss column -// Revision 8: race -// Revision 9: race delta -// Revision 10: scoreboard force -// Revision 11: scoreboard unforce; spectator support beginning -// Revision 12: smaller scores updates (SERVER: requires new engine) -// Revision 13: pointparticles -// Revision 14: laser -// Revision 15: zoom -// Revision 16: multi-weapons -// Revision 17: multi-weaponimpulses -// Revision 18: warmup -// Revision 19: fog -// Revision 20: naggers -// Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar -// Revision 22: hook shot origin -#define CSQC_REVISION 22 - const float AS_STRING = 1; const float AS_INT = 2; const float AS_FLOAT_TRUNCATED = 2; @@ -160,32 +135,32 @@ const vector eZ = '0 0 1'; // moved that here so the client knows the max. // # of maps, I'll use arrays for them :P -#define MAPVOTE_COUNT 30 +const float MAPVOTE_COUNT = 30; /** * Lower scores are better (e.g. suicides) */ -#define SFL_LOWER_IS_BETTER 1 +const float SFL_LOWER_IS_BETTER = 1; /** * Don't show zero values as scores */ -#define SFL_HIDE_ZERO 2 +const float SFL_HIDE_ZERO = 2; /** * Allow a column to be hidden (do not automatically add it even if it is a sorting key) */ -#define SFL_ALLOW_HIDE 16 +const float SFL_ALLOW_HIDE = 16; /** * Display as a rank (with st, nd, rd, th suffix) */ -#define SFL_RANK 32 +const float SFL_RANK = 32; /** * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!) */ -#define SFL_TIME 64 +const float SFL_TIME = 64; // not an extra constant yet #define SFL_ZERO_IS_WORST SFL_TIME @@ -193,21 +168,21 @@ const vector eZ = '0 0 1'; /** * Scoring priority (NOTE: PRIMARY is used for fraglimit) */ -#define SFL_SORT_PRIO_SECONDARY 4 -#define SFL_SORT_PRIO_PRIMARY 8 -#define SFL_SORT_PRIO_MASK 12 +const float SFL_SORT_PRIO_SECONDARY = 4; +const float SFL_SORT_PRIO_PRIMARY = 8; +const float SFL_SORT_PRIO_MASK = 12; /** * Score indices */ -#define MAX_SCORE 10 -#define MAX_TEAMSCORE 2 - -#define ST_SCORE 0 -#define SP_KILLS 0 -#define SP_DEATHS 1 -#define SP_SUICIDES 2 -#define SP_SCORE 3 +const float MAX_SCORE = 10; +const float MAX_TEAMSCORE = 2; + +const float ST_SCORE = 0; +const float SP_KILLS = 0; +const float SP_DEATHS = 1; +const float SP_SUICIDES = 2; +const float SP_SCORE = 3; // game mode specific indices are not in common/, but in server/scores_rules.qc! const float CH_INFO = 0; @@ -235,8 +210,8 @@ const float ATTEN_IDLE = 2; const float ATTEN_STATIC = 3; const float ATTEN_MAX = 3.984375; -#define VOL_BASE 0.7 -#define VOL_BASEVOICE 1.0 +const float VOL_BASE = 0.7; +const float VOL_BASEVOICE = 1.0; // WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc const float PROJECTILE_ELECTRO = 1; @@ -283,10 +258,10 @@ const float SPECIES_ROBOT_RUSTY = 4; const float SPECIES_ROBOT_SHINY = 5; const float SPECIES_RESERVED = 15; -#define FRAGS_PLAYER 0 -#define FRAGS_SPECTATOR -666 -#define FRAGS_LMS_LOSER -616 -#define FRAGS_PLAYER_NONSOLID -616 +const float FRAGS_PLAYER = 0; +const float FRAGS_SPECTATOR = -666; +const float FRAGS_LMS_LOSER = -616; +const float FRAGS_PLAYER_NONSOLID = -616; // we can use this frags value for both // water levels @@ -294,9 +269,9 @@ const float WATERLEVEL_NONE = 0; const float WATERLEVEL_WETFEET = 1; const float WATERLEVEL_SWIMMING = 2; const float WATERLEVEL_SUBMERGED = 3; -#define SERVERFLAG_ALLOW_FULLBRIGHT 1 -#define SERVERFLAG_TEAMPLAY 2 -#define SERVERFLAG_PLAYERSTATS 4 +const float SERVERFLAG_ALLOW_FULLBRIGHT = 1; +const float SERVERFLAG_TEAMPLAY = 2; +const float SERVERFLAG_PLAYERSTATS = 4; // FIXME/EXPLAINME: why? noref var vector autocvar_sv_player_maxs = '16 16 45'; @@ -326,22 +301,22 @@ noref var vector autocvar_sv_player_headsize = '24 24 12'; #define PL_HEAD_z autocvar_sv_player_headsize_z // spawnpoint prios -#define SPAWN_PRIO_NEAR_TEAMMATE_FOUND 200 -#define SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM 100 -#define SPAWN_PRIO_RACE_PREVIOUS_SPAWN 50 -#define SPAWN_PRIO_GOOD_DISTANCE 10 +const float SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200; +const float SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100; +const float SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50; +const float SPAWN_PRIO_GOOD_DISTANCE = 10; // URI handles -#define URI_GET_DISCARD 0 -#define URI_GET_IPBAN 1 -#define URI_GET_IPBAN_END 16 -#define URI_GET_CURL 17 -#define URI_GET_CURL_END 32 -#define URI_GET_UPDATENOTIFICATION 33 -#define URI_GET_URLLIB 128 -#define URI_GET_URLLIB_END 191 +const float URI_GET_DISCARD = 0; +const float URI_GET_IPBAN = 1; +const float URI_GET_IPBAN_END = 16; +const float URI_GET_CURL = 17; +const float URI_GET_CURL_END = 32; +const float URI_GET_UPDATENOTIFICATION = 33; +const float URI_GET_URLLIB = 128; +const float URI_GET_URLLIB_END = 191; // gametype votes -#define GTV_AVAILABLE 0 +const float GTV_AVAILABLE = 0; // for later use in per-map gametype filtering -#define GTV_FORBIDDEN 2 +const float GTV_FORBIDDEN = 2; diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index f521d7de9..16fd950b4 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -62,7 +62,7 @@ #define CSQCPLAYER_HOOK_POSTCAMERASETUP // force updates of player entities that often even if unchanged -#define CSQCPLAYER_FORCE_UPDATES 0.25 +const float CSQCPLAYER_FORCE_UPDATES = 0.25; // mod must define: //vector PL_MIN = ...; diff --git a/qcsrc/common/monsters/monsters.qh b/qcsrc/common/monsters/monsters.qh index c355e12a7..4966d9518 100644 --- a/qcsrc/common/monsters/monsters.qh +++ b/qcsrc/common/monsters/monsters.qh @@ -1,8 +1,8 @@ // monster requests -#define MR_SETUP 1 // (SERVER) setup monster data -#define MR_THINK 2 // (SERVER) logic to run every frame -#define MR_DEATH 3 // (SERVER) called when monster dies -#define MR_PRECACHE 4 // (BOTH) precaches models/sounds used by this monster +const float MR_SETUP = 1; // (SERVER) setup monster data +const float MR_THINK = 2; // (SERVER) logic to run every frame +const float MR_DEATH = 3; // (SERVER) called when monster dies +const float MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster // functions: entity get_monsterinfo(float id); @@ -39,7 +39,7 @@ void register_monster(float id, float(float) func, float monsterflags, vector mi void register_monsters_done(); const float MON_MAXCOUNT = 24; -#define MON_FIRST 1 +const float MON_FIRST = 1; float MON_COUNT; float MON_LAST; diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 0bfd2e5f3..fb4dc7230 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -4,16 +4,16 @@ // ================================================ // main types/groups of notifications -#define MSG_ANNCE 1 // "Global" AND "personal" announcer messages -#define MSG_INFO 2 // "Global" information messages -#define MSG_CENTER 3 // "Personal" centerprint messages -#define MSG_CENTER_CPID 4 // Kill centerprint message -#define MSG_MULTI 5 // Subcall MSG_INFO and/or MSG_CENTER notifications -#define MSG_CHOICE 6 // Choose which subcall wrapper to activate +const float MSG_ANNCE = 1; // "Global" AND "personal" announcer messages +const float MSG_INFO = 2; // "Global" information messages +const float MSG_CENTER = 3; // "Personal" centerprint messages +const float MSG_CENTER_CPID = 4; // Kill centerprint message +const float MSG_MULTI = 5; // Subcall MSG_INFO and/or MSG_CENTER notifications +const float MSG_CHOICE = 6; // Choose which subcall wrapper to activate // negative confirmations -#define NO_MSG -12345 // allows various things to know when no information is added -#define NOTIF_ABORT -1234 // allows Send_Notification to safely abort sending +const float NO_MSG = -12345; // allows various things to know when no information is added +const float NOTIF_ABORT = -1234; // allows Send_Notification to safely abort sending #define EIGHT_VARS_TO_VARARGS_VARLIST \ VARITEM(1, 0, s1) \ @@ -94,12 +94,12 @@ float prev_soundtime; #endif #ifdef SVQC // SERVER ONLY -#define NOTIF_ONE 1 -#define NOTIF_ONE_ONLY 2 -#define NOTIF_TEAM 3 -#define NOTIF_TEAM_EXCEPT 4 -#define NOTIF_ALL 5 -#define NOTIF_ALL_EXCEPT 6 +const float NOTIF_ONE = 1; +const float NOTIF_ONE_ONLY = 2; +const float NOTIF_TEAM = 3; +const float NOTIF_TEAM_EXCEPT = 4; +const float NOTIF_ALL = 5; +const float NOTIF_ALL_EXCEPT = 6; void Kill_Notification( float broadcast, entity client, @@ -1013,18 +1013,18 @@ var float autocvar_notification_show_sprees_center_specialonly = TRUE; death_team: show the full name of the team a player is switching from */ -#define NOTIF_MAX_ARGS 7 -#define NOTIF_MAX_HUDARGS 2 -#define NOTIF_MAX_DURCNT 2 +const float NOTIF_MAX_ARGS = 7; +const float NOTIF_MAX_HUDARGS = 2; +const float NOTIF_MAX_DURCNT = 2; string arg_slot[NOTIF_MAX_ARGS]; -#define ARG_CS_SV_HA 1 // enabled on CSQC, SVQC, and Hudargs -#define ARG_CS_SV_DC 2 // enabled on CSQC, SVQC, and durcnt centerprint -#define ARG_CS_SV 3 // enabled on CSQC and SVQC -#define ARG_CS 4 // unique result to CSQC -#define ARG_SV 5 // unique result to SVQC -#define ARG_DC 6 // unique result to durcnt/centerprint +const float ARG_CS_SV_HA = 1; // enabled on CSQC, SVQC, and Hudargs +const float ARG_CS_SV_DC = 2; // enabled on CSQC, SVQC, and durcnt centerprint +const float ARG_CS_SV = 3; // enabled on CSQC and SVQC +const float ARG_CS = 4; // unique result to CSQC +const float ARG_SV = 5; // unique result to SVQC +const float ARG_DC = 6; // unique result to durcnt/centerprint // todo possible idea.... declare how many floats/strings each arg needs, and then dynamically increment the input // this way, we don't need to have duplicates like i.e. s2loc and s3loc? @@ -1270,7 +1270,7 @@ string notif_arg_spree_inf(float type, string input, string player, float spree) // ==================================== // notification counts -#define NOTIF_FIRST 1 +const float NOTIF_FIRST = 1; float NOTIF_ANNCE_COUNT; float NOTIF_INFO_COUNT; float NOTIF_CENTER_COUNT; @@ -1279,11 +1279,11 @@ float NOTIF_CHOICE_COUNT; float NOTIF_CPID_COUNT; // notification limits -- INCREASE AS NECESSARY -#define NOTIF_ANNCE_MAX 100 -#define NOTIF_INFO_MAX 300 -#define NOTIF_CENTER_MAX 200 -#define NOTIF_MULTI_MAX 200 -#define NOTIF_CHOICE_MAX 20 +const float NOTIF_ANNCE_MAX = 100; +const float NOTIF_INFO_MAX = 300; +const float NOTIF_CENTER_MAX = 200; +const float NOTIF_MULTI_MAX = 200; +const float NOTIF_CHOICE_MAX = 20; // notification entities entity msg_annce_notifs[NOTIF_ANNCE_MAX]; diff --git a/qcsrc/common/playerstats.qh b/qcsrc/common/playerstats.qh index ab4bc166f..6a66380c2 100644 --- a/qcsrc/common/playerstats.qh +++ b/qcsrc/common/playerstats.qh @@ -87,11 +87,11 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status); string autocvar_g_playerstats_gamereport_ladder; var string autocvar_g_playerstats_gamereport_uri = "http://stats.xonotic.org/stats/submit"; -#define PS_B_STATUS_ERROR -2 -#define PS_B_STATUS_IDLE -1 -#define PS_B_STATUS_WAITING 0 -#define PS_B_STATUS_RECEIVED 1 -#define PS_B_STATUS_UPDATING 2 +const float PS_B_STATUS_ERROR = -2; +const float PS_B_STATUS_IDLE = -1; +const float PS_B_STATUS_WAITING = 0; +const float PS_B_STATUS_RECEIVED = 1; +const float PS_B_STATUS_UPDATING = 2; .float playerstats_basicstatus; var string autocvar_g_playerstats_playerbasic_uri = "http://stats.xonotic.org"; @@ -102,10 +102,10 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status); #ifdef MENUQC float PS_D_NEXTUPDATETIME; float PS_D_LASTGAMECOUNT; -#define PS_D_STATUS_ERROR -2 -#define PS_D_STATUS_IDLE -1 -#define PS_D_STATUS_WAITING 0 -#define PS_D_STATUS_RECEIVED 1 +const float PS_D_STATUS_ERROR = -2; +const float PS_D_STATUS_IDLE = -1; +const float PS_D_STATUS_WAITING = 0; +const float PS_D_STATUS_RECEIVED = 1; var float PlayerStats_PlayerDetail_Status = PS_D_STATUS_IDLE; var string autocvar_g_playerstats_playerdetail_uri = "http://stats.xonotic.org/player/me"; var float autocvar_g_playerstats_playerdetail_autoupdatetime = 1800; // automatically update every 30 minutes anyway diff --git a/qcsrc/common/urllib.qc b/qcsrc/common/urllib.qc index b747a27c4..3349d5b24 100644 --- a/qcsrc/common/urllib.qc +++ b/qcsrc/common/urllib.qc @@ -1,7 +1,7 @@ // files .float url_fh; -#define URL_FH_CURL -1 -#define URL_FH_STDOUT -2 +const float URL_FH_CURL = -1; +const float URL_FH_STDOUT = -2; // URLs .string url_url; diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index db6f04c62..e972b1d6b 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -259,7 +259,7 @@ float fexists(string f) } // Databases (hash tables) -#define DB_BUCKETS 8192 +const float DB_BUCKETS = 8192; void db_save(float db, string pFilename) { float fh, i, n; @@ -2373,7 +2373,7 @@ void m_shutdown() cvar_settemp_restore(); // this must be done LAST, but in any case } -#define APPROXPASTTIME_ACCURACY_REQUIREMENT 0.05 +const float APPROXPASTTIME_ACCURACY_REQUIREMENT = 0.05; #define APPROXPASTTIME_MAX (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT) #define APPROXPASTTIME_RANGE (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT) // this will use the value: diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 360aaec36..0fe0ff920 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -99,8 +99,8 @@ string format_time(float seconds); string mmsss(float t); string mmssss(float t); -#define TIME_DECIMALS 2 -#define TIME_FACTOR 100 +const float TIME_DECIMALS = 2; +const float TIME_FACTOR = 100; #define TIME_ENCODED_TOSTRING(n) mmssss(n) #define RACE_RECORD "/race100record/" #define CTS_RECORD "/cts100record/" @@ -265,7 +265,7 @@ float get_model_parameters_age; string get_model_parameters_description; string get_model_parameters_bone_upperbody; string get_model_parameters_bone_weapon; -#define MAX_AIM_BONES 4 +const float MAX_AIM_BONES = 4; string get_model_parameters_bone_aim[MAX_AIM_BONES]; float get_model_parameters_bone_aimweight[MAX_AIM_BONES]; float get_model_parameters_fixbone; @@ -423,12 +423,12 @@ void dedicated_print(string input); #endif #ifndef MENUQC -#define CNT_NORMAL 1 -#define CNT_GAMESTART 2 -#define CNT_IDLE 3 -#define CNT_KILL 4 -#define CNT_RESPAWN 5 -#define CNT_ROUNDSTART 6 +const float CNT_NORMAL = 1; +const float CNT_GAMESTART = 2; +const float CNT_IDLE = 3; +const float CNT_KILL = 4; +const float CNT_RESPAWN = 5; +const float CNT_ROUNDSTART = 6; float Announcer_PickNumber(float type, float num); #endif diff --git a/qcsrc/common/weapons/config.qh b/qcsrc/common/weapons/config.qh index 6a0489314..efef821d8 100644 --- a/qcsrc/common/weapons/config.qh +++ b/qcsrc/common/weapons/config.qh @@ -6,7 +6,7 @@ void Dump_Weapon_Settings(void); float wep_config_file; float wep_config_alsoprint; -#define MAX_WEP_CONFIG 256 +const float MAX_WEP_CONFIG = 256; float WEP_CONFIG_COUNT; string wep_config_queue[MAX_WEP_CONFIG]; diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index 80fcf5524..a32ce00f1 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -55,29 +55,29 @@ REGISTER_WEAPON( w_prop(id, sn, float, weaponthrowable, weaponthrowable) #ifndef MENUQC -#define ARC_MAX_SEGMENTS 20 +const float ARC_MAX_SEGMENTS = 20; vector arc_shotorigin[4]; .vector beam_start; .vector beam_dir; .vector beam_wantdir; .float beam_type; -#define ARC_BT_MISS 0x00 -#define ARC_BT_WALL 0x01 -#define ARC_BT_HEAL 0x02 -#define ARC_BT_HIT 0x03 -#define ARC_BT_BURST_MISS 0x10 -#define ARC_BT_BURST_WALL 0x11 -#define ARC_BT_BURST_HEAL 0x12 -#define ARC_BT_BURST_HIT 0x13 -#define ARC_BT_BURSTMASK 0x10 - -#define ARC_SF_SETTINGS 1 -#define ARC_SF_START 2 -#define ARC_SF_WANTDIR 4 -#define ARC_SF_BEAMDIR 8 -#define ARC_SF_BEAMTYPE 16 -#define ARC_SF_LOCALMASK 14 +const float ARC_BT_MISS = 0x00; +const float ARC_BT_WALL = 0x01; +const float ARC_BT_HEAL = 0x02; +const float ARC_BT_HIT = 0x03; +const float ARC_BT_BURST_MISS = 0x10; +const float ARC_BT_BURST_WALL = 0x11; +const float ARC_BT_BURST_HEAL = 0x12; +const float ARC_BT_BURST_HIT = 0x13; +const float ARC_BT_BURSTMASK = 0x10; + +const float ARC_SF_SETTINGS = 1; +const float ARC_SF_START = 2; +const float ARC_SF_WANTDIR = 4; +const float ARC_SF_BEAMDIR = 8; +const float ARC_SF_BEAMTYPE = 16; +const float ARC_SF_LOCALMASK = 14; #endif #ifdef SVQC ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index 759dc35ea..ea7f38572 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -93,7 +93,7 @@ void spawnfunc_weapon_shockwave(void) weapon_defaultspawnfunc(WEP_SHOCKWAVE); } -#define MAX_SHOCKWAVE_HITS 10 +const float MAX_SHOCKWAVE_HITS = 10; //#define DEBUG_SHOCKWAVE .float swing_prev; @@ -747,9 +747,9 @@ float W_Shockwave(float req) #endif #ifdef CSQC // WEAPONTODO: add client side settings for these -#define SW_MAXALPHA 0.5 -#define SW_FADETIME 0.4 -#define SW_DISTTOMIN 200 +const float SW_MAXALPHA = 0.5; +const float SW_FADETIME = 0.4; +const float SW_DISTTOMIN = 200; void Draw_Shockwave() { // fading/removal control diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index 63db0ac14..19fa6b9bd 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -23,8 +23,8 @@ var float autocvar_cl_movement_errorcompensation = 0; // engine stuff -#define REFDEFFLAG_TELEPORTED 1 -#define REFDEFFLAG_JUMPING 2 +float REFDEFFLAG_TELEPORTED = 1; +float REFDEFFLAG_JUMPING = 2; float pmove_onground; // weird engine flag we shouldn't really use but have to for now vector csqcplayer_origin, csqcplayer_velocity; diff --git a/qcsrc/csqcmodellib/cl_player.qh b/qcsrc/csqcmodellib/cl_player.qh index 1cb42f2a5..ee1a6ac4d 100644 --- a/qcsrc/csqcmodellib/cl_player.qh +++ b/qcsrc/csqcmodellib/cl_player.qh @@ -22,15 +22,15 @@ entity csqcplayer; float csqcplayer_status; -#define CSQCPLAYERSTATUS_UNPREDICTED 0 -#define CSQCPLAYERSTATUS_FROMSERVER 1 -#define CSQCPLAYERSTATUS_PREDICTED 2 +const float CSQCPLAYERSTATUS_UNPREDICTED = 0; +const float CSQCPLAYERSTATUS_FROMSERVER = 1; +const float CSQCPLAYERSTATUS_PREDICTED = 2; // only ever READ these! .float pmove_flags; -#define PMF_JUMP_HELD 1 -#define PMF_DUCKED 4 -#define PMF_ONGROUND 8 +float PMF_JUMP_HELD = 1; +float PMF_DUCKED = 4; +float PMF_ONGROUND = 8; void CSQCPlayer_SetCamera(); float CSQCPlayer_PreUpdate(); diff --git a/qcsrc/csqcmodellib/common.qh b/qcsrc/csqcmodellib/common.qh index 2c13404f5..23db9ab3c 100644 --- a/qcsrc/csqcmodellib/common.qh +++ b/qcsrc/csqcmodellib/common.qh @@ -50,15 +50,15 @@ IN THE SOFTWARE.\ .float frame2time; .float lerpfrac; -#define CSQCMODEL_PROPERTY_FRAME 8388608 -#define CSQCMODEL_PROPERTY_TELEPORTED 4194304 // the "teleport bit" cancelling interpolation -#define CSQCMODEL_PROPERTY_MODELINDEX 2097152 -#define CSQCMODEL_PROPERTY_ORIGIN 1048576 -#define CSQCMODEL_PROPERTY_YAW 524288 -#define CSQCMODEL_PROPERTY_PITCHROLL 262144 -#define CSQCMODEL_PROPERTY_FRAME2 131072 -#define CSQCMODEL_PROPERTY_LERPFRAC 65536 -#define CSQCMODEL_PROPERTY_SIZE 32768 +const float CSQCMODEL_PROPERTY_FRAME = 8388608; +const float CSQCMODEL_PROPERTY_TELEPORTED = 4194304; // the "teleport bit" cancelling interpolation +const float CSQCMODEL_PROPERTY_MODELINDEX = 2097152; +const float CSQCMODEL_PROPERTY_ORIGIN = 1048576; +const float CSQCMODEL_PROPERTY_YAW = 524288; +const float CSQCMODEL_PROPERTY_PITCHROLL = 262144; +const float CSQCMODEL_PROPERTY_FRAME2 = 131072; +const float CSQCMODEL_PROPERTY_LERPFRAC = 65536; +const float CSQCMODEL_PROPERTY_SIZE = 32768; #define ALLPROPERTIES_COMMON \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, float, ReadByte, WriteByte, frame) \ diff --git a/qcsrc/csqcmodellib/interpolate.qh b/qcsrc/csqcmodellib/interpolate.qh index 66bf491e5..535e3dae9 100644 --- a/qcsrc/csqcmodellib/interpolate.qh +++ b/qcsrc/csqcmodellib/interpolate.qh @@ -21,16 +21,16 @@ */ .float iflags; -#define IFLAG_VELOCITY 1 -#define IFLAG_ANGLES 2 -#define IFLAG_AUTOANGLES 4 -#define IFLAG_VALID 8 -#define IFLAG_PREVALID 16 -#define IFLAG_TELEPORTED 32 -#define IFLAG_AUTOVELOCITY 64 -#define IFLAG_V_ANGLE 128 -#define IFLAG_V_ANGLE_X 256 -#define IFLAG_ORIGIN 512 +const float IFLAG_VELOCITY = 1; +const float IFLAG_ANGLES = 2; +const float IFLAG_AUTOANGLES = 4; +const float IFLAG_VALID = 8; +const float IFLAG_PREVALID = 16; +const float IFLAG_TELEPORTED = 32; +const float IFLAG_AUTOVELOCITY = 64; +const float IFLAG_V_ANGLE = 128; +const float IFLAG_V_ANGLE_X = 256; +const float IFLAG_ORIGIN = 512; #define IFLAG_INTERNALMASK (IFLAG_VALID | IFLAG_PREVALID) // call this BEFORE reading an entity update diff --git a/qcsrc/csqcmodellib/settings.qh b/qcsrc/csqcmodellib/settings.qh index aab2a5637..34376c393 100644 --- a/qcsrc/csqcmodellib/settings.qh +++ b/qcsrc/csqcmodellib/settings.qh @@ -16,7 +16,7 @@ #define CSQCPLAYER_HOOK_POSTCAMERASETUP // force updates of player entities that often even if unchanged -#define CSQCPLAYER_FORCE_UPDATES 0.25 +const float CSQCPLAYER_FORCE_UPDATES = 0.25; // mod must define: //vector PL_MIN = ...; diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc index 50586fcc8..a0e396605 100644 --- a/qcsrc/dpdefs/csprogsdefs.qc +++ b/qcsrc/dpdefs/csprogsdefs.qc @@ -930,13 +930,13 @@ float REFDEFFLAG_INTERMISSION = 8; // assorted builtins float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328; vector drawgetimagesize(string pic) = #318; -#define SPA_POSITION 0 -#define SPA_S_AXIS 1 -#define SPA_T_AXIS 2 -#define SPA_R_AXIS 3 -#define SPA_TEXCOORDS0 4 -#define SPA_LIGHTMAP0_TEXCOORDS 5 -#define SPA_LIGHTMAP_COLOR 6 +const float SPA_POSITION = 0; +const float SPA_S_AXIS = 1; +const float SPA_T_AXIS = 2; +const float SPA_R_AXIS = 3; +const float SPA_TEXCOORDS0 = 4; +const float SPA_LIGHTMAP0_TEXCOORDS = 5; +const float SPA_LIGHTMAP_COLOR = 6; float (entity e, float s) getsurfacenumpoints = #434; vector (entity e, float s, float n) getsurfacepoint = #435; vector (entity e, float s) getsurfacenormal = #436; diff --git a/qcsrc/dpdefs/menudefs.qc b/qcsrc/dpdefs/menudefs.qc index 58a2ef585..11129f50c 100644 --- a/qcsrc/dpdefs/menudefs.qc +++ b/qcsrc/dpdefs/menudefs.qc @@ -527,8 +527,8 @@ float(string s) tokenize_console = #514; float(float i) argv_start_index = #515; float(float i) argv_end_index = #516; string(float, float) getgamedirinfo = #626; -#define GETGAMEDIRINFO_NAME 0 -#define GETGAMEDIRINFO_DESCRIPTION 1 +const float GETGAMEDIRINFO_NAME = 0; +const float GETGAMEDIRINFO_DESCRIPTION = 1; float log(float f) = #532; string(string format, ...) sprintf = #627; string(string s) strdecolorize = #477; diff --git a/qcsrc/menu/item/inputbox.c b/qcsrc/menu/item/inputbox.c index 1c1bf5189..7708a0d7f 100644 --- a/qcsrc/menu/item/inputbox.c +++ b/qcsrc/menu/item/inputbox.c @@ -214,7 +214,7 @@ float InputBox_keyDown(entity me, float key, float ascii, float shift) void InputBox_draw(entity me) { -#define CURSOR "_" + string CURSOR = "_"; float cursorPosInWidths, totalSizeInWidths; if(me.pressed) diff --git a/qcsrc/menu/xonotic/charmap.c b/qcsrc/menu/xonotic/charmap.c index 686d90034..5439c391d 100644 --- a/qcsrc/menu/xonotic/charmap.c +++ b/qcsrc/menu/xonotic/charmap.c @@ -24,8 +24,8 @@ entity makeXonoticCharmap(entity controlledInputBox); #ifdef IMPLEMENTATION -#define CHARMAP_COLS 14 -#define CHARMAP_ROWS 10 +const float CHARMAP_COLS = 14; +const float CHARMAP_ROWS = 10; string CHARMAP = "★◆■▮▰▬◣◤◥◢◀▲▶▼" diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c index 60c44ddaf..6f3e56f72 100644 --- a/qcsrc/menu/xonotic/keybinder.c +++ b/qcsrc/menu/xonotic/keybinder.c @@ -34,8 +34,8 @@ void KeyBinder_Bind_Edit(entity btn, entity me); const string KEY_NOT_BOUND_CMD = "// not bound"; -#define MAX_KEYS_PER_FUNCTION 2 -#define MAX_KEYBINDS 256 +const float MAX_KEYS_PER_FUNCTION = 2; +const float MAX_KEYBINDS = 256; string Xonotic_KeyBinds_Functions[MAX_KEYBINDS]; string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS]; var float Xonotic_KeyBinds_Count = -1; diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c index 38b8098ae..d34062d46 100644 --- a/qcsrc/menu/xonotic/languagelist.c +++ b/qcsrc/menu/xonotic/languagelist.c @@ -34,11 +34,11 @@ void SetLanguage_Click(entity btn, entity me); #ifdef IMPLEMENTATION -#define LANGPARM_ID 0 -#define LANGPARM_NAME 1 -#define LANGPARM_NAME_LOCALIZED 2 -#define LANGPARM_PERCENTAGE 3 -#define LANGPARM_COUNT 4 +const float LANGPARM_ID = 0; +const float LANGPARM_NAME = 1; +const float LANGPARM_NAME_LOCALIZED = 2; +const float LANGPARM_PERCENTAGE = 3; +const float LANGPARM_COUNT = 4; entity makeXonoticLanguageList() { diff --git a/qcsrc/menu/xonotic/playerlist.c b/qcsrc/menu/xonotic/playerlist.c index b3ee38670..c60b34e38 100644 --- a/qcsrc/menu/xonotic/playerlist.c +++ b/qcsrc/menu/xonotic/playerlist.c @@ -20,11 +20,11 @@ entity makeXonoticPlayerList(); #ifdef IMPLEMENTATION -#define PLAYERPARM_SCORE 0 -#define PLAYERPARM_PING 1 -#define PLAYERPARM_TEAM 2 -#define PLAYERPARM_NAME 3 -#define PLAYERPARM_COUNT 4 +const float PLAYERPARM_SCORE = 0; +const float PLAYERPARM_PING = 1; +const float PLAYERPARM_TEAM = 2; +const float PLAYERPARM_NAME = 3; +const float PLAYERPARM_COUNT = 4; entity makeXonoticPlayerList() { diff --git a/qcsrc/menu/xonotic/playermodel.c b/qcsrc/menu/xonotic/playermodel.c index 652c581c0..55e3b7746 100644 --- a/qcsrc/menu/xonotic/playermodel.c +++ b/qcsrc/menu/xonotic/playermodel.c @@ -36,14 +36,14 @@ entity makeXonoticPlayerModelSelector() return me; } -#define BUFMODELS_TITLE 0 -#define BUFMODELS_IMAGE 1 -#define BUFMODELS_MODEL 2 -#define BUFMODELS_SKIN 3 -#define BUFMODELS_DESC 4 -#define BUFMODELS_COUNT 5 - -#define XONVOTE186 1 // (nyov) removal of model text description +const float BUFMODELS_TITLE = 0; +const float BUFMODELS_IMAGE = 1; +const float BUFMODELS_MODEL = 2; +const float BUFMODELS_SKIN = 3; +const float BUFMODELS_DESC = 4; +const float BUFMODELS_COUNT = 5; + +const float XONVOTE186 = 1; // (nyov) removal of model text description void XonoticPlayerModelSelector_configureXonoticPlayerModelSelector(entity me) { diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c index c78cba0e0..50ce594e8 100644 --- a/qcsrc/menu/xonotic/serverlist.c +++ b/qcsrc/menu/xonotic/serverlist.c @@ -126,8 +126,8 @@ void ServerList_Info_Click(entity btn, entity me); void ServerList_Update_favoriteButton(entity btn, entity me); // fields for category entities -#define MAX_CATEGORIES 9 -#define CATEGORY_FIRST 1 +const float MAX_CATEGORIES = 9; +const float CATEGORY_FIRST = 1; entity categories[MAX_CATEGORIES]; float category_ent_count; .string cat_name; @@ -1074,9 +1074,9 @@ void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float theAlpha = 1; p = gethostcachenumber(SLIST_FIELD_PING, i); -#define PING_LOW 75 -#define PING_MED 200 -#define PING_HIGH 500 + const float PING_LOW = 75; + const float PING_MED = 200; + const float PING_HIGH = 500; if(p < PING_LOW) theColor = SKINCOLOR_SERVERLIST_LOWPING + (SKINCOLOR_SERVERLIST_MEDPING - SKINCOLOR_SERVERLIST_LOWPING) * (p / PING_LOW); else if(p < PING_MED) diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c index 034fb2584..6d11fe9c6 100644 --- a/qcsrc/menu/xonotic/skinlist.c +++ b/qcsrc/menu/xonotic/skinlist.c @@ -33,11 +33,11 @@ void SetSkin_Click(entity btn, entity me); #ifdef IMPLEMENTATION -#define SKINPARM_NAME 0 -#define SKINPARM_TITLE 1 -#define SKINPARM_AUTHOR 2 -#define SKINPARM_PREVIEW 3 -#define SKINPARM_COUNT 4 +const float SKINPARM_NAME = 0; +const float SKINPARM_TITLE = 1; +const float SKINPARM_AUTHOR = 2; +const float SKINPARM_PREVIEW = 3; +const float SKINPARM_COUNT = 4; entity makeXonoticSkinList() { diff --git a/qcsrc/server/antilag.qc b/qcsrc/server/antilag.qc index c53452ab7..f95afc7a3 100644 --- a/qcsrc/server/antilag.qc +++ b/qcsrc/server/antilag.qc @@ -1,4 +1,4 @@ -#define ANTILAG_MAX_ORIGINS 64 +const float ANTILAG_MAX_ORIGINS = 64; .vector antilag_origins[ANTILAG_MAX_ORIGINS]; .float antilag_times[ANTILAG_MAX_ORIGINS]; .float antilag_index; diff --git a/qcsrc/server/bot/havocbot/role_onslaught.qc b/qcsrc/server/bot/havocbot/role_onslaught.qc index dc942a382..bf5a64389 100644 --- a/qcsrc/server/bot/havocbot/role_onslaught.qc +++ b/qcsrc/server/bot/havocbot/role_onslaught.qc @@ -1,7 +1,7 @@ -#define HAVOCBOT_ONS_ROLE_NONE 0 -#define HAVOCBOT_ONS_ROLE_DEFENSE 2 -#define HAVOCBOT_ONS_ROLE_ASSISTANT 4 -#define HAVOCBOT_ONS_ROLE_OFFENSE 8 +const float HAVOCBOT_ONS_ROLE_NONE = 0; +const float HAVOCBOT_ONS_ROLE_DEFENSE = 2; +const float HAVOCBOT_ONS_ROLE_ASSISTANT = 4; +const float HAVOCBOT_ONS_ROLE_OFFENSE = 8; .float havocbot_role_flags; .float havocbot_attack_time; diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index f984f29b6..1770b4c63 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -91,7 +91,7 @@ float bot_havecommand(entity bot, float idx) return 1; } -#define MAX_BOT_PLACES 4 +const float MAX_BOT_PLACES = 4; .float bot_places_count; .entity bot_places[MAX_BOT_PLACES]; .string bot_placenames[MAX_BOT_PLACES]; @@ -138,35 +138,35 @@ entity bot_getplace(string placename) // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER -#define BOT_CMD_NULL 0 -#define BOT_CMD_PAUSE 1 -#define BOT_CMD_CONTINUE 2 -#define BOT_CMD_WAIT 3 -#define BOT_CMD_TURN 4 -#define BOT_CMD_MOVETO 5 -#define BOT_CMD_RESETGOAL 6 // Not implemented yet -#define BOT_CMD_CC 7 -#define BOT_CMD_IF 8 -#define BOT_CMD_ELSE 9 -#define BOT_CMD_FI 10 -#define BOT_CMD_RESETAIM 11 -#define BOT_CMD_AIM 12 -#define BOT_CMD_PRESSKEY 13 -#define BOT_CMD_RELEASEKEY 14 -#define BOT_CMD_SELECTWEAPON 15 -#define BOT_CMD_IMPULSE 16 -#define BOT_CMD_WAIT_UNTIL 17 -#define BOT_CMD_MOVETOTARGET 18 -#define BOT_CMD_AIMTARGET 19 -#define BOT_CMD_BARRIER 20 -#define BOT_CMD_CONSOLE 21 -#define BOT_CMD_SOUND 22 -#define BOT_CMD_DEBUG_ASSERT_CANFIRE 23 -#define BOT_CMD_WHILE 24 // TODO: Not implemented yet -#define BOT_CMD_WEND 25 // TODO: Not implemented yet -#define BOT_CMD_CHASE 26 // TODO: Not implemented yet - -#define BOT_CMD_COUNTER 24 // Update this value if you add/remove a command +const float BOT_CMD_NULL = 0; +const float BOT_CMD_PAUSE = 1; +const float BOT_CMD_CONTINUE = 2; +const float BOT_CMD_WAIT = 3; +const float BOT_CMD_TURN = 4; +const float BOT_CMD_MOVETO = 5; +const float BOT_CMD_RESETGOAL = 6; // Not implemented yet +const float BOT_CMD_CC = 7; +const float BOT_CMD_IF = 8; +const float BOT_CMD_ELSE = 9; +const float BOT_CMD_FI = 10; +const float BOT_CMD_RESETAIM = 11; +const float BOT_CMD_AIM = 12; +const float BOT_CMD_PRESSKEY = 13; +const float BOT_CMD_RELEASEKEY = 14; +const float BOT_CMD_SELECTWEAPON = 15; +const float BOT_CMD_IMPULSE = 16; +const float BOT_CMD_WAIT_UNTIL = 17; +const float BOT_CMD_MOVETOTARGET = 18; +const float BOT_CMD_AIMTARGET = 19; +const float BOT_CMD_BARRIER = 20; +const float BOT_CMD_CONSOLE = 21; +const float BOT_CMD_SOUND = 22; +const float BOT_CMD_DEBUG_ASSERT_CANFIRE = 23; +const float BOT_CMD_WHILE = 24; // TODO: Not implemented yet +const float BOT_CMD_WEND = 25; // TODO: Not implemented yet +const float BOT_CMD_CHASE = 26; // TODO: Not implemented yet + +const float BOT_CMD_COUNTER = 24; // Update this value if you add/remove a command // NOTE: Following commands should be implemented on the bot ai // If a new command should be handled by the target ai(s) please declare it here @@ -174,10 +174,10 @@ entity bot_getplace(string placename) .float() cmd_resetgoal; // -#define BOT_CMD_PARAMETER_NONE 0 -#define BOT_CMD_PARAMETER_FLOAT 1 -#define BOT_CMD_PARAMETER_STRING 2 -#define BOT_CMD_PARAMETER_VECTOR 3 +const float BOT_CMD_PARAMETER_NONE = 0; +const float BOT_CMD_PARAMETER_FLOAT = 1; +const float BOT_CMD_PARAMETER_STRING = 2; +const float BOT_CMD_PARAMETER_VECTOR = 3; float bot_cmds_initialized; float bot_cmd_parm_type[BOT_CMD_COUNTER]; @@ -650,11 +650,11 @@ float bot_cmd_select_weapon() .float bot_cmd_condition_status; -#define CMD_CONDITION_NONE 0 -#define CMD_CONDITION_TRUE 1 -#define CMD_CONDITION_FALSE 2 -#define CMD_CONDITION_TRUE_BLOCK 4 -#define CMD_CONDITION_FALSE_BLOCK 8 +const float CMD_CONDITION_NONE = 0; +const float CMD_CONDITION_TRUE = 1; +const float CMD_CONDITION_FALSE = 2; +const float CMD_CONDITION_TRUE_BLOCK = 4; +const float CMD_CONDITION_FALSE_BLOCK = 8; float bot_cmd_eval(string expr) { @@ -877,18 +877,18 @@ float bot_cmd_aimtarget() .float bot_cmd_keys; -#define BOT_CMD_KEY_NONE 0 -#define BOT_CMD_KEY_FORWARD 1 -#define BOT_CMD_KEY_BACKWARD 2 -#define BOT_CMD_KEY_RIGHT 4 -#define BOT_CMD_KEY_LEFT 8 -#define BOT_CMD_KEY_JUMP 16 -#define BOT_CMD_KEY_ATTACK1 32 -#define BOT_CMD_KEY_ATTACK2 64 -#define BOT_CMD_KEY_USE 128 -#define BOT_CMD_KEY_HOOK 256 -#define BOT_CMD_KEY_CROUCH 512 -#define BOT_CMD_KEY_CHAT 1024 +const float BOT_CMD_KEY_NONE = 0; +const float BOT_CMD_KEY_FORWARD = 1; +const float BOT_CMD_KEY_BACKWARD = 2; +const float BOT_CMD_KEY_RIGHT = 4; +const float BOT_CMD_KEY_LEFT = 8; +const float BOT_CMD_KEY_JUMP = 16; +const float BOT_CMD_KEY_ATTACK1 = 32; +const float BOT_CMD_KEY_ATTACK2 = 64; +const float BOT_CMD_KEY_USE = 128; +const float BOT_CMD_KEY_HOOK = 256; +const float BOT_CMD_KEY_CROUCH = 512; +const float BOT_CMD_KEY_CHAT = 1024; float bot_presskeys() { diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index c1a637514..45e8a077e 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -16,15 +16,15 @@ void Drag_MoveDrag(entity from, entity to) { } .float maycheat; float gamestart_sv_cheats; -#define CHIMPULSE_SPEEDRUN_INIT 30 -#define CHIMPULSE_GIVE_ALL 99 -#define CHIMPULSE_CLONE_MOVING 140 -#define CHIMPULSE_SPEEDRUN 141 -#define CHIMPULSE_CLONE_STANDING 142 -#define CHIMPULSE_TELEPORT 143 -#define CHIMPULSE_R00T 148 - -#define CHRAME_DRAG 8 +const float CHIMPULSE_SPEEDRUN_INIT = 30; +const float CHIMPULSE_GIVE_ALL = 99; +const float CHIMPULSE_CLONE_MOVING = 140; +const float CHIMPULSE_SPEEDRUN = 141; +const float CHIMPULSE_CLONE_STANDING = 142; +const float CHIMPULSE_TELEPORT = 143; +const float CHIMPULSE_R00T = 148; + +const float CHRAME_DRAG = 8; void CheatInit() { diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 589388bba..13b260dbd 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -4,18 +4,18 @@ // ============================================================ // client verification results -#define CLIENT_ACCEPTABLE 1 -#define CLIENT_DOESNT_EXIST -1 -#define CLIENT_NOT_REAL -2 -#define CLIENT_NOT_BOT -3 +const float CLIENT_ACCEPTABLE = 1; +const float CLIENT_DOESNT_EXIST = -1; +const float CLIENT_NOT_REAL = -2; +const float CLIENT_NOT_BOT = -3; // definitions for timeouts -#define TIMEOUT_INACTIVE 0 -#define TIMEOUT_LEADTIME 1 -#define TIMEOUT_ACTIVE 2 +const float TIMEOUT_INACTIVE = 0; +const float TIMEOUT_LEADTIME = 1; +const float TIMEOUT_ACTIVE = 2; // timeout which pauses the game by setting the slowmo value extremely low. -#define TIMEOUT_SLOWMO_VALUE 0.0001 +const float TIMEOUT_SLOWMO_VALUE = 0.0001; // global timeout information declarations entity timeout_caller; // contains the entity of the player who started the last timeout diff --git a/qcsrc/server/command/getreplies.qh b/qcsrc/server/command/getreplies.qh index 583961d22..4a8043091 100644 --- a/qcsrc/server/command/getreplies.qh +++ b/qcsrc/server/command/getreplies.qh @@ -4,9 +4,9 @@ // ====================================================== // ladder bullshit todo -#define LADDER_FIRSTPOINT 100 -#define LADDER_CNT 10 // position X still gives LADDER_FIRSTPOINT/X points -#define LADDER_SIZE 30 // ladder shows the top X players +const float LADDER_FIRSTPOINT = 100; +const float LADDER_CNT = 10; // position X still gives LADDER_FIRSTPOINT/X points +const float LADDER_SIZE = 30; // ladder shows the top X players string top_uids[LADDER_SIZE]; float top_scores[LADDER_SIZE]; diff --git a/qcsrc/server/command/sv_cmd.qh b/qcsrc/server/command/sv_cmd.qh index 03bd80cef..4b8c946a2 100644 --- a/qcsrc/server/command/sv_cmd.qh +++ b/qcsrc/server/command/sv_cmd.qh @@ -7,8 +7,8 @@ string GotoMap(string m); void race_deleteTime(string map, float pos); -#define SHUFFLETEAMS_MAX_PLAYERS 255 -#define SHUFFLETEAMS_MAX_TEAMS 4 +const float SHUFFLETEAMS_MAX_PLAYERS = 255; +const float SHUFFLETEAMS_MAX_TEAMS = 4; float shuffleteams_players[SHUFFLETEAMS_MAX_PLAYERS]; // maximum of 255 player slots float shuffleteams_teams[SHUFFLETEAMS_MAX_TEAMS]; // maximum of 4 teams diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 0386e1d5a..36da80619 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -4,20 +4,20 @@ // ================================================ // definitions for command selection between progs -#define VC_ASGNMNT_BOTH 1 -#define VC_ASGNMNT_CLIENTONLY 2 -#define VC_ASGNMNT_SERVERONLY 3 +const float VC_ASGNMNT_BOTH = 1; +const float VC_ASGNMNT_CLIENTONLY = 2; +const float VC_ASGNMNT_SERVERONLY = 3; // vote selection definitions -#define VOTE_SELECT_ABSTAIN -2 -#define VOTE_SELECT_REJECT -1 -#define VOTE_SELECT_NULL 0 -#define VOTE_SELECT_ACCEPT 1 +const float VOTE_SELECT_ABSTAIN = -2; +const float VOTE_SELECT_REJECT = -1; +const float VOTE_SELECT_NULL = 0; +const float VOTE_SELECT_ACCEPT = 1; // different statuses of the current vote -#define VOTE_NULL 0 -#define VOTE_NORMAL 1 -#define VOTE_MASTER 2 +const float VOTE_NULL = 0; +const float VOTE_NORMAL = 1; +const float VOTE_MASTER = 2; // global vote information declarations entity vote_caller; // original caller of the current vote @@ -41,7 +41,7 @@ void VoteReset(); void VoteCommand(float request, entity caller, float argc, string vote_command); // warmup and nagger stuff -#define RESTART_COUNTDOWN 10 +const float RESTART_COUNTDOWN = 10; entity nagger; float readycount; // amount of players who are ready float readyrestart_happened; // keeps track of whether a restart has already happened diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 757ee65e2..9c6d35e81 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -138,8 +138,8 @@ void setanim(entity e, vector anim, float looping, float override, float restart //.float chasecam; .float damageforcescale; -#define MIN_DAMAGEEXTRARADIUS 2 -#define MAX_DAMAGEEXTRARADIUS 16 +const float MIN_DAMAGEEXTRARADIUS = 2; +const float MAX_DAMAGEEXTRARADIUS = 16; .float damageextraradius; //.float gravity; @@ -196,12 +196,12 @@ void w_ready(); // weapon states (self.weaponentity.state) const float WS_CLEAR = 0; // no weapon selected const float WS_RAISE = 1; // raise frame -const float WS_DROP = 2; // deselecting frame +const float WS_DROP = 2; // deselecting frame const float WS_INUSE = 3; // fire state const float WS_READY = 4; // idle frame // there is 2 weapon tics that can run in one server frame -#define W_TICSPERFRAME 2 +const float W_TICSPERFRAME = 2; void weapon_defaultspawnfunc(float wpn); @@ -279,7 +279,7 @@ float default_weapon_alpha; .float version_nagtime; -#define NUM_JUMPPADSUSED 3 +const float NUM_JUMPPADSUSED = 3; .float jumppadcount; .entity jumppadsused[NUM_JUMPPADSUSED]; @@ -394,12 +394,12 @@ string globalsound_metalfall; string globalsound_step; string globalsound_metalstep; -#define VOICETYPE_PLAYERSOUND 10 -#define VOICETYPE_TEAMRADIO 11 -#define VOICETYPE_LASTATTACKER 12 -#define VOICETYPE_LASTATTACKER_ONLY 13 -#define VOICETYPE_AUTOTAUNT 14 -#define VOICETYPE_TAUNT 15 +const float VOICETYPE_PLAYERSOUND = 10; +const float VOICETYPE_TEAMRADIO = 11; +const float VOICETYPE_LASTATTACKER = 12; +const float VOICETYPE_LASTATTACKER_ONLY = 13; +const float VOICETYPE_AUTOTAUNT = 14; +const float VOICETYPE_TAUNT = 15; void PrecachePlayerSounds(string f); void PrecacheGlobalSound(string samplestring); @@ -556,11 +556,11 @@ string deathmessage; .float ballistics_density; // wall piercing factor, larger = bullet can pass through more -#define ACTIVE_NOT 0 -#define ACTIVE_ACTIVE 1 -#define ACTIVE_IDLE 2 -#define ACTIVE_BUSY 2 -#define ACTIVE_TOGGLE 3 +const float ACTIVE_NOT = 0; +const float ACTIVE_ACTIVE = 1; +const float ACTIVE_IDLE = 2; +const float ACTIVE_BUSY = 2; +const float ACTIVE_TOGGLE = 3; .float active; .void (float act_state) setactive; .entity realowner; @@ -594,14 +594,14 @@ typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t; string modname; .float missile_flags; -#define MIF_SPLASH 2 -#define MIF_ARC 4 -#define MIF_PROXY 8 -#define MIF_GUIDED_MANUAL 16 -#define MIF_GUIDED_HEAT 32 -#define MIF_GUIDED_LASER 64 -#define MIF_GUIDED_AI 128 -#define MIF_GUIDED_TAG 128 +const float MIF_SPLASH = 2; +const float MIF_ARC = 4; +const float MIF_PROXY = 8; +const float MIF_GUIDED_MANUAL = 16; +const float MIF_GUIDED_HEAT = 32; +const float MIF_GUIDED_LASER = 64; +const float MIF_GUIDED_AI = 128; +const float 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) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 0fd5d2de3..2a706754b 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1,4 +1,4 @@ -#define LATENCY_THINKRATE 10 +const float LATENCY_THINKRATE = 10; .float latency_sum; .float latency_cnt; .float latency_time; diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index d3d7fdca6..5a3bed86d 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -238,7 +238,7 @@ void OnlineBanList_Think() remove(self); } -#define BAN_MAX 256 +const float BAN_MAX = 256; float ban_loaded; string ban_ip[BAN_MAX]; float ban_expire[BAN_MAX]; diff --git a/qcsrc/server/mapvoting.qh b/qcsrc/server/mapvoting.qh index 6875958bf..33e03f8e2 100644 --- a/qcsrc/server/mapvoting.qh +++ b/qcsrc/server/mapvoting.qh @@ -16,7 +16,7 @@ float mapvote_initialized; float mapvote_keeptwotime; float mapvote_timeout; string mapvote_message; -#define MAPVOTE_SCREENSHOT_DIRS_COUNT 4 +const float MAPVOTE_SCREENSHOT_DIRS_COUNT = 4; string mapvote_screenshot_dirs[MAPVOTE_SCREENSHOT_DIRS_COUNT]; float mapvote_screenshot_dirs_count; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index e6fda399e..803561245 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1037,10 +1037,10 @@ void readlevelcvars(void) string precache_sound (string s) = #19; float precache_sound_index (string s) = #19; -#define SND_VOLUME 1 -#define SND_ATTENUATION 2 -#define SND_LARGEENTITY 8 -#define SND_LARGESOUND 16 +const float SND_VOLUME = 1; +const float SND_ATTENUATION = 2; +const float SND_LARGEENTITY = 8; +const float SND_LARGESOUND = 16; float sound_allowed(float dest, entity e) { @@ -1393,14 +1393,14 @@ void precache() #define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return #define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init() -#define INITPRIO_FIRST 0 -#define INITPRIO_GAMETYPE 0 -#define INITPRIO_GAMETYPE_FALLBACK 1 -#define INITPRIO_FINDTARGET 10 -#define INITPRIO_DROPTOFLOOR 20 -#define INITPRIO_SETLOCATION 90 -#define INITPRIO_LINKDOORS 91 -#define INITPRIO_LAST 99 +const float INITPRIO_FIRST = 0; +const float INITPRIO_GAMETYPE = 0; +const float INITPRIO_GAMETYPE_FALLBACK = 1; +const float INITPRIO_FINDTARGET = 10; +const float INITPRIO_DROPTOFLOOR = 20; +const float INITPRIO_SETLOCATION = 90; +const float INITPRIO_LINKDOORS = 91; +const float INITPRIO_LAST = 99; .void(void) initialize_entity; .float initialize_entity_order; diff --git a/qcsrc/server/mutators/base.qc b/qcsrc/server/mutators/base.qc index 1ba8f2663..e13919a23 100644 --- a/qcsrc/server/mutators/base.qc +++ b/qcsrc/server/mutators/base.qc @@ -91,7 +91,7 @@ float CallbackChain_Call(entity cb) return r; // callbacks return an error status, so 0 is default return value } -#define MAX_MUTATORS 15 +const float MAX_MUTATORS = 15; string loaded_mutators[MAX_MUTATORS]; float Mutator_Add(mutatorfunc_t func, string name) { diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index 1c33e3973..3ea206859 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -1,7 +1,7 @@ -#define CBC_ORDER_EXCLUSIVE 3 -#define CBC_ORDER_FIRST 1 -#define CBC_ORDER_LAST 2 -#define CBC_ORDER_ANY 4 +const float CBC_ORDER_EXCLUSIVE = 3; +const float CBC_ORDER_FIRST = 1; +const float CBC_ORDER_LAST = 2; +const float CBC_ORDER_ANY = 4; float CallbackChain_ReturnValue; // read-only field of the current return value @@ -16,9 +16,9 @@ float CallbackChain_Remove(entity cb, float() func); // } float CallbackChain_Call(entity cb); -#define MUTATOR_REMOVING 0 -#define MUTATOR_ADDING 1 -#define MUTATOR_ROLLING_BACK 2 +const float MUTATOR_REMOVING = 0; +const float MUTATOR_ADDING = 1; +const float MUTATOR_ROLLING_BACK = 2; typedef float(float) mutatorfunc_t; float Mutator_Add(mutatorfunc_t func, string name); void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail @@ -356,9 +356,9 @@ MUTATOR_HOOKABLE(ItemTouch); // called at when a item is touched. Called early, can edit item properties. entity self; // item entity other; // player - #define MUT_ITEMTOUCH_CONTINUE 0 // return this flag to make the function continue as normal - #define MUT_ITEMTOUCH_RETURN 1 // return this flag to make the function return (handled entirely by mutator) - #define MUT_ITEMTOUCH_PICKUP 2 // return this flag to have the item "picked up" and taken even after mutator handled it + const float MUT_ITEMTOUCH_CONTINUE = 0; // return this flag to make the function continue as normal + const float MUT_ITEMTOUCH_RETURN = 1; // return this flag to make the function return (handled entirely by mutator) + const float MUT_ITEMTOUCH_PICKUP = 2; // return this flag to have the item "picked up" and taken even after mutator handled it MUTATOR_HOOKABLE(ClientConnect); // called at when a player connect @@ -371,6 +371,6 @@ MUTATOR_HOOKABLE(AccuracyTargetValid); // called when a target is checked for accuracy entity frag_attacker; // attacker entity frag_target; // target - #define MUT_ACCADD_VALID 0 // return this flag to make the function continue if target is a client - #define MUT_ACCADD_INVALID 1 // return this flag to make the function always continue - #define MUT_ACCADD_INDIFFERENT 2 // return this flag to make the function always return + const float MUT_ACCADD_VALID = 0; // return this flag to make the function continue if target is a client + const float MUT_ACCADD_INVALID = 1; // return this flag to make the function always continue + const float MUT_ACCADD_INDIFFERENT = 2; // return this flag to make the function always return diff --git a/qcsrc/server/mutators/gamemode_assault.qh b/qcsrc/server/mutators/gamemode_assault.qh index 9aecf87f2..00b8e98a5 100644 --- a/qcsrc/server/mutators/gamemode_assault.qh +++ b/qcsrc/server/mutators/gamemode_assault.qh @@ -3,9 +3,9 @@ .entity assault_sprite; // legacy bot defs -#define HAVOCBOT_AST_ROLE_NONE 0 -#define HAVOCBOT_AST_ROLE_DEFENSE 2 -#define HAVOCBOT_AST_ROLE_OFFENSE 4 +const float HAVOCBOT_AST_ROLE_NONE = 0; +const float HAVOCBOT_AST_ROLE_DEFENSE = 2; +const float HAVOCBOT_AST_ROLE_OFFENSE = 4; .float havocbot_role_flags; .float havocbot_attack_time; @@ -23,8 +23,8 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_items; void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers; // scoreboard stuff -#define ST_ASSAULT_OBJECTIVES 1 -#define SP_ASSAULT_OBJECTIVES 4 +const float ST_ASSAULT_OBJECTIVES = 1; +const float SP_ASSAULT_OBJECTIVES = 4; // predefined spawnfuncs void spawnfunc_func_breakable(); diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 4ba183004..79ad72130 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -4,7 +4,7 @@ float redalive, bluealive, yellowalive, pinkalive; float ca_teams; float allowed_to_spawn; -#define ST_CA_ROUNDS 1 +const float ST_CA_ROUNDS = 1; void ca_ScoreRules(float teams) { ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE); diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index ca4961edd..86ff40dcc 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -5,23 +5,23 @@ void ctf_RespawnFlag(entity flag); // score rule declarations -#define ST_CTF_CAPS 1 -#define SP_CTF_CAPS 4 -#define SP_CTF_CAPTIME 5 -#define SP_CTF_PICKUPS 6 -#define SP_CTF_DROPS 7 -#define SP_CTF_FCKILLS 8 -#define SP_CTF_RETURNS 9 +const float ST_CTF_CAPS = 1; +const float SP_CTF_CAPS = 4; +const float SP_CTF_CAPTIME = 5; +const float SP_CTF_PICKUPS = 6; +const float SP_CTF_DROPS = 7; +const float SP_CTF_FCKILLS = 8; +const float SP_CTF_RETURNS = 9; // flag constants // for most of these, there is just one question to be asked: WHYYYYY? #define FLAG_MIN (PL_MIN + '0 0 -13') #define FLAG_MAX (PL_MAX + '0 0 -13') -#define FLAG_SCALE 0.6 +const float FLAG_SCALE = 0.6; -#define FLAG_THINKRATE 0.2 -#define FLAG_TOUCHRATE 0.5 -#define WPFE_THINKRATE 0.5 +const float FLAG_THINKRATE = 0.2; +const float FLAG_TOUCHRATE = 0.5; +const float WPFE_THINKRATE = 0.5; #define FLAG_DROP_OFFSET ('0 0 32') #define FLAG_CARRY_OFFSET ('-16 0 8') @@ -31,7 +31,7 @@ void ctf_RespawnFlag(entity flag); #define FLAG_PASS_ARC_OFFSET ('0 0 -10') #define VEHICLE_FLAG_OFFSET ('0 0 96') -#define VEHICLE_FLAG_SCALE 1.0 +const float VEHICLE_FLAG_SCALE = 1.0; // waypoint colors #define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, FALSE) * 0.75) @@ -69,27 +69,27 @@ float wpforenemy_announced; float wpforenemy_nextthink; // statuses -#define FLAG_BASE 1 -#define FLAG_DROPPED 2 -#define FLAG_CARRY 3 -#define FLAG_PASSING 4 +const float FLAG_BASE = 1; +const float FLAG_DROPPED = 2; +const float FLAG_CARRY = 3; +const float FLAG_PASSING = 4; -#define DROP_NORMAL 1 -#define DROP_THROW 2 -#define DROP_PASS 3 -#define DROP_RESET 4 +const float DROP_NORMAL = 1; +const float DROP_THROW = 2; +const float DROP_PASS = 3; +const float DROP_RESET = 4; -#define PICKUP_BASE 1 -#define PICKUP_DROPPED 2 +const float PICKUP_BASE = 1; +const float PICKUP_DROPPED = 2; -#define CAPTURE_NORMAL 1 -#define CAPTURE_DROPPED 2 +const float CAPTURE_NORMAL = 1; +const float CAPTURE_DROPPED = 2; -#define RETURN_TIMEOUT 1 -#define RETURN_DROPPED 2 -#define RETURN_DAMAGE 3 -#define RETURN_SPEEDRUN 4 -#define RETURN_NEEDKILL 5 +const float RETURN_TIMEOUT = 1; +const float RETURN_DROPPED = 2; +const float RETURN_DAMAGE = 3; +const float RETURN_SPEEDRUN = 4; +const float RETURN_NEEDKILL = 5; // flag properties #define ctf_spawnorigin dropped_origin @@ -117,13 +117,13 @@ float ctf_captureshield_max_ratio; // punish at most 30% of each team float ctf_captureshield_force; // push force of the shield // bot player logic -#define HAVOCBOT_CTF_ROLE_NONE 0 -#define HAVOCBOT_CTF_ROLE_DEFENSE 2 -#define HAVOCBOT_CTF_ROLE_MIDDLE 4 -#define HAVOCBOT_CTF_ROLE_OFFENSE 8 -#define HAVOCBOT_CTF_ROLE_CARRIER 16 -#define HAVOCBOT_CTF_ROLE_RETRIEVER 32 -#define HAVOCBOT_CTF_ROLE_ESCORT 64 +const float HAVOCBOT_CTF_ROLE_NONE = 0; +const float HAVOCBOT_CTF_ROLE_DEFENSE = 2; +const float HAVOCBOT_CTF_ROLE_MIDDLE = 4; +const float HAVOCBOT_CTF_ROLE_OFFENSE = 8; +const float HAVOCBOT_CTF_ROLE_CARRIER = 16; +const float HAVOCBOT_CTF_ROLE_RETRIEVER = 32; +const float HAVOCBOT_CTF_ROLE_ESCORT = 64; .float havocbot_cantfindflag; diff --git a/qcsrc/server/mutators/gamemode_cts.qh b/qcsrc/server/mutators/gamemode_cts.qh index f02caf01f..9d6953bcb 100644 --- a/qcsrc/server/mutators/gamemode_cts.qh +++ b/qcsrc/server/mutators/gamemode_cts.qh @@ -1,7 +1,7 @@ float g_race_qualifying; // scores -#define ST_CTS_LAPS 1 -#define SP_CTS_LAPS 4 -#define SP_CTS_TIME 5 -#define SP_CTS_FASTEST 6 +const float ST_CTS_LAPS = 1; +const float SP_CTS_LAPS = 4; +const float SP_CTS_TIME = 5; +const float SP_CTS_FASTEST = 6; diff --git a/qcsrc/server/mutators/gamemode_domination.qh b/qcsrc/server/mutators/gamemode_domination.qh index 6b5b334e4..a0cd99e1c 100644 --- a/qcsrc/server/mutators/gamemode_domination.qh +++ b/qcsrc/server/mutators/gamemode_domination.qh @@ -1,11 +1,11 @@ // these are needed since mutators are compiled last // score rule declarations -#define ST_DOM_TICKS 1 -#define SP_DOM_TICKS 4 -#define SP_DOM_TAKES 5 -#define ST_DOM_CAPS 1 -#define SP_DOM_CAPS 4 +const float ST_DOM_TICKS = 1; +const float SP_DOM_TICKS = 4; +const float SP_DOM_TAKES = 5; +const float ST_DOM_CAPS = 1; +const float SP_DOM_CAPS = 4; // pps: points per second .float dom_total_pps; diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index 5ab96277b..70de31fe3 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -1,10 +1,10 @@ .float freezetag_frozen_time; .float freezetag_frozen_timeout; -#define ICE_MAX_ALPHA 1 -#define ICE_MIN_ALPHA 0.1 +const float ICE_MAX_ALPHA = 1; +const float ICE_MIN_ALPHA = 0.1; float freezetag_teams; -#define SP_FREEZETAG_REVIVALS 4 +const float SP_FREEZETAG_REVIVALS = 4; void freezetag_ScoreRules(float teams) { ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY diff --git a/qcsrc/server/mutators/gamemode_invasion.qh b/qcsrc/server/mutators/gamemode_invasion.qh index 04492d4a3..aa28a2517 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qh +++ b/qcsrc/server/mutators/gamemode_invasion.qh @@ -11,4 +11,4 @@ float inv_monsters_perteam[17]; float inv_monsterskill; -#define ST_INV_KILLS 1 +const float ST_INV_KILLS = 1; diff --git a/qcsrc/server/mutators/gamemode_keepaway.qh b/qcsrc/server/mutators/gamemode_keepaway.qh index 062fc9e0c..98b492e55 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qh +++ b/qcsrc/server/mutators/gamemode_keepaway.qh @@ -2,9 +2,9 @@ entity ka_ball; -#define SP_KEEPAWAY_PICKUPS 4 -#define SP_KEEPAWAY_CARRIERKILLS 5 -#define SP_KEEPAWAY_BCTIME 6 +const float SP_KEEPAWAY_PICKUPS = 4; +const float SP_KEEPAWAY_CARRIERKILLS = 5; +const float SP_KEEPAWAY_BCTIME = 6; void() havocbot_role_ka_carrier; void() havocbot_role_ka_collector; diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 7b3ea98af..c5cd477aa 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -67,13 +67,13 @@ string kh_sound_alarm = "kh/alarm.wav"; // the new siren/alarm float kh_key_dropped, kh_key_carried; -#define ST_KH_CAPS 1 -#define SP_KH_CAPS 4 -#define SP_KH_PUSHES 5 -#define SP_KH_DESTROYS 6 -#define SP_KH_PICKUPS 7 -#define SP_KH_KCKILLS 8 -#define SP_KH_LOSSES 9 +const float ST_KH_CAPS = 1; +const float SP_KH_CAPS = 4; +const float SP_KH_PUSHES = 5; +const float SP_KH_DESTROYS = 6; +const float SP_KH_PICKUPS = 7; +const float SP_KH_KCKILLS = 8; +const float SP_KH_LOSSES = 9; void kh_ScoreRules(float teams) { ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); diff --git a/qcsrc/server/mutators/gamemode_lms.qh b/qcsrc/server/mutators/gamemode_lms.qh index 16fda6155..195c4aac3 100644 --- a/qcsrc/server/mutators/gamemode_lms.qh +++ b/qcsrc/server/mutators/gamemode_lms.qh @@ -1,6 +1,6 @@ // scoreboard stuff -#define SP_LMS_LIVES 4 -#define SP_LMS_RANK 5 +const float SP_LMS_LIVES = 4; +const float SP_LMS_RANK = 5; // lives related defs float lms_lowest_lives; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 346ae1eee..92e707b06 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -8,9 +8,9 @@ vector autocvar_g_nexball_viewmodel_offset; void basketball_touch(); void football_touch(); void ResetBall(); -#define NBM_NONE 0 -#define NBM_FOOTBALL 2 -#define NBM_BASKETBALL 4 +const float NBM_NONE = 0; +const float NBM_FOOTBALL = 2; +const float NBM_BASKETBALL = 4; float nexball_mode; float OtherTeam(float t) //works only if there are two teams on the map! @@ -22,9 +22,9 @@ float OtherTeam(float t) //works only if there are two teams on the map! return e.team; } -#define ST_NEXBALL_GOALS 1 -#define SP_NEXBALL_GOALS 4 -#define SP_NEXBALL_FAULTS 5 +const float ST_NEXBALL_GOALS = 1; +const float SP_NEXBALL_GOALS = 4; +const float SP_NEXBALL_FAULTS = 5; void nb_ScoreRules(float teams) { ScoreRules_basics(teams, 0, 0, TRUE); diff --git a/qcsrc/server/mutators/gamemode_nexball.qh b/qcsrc/server/mutators/gamemode_nexball.qh index 4b0b7eaa1..5a01d4073 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qh +++ b/qcsrc/server/mutators/gamemode_nexball.qh @@ -1,16 +1,16 @@ //EF_BRIGHTFIELD|EF_BRIGHTLIGHT|EF_DIMLIGHT|EF_BLUE|EF_RED|EF_FLAME -#define BALL_EFFECTMASK 1229 -#define BALL_MINS '-16 -16 -16' // The model is 24*24*24 -#define BALL_MAXS '16 16 16' -#define BALL_ATTACHORG '3 0 16' -#define BALL_SPRITECOLOR '.91 .85 .62' -#define BALL_FOOT 1 -#define BALL_BASKET 2 +const float BALL_EFFECTMASK = 1229; +const vector BALL_MINS = '-16 -16 -16'; // The model is 24*24*24 +const vector BALL_MAXS = '16 16 16'; +const vector BALL_ATTACHORG = '3 0 16'; +const vector BALL_SPRITECOLOR = '0.91 0.85 0.62'; +const float BALL_FOOT = 1; +const float BALL_BASKET = 2; //spawnflags -#define GOAL_TOUCHPLAYER 1 +const float GOAL_TOUCHPLAYER = 1; //goal types -#define GOAL_FAULT -1 -#define GOAL_OUT -2 +const float GOAL_FAULT = -1; +const float GOAL_OUT = -2; void DropBall(entity ball, vector org, vector vel); float autocvar_g_nexball_football_boost_forward; diff --git a/qcsrc/server/mutators/gamemode_race.qh b/qcsrc/server/mutators/gamemode_race.qh index 32829a25c..b8b052daa 100644 --- a/qcsrc/server/mutators/gamemode_race.qh +++ b/qcsrc/server/mutators/gamemode_race.qh @@ -2,7 +2,7 @@ float g_race_qualifying; float race_teams; // scores -#define ST_RACE_LAPS 1 -#define SP_RACE_LAPS 4 -#define SP_RACE_TIME 5 -#define SP_RACE_FASTEST 6 +const float ST_RACE_LAPS = 1; +const float SP_RACE_LAPS = 4; +const float SP_RACE_TIME = 5; +const float SP_RACE_FASTEST = 6; diff --git a/qcsrc/server/mutators/mutator_buffs.qh b/qcsrc/server/mutators/mutator_buffs.qh index 66540b876..c96485006 100644 --- a/qcsrc/server/mutators/mutator_buffs.qh +++ b/qcsrc/server/mutators/mutator_buffs.qh @@ -21,8 +21,8 @@ const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack .float oldbuffs; // for updating effects .entity buff_model; // controls effects (TODO: make csqc) -#define BUFF_MIN ('-16 -16 -20') -#define BUFF_MAX ('16 16 20') +const vector BUFF_MIN = ('-16 -16 -20'); +const vector BUFF_MAX = ('16 16 20'); // client side options .float cvar_cl_buffs_autoreplace; diff --git a/qcsrc/server/mutators/mutator_new_toys.qc b/qcsrc/server/mutators/mutator_new_toys.qc index 3e41c42fe..56d38c244 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -69,9 +69,9 @@ roflsound "New toys, new toys!" sound. .string new_toys; float autocvar_g_new_toys_autoreplace; -#define NT_AUTOREPLACE_NEVER 0 -#define NT_AUTOREPLACE_ALWAYS 1 -#define NT_AUTOREPLACE_RANDOM 2 +const float NT_AUTOREPLACE_NEVER = 0; +const float NT_AUTOREPLACE_ALWAYS = 1; +const float NT_AUTOREPLACE_RANDOM = 2; MUTATOR_HOOKFUNCTION(nt_SetModname) { diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index 74e17a6a1..161439d95 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -1,21 +1,21 @@ #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1" #define _ISLOCAL ((edict_num(1) == self) ? TRUE : FALSE) -#define ASF_STRENGTH 1 -#define ASF_SHIELD 2 -#define ASF_MEGA_AR 4 -#define ASF_MEGA_HP 8 -#define ASF_FLAG_GRAB 16 -#define ASF_OBSERVER_ONLY 32 -#define ASF_SHOWWHAT 64 -#define ASF_SSIM 128 -#define ASF_FOLLOWKILLER 256 -#define ASF_ALL 0xFFFFFF +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_ALL = 0xFFFFFF; .float autospec_flags; -#define SSF_SILENT 1 -#define SSF_VERBOSE 2 -#define SSF_ITEMMSG 4 +const float SSF_SILENT = 1; +const float SSF_VERBOSE = 2; +const float SSF_ITEMMSG = 4; .float superspec_flags; .string superspec_itemfilter; //"classname1 classname2 ..." diff --git a/qcsrc/server/pathlib.qc b/qcsrc/server/pathlib.qc index d1f5fd358..5a629e9ab 100644 --- a/qcsrc/server/pathlib.qc +++ b/qcsrc/server/pathlib.qc @@ -520,7 +520,7 @@ float pathlib_h_diagonal3(vector a,vector b) } //#define PATHLIB_USE_NODESCRAP -#define PATHLIB_NODEEXPIRE 0.05 +const float PATHLIB_NODEEXPIRE = 0.05; float pathlib_scraplist_cnt; entity newnode() { diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index 589ff82a1..897c0005d 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -12,7 +12,7 @@ void pathlib_deletepath(entity start) } //#define PATHLIB_NODEEXPIRE 0.05 -#define PATHLIB_NODEEXPIRE 20 +const float PATHLIB_NODEEXPIRE = 20; void dumpnode(entity n) { diff --git a/qcsrc/server/pathlib/pathlib.qh b/qcsrc/server/pathlib/pathlib.qh index d1b6667d7..55bd95dbd 100644 --- a/qcsrc/server/pathlib/pathlib.qh +++ b/qcsrc/server/pathlib/pathlib.qh @@ -5,9 +5,9 @@ #define inwater(point) (pointcontents(point) == CONTENT_WATER) #define medium spawnshieldtime -#define PLIB_FORWARD '0 1 0' +const vector PLIB_FORWARD = '0 1 0'; //#define PLIB_BACK '0 -1 0' -#define PLIB_RIGHT '1 0 0' +const vector PLIB_RIGHT = '1 0 0'; //#define PLIB_LEFT '-1 0 0' #define DEBUGPATHING @@ -28,16 +28,16 @@ entity start_node; .float pathlib_node_f; .float pathlib_node_c; -#define pathlib_node_edgeflag_unknown 0 -#define pathlib_node_edgeflag_left 2 -#define pathlib_node_edgeflag_right 4 -#define pathlib_node_edgeflag_forward 8 -#define pathlib_node_edgeflag_back 16 -#define pathlib_node_edgeflag_backleft 32 -#define pathlib_node_edgeflag_backright 64 -#define pathlib_node_edgeflag_forwardleft 128 -#define pathlib_node_edgeflag_forwardright 256 -#define pathlib_node_edgeflag_none 512 +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; .float pathlib_node_edgeflags; float pathlib_open_cnt; @@ -55,7 +55,7 @@ float pathlib_movecost_waterfactor; float pathlib_foundgoal; float pathlib_starttime; -#define pathlib_maxtime 60 +const float pathlib_maxtime = 60; entity best_open_node; diff --git a/qcsrc/server/playerdemo.qc b/qcsrc/server/playerdemo.qc index 631c10dcb..b848cfac7 100644 --- a/qcsrc/server/playerdemo.qc +++ b/qcsrc/server/playerdemo.qc @@ -2,9 +2,9 @@ .float playerdemo_mode; .float playerdemo_starttime; .float playerdemo_time; -#define PLAYERDEMO_MODE_OFF 0 -#define PLAYERDEMO_MODE_READING 1 -#define PLAYERDEMO_MODE_WRITING 2 +const float PLAYERDEMO_MODE_OFF = 0; +const float PLAYERDEMO_MODE_READING = 1; +const float PLAYERDEMO_MODE_WRITING = 2; void playerdemo_init() { self.playerdemo_mode = PLAYERDEMO_MODE_OFF; diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index aff0652d4..28cbfdaff 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -1,7 +1,7 @@ #define PORTALS_ARE_NOT_SOLID -#define SAFENUDGE '1 1 1' -#define SAFERNUDGE '8 8 8' +const vector SAFENUDGE = '1 1 1'; +const vector SAFERNUDGE = '8 8 8'; .vector portal_transform; .vector portal_safe_origin; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 1c12058d0..f3748f9ce 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -67,7 +67,7 @@ string race_readName(string map, float pos) } -#define MAX_CHECKPOINTS 255 +const float MAX_CHECKPOINTS = 255; void spawnfunc_target_checkpoint(); diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 620ce8ce5..bd83f0b69 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -773,8 +773,8 @@ float TeamScore_GetCompareValue(float t) return s; } -#define NAMEWIDTH 22 -#define SCORESWIDTH 58 +const float NAMEWIDTH = 22; +const float SCORESWIDTH = 58; // TODO put this somewhere in common? string Score_NicePrint_ItemColor(float vflags) { diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 13cc3796f..9db934196 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -44,20 +44,20 @@ const float IT_UNLIMITED_AMMO = 3; // IT_UNLIMITED_SUPERWE const float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking -#define ISF_LOCATION 2 -#define ISF_MODEL 4 -#define ISF_STATUS 8 - #define ITS_STAYWEP 1 - #define ITS_ANIMATE1 2 - #define ITS_ANIMATE2 4 - #define ITS_AVAILABLE 8 - #define ITS_ALLOWFB 16 - #define ITS_ALLOWSI 32 - #define ITS_POWERUP 64 -#define ISF_COLORMAP 16 -#define ISF_DROP 32 -#define ISF_ANGLES 64 -#define ISF_SIZE 128 +const float ISF_LOCATION = 2; +const float ISF_MODEL = 4; +const float ISF_STATUS = 8; + const float ITS_STAYWEP = 1; + const float ITS_ANIMATE1 = 2; + const float ITS_ANIMATE2 = 4; + const float ITS_AVAILABLE = 8; + const float ITS_ALLOWFB = 16; + const float ITS_ALLOWSI = 32; + const float ITS_POWERUP = 64; +const float ISF_COLORMAP = 16; +const float ISF_DROP = 32; +const float ISF_ANGLES = 64; +const float ISF_SIZE = 128; .float ItemStatus; @@ -88,7 +88,7 @@ float ItemSend(entity to, float sf); float have_pickup_item(void); -#define ITEM_RESPAWN_TICKS 10 +const float ITEM_RESPAWN_TICKS = 10; #define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter) // range: respawntime - respawntimejitter .. respawntime + respawntimejitter @@ -142,11 +142,11 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, void target_items_use (void); -#define OP_SET 0 -#define OP_MIN 1 -#define OP_MAX 2 -#define OP_PLUS 3 -#define OP_MINUS 4 +const float OP_SET = 0; +const float OP_MIN = 1; +const float OP_MAX = 2; +const float OP_PLUS = 3; +const float OP_MINUS = 4; float GiveWeapon(entity e, float wpn, float op, float val); diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 315abe152..e3e962a1d 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -1480,8 +1480,8 @@ void door_reset() } // spawnflags require key (for now only func_door) -#define SPAWNFLAGS_GOLD_KEY 8 -#define SPAWNFLAGS_SILVER_KEY 16 +const float SPAWNFLAGS_GOLD_KEY = 8; +const float SPAWNFLAGS_SILVER_KEY = 16; void spawnfunc_func_door() { // Quake 1 keys compatibility diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index 543c1cf0b..2b99cef69 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -67,18 +67,18 @@ void spawn_tdeath(vector v0, entity e, vector v) } .entity pusher; -#define TELEPORT_FLAG_SOUND 1 -#define TELEPORT_FLAG_PARTICLES 2 -#define TELEPORT_FLAG_TDEATH 4 -#define TELEPORT_FLAG_FORCE_TDEATH 8 +const float TELEPORT_FLAG_SOUND = 1; +const float TELEPORT_FLAG_PARTICLES = 2; +const float TELEPORT_FLAG_TDEATH = 4; +const float TELEPORT_FLAG_FORCE_TDEATH = 8; #define TELEPORT_FLAGS_WARPZONE 0 #define TELEPORT_FLAGS_PORTAL (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH) #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH) // types for .teleportable entity setting -#define TELEPORT_NORMAL 1 // play sounds/effects etc -#define TELEPORT_SIMPLE 2 // only do teleport, nothing special +const float TELEPORT_NORMAL = 1; // play sounds/effects etc +const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special void Reset_ArcBeam(entity player, vector forward); void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags) diff --git a/qcsrc/server/tturrets/include/turrets_early.qh b/qcsrc/server/tturrets/include/turrets_early.qh index 4ce95fc39..c13e45137 100644 --- a/qcsrc/server/tturrets/include/turrets_early.qh +++ b/qcsrc/server/tturrets/include/turrets_early.qh @@ -28,81 +28,81 @@ vector real_origin(entity ent); .string cvar_basename; //.float spawnflags -#define TSF_SUSPENDED 1 +const float TSF_SUSPENDED = 1; /// Spawn a pillar model under the turret to make it look ok on uneven ground surfaces -#define TSF_TERRAINBASE 2 +const float TSF_TERRAINBASE = 2; /// Disable builtin ammo regeneration -#define TSF_NO_AMMO_REGEN 4 +const float TSF_NO_AMMO_REGEN = 4; /// Dont break path to chase enemys. will still fire at them if possible. -#define TSF_NO_PATHBREAK 8 +const float TSF_NO_PATHBREAK = 8; /// Dont respawn -#define TSL_NO_RESPAWN 16 +const float TSL_NO_RESPAWN = 16; /// Let this turret roam when idle. -#define TSL_ROAM 32 +const float TSL_ROAM = 32; /// target selection flags .float target_select_flags; /// target validatoin flags .float target_validate_flags; /// Dont select a target on its own. -#define TFL_TARGETSELECT_NO 2 +const float TFL_TARGETSELECT_NO = 2; /// Need line of sight -#define TFL_TARGETSELECT_LOS 4 +const float TFL_TARGETSELECT_LOS = 4; /// Players are valid targets -#define TFL_TARGETSELECT_PLAYERS 8 +const float TFL_TARGETSELECT_PLAYERS = 8; /// Missiles are valid targets -#define TFL_TARGETSELECT_MISSILES 16 +const float TFL_TARGETSELECT_MISSILES = 16; /// Responds to turret_trigger_target events -#define TFL_TARGETSELECT_TRIGGERTARGET 32 +const float TFL_TARGETSELECT_TRIGGERTARGET = 32; /// Angular limitations of turret head limits target selection -#define TFL_TARGETSELECT_ANGLELIMITS 64 +const float TFL_TARGETSELECT_ANGLELIMITS = 64; /// Range limits apply in targetselection -#define TFL_TARGETSELECT_RANGELIMTS 128 +const float TFL_TARGETSELECT_RANGELIMTS = 128; /// DOnt select targets with a .team matching its own -#define TFL_TARGETSELECT_TEAMCHECK 256 +const float TFL_TARGETSELECT_TEAMCHECK = 256; /// Cant select targets on its own. needs to be triggerd or slaved. -#define TFL_TARGETSELECT_NOBUILTIN 512 +const float TFL_TARGETSELECT_NOBUILTIN = 512; /// TFL_TARGETSELECT_TEAMCHECK is inverted (selects only mebers of own .team) -#define TFL_TARGETSELECT_OWNTEAM 1024 +const float TFL_TARGETSELECT_OWNTEAM = 1024; /// Turrets aren't valid targets -#define TFL_TARGETSELECT_NOTURRETS 2048 +const float TFL_TARGETSELECT_NOTURRETS = 2048; /// Use feild of view -#define TFL_TARGETSELECT_FOV 4096 +const float TFL_TARGETSELECT_FOV = 4096; -#define TFL_TARGETSELECT_MISSILESONLY 8192 +const float TFL_TARGETSELECT_MISSILESONLY = 8192; /// aim flags .float aim_flags; /// Dont aim. -#define TFL_AIM_NO 1 +const float TFL_AIM_NO = 1; /// Go for ground, not direct hit, but only if target is on ground. -#define TFL_AIM_GROUNDGROUND 2 +const float TFL_AIM_GROUNDGROUND = 2; /// Try to predict target movement (does not account for gravity) -#define TFL_AIM_LEAD 4 +const float TFL_AIM_LEAD = 4; /// Compensate for shot traveltime when lead -#define TFL_AIM_SHOTTIMECOMPENSATE 8 +const float TFL_AIM_SHOTTIMECOMPENSATE = 8; /// Try to do real prediction of targets z pos at impact. -#define TFL_AIM_ZPREDICT 16 +const float TFL_AIM_ZPREDICT = 16; /// Simply aim at target's current location -#define TFL_AIM_SIMPLE 32 +const float TFL_AIM_SIMPLE = 32; /// track (turn and pitch head) flags .float track_flags; /// Dont move head -#define TFL_TRACK_NO 2 +const float TFL_TRACK_NO = 2; /// Pitch the head -#define TFL_TRACK_PITCH 4 +const float TFL_TRACK_PITCH = 4; /// Rotate the head -#define TFL_TRACK_ROT 8 +const float TFL_TRACK_ROT = 8; /// How tracking is preformed .float track_type; /// Hard angle increments. Ugly for fast turning, best accuracy. -#define TFL_TRACKTYPE_STEPMOTOR 1 +const float TFL_TRACKTYPE_STEPMOTOR = 1; /// Smoth absolute movement. Looks ok, fair accuracy. -#define TFL_TRACKTYPE_FLUIDPRECISE 2 +const float TFL_TRACKTYPE_FLUIDPRECISE = 2; /// Simulated inertia. "Wobbly mode" Looks kool, can mean really bad accuracy depending on how the fields below are set -#define TFL_TRACKTYPE_FLUIDINERTIA 3 +const float TFL_TRACKTYPE_FLUIDINERTIA = 3; /// TFL_TRACKTYPE_FLUIDINERTIA: pitch multiplier .float track_accel_pitch; /// TFL_TRACKTYPE_FLUIDINERTIA: rotation multiplier @@ -113,125 +113,125 @@ vector real_origin(entity ent); /// How prefire check is preformed .float firecheck_flags; /// Dont kill the dead -#define TFL_FIRECHECK_DEAD 4 +const float TFL_FIRECHECK_DEAD = 4; /// Range limits apply -#define TFL_FIRECHECK_DISTANCES 8 +const float TFL_FIRECHECK_DISTANCES = 8; /// Line Of Sight needs to be clear -#define TFL_FIRECHECK_LOS 16 +const float TFL_FIRECHECK_LOS = 16; /// Consider distance inpactpoint<->aimspot -#define TFL_FIRECHECK_AIMDIST 32 +const float TFL_FIRECHECK_AIMDIST = 32; /// Consider enemy origin<->impactpoint -#define TFL_FIRECHECK_REALDIST 64 +const float TFL_FIRECHECK_REALDIST = 64; /// Consider angular diff head<->aimspot -#define TFL_FIRECHECK_ANGLEDIST 128 +const float TFL_FIRECHECK_ANGLEDIST = 128; /// (re)consider target.team<->self.team -#define TFL_FIRECHECK_TEAMCECK 256 +const float TFL_FIRECHECK_TEAMCECK = 256; /// Try to avoid friendly fire -#define TFL_FIRECHECK_AFF 512 +const float TFL_FIRECHECK_AFF = 512; /// Own .ammo needs to be >= then own .shot_dmg -#define TFL_FIRECHECK_OWM_AMMO 1024 +const float TFL_FIRECHECK_OWM_AMMO = 1024; /// Others ammo need to be < others .ammo_max -#define TFL_FIRECHECK_OTHER_AMMO 2048 +const float TFL_FIRECHECK_OTHER_AMMO = 2048; /// Check own .attack_finished_single vs time -#define TFL_FIRECHECK_REFIRE 4096 +const float TFL_FIRECHECK_REFIRE = 4096; /// Move the acctual target to aimspot before tracing impact (and back after) //#define TFL_FIRECHECK_VERIFIED 8192 /// Dont do any chekcs -#define TFL_FIRECHECK_NO 16384 +const float TFL_FIRECHECK_NO = 16384; /// How shooting is done .float shoot_flags; /// Dont shoot -#define TFL_SHOOT_NO 64 +const float TFL_SHOOT_NO = 64; /// Fire in vollys (partial implementation through .shot_volly) -#define TFL_SHOOT_VOLLY 2 +const float TFL_SHOOT_VOLLY = 2; /// Always do a full volly, even if target is lost or dead. (not implemented) -#define TFL_SHOOT_VOLLYALWAYS 4 +const float TFL_SHOOT_VOLLYALWAYS = 4; /// Loop though all valid tarters, and hit them. -#define TFL_SHOOT_HITALLVALID 8 +const float TFL_SHOOT_HITALLVALID = 8; /// Fiering makes unit loose target (after volly is done, if in volly mode) -#define TFL_SHOOT_CLEARTARGET 16 +const float TFL_SHOOT_CLEARTARGET = 16; ///Custom shooting; -#define TFL_SHOOT_CUSTOM 32 +const float TFL_SHOOT_CUSTOM = 32; /// Information aboute the units capabilities .float turrcaps_flags; /// No kown capabilities -#define TFL_TURRCAPS_NONE 0 +const float TFL_TURRCAPS_NONE = 0; /// Capable of sniping -#define TFL_TURRCAPS_SNIPER 2 +const float TFL_TURRCAPS_SNIPER = 2; /// Capable of splasdamage -#define TFL_TURRCAPS_RADIUSDMG 4 +const float TFL_TURRCAPS_RADIUSDMG = 4; /// Has one or more cannons with zero shot traveltime -#define TFL_TURRCAPS_HITSCAN 8 +const float TFL_TURRCAPS_HITSCAN = 8; /// More then one (type of) gun -#define TFL_TURRCAPS_MULTIGUN 16 +const float TFL_TURRCAPS_MULTIGUN = 16; /// Carries at least one guided weapon -#define TFL_TURRCAPS_GUIDED 32 +const float TFL_TURRCAPS_GUIDED = 32; /// At least one gun fiers slow projectiles -#define TFL_TURRCAPS_SLOWPROJ 64 +const float TFL_TURRCAPS_SLOWPROJ = 64; /// At least one gun fiers medium speed projectiles -#define TFL_TURRCAPS_MEDPROJ 128 +const float TFL_TURRCAPS_MEDPROJ = 128; /// At least one gun fiers fast projectiles -#define TFL_TURRCAPS_FASTPROJ 256 +const float TFL_TURRCAPS_FASTPROJ = 256; /// At least one gun capable of damaging players -#define TFL_TURRCAPS_PLAYERKILL 512 +const float TFL_TURRCAPS_PLAYERKILL = 512; /// At least one gun that can shoot town missiles -#define TFL_TURRCAPS_MISSILEKILL 1024 +const float TFL_TURRCAPS_MISSILEKILL = 1024; /// Has support capabilities. powerplants and sutch. -#define TFL_TURRCAPS_SUPPORT 2048 +const float TFL_TURRCAPS_SUPPORT = 2048; /// Proveides at least one type of ammmo -#define TFL_TURRCAPS_AMMOSOURCE 4096 +const float TFL_TURRCAPS_AMMOSOURCE = 4096; /// Can recive targets from external sources -#define TFL_TURRCAPS_RECIVETARGETS 8192 +const float TFL_TURRCAPS_RECIVETARGETS = 8192; /// Capable of self-transport -#define TFL_TURRCAPS_MOVE 16384 +const float TFL_TURRCAPS_MOVE = 16384; /// Will roam arround even if not chasing anyting -#define TFL_TURRCAPS_ROAM 32768 -#define TFL_TURRCAPS_ISTURRET 65536 +const float TFL_TURRCAPS_ROAM = 32768; +const float TFL_TURRCAPS_ISTURRET = 65536; /// Ammo types needed and/or provided //.float ammo_flags; #define ammo_flags currentammo /// Has and needs no ammo -#define TFL_AMMO_NONE 64 +const float TFL_AMMO_NONE = 64; /// Uses power -#define TFL_AMMO_ENERGY 2 +const float TFL_AMMO_ENERGY = 2; /// Uses bullets -#define TFL_AMMO_BULLETS 4 +const float TFL_AMMO_BULLETS = 4; /// Uses explosives -#define TFL_AMMO_ROCKETS 8 +const float TFL_AMMO_ROCKETS = 8; /// Regenerates ammo on its own -#define TFL_AMMO_RECHARGE 16 +const float TFL_AMMO_RECHARGE = 16; /// Can recive ammo from others -#define TFL_AMMO_RECIVE 32 +const float TFL_AMMO_RECIVE = 32; /// How incomming damage is handeld .float damage_flags; /// Cant be hurt -#define TFL_DMG_NO 256 +const float TFL_DMG_NO = 256; /// Can be damaged -#define TFL_DMG_YES 2 +const float TFL_DMG_YES = 2; /// Can be damaged by teammates -#define TFL_DMG_TAKEFROMTEAM 4 +const float TFL_DMG_TAKEFROMTEAM = 4; /// Traget attackers -#define TFL_DMG_RETALIATE 8 +const float TFL_DMG_RETALIATE = 8; /// Target attackers, even is on own team -#define TFL_DMG_RETALIATEONTEAM 16 +const float TFL_DMG_RETALIATEONTEAM = 16; /// Loses target when damaged -#define TFL_DMG_TARGETLOSS 32 +const float TFL_DMG_TARGETLOSS = 32; /// Reciving damage trows off aim (pointless atm, aim gets recalculated to fast). not implemented. -#define TFL_DMG_AIMSHAKE 64 +const float TFL_DMG_AIMSHAKE = 64; /// Reciving damage slaps the head arround -#define TFL_DMG_HEADSHAKE 128 +const float TFL_DMG_HEADSHAKE = 128; /// Die and stay dead. -#define TFL_DMG_DEATH_NORESPAWN 256 +const float TFL_DMG_DEATH_NORESPAWN = 256; // Spawnflags /// Spawn in teambased modes -#define TFL_SPAWN_TEAM 2 +const float TFL_SPAWN_TEAM = 2; /// Spawn in FFA modes -#define TFL_SPAWN_FFA 4 +const float TFL_SPAWN_FFA = 4; /* diff --git a/qcsrc/server/tturrets/units/unit_ewheel.qc b/qcsrc/server/tturrets/units/unit_ewheel.qc index e8e677ac8..1a4d6c4de 100644 --- a/qcsrc/server/tturrets/units/unit_ewheel.qc +++ b/qcsrc/server/tturrets/units/unit_ewheel.qc @@ -1,8 +1,8 @@ -#define ewheel_amin_stop 0 -#define ewheel_amin_fwd_slow 1 -#define ewheel_amin_fwd_fast 2 -#define ewheel_amin_bck_slow 3 -#define ewheel_amin_bck_fast 4 +const float ewheel_amin_stop = 0; +const float ewheel_amin_fwd_slow = 1; +const float ewheel_amin_fwd_fast = 2; +const float ewheel_amin_bck_slow = 3; +const float ewheel_amin_bck_fast = 4; void ewheel_attack() { diff --git a/qcsrc/server/tturrets/units/unit_walker.qc b/qcsrc/server/tturrets/units/unit_walker.qc index a91daa190..660499a52 100644 --- a/qcsrc/server/tturrets/units/unit_walker.qc +++ b/qcsrc/server/tturrets/units/unit_walker.qc @@ -1,19 +1,19 @@ -#define ANIM_NO 0 -#define ANIM_TURN 1 -#define ANIM_WALK 2 -#define ANIM_RUN 3 -#define ANIM_STRAFE_L 4 -#define ANIM_STRAFE_R 5 -#define ANIM_JUMP 6 -#define ANIM_LAND 7 -#define ANIM_PAIN 8 -#define ANIM_MEELE 9 -#define ANIM_SWIM 10 -#define ANIM_ROAM 11 +const float ANIM_NO = 0; +const float ANIM_TURN = 1; +const float ANIM_WALK = 2; +const float ANIM_RUN = 3; +const float ANIM_STRAFE_L = 4; +const float ANIM_STRAFE_R = 5; +const float ANIM_JUMP = 6; +const float ANIM_LAND = 7; +const float ANIM_PAIN = 8; +const float ANIM_MEELE = 9; +const float ANIM_SWIM = 10; +const float ANIM_ROAM = 11; .float animflag; -#define WALKER_MIN '-70 -70 0' -#define WALKER_MAX '70 70 95' +const vector WALKER_MIN = '-70 -70 0'; +const vector WALKER_MAX = '70 70 95'; #define WALKER_PATH(s,e) pathlib_astar(s,e) diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc index 8b8d308f9..88b2cb2a5 100644 --- a/qcsrc/server/vehicles/bumblebee.qc +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -1,6 +1,6 @@ -#define BRG_SETUP 2 -#define BRG_START 4 -#define BRG_END 8 +const float BRG_SETUP = 2; +const float BRG_START = 4; +const float BRG_END = 8; #ifdef SVQC // Auto cvars @@ -77,8 +77,8 @@ var float autocvar_g_vehicle_bumblebee = 0; float bumble_raygun_send(entity to, float sf); -#define BUMB_MIN '-130 -130 -130' -#define BUMB_MAX '130 130 130' +const vector BUMB_MIN = '-130 -130 -130'; +const vector BUMB_MAX = '130 130 130'; void bumb_fire_cannon(entity _gun, string _tagname, entity _owner) { diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index fc9cee865..67e758223 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -1,5 +1,5 @@ -#define RACER_MIN '-120 -120 -40' -#define RACER_MAX '120 120 40' +const vector RACER_MIN = '-120 -120 -40'; +const vector RACER_MAX = '120 120 40'; #ifdef SVQC void racer_exit(float eject); diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 53e4d35f7..4faf3d37e 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -1,10 +1,10 @@ -#define RSM_FIRST 0 -#define RSM_BOMB 0 -#define RSM_FLARE 1 -#define RSM_LAST 1 +const float RSM_FIRST = 0; +const float RSM_BOMB = 0; +const float RSM_FLARE = 1; +const float RSM_LAST = 1; -#define RAPTOR_MIN '-80 -80 0' -#define RAPTOR_MAX '80 80 70' +const vector RAPTOR_MIN = '-80 -80 0'; +const vector RAPTOR_MAX = '80 80 70'; #ifdef SVQC float autocvar_g_vehicle_raptor; diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index c5eb546e8..7b579b1c5 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -69,11 +69,11 @@ vector autocvar_g_vehicle_spiderbot_bouncepain; void spiderbot_exit(float eject); void spiderbot_enter(); void spiderbot_spawn(float); -#define SBRM_FIRST 0 -#define SBRM_VOLLY 0 -#define SBRM_GUIDE 1 -#define SBRM_ARTILLERY 2 -#define SBRM_LAST 2 +const float SBRM_FIRST = 0; +const float SBRM_VOLLY = 0; +const float SBRM_GUIDE = 1; +const float SBRM_ARTILLERY = 2; +const float SBRM_LAST = 2; void spiderbot_rocket_artillery() { diff --git a/qcsrc/server/vehicles/vehicles_def.qh b/qcsrc/server/vehicles/vehicles_def.qh index 56fc9ea00..9c1f0ffd8 100644 --- a/qcsrc/server/vehicles/vehicles_def.qh +++ b/qcsrc/server/vehicles/vehicles_def.qh @@ -40,7 +40,7 @@ const float VHF_PLAYERSLOT = 16384; /// This ent is a player slot on a mul .float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value. .float sound_nexttime; -#define VOL_VEHICLEENGINE 1 +const float VOL_VEHICLEENGINE = 1; .float hud; .float dmg_time; @@ -59,8 +59,8 @@ const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80 .void() vehicle_enter; /// Vehicles custom funciton to be executed when owner exit it .void() vehicle_die; /// Vehicles custom function to be executed when vehile die -#define VHSF_NORMAL 0 -#define VHSF_FACTORY 2 +const float VHSF_NORMAL = 0; +const float VHSF_FACTORY = 2; .void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns .float(float _imp) vehicles_impulse; .float vehicle_weapon2mode = volly_counter; diff --git a/qcsrc/warpzonelib/mathlib.qh b/qcsrc/warpzonelib/mathlib.qh index 18d402a36..8b1569221 100644 --- a/qcsrc/warpzonelib/mathlib.qh +++ b/qcsrc/warpzonelib/mathlib.qh @@ -3,11 +3,11 @@ // The commented-out functions need no implementation because DarkPlaces offers // them as builtins. They are listed here anyway for completeness sake. -#define FP_NAN 0 -#define FP_INFINITE 1 -#define FP_ZERO 2 -#define FP_SUBNORMAL 3 -#define FP_NORMAL 4 +const float FP_NAN = 0; +const float FP_INFINITE = 1; +const float FP_ZERO = 2; +const float FP_SUBNORMAL = 3; +const float FP_NORMAL = 4; int fpclassify(float x); int isfinite(float x); int isinf(float x); @@ -85,16 +85,16 @@ int islessequal(float x, float y); int islessgreater(float x, float y); int isunordered(float x, float y); -#define M_E 2.7182818284590452354 /* e */ -#define M_LOG2E 1.4426950408889634074 /* log_2 e */ -#define M_LOG10E 0.43429448190325182765 /* log_10 e */ -#define M_LN2 0.69314718055994530942 /* log_e 2 */ -#define M_LN10 2.30258509299404568402 /* log_e 10 */ -#define M_PI 3.14159265358979323846 /* pi */ -#define M_PI_2 1.57079632679489661923 /* pi/2 */ -#define M_PI_4 0.78539816339744830962 /* pi/4 */ -#define M_1_PI 0.31830988618379067154 /* 1/pi */ -#define M_2_PI 0.63661977236758134308 /* 2/pi */ -#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ -#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +const float M_E = 2.7182818284590452354; /* e */ +const float M_LOG2E = 1.4426950408889634074; /* log_2 e */ +const float M_LOG10E = 0.43429448190325182765; /* log_10 e */ +const float M_LN2 = 0.69314718055994530942; /* log_e 2 */ +const float M_LN10 = 2.30258509299404568402; /* log_e 10 */ +const float M_PI = 3.14159265358979323846; /* pi */ +const float M_PI_2 = 1.57079632679489661923; /* pi/2 */ +const float M_PI_4 = 0.78539816339744830962; /* pi/4 */ +const float M_1_PI = 0.31830988618379067154; /* 1/pi */ +const float M_2_PI = 0.63661977236758134308; /* 2/pi */ +const float M_2_SQRTPI = 1.12837916709551257390; /* 2/sqrt(pi) */ +const float M_SQRT2 = 1.41421356237309504880; /* sqrt(2) */ +const float M_SQRT1_2 = 0.70710678118654752440; /* 1/sqrt(2) */ -- 2.39.2