X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fconstants.qh;h=344eec48cee50401790682864c2e79e97abfcd13;hb=4115f971d5c8a3902d895f60966d08a1d700f6ff;hp=910f34e326eaaed24ab4462ef31b5d8321bff4c8;hpb=2046c0aa48fa58594d075ca4247a7dd724ae9bfb;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 910f34e32..344eec48c 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -1,10 +1,31 @@ #pragma once -const int RANKINGS_CNT = 15; +const int FRAGS_PLAYER = 0; +const int FRAGS_SPECTATOR = -666; +const int FRAGS_PLAYER_OUT_OF_GAME = -616; + +/////////////////////////// +// cvar constants + +const int CVAR_SAVE = 1; +const int CVAR_NOTIFY = 2; +const int CVAR_READONLY = 4; + +// server flags +const int SERVERFLAG_ALLOW_FULLBRIGHT = 1; +const int SERVERFLAG_TEAMPLAY = 2; +const int SERVERFLAG_PLAYERSTATS = 4; -const int SPRITERULE_DEFAULT = 0; -const int SPRITERULE_TEAMPLAY = 1; -const int SPRITERULE_SPECTATOR = 2; +const int SPECIES_HUMAN = 0; +const int SPECIES_ROBOT_SOLID = 1; +const int SPECIES_ALIEN = 2; +const int SPECIES_ANIMAL = 3; +const int SPECIES_ROBOT_RUSTY = 4; +const int SPECIES_ROBOT_SHINY = 5; +const int SPECIES_RESERVED = 15; + +#ifdef GAMEQC +const int RANKINGS_CNT = 99; /////////////////////////// // keys pressed @@ -17,13 +38,6 @@ const int KEY_CROUCH = BIT(5); const int KEY_ATCK = BIT(6); const int KEY_ATCK2 = BIT(7); -/////////////////////////// -// cvar constants - -const int CVAR_SAVE = 1; -const int CVAR_NOTIFY = 2; -const int CVAR_READONLY = 4; - /////////////////////////// // csqc communication stuff @@ -34,242 +48,45 @@ const int HUD_BUMBLEBEE_GUN = 25; // # of maps, I'll use arrays for them :P const int MAPVOTE_COUNT = 30; -/** - * Lower scores are better (e.g. suicides) - */ -const int SFL_LOWER_IS_BETTER = BIT(0); - -/** - * Don't show zero values as scores - */ -const int SFL_HIDE_ZERO = BIT(1); - -/** - * Allow a column to be hidden (do not automatically add it even if it is a sorting key) - */ -const int SFL_ALLOW_HIDE = BIT(4); - -/** - * Display as a rank (with st, nd, rd, th suffix) - */ -const int SFL_RANK = BIT(5); - -/** - * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!) - */ -const int SFL_TIME = BIT(6); - -// not an extra constant yet -#define SFL_ZERO_IS_WORST SFL_TIME - -/** - * Scoring priority (NOTE: PRIMARY is used for fraglimit) - */ -const int SFL_SORT_PRIO_SECONDARY = 4; -const int SFL_SORT_PRIO_PRIMARY = 8; -const int SFL_SORT_PRIO_MASK = 12; - -/* - * Score indices - */ - -#ifdef GAMEQC - -#define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER ) -#define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) ) - - -#define MAX_SCORE 64 - -#define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField)) -REGISTRY(Scores, MAX_SCORE); -#define Scores_from(i) _Scores_from(i, NULL) -REGISTER_REGISTRY(Scores) -REGISTRY_SORT(Scores); -REGISTRY_CHECK(Scores); -STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); } - -USING(PlayerScoreField, entity); -.int _scores[MAX_SCORE]; -.string m_name; -.int m_flags; - -#define scores(this) _scores[(this).m_id] -#define scores_label(this) ((this).m_name) -#define scores_flags(this) ((this).m_flags) - -REGISTER_SP(END); - -REGISTER_SP(PING); -REGISTER_SP(PL); -REGISTER_SP(NAME); -REGISTER_SP(KDRATIO); -REGISTER_SP(SUM); - -REGISTER_SP(SEPARATOR); - -REGISTER_SP(SCORE); - -REGISTER_SP(DMG); -REGISTER_SP(DMGTAKEN); - -REGISTER_SP(KILLS); -REGISTER_SP(DEATHS); -REGISTER_SP(SUICIDES); -REGISTER_SP(FRAGS); - -REGISTER_SP(ELO); - -// TODO: move to common mutators - -REGISTER_SP(RACE_TIME); -REGISTER_SP(RACE_LAPS); -REGISTER_SP(RACE_FASTEST); - -//REGISTER_SP(CTS_TIME); -//REGISTER_SP(CTS_LAPS); -//REGISTER_SP(CTS_FASTEST); - -REGISTER_SP(ASSAULT_OBJECTIVES); - -REGISTER_SP(CTF_PICKUPS); -REGISTER_SP(CTF_FCKILLS); -REGISTER_SP(CTF_RETURNS); -REGISTER_SP(CTF_CAPS); -REGISTER_SP(CTF_CAPTIME); -REGISTER_SP(CTF_DROPS); - -REGISTER_SP(DOM_TAKES); -REGISTER_SP(DOM_TICKS); - -REGISTER_SP(FREEZETAG_REVIVALS); - -REGISTER_SP(KEEPAWAY_PICKUPS); -REGISTER_SP(KEEPAWAY_BCTIME); -REGISTER_SP(KEEPAWAY_CARRIERKILLS); - -REGISTER_SP(KH_PICKUPS); -REGISTER_SP(KH_CAPS); -REGISTER_SP(KH_KCKILLS); -REGISTER_SP(KH_PUSHES); -REGISTER_SP(KH_DESTROYS); -REGISTER_SP(KH_LOSSES); - -REGISTER_SP(LMS_RANK); -REGISTER_SP(LMS_LIVES); - -REGISTER_SP(NEXBALL_GOALS); -REGISTER_SP(NEXBALL_FAULTS); - -REGISTER_SP(ONS_TAKES); -REGISTER_SP(ONS_CAPS); - -#define MAX_TEAMSCORE 2 -USING(ScoreTeam, string); -.int _teamscores[MAX_TEAMSCORE]; -#define teamscores(i) _teamscores[i] -string _teamscores_label[MAX_TEAMSCORE]; -#define teamscores_label(i) _teamscores_label[i] -int _teamscores_flags[MAX_TEAMSCORE]; -#define teamscores_flags(i) _teamscores_flags[i] - -#endif - -const int ST_SCORE = 0; - -// game mode specific indices are not in common/, but in server/scores_rules.qc! - -// WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc -const int PROJECTILE_ELECTRO = 1; -const int PROJECTILE_ROCKET = 2; -const int PROJECTILE_TAG = 3; -const int PROJECTILE_CRYLINK = 5; -const int PROJECTILE_ELECTRO_BEAM = 6; -const int PROJECTILE_GRENADE = 7; -const int PROJECTILE_GRENADE_BOUNCING = 8; -const int PROJECTILE_MINE = 9; -const int PROJECTILE_BLASTER = 10; -const int PROJECTILE_HLAC = 11; -const int PROJECTILE_SEEKER = 12; -const int PROJECTILE_FLAC = 13; -const int PROJECTILE_PORTO_RED = 14; -const int PROJECTILE_PORTO_BLUE = 15; -const int PROJECTILE_HOOKBOMB = 16; -const int PROJECTILE_HAGAR = 17; -const int PROJECTILE_HAGAR_BOUNCING = 18; -const int PROJECTILE_CRYLINK_BOUNCING = 20; -const int PROJECTILE_FIREBALL = 21; -const int PROJECTILE_FIREMINE = 22; - -const int PROJECTILE_RAPTORCANNON = 24; -const int PROJECTILE_RAPTORBOMB = 25; -const int PROJECTILE_RAPTORBOMBLET = 26; -const int PROJECTILE_SPIDERROCKET = 27; -const int PROJECTILE_WAKIROCKET = 28; -const int PROJECTILE_WAKICANNON = 29; - -const int PROJECTILE_BUMBLE_GUN = 30; -const int PROJECTILE_BUMBLE_BEAM = 31; - -const int PROJECTILE_MAGE_SPIKE = 32; -const int PROJECTILE_SHAMBLER_LIGHTNING = 33; - -const int PROJECTILE_ROCKETMINSTA_LASER = 34; - -const int PROJECTILE_ARC_BOLT = 35; - -// projectile IDs 40-50 reserved - -const int PROJECTILE_RPC = 60; - -const int SPECIES_HUMAN = 0; -const int SPECIES_ROBOT_SOLID = 1; -const int SPECIES_ALIEN = 2; -const int SPECIES_ANIMAL = 3; -const int SPECIES_ROBOT_RUSTY = 4; -const int SPECIES_ROBOT_SHINY = 5; -const int SPECIES_RESERVED = 15; - -const int FRAGS_PLAYER = 0; -const int FRAGS_SPECTATOR = -666; -const int FRAGS_LMS_LOSER = -616; -const int FRAGS_PLAYER_NONSOLID = FRAGS_LMS_LOSER; -// we can use this frags value for both - -// water levels -const int WATERLEVEL_NONE = 0; -const int WATERLEVEL_WETFEET = 1; -const int WATERLEVEL_SWIMMING = 2; -const int WATERLEVEL_SUBMERGED = 3; - -// server flags -const int SERVERFLAG_ALLOW_FULLBRIGHT = 1; -const int SERVERFLAG_TEAMPLAY = 2; -const int SERVERFLAG_PLAYERSTATS = 4; - -#ifdef SVQC -// FIXME/EXPLAINME: why? Mario: because -vector autocvar_sv_player_maxs = '16 16 45'; -vector autocvar_sv_player_mins = '-16 -16 -24'; -vector autocvar_sv_player_viewoffset = '0 0 20'; -vector autocvar_sv_player_crouch_maxs = '16 16 25'; -vector autocvar_sv_player_crouch_mins = '-16 -16 -24'; -vector autocvar_sv_player_crouch_viewoffset = '0 0 20'; -//vector autocvar_sv_player_headsize = '24 24 12'; -#endif - - // a bit more constant const vector PL_MAX_CONST = '16 16 45'; const vector PL_MIN_CONST = '-16 -16 -24'; - -// spawnpoint prios -const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200; -const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100; -const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50; -const int SPAWN_PRIO_GOOD_DISTANCE = 10; +const vector PL_CROUCH_MAX_CONST = '16 16 25'; +const vector PL_CROUCH_MIN_CONST = '-16 -16 -24'; // gametype vote flags const int GTV_FORBIDDEN = 0; // Cannot be voted const int GTV_AVAILABLE = 1; // Can be voted const int GTV_CUSTOM = 2; // Custom entry + +// generic entity flags +// engine flags can't be redefined as they are used by the engine (unfortunately), they are listed here for posterity +#ifdef CSQC +const int FL_FLY = 1; /* BIT(0) */ +const int FL_SWIM = 2; /* BIT(1) */ +const int FL_CLIENT = 8; /* BIT(2) */ // set for all client edicts +const int FL_INWATER = 16; /* BIT(3) */ // for enter / leave water splash +const int FL_MONSTER = 32; /* BIT(4) */ +const int FL_GODMODE = 64; /* BIT(5) */ // player cheat +const int FL_NOTARGET = 128; /* BIT(6) */ // player cheat +const int FL_ITEM = 256; /* BIT(7) */ // extra wide size for bonus items +const int FL_ONGROUND = 512; /* BIT(8) */ // standing on something +const int FL_PARTIALGROUND = 1024; /* BIT(9) */ // not all corners are valid +const int FL_WATERJUMP = 2048; /* BIT(10) */ // player jumping out of water +const int FL_JUMPRELEASED = 4096; /* BIT(11) */ // for jump debouncing +#endif +const int FL_WEAPON = BIT(12); +const int FL_POWERUP = BIT(13); +const int FL_PROJECTILE = BIT(14); +const int FL_TOSSED = BIT(15); +const int FL_SPAWNING = BIT(16); +const int FL_PICKUPITEMS = BIT(17); +const int FL_DUCKED = BIT(18); +const int FL_ONSLICK = BIT(19); +#endif + +#if defined(SVQC) + #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT) +#elif defined(CSQC) + #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT) +#endif