diff --git a/include/QF/vid.h b/include/QF/vid.h index 70298fa8b..057414b2f 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -88,5 +88,6 @@ void VID_Init_Cvars (void); void VID_Init (byte *palette, byte *colormap); void VID_Shutdown (void); void VID_SetCaption (const char *text); +void VID_ClearMemory (void); #endif // __vid_h_ diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 46507e26d..d7aeb3b2d 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -305,3 +305,10 @@ VID_InitBuffers (void) if (viddef.init_caches) viddef.init_caches (viddef.surfcache, cachesize); } + +void +VID_ClearMemory (void) +{ + if (viddef.flush_caches) + viddef.flush_caches (); +} diff --git a/nq/include/client.h b/nq/include/client.h index e6dc80e97..54477f7b4 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -287,6 +287,7 @@ struct cbuf_s; void CL_Init (struct cbuf_s *cbuf); void CL_InitCvars (void); void CL_Shutdown (void); +void CL_ClearMemory (void); void CL_EstablishConnection (const char *host); void CL_Signon1 (void); diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 7f6dd9e82..3f8e7bde6 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -130,6 +130,14 @@ CL_Shutdown (void) VID_Shutdown (); } +void +CL_ClearMemory (void) +{ + VID_ClearMemory (); + if (r_data) + r_data->force_fullscreen = 0; +} + void CL_InitCvars (void) { diff --git a/nq/source/host.c b/nq/source/host.c index f6b59cf8b..d15dd0431 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -495,8 +495,7 @@ void Host_ClearMemory (void) { Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); - if (viddef.flush_caches) - viddef.flush_caches (); + CL_ClearMemory (); Mod_ClearAll (); if (host_hunklevel) Hunk_FreeToLowMark (host_hunklevel); @@ -504,8 +503,6 @@ Host_ClearMemory (void) cls.signon = 0; memset (&sv, 0, sizeof (sv)); memset (&cl, 0, sizeof (cl)); - if (r_data) - r_data->force_fullscreen = 0; } /* diff --git a/nq/source/sv_ded.c b/nq/source/sv_ded.c index c22f9cc3a..44dd57408 100644 --- a/nq/source/sv_ded.c +++ b/nq/source/sv_ded.c @@ -68,6 +68,11 @@ CL_UpdateScreen (double realtime) { } +void +CL_ClearMemory (void) +{ +} + void CL_Cmd_ForwardToServer (void) { diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 09fb1aec2..c2b3c3a35 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -412,8 +412,7 @@ CL_ClearState (void) CL_Init_Entity (&cl.viewent); Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); - if (viddef.flush_caches) - viddef.flush_caches (); + VID_ClearMemory (); Mod_ClearAll (); if (host_hunklevel) // FIXME: check this... Hunk_FreeToLowMark (host_hunklevel);