X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fconstants.qh;h=29f96aa4490b527ecab33592689534fb358c16ec;hp=8d8e8df19fecc4965ebf3242946f04282d972d47;hb=3cc1e9c4a52d70b4d7097a0a584cbb391570c6e2;hpb=c741e6b3f012aa525f23e1df30d1d933b383fbc5 diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 8d8e8df19..29f96aa44 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -1,30 +1,4 @@ -#ifndef CONSTANTS_H -#define CONSTANTS_H - -// 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 +#pragma once REGISTER_NET_TEMP(TE_CSQC_PICTURE) REGISTER_NET_TEMP(TE_CSQC_RACE) @@ -50,12 +24,11 @@ const int RANKINGS_CNT = 15; REGISTER_NET_LINKED(_ENT_CLIENT_INIT) #ifdef CSQC -NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { return true; } +NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { make_pure(this); return true; } #endif /** Sent as a temp entity from a persistent linked entity */ REGISTER_NET_TEMP(ENT_CLIENT_INIT) -REGISTER_NET_LINKED(ENT_CLIENT_ENTCS) REGISTER_NET_LINKED(ENT_CLIENT_SCORES_INFO) REGISTER_NET_LINKED(ENT_CLIENT_SCORES) REGISTER_NET_LINKED(ENT_CLIENT_TEAMSCORES) @@ -149,19 +122,114 @@ const int SFL_SORT_PRIO_SECONDARY = 4; const int SFL_SORT_PRIO_PRIMARY = 8; const int SFL_SORT_PRIO_MASK = 12; -/** +/* * Score indices */ -#define MAX_SCORE 12 + +#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; -const int SP_KILLS = 0; -const int SP_DEATHS = 1; -const int SP_SUICIDES = 2; -const int SP_SCORE = 3; -const int SP_DMG = 10; -const int SP_DMGTAKEN = 11; + // 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 @@ -201,6 +269,8 @@ 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; @@ -224,6 +294,8 @@ 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; @@ -238,24 +310,6 @@ vector autocvar_sv_player_crouch_viewoffset = '0 0 20'; vector autocvar_sv_player_headsize = '24 24 12'; -// not so constant -#ifdef SVQC -#define PL_VIEW_OFS autocvar_sv_player_viewoffset -#define PL_MIN autocvar_sv_player_mins -#define PL_MAX autocvar_sv_player_maxs -#define PL_CROUCH_VIEW_OFS autocvar_sv_player_crouch_viewoffset -#define PL_CROUCH_MIN autocvar_sv_player_crouch_mins -#define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs -#define PL_HEAD autocvar_sv_player_headsize -#elif defined(CSQC) -#define PL_VIEW_OFS vec3(getstatf(STAT_PL_VIEW_OFS1), getstatf(STAT_PL_VIEW_OFS2), getstatf(STAT_PL_VIEW_OFS3)) -#define PL_MIN vec3(getstatf(STAT_PL_MIN1), getstatf(STAT_PL_MIN2), getstatf(STAT_PL_MIN3)) -#define PL_MAX vec3(getstatf(STAT_PL_MAX1), getstatf(STAT_PL_MAX2), getstatf(STAT_PL_MAX3)) -#define PL_CROUCH_VIEW_OFS vec3(getstatf(STAT_PL_CROUCH_VIEW_OFS1), getstatf(STAT_PL_CROUCH_VIEW_OFS2), getstatf(STAT_PL_CROUCH_VIEW_OFS3)) -#define PL_CROUCH_MIN vec3(getstatf(STAT_PL_CROUCH_MIN1), getstatf(STAT_PL_CROUCH_MIN2), getstatf(STAT_PL_CROUCH_MIN3)) -#define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3)) -#endif - // a bit more constant const vector PL_MAX_CONST = '16 16 45'; const vector PL_MIN_CONST = '-16 -16 -24'; @@ -270,4 +324,3 @@ const int SPAWN_PRIO_GOOD_DISTANCE = 10; const int GTV_FORBIDDEN = 0; // Cannot be voted const int GTV_AVAILABLE = 1; // Can be voted const int GTV_CUSTOM = 2; // Custom entry -#endif