]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qh
Move fexists from server/miscfunctions.qc to common/util.qc so that it's available...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qh
index 2a57be012575715b6489ca3a1fca565859d6fafd..c3ae491660e116edcebc1adcee2d99340361ead8 100644 (file)
@@ -1,3 +1,6 @@
+// a dummy macro that prevents the "hanging ;" warning
+#define ENDS_WITH_CURLY_BRACE
+
 #define ACCUMULATE_FUNCTION(func,otherfunc) \
        #ifdef func \
        void __merge__##otherfunc() { func(); otherfunc(); } \
@@ -31,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
@@ -139,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)
@@ -162,7 +167,7 @@ void check_unacceptable_compiler_bugs();
 float compressShotOrigin(vector v);
 vector decompressShotOrigin(float f);
 
-string rankings_reply, lsmaps_reply, lsnewmaps_reply, maplist_reply; // cached replies
+string rankings_reply, ladder_reply, lsmaps_reply, lsnewmaps_reply, maplist_reply; // cached replies
 string records_reply[10];
 
 float RandomSelection_totalweight;
@@ -211,4 +216,44 @@ float get_model_parameters_age;
 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
 
-string HUD_Panel_GetName(float id)
+// stupid stupid stupid FTEQCC has a max limit on macro sizes, let's work around by splitting the macro into two macros! :(
+#define HUD_Panel_GetName_Part2(id) \
+switch(id) {\
+       case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \
+       case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
+} ENDS_WITH_CURLY_BRACE
+
+// Get name of specified panel id
+#define HUD_Panel_GetName(id) \
+switch(id) { \
+       case HUD_PANEL_WEAPONS: panel_name = HUD_PANELNAME_WEAPONS; break; \
+       case HUD_PANEL_AMMO: panel_name = HUD_PANELNAME_AMMO; break; \
+       case HUD_PANEL_POWERUPS: panel_name = HUD_PANELNAME_POWERUPS; break; \
+       case HUD_PANEL_HEALTHARMOR: panel_name = HUD_PANELNAME_HEALTHARMOR; break; \
+       case HUD_PANEL_NOTIFY: panel_name = HUD_PANELNAME_NOTIFY; break; \
+       case HUD_PANEL_TIMER: panel_name = HUD_PANELNAME_TIMER; break; \
+       case HUD_PANEL_RADAR: panel_name = HUD_PANELNAME_RADAR; break; \
+       case HUD_PANEL_SCORE: panel_name = HUD_PANELNAME_SCORE; break; \
+       case HUD_PANEL_RACETIMER: panel_name = HUD_PANELNAME_RACETIMER; break; \
+       case HUD_PANEL_VOTE: panel_name = HUD_PANELNAME_VOTE; break; \
+       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)
+
+vector vec2(vector v);
+
+#ifndef MENUQC
+vector NearestPointOnBox(entity box, vector org);
+#endif
+
+float vercmp(string v1, string v2);
+
+float u8_strsize(string s);
+
+// translation helpers
+string prvm_language;
+string language_filename(string s);
+string CTX(string s);
+#define ZCTX(s) strzone(CTX(s))