From 58edfbc485bf28a662f01bd18c63589eb2ddbc06 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 1 Mar 2021 20:03:32 +0300 Subject: [PATCH] engine: move cvars that expected to exist by client.dll from render dll to engine Fixes #316 --- engine/client/ref_common.c | 5 +++++ ref_gl/gl_opengl.c | 2 +- ref_gl/gl_studio.c | 4 +++- ref_soft/r_main.c | 2 +- ref_soft/r_studio.c | 4 +++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 2f5a8fb6..79f8a8a1 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -648,6 +648,11 @@ qboolean R_Init( void ) r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" ); r_refdll = Cvar_Get( "r_refdll", "", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "choose renderer implementation, if supported" ); + // cvars that are expected to exist by client.dll + // refdll should just get pointer to them + Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" ); + Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" ); + // cvars are created, execute video config Cbuf_AddText( "exec video.cfg" ); Cbuf_Execute(); diff --git a/ref_gl/gl_opengl.c b/ref_gl/gl_opengl.c index 11d0123b..547ead4a 100644 --- a/ref_gl/gl_opengl.c +++ b/ref_gl/gl_opengl.c @@ -842,7 +842,7 @@ void GL_InitCommands( void ) r_dynamic = gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" ); r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" ); r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" ); - r_drawentities = gEngfuncs.Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" ); + r_drawentities = gEngfuncs.pfnGetCvarPointer( "r_drawentities", 0 ); r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals", 0 ); r_showhull = gEngfuncs.pfnGetCvarPointer( "r_showhull", 0 ); diff --git a/ref_gl/gl_studio.c b/ref_gl/gl_studio.c index 8029e930..dd53eb5a 100644 --- a/ref_gl/gl_studio.c +++ b/ref_gl/gl_studio.c @@ -152,7 +152,9 @@ R_StudioInit */ void R_StudioInit( void ) { - cl_himodels = gEngfuncs.Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" ); + // guaranteed to exist by engine + cl_himodels = gEngfuncs.pfnGetCvarPointer( "cl_himodels", 0 ); + r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" ); r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" ); r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" ); diff --git a/ref_soft/r_main.c b/ref_soft/r_main.c index 64c3b461..a33f6713 100644 --- a/ref_soft/r_main.c +++ b/ref_soft/r_main.c @@ -1930,7 +1930,7 @@ qboolean GAME_EXPORT R_Init( void ) gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" ); vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma", 0 ); r_norefresh = gEngfuncs.Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" ); - r_drawentities = gEngfuncs.Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" ); + r_drawentities = gEngfuncs.pfnGetCvarPointer( "r_drawentities", 0 ); vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness", 0 ); r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" ); diff --git a/ref_soft/r_studio.c b/ref_soft/r_studio.c index 3037e28b..03994bcd 100644 --- a/ref_soft/r_studio.c +++ b/ref_soft/r_studio.c @@ -149,11 +149,13 @@ R_StudioInit */ void R_StudioInit( void ) { - cl_himodels = gEngfuncs.Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" ); r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" ); r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" ); r_studio_drawelements = gEngfuncs.Cvar_Get( "r_studio_drawelements", "1", FCVAR_ARCHIVE, "use glDrawElements for studiomodels" ); + // guaranteed to exist by engine + cl_himodels = gEngfuncs.pfnGetCvarPointer( "cl_himodels", 0 ); + Matrix3x4_LoadIdentity( g_studio.rotationmatrix ); r_glowshellfreq = gEngfuncs.Cvar_Get( "r_glowshellfreq", "2.2", 0, "glowing shell frequency update" );