diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index b29be3584..fe7b955d8 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -207,13 +207,11 @@ Draw_PicFromWad (const char *name) } static void -Draw_ClearCache (int phase) +draw_clear_cache (void) { cachepic_t *pic; int i; - if (phase) - return; for (pic = cachepics, i = 0; i < numcachepics; pic++, i++) pic->dirty = true; } @@ -330,23 +328,13 @@ Draw_TextBox (int x, int y, int width, int lines, byte alpha) qfglColor3ubv (color_white); } -VISIBLE void -Draw_Init (void) +static void +draw_load_conchars (void) { int i; tex_t *image; - byte *cs_tmp_data; float width, height; - Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, - "Texture mipmap quality."); - - QFS_GamedirCallback (Draw_ClearCache); - - // 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 - image = LoadImage ("gfx/conchars"); if (image) { if (image->format < 4) { @@ -387,6 +375,32 @@ Draw_Init (void) char_cells[i].blx = fcol + CELL_INSET / width; char_cells[i].bly = frow - CELL_INSET / height + CELL_SIZE; } +} + +static void +draw_gamedir (int phase) +{ + if (!phase) + return; + draw_load_conchars (); + draw_clear_cache (); +} + +VISIBLE void +Draw_Init (void) +{ + int i; + byte *cs_tmp_data; + + Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, + "Texture mipmap quality."); + + QFS_GamedirCallback (draw_gamedir); + + // 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_load_conchars (); // re-arrange the cs_data bytes so they're layed out properly for // subimaging diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 39dce700e..f1e12d27e 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1698,12 +1698,10 @@ CL_Init_Memory (void) } static void -CL_Autoexec (int phase) +CL_Autoexec (void) { int cmd_warncmd_val = cmd_warncmd->int_val; - if (!phase) - return; Cbuf_AddText (cl_cbuf, "cmd_warncmd 0\n"); Cbuf_AddText (cl_cbuf, "exec config.cfg\n"); Cbuf_AddText (cl_cbuf, "exec frontend.cfg\n"); @@ -1715,6 +1713,16 @@ CL_Autoexec (int phase) Cbuf_AddText (cl_cbuf, va ("cmd_warncmd %d\n", cmd_warncmd_val)); } +static void +cl_gamedir (int phase) +{ + if (phase) { + CL_Autoexec (); + } else { + W_LoadWadFile ("gfx.wad"); + } +} + void Host_Init (void) { @@ -1769,7 +1777,7 @@ Host_Init (void) cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0); QFS_Init ("qw"); - QFS_GamedirCallback (CL_Autoexec); + QFS_GamedirCallback (cl_gamedir); PI_Init (); CL_Cam_Init_Cvars ();