]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - gl_draw.c
very minor cruft removal
[xonotic/darkplaces.git] / gl_draw.c
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 // draw.c -- this is the only file outside the refresh that touches the
22 // vid buffer
23
24 #include "quakedef.h"
25
26 #define GL_COLOR_INDEX8_EXT     0x80E5
27
28 extern unsigned char d_15to8table[65536];
29
30 cvar_t          qsg_version = {"qsg_version", "1"};
31 cvar_t          scr_conalpha = {"scr_conalpha", "1"};
32
33 byte            *draw_chars;                            // 8*8 graphic characters
34 qpic_t          *draw_disc;
35
36 //int                   translate_texture;
37 int                     char_texture;
38
39 typedef struct
40 {
41         int             texnum;
42         float   sl, tl, sh, th;
43 } glpic_t;
44
45 byte            conback_buffer[sizeof(qpic_t) + sizeof(glpic_t)];
46 qpic_t          *conback = (qpic_t *)&conback_buffer;
47
48 /*
49 =============================================================================
50
51   scrap allocation
52
53   Allocate all the little status bar obejcts into a single texture
54   to crutch up stupid hardware / drivers
55
56 =============================================================================
57 */
58
59 #define MAX_SCRAPS              2
60 #define BLOCK_WIDTH             256
61 #define BLOCK_HEIGHT    256
62
63 int                     scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
64 byte            scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT*4];
65 qboolean        scrap_dirty;
66
67 // returns a texture number and the position inside it
68 int Scrap_AllocBlock (int w, int h, int *x, int *y)
69 {
70         int             i, j;
71         int             best, best2;
72         int             texnum;
73
74         for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++)
75         {
76                 best = BLOCK_HEIGHT;
77
78                 for (i=0 ; i<BLOCK_WIDTH-w ; i++)
79                 {
80                         best2 = 0;
81
82                         for (j=0 ; j<w ; j++)
83                         {
84                                 if (scrap_allocated[texnum][i+j] >= best)
85                                         break;
86                                 if (scrap_allocated[texnum][i+j] > best2)
87                                         best2 = scrap_allocated[texnum][i+j];
88                         }
89                         if (j == w)
90                         {       // this is a valid spot
91                                 *x = i;
92                                 *y = best = best2;
93                         }
94                 }
95
96                 if (best + h > BLOCK_HEIGHT)
97                         continue;
98
99                 for (i=0 ; i<w ; i++)
100                         scrap_allocated[texnum][*x + i] = best + h;
101
102                 return texnum;
103         }
104
105         Sys_Error ("Scrap_AllocBlock: full");
106         return 0;
107 }
108
109 int     scrap_uploads;
110 int scraptexnum[MAX_SCRAPS];
111
112 void Scrap_Upload (void)
113 {
114         int             texnum;
115
116         scrap_uploads++;
117
118         for (texnum=0 ; texnum<MAX_SCRAPS ; texnum++)
119                 scraptexnum[texnum] = GL_LoadTexture (va("scrapslot%d", texnum), BLOCK_WIDTH, BLOCK_HEIGHT, scrap_texels[texnum], false, true, 1);
120         scrap_dirty = false;
121 }
122
123 //=============================================================================
124 /* Support Routines */
125
126 typedef struct cachepic_s
127 {
128         char            name[MAX_QPATH];
129         qpic_t          pic;
130         byte            padding[32];    // for appended glpic
131 } cachepic_t;
132
133 #define MAX_CACHED_PICS         128
134 cachepic_t      menu_cachepics[MAX_CACHED_PICS];
135 int                     menu_numcachepics;
136
137 byte            menuplyr_pixels[4096];
138
139 int             pic_texels;
140 int             pic_count;
141
142 int GL_LoadPicTexture (qpic_t *pic);
143
144 qpic_t *Draw_PicFromWad (char *name)
145 {
146         qpic_t  *p;
147         glpic_t *gl;
148
149         p = W_GetLumpName (name);
150         gl = (glpic_t *)p->data;
151
152         // load little ones into the scrap
153         if (p->width < 64 && p->height < 64)
154         {
155                 int             x, y;
156                 int             i, j, k;
157                 int             texnum;
158
159                 texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
160                 scrap_dirty = true;
161                 k = 0;
162                 for (i=0 ; i<p->height ; i++)
163                         for (j=0 ; j<p->width ; j++, k++)
164                                 scrap_texels[texnum][(y+i)*BLOCK_WIDTH + x + j] = p->data[k];
165                 if (!scraptexnum[texnum])
166                         scraptexnum[texnum] = GL_LoadTexture (va("scrapslot%d", texnum), BLOCK_WIDTH, BLOCK_HEIGHT, scrap_texels[texnum], false, true, 1);
167                 gl->texnum = scraptexnum[texnum];
168                 gl->sl = (x+0.01)/(float)BLOCK_WIDTH;
169                 gl->sh = (x+p->width-0.01)/(float)BLOCK_WIDTH;
170                 gl->tl = (y+0.01)/(float)BLOCK_WIDTH;
171                 gl->th = (y+p->height-0.01)/(float)BLOCK_WIDTH;
172
173                 pic_count++;
174                 pic_texels += p->width*p->height;
175         }
176         else
177         {
178                 gl->texnum = GL_LoadPicTexture (p);
179                 gl->sl = 0;
180                 gl->sh = 1;
181                 gl->tl = 0;
182                 gl->th = 1;
183         }
184         return p;
185 }
186
187
188 /*
189 ================
190 Draw_CachePic
191 ================
192 */
193 qpic_t  *Draw_CachePic (char *path)
194 {
195         cachepic_t      *pic;
196         int                     i;
197         qpic_t          *dat;
198         glpic_t         *gl;
199
200         for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
201                 if (!strcmp (path, pic->name))
202                         return &pic->pic;
203
204         if (menu_numcachepics == MAX_CACHED_PICS)
205                 Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
206         menu_numcachepics++;
207         strcpy (pic->name, path);
208
209 //
210 // load the pic from disk
211 //
212         dat = (qpic_t *)COM_LoadTempFile (path, false);
213         if (!dat)
214                 Sys_Error ("Draw_CachePic: failed to load %s", path);
215         SwapPic (dat);
216
217         // HACK HACK HACK --- we need to keep the bytes for
218         // the translatable player picture just for the menu
219         // configuration dialog
220         if (!strcmp (path, "gfx/menuplyr.lmp"))
221                 memcpy (menuplyr_pixels, dat->data, dat->width*dat->height);
222
223         pic->pic.width = dat->width;
224         pic->pic.height = dat->height;
225
226         gl = (glpic_t *)pic->pic.data;
227         gl->texnum = GL_LoadPicTexture (dat);
228         gl->sl = 0;
229         gl->sh = 1;
230         gl->tl = 0;
231         gl->th = 1;
232
233         return &pic->pic;
234 }
235
236 /*
237 void Draw_CharToConback (int num, byte *dest)
238 {
239         int             row, col;
240         byte    *source;
241         int             drawline;
242         int             x;
243
244         row = num>>4;
245         col = num&15;
246         source = draw_chars + (row<<10) + (col<<3);
247
248         drawline = 8;
249
250         while (drawline--)
251         {
252                 for (x=0 ; x<8 ; x++)
253                         if (source[x] != 255)
254                                 dest[x] = 0x60 + source[x];
255                 source += 128;
256                 dest += 320;
257         }
258
259 }
260 */
261
262 extern void LoadSky_f(void);
263
264 extern char *QSG_EXTENSIONS;
265
266 /*
267 ===============
268 Draw_Init
269 ===============
270 */
271 void rmain_registercvars();
272 extern int buildnumber;
273
274 void gl_draw_start()
275 {
276         int             i;
277         glpic_t *gl;
278
279         // load the console background and the charset
280         // by hand, because we need to write the version
281         // string into the background before turning
282         // it into a texture
283         char_texture = loadtextureimage ("conchars", 0, 0, false, false);
284         if (!char_texture)
285         {
286                 draw_chars = W_GetLumpName ("conchars");
287                 for (i=0 ; i<256*64 ; i++)
288                         if (draw_chars[i] == 0)
289                                 draw_chars[i] = 255;    // proper transparent color
290
291                 // now turn them into textures
292                 char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1);
293         }
294
295         gl = (glpic_t *)conback->data;
296         gl->texnum = loadtextureimage("gfx/conback", 0, 0, false, false);
297         gl->sl = 0;
298         gl->sh = 1;
299         gl->tl = 0;
300         gl->th = 1;
301         conback->width = vid.width;
302         conback->height = vid.height;
303
304         memset(scraptexnum, 0, sizeof(scraptexnum));
305
306         // get the other pics we need
307         draw_disc = Draw_PicFromWad ("disc");
308 }
309
310 void gl_draw_shutdown()
311 {
312 }
313
314 char engineversion[40];
315 int engineversionx, engineversiony;
316
317 extern void GL_Textures_Init();
318 void GL_Draw_Init (void)
319 {
320         int i;
321         Cvar_RegisterVariable (&qsg_version);
322         Cvar_RegisterVariable (&scr_conalpha);
323
324         Cmd_AddCommand ("loadsky", &LoadSky_f);
325
326 #ifdef NEHAHRA
327 #if defined(__linux__)
328         sprintf (engineversion, "DPNehahra Linux   GL %.2f build %3i", (float) VERSION, buildnumber);
329 #elif defined(WIN32)
330         sprintf (engineversion, "DPNehahra Windows GL %.2f build %3i", (float) VERSION, buildnumber);
331 #else
332         sprintf (engineversion, "DPNehahra Unknown GL %.2f build %3i", (float) VERSION, buildnumber);
333 #endif
334 #else
335 #if defined(__linux__)
336         sprintf (engineversion, "DarkPlaces Linux   GL %.2f build %3i", (float) VERSION, buildnumber);
337 #elif defined(WIN32)
338         sprintf (engineversion, "DarkPlaces Windows GL %.2f build %3i", (float) VERSION, buildnumber);
339 #else
340         sprintf (engineversion, "DarkPlaces Unknown GL %.2f build %3i", (float) VERSION, buildnumber);
341 #endif
342 #endif
343         for (i = 0;i < 40 && engineversion[i];i++)
344                 engineversion[i] += 0x80; // shift to orange
345         engineversionx = vid.width - strlen(engineversion) * 8 - 8;
346         engineversiony = vid.height - 8;
347
348         GL_Textures_Init();
349         R_RegisterModule("GL_Draw", gl_draw_start, gl_draw_shutdown);
350 }
351
352 /*
353 ================
354 Draw_Character
355
356 Draws one 8*8 graphics character with 0 being transparent.
357 It can be clipped to the top of the screen to allow the console to be
358 smoothly scrolled off.
359 ================
360 */
361 void Draw_Character (int x, int y, int num)
362 {
363         int                             row, col;
364         float                   frow, fcol, size;
365
366         if (num == 32)
367                 return;         // space
368
369         num &= 255;
370         
371         if (y <= -8)
372                 return;                 // totally off screen
373
374         row = num>>4;
375         col = num&15;
376
377         frow = row*0.0625;
378         fcol = col*0.0625;
379         size = 0.0625;
380
381         if (!r_render.value)
382                 return;
383         glBindTexture(GL_TEXTURE_2D, char_texture);
384         // LordHavoc: NEAREST mode on text if not scaling up
385         if ((int) vid.width < glwidth)
386         {
387                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
388                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
389         }
390
391         glColor3f(1,1,1);
392         glBegin (GL_QUADS);
393         glTexCoord2f (fcol, frow);
394         glVertex2f (x, y);
395         glTexCoord2f (fcol + size, frow);
396         glVertex2f (x+8, y);
397         glTexCoord2f (fcol + size, frow + size);
398         glVertex2f (x+8, y+8);
399         glTexCoord2f (fcol, frow + size);
400         glVertex2f (x, y+8);
401         glEnd ();
402
403         // LordHavoc: revert to LINEAR mode
404         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
405         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
406 }
407
408 /*
409 ================
410 Draw_String
411 ================
412 */
413 // LordHavoc: sped this up a lot, and added maxlen
414 void Draw_String (int x, int y, char *str, int maxlen)
415 {
416         int num;
417         float frow, fcol;
418         if (!r_render.value)
419                 return;
420         if (y <= -8 || y >= (int) vid.height || x >= (int) vid.width || *str == 0) // completely offscreen or no text to print
421                 return;
422         if (maxlen < 1)
423                 maxlen = strlen(str);
424         else if (maxlen > (int) strlen(str))
425                 maxlen = strlen(str);
426         glBindTexture(GL_TEXTURE_2D, char_texture);
427
428         // LordHavoc: NEAREST mode on text if not scaling up
429         if ((int) vid.width < glwidth)
430         {
431                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
432                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
433         }
434
435         glColor3f(1,1,1);
436         glBegin (GL_QUADS);
437         while (maxlen-- && x < (int) vid.width) // stop rendering when out of characters or room
438         {
439                 if ((num = *str++) != 32) // skip spaces
440                 {
441                         frow = (float) ((int) num >> 4)*0.0625;
442                         fcol = (float) ((int) num & 15)*0.0625;
443                         glTexCoord2f (fcol, frow);
444                         glVertex2f (x, y);
445                         glTexCoord2f (fcol + 0.0625, frow);
446                         glVertex2f (x+8, y);
447                         glTexCoord2f (fcol + 0.0625, frow + 0.0625);
448                         glVertex2f (x+8, y+8);
449                         glTexCoord2f (fcol, frow + 0.0625);
450                         glVertex2f (x, y+8);
451                 }
452                 x += 8;
453         }
454         glEnd ();
455
456         // LordHavoc: revert to LINEAR mode
457         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
458         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
459 }
460
461 void Draw_GenericPic (int texnum, float red, float green, float blue, float alpha, float x, float y, float width, float height)
462 {
463         if (!r_render.value)
464                 return;
465         glDisable(GL_ALPHA_TEST);
466 //      glEnable (GL_BLEND);
467         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
468 //      glCullFace(GL_FRONT);
469         glColor4f(red,green,blue,alpha);
470         glBindTexture(GL_TEXTURE_2D, texnum);
471         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
472         glBegin (GL_QUADS);
473         glTexCoord2f (0, 0);
474         glVertex2f (x, y);
475         glTexCoord2f (1, 0);
476         glVertex2f (x+width, y);
477         glTexCoord2f (1, 1);
478         glVertex2f (x+width, y+height);
479         glTexCoord2f (0, 1);
480         glVertex2f (x, y+height);
481         glEnd ();
482         glColor3f(1,1,1);
483 //      glEnable(GL_ALPHA_TEST);
484 //      glDisable (GL_BLEND);
485 }
486
487 /*
488 =============
489 Draw_AlphaPic
490 =============
491 */
492 void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
493 {
494         glpic_t                 *gl;
495
496         if (scrap_dirty)
497                 Scrap_Upload ();
498         gl = (glpic_t *)pic->data;
499         if (!r_render.value)
500                 return;
501         glColor4f(1,1,1,alpha);
502         glBindTexture(GL_TEXTURE_2D, gl->texnum);
503         glBegin (GL_QUADS);
504         glTexCoord2f (gl->sl, gl->tl);
505         glVertex2f (x, y);
506         glTexCoord2f (gl->sh, gl->tl);
507         glVertex2f (x+pic->width, y);
508         glTexCoord2f (gl->sh, gl->th);
509         glVertex2f (x+pic->width, y+pic->height);
510         glTexCoord2f (gl->sl, gl->th);
511         glVertex2f (x, y+pic->height);
512         glEnd ();
513 }
514
515
516 /*
517 =============
518 Draw_Pic
519 =============
520 */
521 void Draw_Pic (int x, int y, qpic_t *pic)
522 {
523         glpic_t                 *gl;
524
525         if (scrap_dirty)
526                 Scrap_Upload ();
527         gl = (glpic_t *)pic->data;
528         if (!r_render.value)
529                 return;
530         glColor3f(1,1,1);
531         glBindTexture(GL_TEXTURE_2D, gl->texnum);
532         glBegin (GL_QUADS);
533         glTexCoord2f (gl->sl, gl->tl);
534         glVertex2f (x, y);
535         glTexCoord2f (gl->sh, gl->tl);
536         glVertex2f (x+pic->width, y);
537         glTexCoord2f (gl->sh, gl->th);
538         glVertex2f (x+pic->width, y+pic->height);
539         glTexCoord2f (gl->sl, gl->th);
540         glVertex2f (x, y+pic->height);
541         glEnd ();
542 }
543
544
545 /*
546 =============
547 Draw_PicTranslate
548
549 Only used for the player color selection menu
550 =============
551 */
552 void Draw_PicTranslate (int x, int y, qpic_t *pic, byte *translation)
553 {
554         int                             i, c;
555         byte                    *trans, *src, *dest;
556
557         c = pic->width * pic->height;
558         src = menuplyr_pixels;
559         dest = trans = malloc(c);
560         for (i = 0;i < c;i++)
561                 *dest++ = translation[*src++];
562
563         c = GL_LoadTexture ("translatedplayerpic", pic->width, pic->height, trans, false, true, 1);
564         free(trans);
565
566         if (!r_render.value)
567                 return;
568         glBindTexture(GL_TEXTURE_2D, c);
569         glColor3f(1,1,1);
570         glBegin (GL_QUADS);
571         glTexCoord2f (0, 0);
572         glVertex2f (x, y);
573         glTexCoord2f (1, 0);
574         glVertex2f (x+pic->width, y);
575         glTexCoord2f (1, 1);
576         glVertex2f (x+pic->width, y+pic->height);
577         glTexCoord2f (0, 1);
578         glVertex2f (x, y+pic->height);
579         glEnd ();
580 }
581
582
583 /*
584 ================
585 Draw_ConsoleBackground
586
587 ================
588 */
589 void Draw_ConsoleBackground (int lines)
590 {
591         // LordHavoc: changed alpha
592         //int y = (vid.height >> 1);
593
594         if (lines >= (int) vid.height)
595                 Draw_Pic(0, lines - vid.height, conback);
596         else
597                 Draw_AlphaPic (0, lines - vid.height, conback, scr_conalpha.value*lines/vid.height);
598         //      Draw_AlphaPic (0, lines - vid.height, conback, (float)(1.2 * lines)/y);
599         // LordHavoc: draw version
600         Draw_String(engineversionx, lines - vid.height + engineversiony, engineversion, 9999);
601 }
602
603 /*
604 =============
605 Draw_Fill
606
607 Fills a box of pixels with a single color
608 =============
609 */
610 void Draw_Fill (int x, int y, int w, int h, int c)
611 {
612         if (!r_render.value)
613                 return;
614         glDisable (GL_TEXTURE_2D);
615         glColor3f (host_basepal[c*3]/255.0, host_basepal[c*3+1]/255.0, host_basepal[c*3+2]/255.0);
616
617         glBegin (GL_QUADS);
618
619         glVertex2f (x,y);
620         glVertex2f (x+w, y);
621         glVertex2f (x+w, y+h);
622         glVertex2f (x, y+h);
623
624         glEnd ();
625         glColor3f(1,1,1);
626         glEnable (GL_TEXTURE_2D);
627 }
628 //=============================================================================
629
630 //=============================================================================
631
632 /*
633 ================
634 GL_Set2D
635
636 Setup as if the screen was 320*200
637 ================
638 */
639 void GL_Set2D (void)
640 {
641         if (!r_render.value)
642                 return;
643         glViewport (glx, gly, glwidth, glheight);
644
645         glMatrixMode(GL_PROJECTION);
646     glLoadIdentity ();
647         glOrtho  (0, vid.width, vid.height, 0, -99999, 99999);
648
649         glMatrixMode(GL_MODELVIEW);
650     glLoadIdentity ();
651
652         glDisable (GL_DEPTH_TEST);
653         glDisable (GL_CULL_FACE);
654         glEnable (GL_BLEND); // was Disable
655 //      glEnable (GL_ALPHA_TEST);
656         glDisable (GL_ALPHA_TEST);
657         glEnable(GL_TEXTURE_2D);
658
659         // LordHavoc: added this
660         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
661         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
662
663         glColor3f(1,1,1);
664 }
665
666 // LordHavoc: SHOWLMP stuff
667 #define SHOWLMP_MAXLABELS 256
668 typedef struct showlmp_s
669 {
670         qboolean        isactive;
671         float           x;
672         float           y;
673         char            label[32];
674         char            pic[128];
675 } showlmp_t;
676
677 showlmp_t showlmp[SHOWLMP_MAXLABELS];
678
679 void SHOWLMP_decodehide()
680 {
681         int i;
682         byte *lmplabel;
683         lmplabel = MSG_ReadString();
684         for (i = 0;i < SHOWLMP_MAXLABELS;i++)
685                 if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
686                 {
687                         showlmp[i].isactive = false;
688                         return;
689                 }
690 }
691
692 void SHOWLMP_decodeshow()
693 {
694         int i, k;
695         byte lmplabel[256], picname[256];
696         float x, y;
697         strcpy(lmplabel,MSG_ReadString());
698         strcpy(picname, MSG_ReadString());
699         x = MSG_ReadByte();
700         y = MSG_ReadByte();
701         k = -1;
702         for (i = 0;i < SHOWLMP_MAXLABELS;i++)
703                 if (showlmp[i].isactive)
704                 {
705                         if (strcmp(showlmp[i].label, lmplabel) == 0)
706                         {
707                                 k = i;
708                                 break; // drop out to replace it
709                         }
710                 }
711                 else if (k < 0) // find first empty one to replace
712                         k = i;
713         if (k < 0)
714                 return; // none found to replace
715         // change existing one
716         showlmp[k].isactive = true;
717         strcpy(showlmp[k].label, lmplabel);
718         strcpy(showlmp[k].pic, picname);
719         showlmp[k].x = x;
720         showlmp[k].y = y;
721 }
722
723 void SHOWLMP_drawall()
724 {
725         int i;
726         for (i = 0;i < SHOWLMP_MAXLABELS;i++)
727                 if (showlmp[i].isactive)
728                         Draw_Pic(showlmp[i].x, showlmp[i].y, Draw_CachePic(showlmp[i].pic));
729 }
730
731 void SHOWLMP_clear()
732 {
733         int i;
734         for (i = 0;i < SHOWLMP_MAXLABELS;i++)
735                 showlmp[i].isactive = false;
736 }