- int i;
- qpic_t *cb;
- byte *dest;
- int x, y;
- char ver[40];
- glpic_t *gl;
- int start;
-
- Cvar_RegisterVariable (&qsg_version);
- Cvar_RegisterVariable (&gl_max_size);
- Cvar_RegisterVariable (&gl_picmip);
- Cvar_RegisterVariable (&gl_conalpha);
- Cvar_RegisterVariable (&gl_lerpimages);
-
- // 3dfx can only handle 256 wide textures
- if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) ||
- strstr((char *)gl_renderer, "Glide"))
- Cvar_Set ("gl_max_size", "256");
-
- Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f);
-
- Cmd_AddCommand ("loadsky", &LoadSky_f);
-
- // load the console background and the charset
- // by hand, because we need to write the version
- // string into the background before turning
- // it into a texture
- draw_chars = W_GetLumpName ("conchars");
- for (i=0 ; i<256*64 ; i++)
- if (draw_chars[i] == 0)
- draw_chars[i] = 255; // proper transparent color
-
- // now turn them into textures
- char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1);
-
- start = Hunk_LowMark();
-
- cb = (qpic_t *)COM_LoadMallocFile ("gfx/conback.lmp", false);
- if (!cb)
- Sys_Error ("Couldn't load gfx/conback.lmp");
- SwapPic (cb);
-
- // hack the version number directly into the pic
-#ifdef NEHAHRA
-#if defined(__linux__)
- sprintf (ver, "DPNehahra Linux GL %.2f", (float) VERSION);
-#else
- sprintf (ver, "DPNehahra Windows GL %.2f", (float) VERSION);
-#endif
-#else
-#if defined(__linux__)
- sprintf (ver, "DarkPlaces Linux GL %.2f", (float)VERSION);
-#else
- sprintf (ver, "DarkPlaces Windows GL %.2f", (float)VERSION);
-#endif
-#endif
- dest = cb->data + 320*186 + 320 - 11 - 8*strlen(ver);
- y = strlen(ver);
- for (x=0 ; x<y ; x++)
- Draw_CharToConback (ver[x], dest+(x<<3));
-
- gl = (glpic_t *)conback->data;
- gl->texnum = GL_LoadTexture ("conback", cb->width, cb->height, cb->data, false, false, 1);
- gl->sl = 0;
- gl->sh = 1;
- gl->tl = 0;
- gl->th = 1;
- conback->width = vid.width;
- conback->height = vid.height;
-
- // free loaded console
- free(cb);
-
- // save a texture slot for translated picture
- translate_texture = texture_extension_number++;
-
- // save slots for scraps
- scrap_texnum = texture_extension_number;
- texture_extension_number += MAX_SCRAPS;
-
- //
- // get the other pics we need
- //
- draw_disc = Draw_PicFromWad ("disc");
-
- rmain_registercvars();
-}