]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/miscfunctions.qc
add csqc_flags cvar for client compatibility
[divverent/nexuiz.git] / data / qcsrc / client / miscfunctions.qc
1 float stringwidth_oldfont(string text, float handleColors)
2 {
3         float i, len, ch, width;
4         len = strlen(text);
5         if(!handleColors)
6                 return len;
7         width = 0;
8         for(i = 0; i < len; ++i)
9         {
10                 if(substring(text, i, 1) == "^")
11                 {
12                         ch = str2chr(text, i+1);
13                         if(ch >= '0' && ch <= '9')
14                                 ++i;
15                         else
16                                 ++width;
17                 }
18                 else
19                         ++width;
20         }
21         return width;
22 }
23
24 void CSQC_CheckEngine()
25 {
26         float i, tmp;
27         registercvar("csqc_flags", "0");
28         csqc_flags = cvar("csqc_flags");
29
30         if(csqc_flags & CSQC_FLAG_STRINGWIDTH)
31         {
32                 stringwidth = stringwidth_engine;
33                 sbar_font = FONT_USER+1;
34         } else {
35                 stringwidth = stringwidth_oldfont;
36                 sbar_font = FONT_DEFAULT;
37         }
38 }
39
40 vector Sbar_GetFontsize()
41 {
42         if(csqc_flags & CSQC_FLAG_STRINGWIDTH)
43                 return stov(cvar_string("sbar_fontsize"));
44         return '8 8' ;
45 }