From 80a5c53cb2a109bae9c8aa2641581211040f20f0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 14 Sep 2020 14:32:46 +0300 Subject: [PATCH] engine: client: move ref state updating into standalone function --- engine/client/cl_parse.c | 10 ++-------- engine/client/ref_common.c | 7 ++++++- engine/client/ref_common.h | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 3478596b..367d29a5 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1579,10 +1579,7 @@ void CL_RegisterResources( sizebuf_t *msg ) CL_ClearWorld (); // update the ref state. - refState.time = cl.time; - refState.oldtime = cl.oldtime; - refState.realtime = host.realtime; - refState.frametime = host.frametime; + R_UpdateRefState (); // tell rendering system we have a new set of models. ref.dllFuncs.R_NewMap (); @@ -3175,10 +3172,7 @@ void CL_LegacyPrecache_f( void ) clgame.entities->model = cl.worldmodel; // update the ref state. - refState.time = cl.time; - refState.oldtime = cl.oldtime; - refState.realtime = host.realtime; - refState.frametime = host.frametime; + R_UpdateRefState (); // tell rendering system we have a new set of models. ref.dllFuncs.R_NewMap (); diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 0b674255..4a63b438 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -41,12 +41,17 @@ void GAME_EXPORT GL_FreeImage( const char *name ) ref.dllFuncs.GL_FreeTexture( texnum ); } -void GL_RenderFrame( const ref_viewpass_t *rvp ) +void R_UpdateRefState( void ) { refState.time = cl.time; refState.oldtime = cl.oldtime; refState.realtime = host.realtime; refState.frametime = host.frametime; +} + +void GL_RenderFrame( const ref_viewpass_t *rvp ) +{ + R_UpdateRefState(); VectorCopy( rvp->vieworigin, refState.vieworg ); VectorCopy( rvp->viewangles, refState.viewangles ); diff --git a/engine/client/ref_common.h b/engine/client/ref_common.h index 18685017..1e8521cb 100644 --- a/engine/client/ref_common.h +++ b/engine/client/ref_common.h @@ -51,5 +51,6 @@ extern convar_t *gl_clear; qboolean R_Init( void ); void R_Shutdown( void ); +void R_UpdateRefState( void ); #endif // REF_COMMON_H