]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/miscfunctions.qc
Merge remote-tracking branch 'origin/Mario/vote_mapchange_fix'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / miscfunctions.qc
1 entity players;
2 entity teams;
3
4 void AuditLists()
5 {
6         entity e;
7         entity prev;
8
9         prev = players;
10         for(e = prev.sort_next; e; prev = e, e = e.sort_next)
11         {
12                 if(prev != e.sort_prev)
13                         error(strcat("sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
14         }
15
16         prev = teams;
17         for(e = prev.sort_next; e; prev = e, e = e.sort_next)
18         {
19                 if(prev != e.sort_prev)
20                         error(strcat("sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
21         }
22 }
23
24
25 float RegisterPlayer(entity player)
26 {
27         entity pl;
28         AuditLists();
29         for(pl = players.sort_next; pl; pl = pl.sort_next)
30                 if(pl == player)
31                         error("Player already registered!");
32         player.sort_next = players.sort_next;
33         player.sort_prev = players;
34         if(players.sort_next)
35                 players.sort_next.sort_prev = player;
36         players.sort_next = player;
37         AuditLists();
38         return true;
39 }
40
41 void RemovePlayer(entity player)
42 {
43         entity pl, parent;
44         AuditLists();
45         parent = players;
46         for(pl = players.sort_next; pl && pl != player; pl = pl.sort_next)
47                 parent = pl;
48
49         if(!pl)
50         {
51                 error("Trying to remove a player which is not in the playerlist!");
52                 return;
53         }
54         parent.sort_next = player.sort_next;
55         if(player.sort_next)
56                 player.sort_next.sort_prev = parent;
57         AuditLists();
58 }
59
60 void MoveToLast(entity e)
61 {
62         AuditLists();
63         other = e.sort_next;
64         while(other)
65         {
66                 SORT_SWAP(other, e);
67                 other = e.sort_next;
68         }
69         AuditLists();
70 }
71
72 float RegisterTeam(entity Team)
73 {
74         entity tm;
75         AuditLists();
76         for(tm = teams.sort_next; tm; tm = tm.sort_next)
77                 if(tm == Team)
78                         error("Team already registered!");
79         Team.sort_next = teams.sort_next;
80         Team.sort_prev = teams;
81         if(teams.sort_next)
82                 teams.sort_next.sort_prev = Team;
83         teams.sort_next = Team;
84         AuditLists();
85         return true;
86 }
87
88 void RemoveTeam(entity Team)
89 {
90         entity tm, parent;
91         AuditLists();
92         parent = teams;
93         for(tm = teams.sort_next; tm && tm != Team; tm = tm.sort_next)
94                 parent = tm;
95
96         if(!tm)
97         {
98                 print(_("Trying to remove a team which is not in the teamlist!"));
99                 return;
100         }
101         parent.sort_next = Team.sort_next;
102         if(Team.sort_next)
103                 Team.sort_next.sort_prev = parent;
104         AuditLists();
105 }
106
107 entity GetTeam(float Team, float add)
108 {
109         float num;
110         entity tm;
111         num = (Team == COLOR_SPECTATOR) ? 16 : Team;
112         if(teamslots[num])
113                 return teamslots[num];
114         if not(add)
115                 return world;
116         tm = spawn();
117         tm.team = Team;
118         teamslots[num] = tm;
119         RegisterTeam(tm);
120         return tm;
121 }
122
123 vector HUD_GetFontsize(string cvarname)
124 {
125         vector v;
126         v = stov(cvar_string(cvarname));
127         if(v_x == 0)
128                 v = '8 8 0';
129         if(v_y == 0)
130                 v_y = v_x;
131         v_z = 0;
132         return v;
133 }
134
135 float PreviewExists(string name)
136 {
137         if(autocvar_cl_readpicture_force)
138                 return false;
139
140         if (fexists(strcat(name, ".tga"))) return true;
141         if (fexists(strcat(name, ".png"))) return true;
142         if (fexists(strcat(name, ".jpg"))) return true;
143         if (fexists(strcat(name, ".pcx"))) return true;
144
145         return false;
146 }
147
148 vector rotate(vector v, float a)
149 {
150         vector w = '0 0 0';
151         // FTEQCC SUCKS AGAIN
152         w_x =      v_x * cos(a) + v_y * sin(a);
153         w_y = -1 * v_x * sin(a) + v_y * cos(a);
154         return w;
155 }
156
157 float ColorTranslateMode;
158
159 string ColorTranslateRGB(string s)
160 {
161         if(ColorTranslateMode & 1)
162                 return strdecolorize(s);
163         else
164                 return s;
165 }
166
167 string Team_ColorCode(float teamid)
168 {
169     if (teamid == COLOR_TEAM1)
170         return "^1";
171     else if (teamid == COLOR_TEAM2)
172         return "^4";
173     else if (teamid == COLOR_TEAM3)
174         return "^3";
175     else if (teamid == COLOR_TEAM4)
176         return "^6";
177     else
178         return "^7";
179 }
180
181 // decolorizes and team colors the player name when needed
182 string playername(string thename, float teamid)
183 {
184     string t;
185     if (teamplay)
186     {
187         t = Team_ColorCode(teamid);
188         return strcat(t, strdecolorize(thename));
189     }
190     else
191         return strdecolorize(thename);
192 }
193
194 float cvar_or(string cv, float v)
195 {
196         string s;
197         s = cvar_string(cv);
198         if(s == "")
199                 return v;
200         else
201                 return stof(s);
202 }
203
204 vector project_3d_to_2d(vector vec)
205 {
206         vec = cs_project(vec);
207         if(cs_project_is_b0rked > 0)
208         {
209                 vec_x *= vid_conwidth / vid_width;
210                 vec_y *= vid_conheight / vid_height;
211         }
212         return vec;
213 }
214
215 void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8)
216 {
217 }
218
219 float expandingbox_sizefactor_from_fadelerp(float fadelerp)
220 {
221         return 1.2 / (1.2 - fadelerp);
222 }
223
224 vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
225 {
226         boxsize_x *= boxxsizefactor; // easier interface for text
227         return boxsize * (0.5 * (1 - sz));
228 }
229
230 void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag)
231 {
232         vector line_dim = '0 0 0';
233
234         // left and right lines
235         pos_x -= thickness;
236         line_dim_x = thickness;
237         line_dim_y = dim_y;
238         drawfill(pos, line_dim, color, theAlpha, drawflag);
239         drawfill(pos + (dim_x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag);
240
241         // upper and lower lines
242         pos_y -= thickness;
243         line_dim_x = dim_x + thickness * 2; // make upper and lower lines longer
244         line_dim_y = thickness;
245         drawfill(pos, line_dim, color, theAlpha, drawflag);
246         drawfill(pos + (dim_y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag);
247 }
248
249 void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag)
250 {
251         vector current_pos = '0 0 0', end_pos, new_size = '0 0 0', ratio = '0 0 0';
252         end_pos = pos + area;
253
254         current_pos_y = pos_y;
255         while (current_pos_y < end_pos_y)
256         {
257                 current_pos_x = pos_x;
258                 while (current_pos_x < end_pos_x)
259                 {
260                         new_size_x = min(sz_x, end_pos_x - current_pos_x);
261                         new_size_y = min(sz_y, end_pos_y - current_pos_y);
262                         ratio_x = new_size_x / sz_x;
263                         ratio_y = new_size_y / sz_y;
264                         drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, theAlpha, drawflag);
265                         current_pos_x += sz_x;
266                 }
267                 current_pos_y += sz_y;
268         }
269 }
270
271 // drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
272 var float _drawpic_imgaspect;
273 var vector _drawpic_imgsize;
274 var vector _drawpic_sz;
275 var float _drawpic_oldsz;
276 var string _drawpic_picpath;
277 #define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
278         do {\
279                 _drawpic_imgsize = draw_getimagesize(pic);\
280                 if(_drawpic_imgsize != '0 0 0') {\
281                         _drawpic_imgaspect = _drawpic_imgsize_x/_drawpic_imgsize_y;\
282                         _drawpic_sz = mySize;\
283                         if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\
284                                 _drawpic_oldsz = _drawpic_sz_x;\
285                                 _drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\
286                                 if(_drawpic_sz_x)\
287                                         drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
288                         } else {\
289                                 _drawpic_oldsz = _drawpic_sz_y;\
290                                 _drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\
291                                 if(_drawpic_sz_y)\
292                                         drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
293                         }\
294                 }\
295         } while(0)
296
297 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
298 #define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
299         do{\
300                 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
301                 if(precache_pic(_drawpic_picpath) == "") {\
302                         _drawpic_picpath = strcat("gfx/hud/default/", pic);\
303                 }\
304                 drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
305                 _drawpic_picpath = string_null;\
306         } while(0)
307
308 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
309 #define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
310         do{\
311                 _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
312                 if(precache_pic(_drawpic_picpath) == "") {\
313                         _drawpic_picpath = strcat("gfx/hud/default/", pic);\
314                 }\
315                 drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
316                 _drawpic_picpath = string_null;\
317         } while(0)
318
319 void drawpic_aspect_skin_expanding(vector position, string pic, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
320 {
321         float sz;
322         sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
323
324         drawpic_aspect_skin(position + expandingbox_resize_centered_box_offset(sz, scale, 1), pic, scale * sz, rgb, theAlpha * (1 - fadelerp), flag);
325 }
326
327 void drawpic_aspect_skin_expanding_two(vector position, string pic, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
328 {
329         drawpic_aspect_skin_expanding(position, pic, scale, rgb, theAlpha, flag, fadelerp);
330         drawpic_skin(position, pic, scale, rgb, theAlpha * fadelerp, flag);
331 }
332 #define SET_POS_AND_SZ_Y_ASPECT(allow_colors)\
333         float textaspect, oldsz;\
334         textaspect = stringwidth(text, allow_colors, '1 1 1' * sz_y) / sz_y;\
335         if(sz_x/sz_y > textaspect) {\
336                 oldsz = sz_x;\
337                 sz_x = sz_y * textaspect;\
338                 pos_x += (oldsz - sz_x) * 0.5;\
339         } else {\
340                 oldsz = sz_y;\
341                 sz_y = sz_x / textaspect; \
342                 pos_y += (oldsz - sz_y) * 0.5;\
343         }
344
345 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
346 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag) {
347         SET_POS_AND_SZ_Y_ASPECT(FALSE)
348         drawstring(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag);
349 }
350
351 // drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box
352 void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag) {
353         SET_POS_AND_SZ_Y_ASPECT(TRUE)
354         drawcolorcodedstring(pos, text, '1 1 0' * sz_y, theAlpha, drawflag);
355 }
356
357 vector drawfontscale;
358 void drawstring_expanding(vector position, string text, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
359 {
360         float sz;
361         sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
362
363         drawfontscale = sz * '1 1 0';
364         dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
365         drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), rgb, theAlpha * (1 - fadelerp), flag);
366         // width parameter:
367         //    (scale_x * sz / drawfontscale_x) * drawfontscale_x * SIZE1 / (scale_x * sz)
368         //    SIZE1
369         drawfontscale = '1 1 0';
370 }
371
372 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
373 void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp) {
374         SET_POS_AND_SZ_Y_ASPECT(FALSE)
375         drawstring_expanding(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag, fadelerp);
376 }
377
378 void drawcolorcodedstring_expanding(vector position, string text, vector scale, float theAlpha, float flag, float fadelerp)
379 {
380         float sz;
381         sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
382
383         drawfontscale = sz * '1 1 0';
384         dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
385         drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), theAlpha * (1 - fadelerp), flag);
386         drawfontscale = '1 1 0';
387 }
388
389 void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp) {
390         SET_POS_AND_SZ_Y_ASPECT(TRUE)
391         drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz_y, theAlpha, drawflag, fadelerp);
392 }
393
394 // this draws the triangles of a model DIRECTLY. Don't expect high performance, really...
395 float PolyDrawModelSurface(entity e, float i_s)
396 {
397         float i_t;
398         float n_t;
399         vector tri;
400         string tex;
401         tex = getsurfacetexture(e, i_s);
402         if not(tex)
403                 return 0; // this is beyond the last one
404         n_t = getsurfacenumtriangles(e, i_s);
405         for(i_t = 0; i_t < n_t; ++i_t)
406         {
407                 tri = getsurfacetriangle(e, i_s, i_t);
408                 R_BeginPolygon(tex, 0);
409                 R_PolygonVertex(getsurfacepoint(e, i_s, tri_x), getsurfacepointattribute(e, i_s, tri_x, SPA_TEXCOORDS0), '1 1 1', 1);
410                 R_PolygonVertex(getsurfacepoint(e, i_s, tri_y), getsurfacepointattribute(e, i_s, tri_y, SPA_TEXCOORDS0), '1 1 1', 1);
411                 R_PolygonVertex(getsurfacepoint(e, i_s, tri_z), getsurfacepointattribute(e, i_s, tri_z, SPA_TEXCOORDS0), '1 1 1', 1);
412                 R_EndPolygon();
413         }
414         return 1;
415 }
416 void PolyDrawModel(entity e)
417 {
418         float i_s;
419         for(i_s = 0; ; ++i_s)
420                 if(!PolyDrawModelSurface(e, i_s))
421                         break;
422 }
423
424 void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vector rgb, float a, float drawflag)
425 {
426         float x, y, q, d;
427         vector ringsize, v, t;
428         ringsize = radius * '1 1 0';
429
430         x = cos(f * 2 * M_PI);
431         y = sin(f * 2 * M_PI);
432         q = fabs(x) + fabs(y);
433         x /= q;
434         y /= q;
435
436         if(f >= 1)
437         {
438                 // draw full rectangle
439                 R_BeginPolygon(pic, drawflag);
440                         v = centre;                     t = '0.5 0.5 0';
441                         v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
442                         R_PolygonVertex(v, t, rgb, a);
443
444                         v = centre;                     t = '0.5 0.5 0';
445                         v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
446                         R_PolygonVertex(v, t, rgb, a);
447
448                         v = centre;                     t = '0.5 0.5 0';
449                         v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
450                         R_PolygonVertex(v, t, rgb, a);
451
452                         v = centre;                     t = '0.5 0.5 0';
453                         v_y -= 0.5 * ringsize_y;        t -= '0.5 -0.5 0';
454                         R_PolygonVertex(v, t, rgb, a);
455                 R_EndPolygon();
456
457                 d = q - 1;
458                 if(d > 0)
459                 {
460                         R_BeginPolygon(pic, drawflag);
461                                 v = centre;                     t = '0.5 0.5 0';
462                                 R_PolygonVertex(v, t, rgb, a);
463
464                                 v = centre;                     t = '0.5 0.5 0';
465                                 v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
466                                 R_PolygonVertex(v, t, rgb, a);
467                 }
468         }
469         else if(f > 0.75)
470         {
471                 // draw upper and first triangle
472                 R_BeginPolygon(pic, drawflag);
473                         v = centre;                     t = '0.5 0.5 0';
474                         v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
475                         R_PolygonVertex(v, t, rgb, a);
476
477                         v = centre;                     t = '0.5 0.5 0';
478                         v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
479                         R_PolygonVertex(v, t, rgb, a);
480
481                         v = centre;                     t = '0.5 0.5 0';
482                         v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
483                         R_PolygonVertex(v, t, rgb, a);
484                 R_EndPolygon();
485                 R_BeginPolygon(pic, drawflag);
486                         v = centre;                     t = '0.5 0.5 0';
487                         R_PolygonVertex(v, t, rgb, a);
488
489                         v = centre;                     t = '0.5 0.5 0';
490                         v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
491                         R_PolygonVertex(v, t, rgb, a);
492
493                         v = centre;                     t = '0.5 0.5 0';
494                         v_y -= 0.5 * ringsize_y;        t -= '0.5 -0.5 0';
495                         R_PolygonVertex(v, t, rgb, a);
496
497                 d = q - 0.75;
498                 if(d <= 0)
499                         R_EndPolygon();
500         }
501         else if(f > 0.5)
502         {
503                 // draw upper triangle
504                 R_BeginPolygon(pic, drawflag);
505                         v = centre;                     t = '0.5 0.5 0';
506                         v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
507                         R_PolygonVertex(v, t, rgb, a);
508
509                         v = centre;                     t = '0.5 0.5 0';
510                         v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
511                         R_PolygonVertex(v, t, rgb, a);
512
513                         v = centre;                     t = '0.5 0.5 0';
514                         v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
515                         R_PolygonVertex(v, t, rgb, a);
516                 R_EndPolygon();
517
518                 d = q - 0.5;
519                 if(d > 0)
520                 {
521                         R_BeginPolygon(pic, drawflag);
522                                 v = centre;                     t = '0.5 0.5 0';
523                                 R_PolygonVertex(v, t, rgb, a);
524
525                                 v = centre;                     t = '0.5 0.5 0';
526                                 v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
527                                 R_PolygonVertex(v, t, rgb, a);
528                 }
529         }
530         else if(f > 0.25)
531         {
532                 // draw first triangle
533                 R_BeginPolygon(pic, drawflag);
534                         v = centre;                     t = '0.5 0.5 0';
535                         R_PolygonVertex(v, t, rgb, a);
536
537                         v = centre;                     t = '0.5 0.5 0';
538                         v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
539                         R_PolygonVertex(v, t, rgb, a);
540
541                         v = centre;                     t = '0.5 0.5 0';
542                         v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
543                         R_PolygonVertex(v, t, rgb, a);
544
545                 d = q - 0.25;
546                 if(d <= 0)
547                         R_EndPolygon();
548         }
549         else
550         {
551                 d = q;
552                 if(d > 0)
553                 {
554                         R_BeginPolygon(pic, drawflag);
555                                 v = centre;                     t = '0.5 0.5 0';
556                                 R_PolygonVertex(v, t, rgb, a);
557
558                                 v = centre;                     t = '0.5 0.5 0';
559                                 v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
560                                 R_PolygonVertex(v, t, rgb, a);
561                 }
562         }
563
564         if(d > 0)
565         {
566                         v = centre;                     t = '0.5 0.5 0';
567                         v_x += x * 0.5 * ringsize_x;    t += x * '0.5 0.5 0';
568                         v_y += y * 0.5 * ringsize_y;    t += y * '0.5 -0.5 0';
569                         R_PolygonVertex(v, t, rgb, a);
570                 R_EndPolygon();
571         }
572 }
573
574 const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map
575 vector getplayerorigin(float pl)
576 {
577         string s;
578         entity e;
579
580         e = CSQCModel_server2csqc(pl + 1);
581         if(e)
582                 return e.origin;
583
584 #ifndef NO_LEGACY_NETWORKING
585         s = getplayerkeyvalue(pl, "TEMPHACK_origin");
586         if(s != "")
587                 return stov(s);
588 #endif
589
590         e = entcs_receiver[pl];
591         if(e)
592                 return e.origin;
593
594         return GETPLAYERORIGIN_ERROR;
595 }
596
597 float getplayerisdead(float pl)
598 {
599         entity e;
600         
601         e = CSQCModel_server2csqc(pl + 1);
602         if(e)
603                 return e.csqcmodel_isdead;
604         
605         return FALSE;
606 }
607
608 void URI_Get_Callback(float id, float status, string data)
609 {
610         if(url_URI_Get_Callback(id, status, data))
611         {
612                 // handled
613         }
614         else if (id == URI_GET_DISCARD)
615         {
616                 // discard
617         }
618         else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
619         {
620                 // sv_cmd curl
621                 Curl_URI_Get_Callback(id, status, data);
622         }
623         else
624         {
625                 print(sprintf(_("Received HTTP request data for an invalid id %d.\n"), id));
626         }
627 }
628
629 void draw_beginBoldFont()
630 {
631         drawfont = FONT_USER+2;
632 }
633
634 void draw_endBoldFont()
635 {
636         drawfont = FONT_USER+1;
637 }