8#define VM_TEMPSTRING_MAXSIZE 16383
32 return stringwidth_builtin(s,
true, theSize);
37 return stringwidth_builtin(s,
false, theSize);
52#define strcpy(this, s) MACRO_BEGIN \
59#define strfree(this) MACRO_BEGIN \
72 int years = (M <= 2) ? Y - 1 : Y;
74 int leap_days =
floor(years / 4) -
floor(years / 100) +
floor(years / 400);
77 int months = (M <= 2) ? (M + 9) : (M - 3);
78 int leftover_days = (M <= 2) ? (M + 5) :
floor(0.58 * M - 1.1);
80 int month_days = 30 * months + leftover_days;
82 return 365 * years + month_days + D + leap_days;
85#define DAYS_UP_TO_EPOCH 719469
96 string date = strftime(
false,
"%Y-%m-%d %H:%M:%S");
112 int hundreds_of_seconds = days_since_epoch * 24 * 6 * 6;
113 hundreds_of_seconds +=
floor(seconds / 100);
116 string seconds_str =
ftos(seconds % 100);
117 if ((seconds % 100) < 10)
118 seconds_str =
strcat(
"0", seconds_str);
120 return strcat(
ftos(hundreds_of_seconds), seconds_str);
128 bool negative =
false;
133 if (
floor(seconds) != seconds)
136 int minutes =
floor(seconds / 60);
137 seconds -= minutes * 60;
139 return sprintf(
"-%d:%02d", minutes, seconds);
140 return sprintf(
"%d:%02d", minutes, seconds);
153 return strcat(
"0.0", hundredths ?
"0" :
"");
155 return strcat(
"0:00.0", hundredths ?
"0" :
"");
157 int acc = hundredths ? 6000 : 600;
158 tm =
floor(tm + 0.5);
159 int minutes =
floor(tm / acc);
160 int tm_without_minutes = tm - minutes * acc;
162 string s =
ftos(acc * 10 + tm_without_minutes);
163 if (!compact || minutes > 0)
166 int ofs = 2, digits = 1;
167 if (tm_without_minutes >= 10 * (hundredths ? 100 : 10))
176#define mmsst(tm, compact) clockedtime_tostring(tm, false, compact)
177#define mmssth(tm, compact) clockedtime_tostring(tm, true, compact)
182 seconds =
floor(seconds + 0.5);
183 float days =
floor(seconds / 864000);
184 seconds -= days * 864000;
185 float hours =
floor(seconds / 36000);
186 seconds -= hours * 36000;
187 float minutes =
floor(seconds / 600);
188 seconds -= minutes * 600;
189 if (days > 0)
return sprintf(_(
"%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
190 else return sprintf(_(
"%02d:%02d:%02d"), hours, minutes, seconds);
231 input = strreplace(
"^N",
"^7", input);
236#define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
245#define endsWith(this, suffix) (_endsWith_suffix = suffix, substring(this, -strlen(_endsWith_suffix), -1) == _endsWith_suffix)
252 string sc =
strcat(s,
"");
278 if (a ==
"")
return b;
279 if (b ==
"")
return a;
286 if (a ==
"")
return b;
287 if (b ==
"")
return a;
300 string s1,
s2, s3, s4, s5;
301 float si, ei, sj, ej, s0, en;
342 for (
int i = 0; i < len; ++i)
348 if (s ==
"n") str =
strcat(str,
"\n");
349 else if (s ==
"\\") str =
strcat(str,
"\\");
364 for ( ; w && endpos >= 0; --w)
366 if (endpos < 0)
return s;
370#define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
376 for (
int i = 0, c; (c =
str2chr(s, i)) > 0; ++i, ++l)
389 s = strdecolorize(s);
390 bool utf8 =
cvar(
"utf8_enable");
391 for (
int i = 0, n =
strlen(s); i < n; ++i)
440 if (buf < 0)
return -1;
448 for (
int i = 0; (l =
fgets(fh)); ++i)
449 bufstr_set(buf, i, l);
458 if (fh < 0)
error(
strcat(
"Can't write buf to ", pFilename));
459 int n = buf_getsize(buf);
460 for (
int i = 0; i < n; ++i)
473 return sprintf(
"%.*f", decimals,
number);
484 return sprintf(_(
"%.*f%%"), decimals,
number * 100);
505 return ftos(rounded);
507 string s = sprintf(
"%.4f",
number);
531 if (i == 4 || ch ==
".")
542 string s1 = (dot1 == -1) ? v1 :
substring(v1, 0, dot1);
543 string s2 = (dot2 == -1) ? v2 :
substring(v2, 0, dot2);
547 if (r != 0)
return r;
550 if (r != 0)
return r;
552 if (dot1 == -1)
return (dot2 == -1) ? 0 : -1;
562 if (v1 ==
"git")
return 1;
563 if (v2 ==
"git")
return -1;
569const string HEXDIGITS =
"0123456789ABCDEF0123456789abcdef";
570#define HEXDIGIT_TO_DEC_RAW(d) (strstrofs(HEXDIGITS, (d), 0))
571#define HEXDIGIT_TO_DEC(d) ((HEXDIGIT_TO_DEC_RAW(d) | 0x10) - 0x10)
572#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS_MINSET, (d), 1))
573#define IS_HEXDIGIT(d) (strstrofs(HEXDIGITS_MINSET, (d), 0) >= 0)
576#define IS_DIGIT(d) (strstrofs(DIGITS, (d), 0) >= 0)
584 while(pos - carets >= 1 &&
substring(theText, pos - carets - 1, 1) ==
"^")
612 text_len =
strlen(theText);
613 string tag_type =
"^";
617 LABEL(check_color_tag)
620 if (!check_at_the_end)
622 for (; ofs >= 1; --ofs)
624 if (!(pos >= ofs && text_len >= pos + (cc_len - ofs)))
626 if(
substring(theText, pos - ofs, tag_len) == tag_type)
629 return eX * cc_len +
eY * ofs;
637 goto check_color_tag;
642#define PAGE_TEXT_INIT() string _page_text = ""
643#define PAGE_TEXT _page_text
649#define PAR(...) EVAL_PAR(OVERLOAD(PAR, __VA_ARGS__))
650#define EVAL_PAR(...) __VA_ARGS__
651#define PAR_1(msg) _page_text = (_page_text == "" ? msg : strcat(_page_text, "\n\n", msg))
652#define PAR_2(msg, a1) MACRO_BEGIN string _msg = sprintf(msg, a1); PAR_1(_msg); MACRO_END
653#define PAR_3(msg, a1, a2) MACRO_BEGIN string _msg = sprintf(msg, a1, a2); PAR_1(_msg); MACRO_END
654#define PAR_4(msg, a1, a2, a3) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3); PAR_1(_msg); MACRO_END
655#define PAR_5(msg, a1, a2, a3, a4) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4); PAR_1(_msg); MACRO_END
656#define PAR_6(msg, a1, a2, a3, a4, a5) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5); PAR_1(_msg); MACRO_END
657#define PAR_7(msg, a1, a2, a3, a4, a5, a6) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6); PAR_1(_msg); MACRO_END
658#define PAR_8(msg, a1, a2, a3, a4, a5, a6, a7) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6, a7); PAR_1(_msg); MACRO_END
659#define PAR_9(msg, a1, a2, a3, a4, a5, a6, a7, a8) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4, a5, a6, a7, a8); PAR_1(_msg); MACRO_END
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define tokenizebyseparator
#define pass(name, colormin, colormax)
spree_inf s1 s2 s3loc s2 s1
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
ERASEABLE void shuffle(float n, swapfunc_t swap, entity pass)
ERASEABLE bool isCaretEscaped(string theText, float pos)
ERASEABLE string ColorTranslateRGB(string s)
ERASEABLE int buf_load(string pFilename)
ERASEABLE string car(string s)
returns first word
string autocvar_hud_colorset_foreground_1
string autocvar_hud_colorset_kill_1
ERASEABLE int vercmp_recursive(string v1, string v2)
const string HEXDIGITS_MINSET
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
ERASEABLE string shufflewords(string str)
string autocvar_hud_colorset_kill_2
ERASEABLE void buf_save(float buf, string pFilename)
ERASEABLE void _shufflewords_swapfunc(float i, float j, entity pass)
ERASEABLE string cdr(string s)
returns all but first word
ERASEABLE string substring_range(string s, float b, float e)
ERASEABLE bool isValidColorCodeValue(string theText, int cc_len, int tag_start)
ERASEABLE string strwords(string s, int w)
ERASEABLE string seconds_tostring(float seconds)
ERASEABLE int u8_strsize(string s)
noref string _endsWith_suffix
ERASEABLE string fstrunzone(string s)
unzone the string, and return it as tempstring.
ERASEABLE int vercmp(string v1, string v2)
string autocvar_hud_colorset_foreground_3
string CCR(string input)
color code replace, place inside of sprintf and parse the string
ERASEABLE string cons_mid(string a, string mid, string b)
string autocvar_hud_colorset_foreground_4
ERASEABLE bool startsWithNocase(string haystack, string needle)
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
ERASEABLE bool isInvisibleString(string s)
ERASEABLE string cons(string a, string b)
string autocvar_hud_colorset_background
ERASEABLE string unescape(string in)
ERASEABLE string swapwords(string str, float i, float j)
string autocvar_hud_colorset_foreground_2
ERASEABLE int days_up_to_date(int Y, int M, int D)
ERASEABLE string clockedtime_tostring(int tm, bool hundredths, bool compact)
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
ERASEABLE string ftos_decimals_percentage(float number, int decimals)
converts a percentage to a string with the indicated number of decimals
float stringwidth_nocolors(string s, vector theSize)
ERASEABLE string strftime_s()
string autocvar_hud_colorset_kill_3
ERASEABLE string format_time(float seconds)
float stringwidth_colors(string s, vector theSize)