1 var float(string text, float handleColors) stringwidth;
6 void restartAnnouncer_Think() {
7 float countdown_rounded, countdown;
8 countdown = getstatf(STAT_GAMESTARTTIME) - time;
9 countdown_rounded = floor(0.5 + countdown);
11 if (!spectatee_status) //do cprint only for players
12 centerprint("^1Begin!");
14 sound(self, CHAN_VOICE, "announcer/robotic/begin.wav", VOL_BASEVOICE, ATTN_NONE);
19 if (!spectatee_status) //do cprint only for players
20 centerprint(strcat("^1Game starts in ", ftos(countdown_rounded), " seconds"));
22 if(countdown_rounded <= 3 && countdown_rounded >= 1) {
23 sound(self, CHAN_VOICE, strcat("announcer/robotic/", ftos(countdown_rounded), ".wav"), VOL_BASEVOICE, ATTN_NONE);
26 self.nextthink = getstatf(STAT_GAMESTARTTIME) - (countdown - 1);
36 for(e = prev.sort_next; e; prev = e, e = e.sort_next)
38 if(prev != e.sort_prev)
39 error(strcat("sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
43 for(e = prev.sort_next; e; prev = e, e = e.sort_next)
45 if(prev != e.sort_prev)
46 error(strcat("sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
51 float RegisterPlayer(entity player)
55 for(pl = players.sort_next; pl; pl = pl.sort_next)
57 error("Player already registered!");
58 player.sort_next = players.sort_next;
59 player.sort_prev = players;
61 players.sort_next.sort_prev = player;
62 players.sort_next = player;
67 void RemovePlayer(entity player)
72 for(pl = players.sort_next; pl && pl != player; pl = pl.sort_next)
77 error("Trying to remove a player which is not in the playerlist!");
80 parent.sort_next = player.sort_next;
82 player.sort_next.sort_prev = parent;
86 void MoveToLast(entity e)
98 float RegisterTeam(entity Team)
102 for(tm = teams.sort_next; tm; tm = tm.sort_next)
104 error("Team already registered!");
105 Team.sort_next = teams.sort_next;
106 Team.sort_prev = teams;
108 teams.sort_next.sort_prev = Team;
109 teams.sort_next = Team;
114 void RemoveTeam(entity Team)
119 for(tm = teams.sort_next; tm && tm != Team; tm = tm.sort_next)
124 print("Trying to remove a team which is not in the teamlist!");
127 parent.sort_next = Team.sort_next;
129 Team.sort_next.sort_prev = parent;
133 entity GetTeam(float Team, float add)
137 num = (Team == COLOR_SPECTATOR) ? 16 : Team;
139 return teamslots[num];
149 void CSQC_CheckEngine()
151 sbar_font = FONT_USER+1;
152 sbar_bigfont = FONT_USER+2;
155 vector Sbar_GetFontsize(string cvarname)
158 v = stov(cvar_string(cvarname));
167 float Sbar_GetWidth(float teamcolumnwidth)
170 f = stof(cvar_string("sbar_width"));
175 if(f > vid_conwidth - 2 * teamcolumnwidth)
176 f = vid_conwidth - 2 * teamcolumnwidth;
180 float PreviewExists(string name)
185 if(cvar("cl_readpicture_force"))
188 file = strcat(name, ".tga");
189 f = fopen(file, FILE_READ);
195 file = strcat(name, ".png");
196 f = fopen(file, FILE_READ);
202 file = strcat(name, ".jpg");
203 f = fopen(file, FILE_READ);
209 file = strcat(name, ".pcx");
210 f = fopen(file, FILE_READ);
219 float PI = 3.14159265359;
220 float DEG2RAD = 0.01745329252;
221 vector rotate(vector v, float a)
224 // FTEQCC SUCKS AGAIN
225 w_x = v_x * cos(a) + v_y * sin(a);
226 w_y = -1 * v_x * sin(a) + v_y * cos(a);
230 float ColorTranslateMode;
232 string ColorTranslateRGB(string s)
234 if(ColorTranslateMode & 1)
235 return strdecolorize(s);
240 float cvar_or(string cv, float v)
250 vector project_3d_to_2d(vector vec)
252 vec = cs_project(vec);
253 if(cs_project_is_b0rked)
255 vec_x += vid_width / 2;
256 vec_y += vid_height / 2;
258 vec_x *= vid_conwidth / vid_width;
259 vec_y *= vid_conheight / vid_height;
263 void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
267 float expandingbox_sizefactor_from_fadelerp(float fadelerp)
269 return 1.2 / (1.2 - fadelerp);
272 vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
274 boxsize_x *= boxxsizefactor; // easier interface for text
275 return boxsize * (0.5 * (1 - sz));
278 void drawpic_expanding(vector position, string pic, vector scale, vector rgb, float alpha, float flag, float fadelerp)
281 sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
283 drawpic(position + expandingbox_resize_centered_box_offset(sz, scale, 1), pic, scale * sz, rgb, alpha * (1 - fadelerp), flag);
286 void drawpic_expanding_two(vector position, string pic, vector scale, vector rgb, float alpha, float flag, float fadelerp)
288 drawpic_expanding(position, pic, scale, rgb, alpha, flag, fadelerp);
289 drawpic(position, pic, scale, rgb, alpha * fadelerp, flag);
292 void drawstring_expanding(vector position, string text, vector scale, vector rgb, float alpha, float flag, float fadelerp)
295 sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
297 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
298 drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE)), text, scale * sz, rgb, alpha * (1 - fadelerp), flag);
301 void drawcolorcodedstring_expanding(vector position, string text, vector scale, float alpha, float flag, float fadelerp)
304 sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
306 dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
307 drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE)), text, scale * sz, alpha * (1 - fadelerp), flag);