X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Futil.qh;h=2eee6d74ef1a4d369286c1fcc01a71588ccd130d;hp=56cba34cc2749aa6949d017584ce337dbc79cdc3;hb=e3e13a6eac82464c004af16230f1da2b92776636;hpb=49a1b0a79699721877d9630fc598574bb0ac91b2 diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 56cba34cc..2eee6d74e 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -34,6 +34,8 @@ float median(float a, float b, float c); // works for up to 10 decimals! string ftos_decimals(float number, float decimals); +float fexists(string f); + vector colormapPaletteColor(float c, float isPants); // unzone the string, and return it as tempstring. Safe to be called on string_null @@ -142,7 +144,7 @@ string getWrappedLine_remaining; string getWrappedLine(float w, vector size, textLengthUpToWidth_widthFunction_t tw); string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw); -float isGametypeInFilter(float gt, float tp, string pattern); +float isGametypeInFilter(float gt, float tp, float ts, string pattern); typedef void(float i1, float i2, entity pass) swapfunc_t; // is only ever called for i1 < i2 typedef float(float i1, float i2, entity pass) comparefunc_t; // <0 for <, ==0 for ==, >0 for > (like strcmp) @@ -219,6 +221,8 @@ float get_model_parameters(string mod, float skn); // call with string_null to c switch(id) {\ case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \ case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \ + case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \ + case HUD_PANEL_CENTERPRINT: panel_name = HUD_PANELNAME_CENTERPRINT; break; \ } ENDS_WITH_CURLY_BRACE // Get name of specified panel id @@ -237,8 +241,8 @@ switch(id) { \ case HUD_PANEL_MODICONS: panel_name = HUD_PANELNAME_MODICONS; break; \ case HUD_PANEL_PRESSEDKEYS: panel_name = HUD_PANELNAME_PRESSEDKEYS; break; \ case HUD_PANEL_CHAT: panel_name = HUD_PANELNAME_CHAT; break; \ -}\ -HUD_Panel_GetName_Part2(id) + default: HUD_Panel_GetName_Part2(id)\ +} vector vec2(vector v); @@ -255,3 +259,14 @@ string prvm_language; string language_filename(string s); string CTX(string s); #define ZCTX(s) strzone(CTX(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 +const float XENCODE_LEN = 5; +string xencode(float f); +float xdecode(string s); + +#ifndef COMPAT_XON010_CHANNELS +#define sound(e,c,s,v,a) sound7(e,c,s,v,a,0,0) +#endif