#pragma once
#include <common/weapons/_all.qh>
+#include <common/scores.qh>
void Hud_Dynamic_Frame();
#include <common/mapinfo.qh>
#include <common/ent_cs.qh>
+#include <common/scores.qh>
#include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
// Mod icons (#10)
#include "scoreboard.qh"
#include <common/ent_cs.qh>
#include <common/mapinfo.qh>
+#include <common/scores.qh>
// Score (#7)
#include <common/net_linked.qh>
#include <common/mapinfo.qh>
#include <common/minigames/cl_minigames.qh>
+#include <common/scores.qh>
#include <common/stats.qh>
#include <common/teams.qh>
#include <common/minigames/cl_minigames_hud.qh>
#include <common/net_linked.qh>
#include <common/net_notice.qh>
+#include <common/scores.qh>
#include <common/triggers/include.qh>
#include <common/vehicles/all.qh>
#include <lib/csqcmodel/cl_model.qh>
// # 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;
--- /dev/null
+#pragma once
+
+#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); }
+
+/*
+ * Score indices
+ */
+
+#ifdef GAMEQC
+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);
+#endif
+
+
+// the stuff you don't need to see
+
+/**
+ * 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;
+
+#define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
+#define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
+
+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)
+
+#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]
+
+const int ST_SCORE = 0;
#include "util.qh"
#if defined(CSQC)
- #include "../client/defs.qh"
#include "constants.qh"
#include "../client/mutators/events.qh"
#include "mapinfo.qh"
#include "notifications/all.qh"
+ #include "scores.qh"
#include <common/deathtypes/all.qh>
#elif defined(MENUQC)
#elif defined(SVQC)
#include "constants.qh"
- #include "../server/autocvars.qh"
- #include "../server/defs.qh"
#include "../server/mutators/events.qh"
#include "notifications/all.qh"
#include <common/deathtypes/all.qh>
+ #include "scores.qh"
#include "mapinfo.qh"
#endif
}
}
+#ifdef GAMEQC
string ScoreString(int pFlags, float pValue)
{
string valstr;
return valstr;
}
+#endif
// compressed vector format:
// like MD3, just even shorter
#pragma once
#ifdef GAMEQC
-
vector real_origin(entity ent);
#endif
+.string netname;
+.string message;
+
IntrusiveList g_saved_cvars;
STATIC_INIT(g_saved_cvars) { g_saved_cvars = IL_NEW(); }
// for each element, funcPre is called first, then funcPre and funcPost for all its children, and funcPost last
void depthfirst(entity start, .entity up, .entity downleft, .entity right, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass);
-float median(float a, float b, float c);
-
-// converts a number to a string with the indicated number of decimals
-string ftos_decimals(float number, float decimals);
-string ftos_mindecimals(float number);
-
-bool fexists(string f);
-
-// unzone the string, and return it as tempstring. Safe to be called on string_null
-string fstrunzone(string s);
-
-// database (NOTE: keys are case sensitive)
-void db_save(int db, string filename);
-void db_dump(int db, string pFilename);
-int db_create();
-int db_load(string filename);
-void db_close(int db);
-string db_get(int db, string key);
-void db_put(int db, string key, string value);
-
-// stringbuffer loading/saving
-int buf_load(string filename);
-void buf_save(int buf, string filename);
-
// adding just 0.4 for race times so it rounds down in the .5 case (matching the timer display)
// FIXME it doesn't round properly
#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
-string format_time(float seconds);
-string mmsss(float t);
-string mmssss(float t);
-const float TIME_DECIMALS = 2;
+const int TIME_DECIMALS = 2;
const float TIME_FACTOR = 100;
#define TIME_ENCODED_TOSTRING(n) mmssss(n)
#define RACE_RECORD "/race100record/"
#define TIME_ENCODE(t) TIME_TO_NTHS(t, TIME_FACTOR)
#define TIME_DECODE(n) ((n) / TIME_FACTOR)
+#ifdef GAMEQC
string ScoreString(float vflags, float value);
+#endif
vector decompressShortVector(float data);
float compressShortVector(vector vec);
string mapPriorityList(string order, string(string) mapfunc);
string swapInPriorityList(string order, float i, float j);
-float cvar_value_issafe(string s);
-
float cvar_settemp(string pKey, string pValue);
float cvar_settemp_restore();
void get_mi_min_max_texcoords(float mode);
#endif
-float almost_equals(float a, float b);
-float almost_in_bounds(float a, float b, float c);
-
-float boxesoverlap(vector m1, vector m2, vector m3, vector m4);
-float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs);
-
USING(textLengthUpToWidth_widthFunction_t, float(string s, vector size));
USING(textLengthUpToLength_lenFunction_t, float(string s));
float textLengthUpToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
float isGametypeInFilter(entity gt, float tp, float ts, string pattern);
-string swapwords(string str, float i, float j);
-string shufflewords(string str);
-
-string substring_range(string s, float b, float e);
-
-vector solve_quadratic(float a, float b, float c);
-// solution 1 -> x
-// solution 2 -> y
-// z = 1 if a real solution exists, 0 if not
-// if no real solution exists, x contains the real part and y the imaginary part of the complex solutions x+iy and x-iy
-
vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, float spd, float newton_style);
vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma);
string getcurrentmod();
-float float2range11(float f);
-float float2range01(float f);
-
-float gsl_ran_gaussian(float sigma);
-
float matchacl(string acl, string str); // matches str against ACL acl (with entries +foo*, +foo, +*foo, +*foo*, and same with - for forbidding)
string get_model_datafilename(string mod, float skn, string fil); // skin -1 will return wildcard, mod string_null will also put wildcard there
string get_model_parameters_desc;
float get_model_parameters(string mod, float skn); // call with string_null to clear; skin -1 means mod is the filename of the txt file and is to be split
-#ifdef GAMEQC
-vector NearestPointOnBox(entity box, vector org);
-#endif
-
-float vercmp(string v1, string v2);
-
-float u8_strsize(string s);
-
// x-encoding (encoding as zero length invisible string)
// encodes approx. 14 bits into 5 bytes of color code string
const float XENCODE_MAX = 21295; // 2*22*22*22-1
string strtolower(string s);
#endif
-string MakeConsoleSafe(string input);
-
// generic shutdown handler
void Shutdown();
// loops through the tags of model v using counter tagnum
#define FOR_EACH_TAG(v) float tagnum; Skeleton_SetBones(v); for(tagnum = 0; tagnum < v.skeleton_bones; tagnum++, gettaginfo(v, tagnum))
#endif
-#ifdef SVQC
-void WriteApproxPastTime(float dst, float t);
-#endif
-#ifdef CSQC
-float ReadApproxPastTime();
-#endif
// execute-stuff-next-frame subsystem
void execute_next_frame();
void queue_to_execute_next_frame(string s);
-// a function f with:
-// f(0) = 0
-// f(1) = 1
-// f'(0) = startspeedfactor
-// f'(1) = endspeedfactor
-float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd);
-
-// checks whether f'(x) = 0 anywhere from 0 to 1
-// because if this is the case, the function is not usable for platforms
-// as it may exceed 0..1 bounds, or go in reverse
-float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor);
-
USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass));
USING(isConnectedFunction_t, float(entity a, entity b, entity pass));
void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass);
#define fprintf(file, ...) fputs(file, sprintf(__VA_ARGS__))
#define bprintf(...) bprint(sprintf(__VA_ARGS__))
-#ifdef GAMEQC
-string CCR(string input);
-#endif
-
#ifdef GAMEQC
#ifdef CSQC
#define GENTLE (autocvar_cl_gentle || autocvar_cl_gentle_messages)
#endif
#ifdef GAMEQC
-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;
-entity Announcer_PickNumber(float type, float num);
+const int CNT_NORMAL = 1;
+const int CNT_GAMESTART = 2;
+const int CNT_IDLE = 3;
+const int CNT_KILL = 4;
+const int CNT_RESPAWN = 5;
+const int CNT_ROUNDSTART = 6;
+entity Announcer_PickNumber(int type, int num);
#endif
#ifdef GAMEQC
int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents);
#endif
-// Quadratic splines (bezier)
-vector bezier_quadratic_getpoint(vector a, vector p, vector b, float t);
-vector bezier_quadratic_getderivative(vector a, vector p, vector b, float t);
-
#define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add)))
// Returns the correct difference between two always increasing numbers
#ifdef GAMEQC
#include "calculations.qh"
+#include "projectiles.qh"
#include <common/models/all.qh>
#endif
--- /dev/null
+#pragma once
+
+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;
MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
#define EV_AddPlayerScore(i, o) \
- /** score field */ i(PlayerScoreField, MUTATOR_ARGV_0_entity) \
+ /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
/** score */ i(float, MUTATOR_ARGV_1_float) \
/**/ o(float, MUTATOR_ARGV_1_float) \
/** player */ i(entity, MUTATOR_ARGV_2_entity) \
#include <lib/warpzone/util_server.qh>
#include <lib/warpzone/server.qh>
#include <common/constants.qh>
+#include <common/scores.qh>
#include <common/stats.qh>
#include <common/teams.qh>
#include <common/util.qh>
#include <common/net_linked.qh>
#include "../common/playerstats.qh"
#include "../common/teams.qh"
+#include <common/scores.qh>
.entity scorekeeper;
entity teamscorekeepers[16];
#pragma once
-#include <common/constants.qh>
+#include <common/scores.qh>
entity scores_initialized; // non-NULL when scores labels/rules have been set
.float scoreboard_pos;