8#define VM_TEMPSTRING_MAXSIZE 16383
32 return stringwidth_builtin(s,
true, theSize);
37 return stringwidth_builtin(s,
false, theSize);
51#define strcpy(this, s) MACRO_BEGIN \
57#define strfree(this) MACRO_BEGIN \
69 int years = (M <= 2) ? Y - 1 : Y;
71 int leap_days =
floor(years / 4) -
floor(years / 100) +
floor(years / 400);
74 int months = (M <= 2) ? (M + 9) : (M - 3);
75 int leftover_days = (M <= 2) ? (M + 5) :
floor(0.58 * M - 1.1);
77 int month_days = 30 * months + leftover_days;
79 return 365 * years + month_days + D + leap_days;
82#define DAYS_UP_TO_EPOCH 719469
93 string date = strftime(
false,
"%Y-%m-%d %H:%M:%S");
109 int hundreds_of_seconds = days_since_epoch * 24 * 6 * 6;
110 hundreds_of_seconds +=
floor(seconds / 100);
113 string seconds_str =
ftos(seconds % 100);
114 if ((seconds % 100) < 10)
115 seconds_str =
strcat(
"0", seconds_str);
117 return strcat(
ftos(hundreds_of_seconds), seconds_str);
125 bool negative =
false;
130 if (
floor(seconds) != seconds)
133 int minutes =
floor(seconds / 60);
134 seconds -= minutes * 60;
136 return sprintf(
"-%d:%02d", minutes, seconds);
137 return sprintf(
"%d:%02d", minutes, seconds);
150 return strcat(
"0.0", hundredths ?
"0" :
"");
152 return strcat(
"0:00.0", hundredths ?
"0" :
"");
154 int acc = hundredths ? 6000 : 600;
155 tm =
floor(tm + 0.5);
156 int minutes =
floor(tm / acc);
157 int tm_without_minutes = tm - minutes * acc;
159 string s =
ftos(acc * 10 + tm_without_minutes);
160 if (!compact || minutes > 0)
163 int ofs = 2, digits = 1;
164 if (tm_without_minutes >= 10 * (hundredths ? 100 : 10))
173#define mmsst(tm, compact) clockedtime_tostring(tm, false, compact)
174#define mmssth(tm, compact) clockedtime_tostring(tm, true, compact)
179 seconds =
floor(seconds + 0.5);
180 float days =
floor(seconds / 864000);
181 seconds -= days * 864000;
182 float hours =
floor(seconds / 36000);
183 seconds -= hours * 36000;
184 float minutes =
floor(seconds / 600);
185 seconds -= minutes * 600;
187 return sprintf(_(
"%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
188 return sprintf(_(
"%02d:%02d:%02d"), hours, minutes, seconds);
229 input = strreplace(
"^N",
"^7", input);
234#define startsWith(haystack, needle) (strstrofs(haystack, needle, 0) == 0)
243#define endsWith(this, suffix) (_endsWith_suffix = suffix, substring(this, -strlen(_endsWith_suffix), -1) == _endsWith_suffix)
251 string sc =
strcat(s,
"");
279 if (a ==
"")
return b;
280 if (b ==
"")
return a;
287 if (a ==
"")
return b;
288 if (b ==
"")
return a;
301 string s1,
s2, s3, s4, s5;
302 float si, ei, sj, ej, s0, en;
343 for (
int i = 0; i < len; ++i)
368 for (; w && endpos >= 0; --w)
375#define strhasword(s, w) (strstrofs(strcat(" ", s, " "), strcat(" ", w, " "), 0) >= 0)
381 for (
int i = 0, c; (c =
str2chr(s, i)) > 0; ++i, ++l)
394 s = strdecolorize(s);
395 bool utf8 =
cvar(
"utf8_enable");
396 for (
int i = 0, n =
strlen(s); i < n; ++i)
456 for (
int i = 0; (l =
fgets(fh)); ++i)
457 bufstr_set(buf, i, l);
468 int n = buf_getsize(buf);
469 for (
int i = 0; i < n; ++i)
480 return sprintf(
"%.*f", decimals,
number);
489 return sprintf(_(
"%.*f%%"), decimals,
number * 100);
510 return ftos(rounded);
512 string s = sprintf(
"%.4f",
number);
536 if (i == 4 || ch ==
".")
547 string s1 = (dot1 == -1) ? v1 :
substring(v1, 0, dot1);
548 string s2 = (dot2 == -1) ? v2 :
substring(v2, 0, dot2);
558 return (dot2 == -1) ? 0 : -1;
569 if (v1 ==
"git")
return 1;
570 if (v2 ==
"git")
return -1;
576const string HEXDIGITS =
"0123456789ABCDEF0123456789abcdef";
577#define HEXDIGIT_TO_DEC_RAW(d) (strstrofs(HEXDIGITS, (d), 0))
578#define HEXDIGIT_TO_DEC(d) ((HEXDIGIT_TO_DEC_RAW(d) | 0x10) - 0x10)
579#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS_MINSET, (d), 1))
580#define IS_HEXDIGIT(d) (strstrofs(HEXDIGITS_MINSET, (d), 0) >= 0)
583#define IS_DIGIT(d) (strstrofs(DIGITS, (d), 0) >= 0)
591 while (pos - carets >= 1 &&
substring(theText, pos - carets - 1, 1) ==
"^")
619 text_len =
strlen(theText);
620 string tag_type =
"^";
624 LABEL(check_color_tag)
627 if (!check_at_the_end)
629 for (; ofs >= 1; --ofs)
631 if (!(pos >= ofs && text_len >= pos + (cc_len - ofs)))
633 if (
substring(theText, pos - ofs, tag_len) == tag_type)
636 return eX * cc_len +
eY * ofs;
644 goto check_color_tag;
650#define PAGE_TEXT_INIT() string _page_text = ""
651#define PAGE_TEXT _page_text
657#define PAR(...) EVAL_PAR(OVERLOAD(PAR, __VA_ARGS__))
658#define EVAL_PAR(...) __VA_ARGS__
659#define PAR_1(msg) _page_text = (_page_text == "" ? msg : strcat(_page_text, "\n\n", msg))
660#define PAR_2(msg, a1) MACRO_BEGIN string _msg = sprintf(msg, a1); PAR_1(_msg); MACRO_END
661#define PAR_3(msg, a1, a2) MACRO_BEGIN string _msg = sprintf(msg, a1, a2); PAR_1(_msg); MACRO_END
662#define PAR_4(msg, a1, a2, a3) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3); PAR_1(_msg); MACRO_END
663#define PAR_5(msg, a1, a2, a3, a4) MACRO_BEGIN string _msg = sprintf(msg, a1, a2, a3, a4); PAR_1(_msg); MACRO_END
664#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
665#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
666#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
667#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)
Returns true if the caret at position pos is escaped.
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
F1 - Green : primary priority (important names, etc).
string autocvar_hud_colorset_kill_1
K1 - Red : "bad" or "dangerous" text (death messages against you, kill notifications,...
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
K2 - Yellow : similar to above, but less important... OR, a highlight out of above message type.
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. Safe to be called on string_null
ERASEABLE int vercmp(string v1, string v2)
string autocvar_hud_colorset_foreground_3
F3 - Blue : tertiary priority or relatively inconsequential text.
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
F4 - Red : notice/attention grabbing texting.
ERASEABLE bool startsWithNocase(string haystack, string needle)
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
Returns 0 if pos is NOT in the middle or at the end of a color code otherwise it returns a vector wit...
ERASEABLE bool isInvisibleString(string s)
ERASEABLE string cons(string a, string b)
string autocvar_hud_colorset_background
BG - White : neutral/unimportant text.
ERASEABLE string unescape(string in)
ERASEABLE string swapwords(string str, float i, float j)
string autocvar_hud_colorset_foreground_2
F2 - Yellow : secondary priority (items, locations, numbers, etc).
ERASEABLE int days_up_to_date(int Y, int M, int D)
Returns the number of days since 0000-03-01 (March 1, year 0).
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()
Returns the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
string autocvar_hud_colorset_kill_3
K3 - Blue : "good" or "beneficial" text (you fragging someone, etc).
ERASEABLE string format_time(float seconds)
float stringwidth_colors(string s, vector theSize)