- qpic_t *p;
- glpic_t *gl;
-
- p = W_GetLumpName (name);
- gl = (glpic_t *)p->data;
-
- // load little ones into the scrap
- if (p->width < 64 && p->height < 64)
- {
- int x, y;
- int i, j, k;
- int texnum;
-
- texnum = Scrap_AllocBlock (p->width, p->height, &x, &y);
- scrap_dirty = true;
- k = 0;
- for (i=0 ; i<p->height ; i++)
- for (j=0 ; j<p->width ; j++, k++)
- scrap_texels[texnum][(y+i)*BLOCK_WIDTH + x + j] = p->data[k];
- texnum += scrap_texnum;
- gl->texnum = texnum;
- gl->sl = (x+0.01)/(float)BLOCK_WIDTH;
- gl->sh = (x+p->width-0.01)/(float)BLOCK_WIDTH;
- gl->tl = (y+0.01)/(float)BLOCK_WIDTH;
- gl->th = (y+p->height-0.01)/(float)BLOCK_WIDTH;
-
- pic_count++;
- pic_texels += p->width*p->height;
- // LordHavoc: LINEAR interpolation
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else
- {
- gl->texnum = GL_LoadPicTexture (p);
- gl->sl = 0;
- gl->sh = 1;
- gl->tl = 0;
- gl->th = 1;
- // LordHavoc: LINEAR interpolation
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //NEAREST);
- }
- return p;
-}
-
-
-/*
-================
-Draw_CachePic
-================
-*/
-qpic_t *Draw_CachePic (char *path)
-{
- cachepic_t *pic;
- int i;
- qpic_t *dat;
- glpic_t *gl;
-
- for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
- if (!strcmp (path, pic->name))
- return &pic->pic;
-
- if (menu_numcachepics == MAX_CACHED_PICS)
- Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
- menu_numcachepics++;
- strcpy (pic->name, path);
-
-//
-// load the pic from disk
-//
- dat = (qpic_t *)COM_LoadTempFile (path, false);
- if (!dat)
- Sys_Error ("Draw_CachePic: failed to load %s", path);
- SwapPic (dat);
-
- // HACK HACK HACK --- we need to keep the bytes for
- // the translatable player picture just for the menu
- // configuration dialog
- if (!strcmp (path, "gfx/menuplyr.lmp"))
- memcpy (menuplyr_pixels, dat->data, dat->width*dat->height);
-
- pic->pic.width = dat->width;
- pic->pic.height = dat->height;
-
- gl = (glpic_t *)pic->pic.data;
- gl->texnum = GL_LoadPicTexture (dat);
- gl->sl = 0;
- gl->sh = 1;
- gl->tl = 0;
- gl->th = 1;
-
- return &pic->pic;
-}
-
-
-void Draw_CharToConback (int num, byte *dest)
-{
- int row, col;
- byte *source;
- int drawline;
- int x;
-
- row = num>>4;
- col = num&15;
- source = draw_chars + (row<<10) + (col<<3);
-
- drawline = 8;
-
- while (drawline--)
- {
- for (x=0 ; x<8 ; x++)
- if (source[x] != 255)
- dest[x] = 0x60 + source[x];
- source += 128;
- dest += 320;
- }
-
-}
-
-typedef struct
-{
- char *name;
- int minimize, maximize;
-} glmode_t;
-
-glmode_t modes[] = {
- {"GL_NEAREST", GL_NEAREST, GL_NEAREST},
- {"GL_LINEAR", GL_LINEAR, GL_LINEAR},
- {"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
- {"GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR},
- {"GL_NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST},
- {"GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}