Get conchars reloading on gamedir change.

gfx.wad now gets reloaded every gamedir change.

The remaining gamedir graphics issues should be just a matter of finding
caches and flushing them.
This commit is contained in:
Bill Currie 2010-12-28 09:10:05 +09:00
parent 6e18c3df85
commit acf6c1d37d
2 changed files with 41 additions and 19 deletions

View file

@ -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

View file

@ -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 ();