From 1785c0bfc5f8e9863f9246a497e554a014e1884c Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sun, 2 Apr 2006 07:14:25 +0000 Subject: [PATCH] added vid_conautoscale which allows vid_conheight/vid_conwiidth to be updated based on scale of current resolution, updated vc2005 project yet again git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2141 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/renderer.c | 7 ++++-- engine/dotnet2005/gas2masm.vcproj | 16 ++++++------- engine/gl/gl_rsurf.c | 3 ++- engine/gl/gl_screen.c | 38 +++++++++++++++++++++++++------ 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/engine/client/renderer.c b/engine/client/renderer.c index a74bd2ddb..637e0fd75 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -118,6 +118,7 @@ cvar_t gl_nocolors = SCVAR("gl_nocolors","0"); cvar_t gl_load24bit = SCVARF("gl_load24bit", "1", CVAR_ARCHIVE); cvar_t vid_conwidth = SCVARF("vid_conwidth", "640", CVAR_ARCHIVE); cvar_t vid_conheight = SCVARF("vid_conheight", "480", CVAR_ARCHIVE); +cvar_t vid_conautoscale = SCVARF("vid_conautoscale", "0", CVAR_ARCHIVE); cvar_t gl_nobind = SCVAR("gl_nobind", "0"); cvar_t gl_max_size = SCVAR("gl_max_size", "1024"); cvar_t gl_picmip = SCVAR("gl_picmip", "0"); @@ -301,8 +302,6 @@ void GLRenderer_Init(void) Cvar_Register (&gl_max_size, GLRENDEREROPTIONS); Cvar_Register (&gl_maxdist, GLRENDEREROPTIONS); Cvar_Register (&gl_mindist, GLRENDEREROPTIONS); - Cvar_Register (&vid_conwidth, GLRENDEREROPTIONS); - Cvar_Register (&vid_conheight, GLRENDEREROPTIONS); Cvar_Register (&vid_multisample, GLRENDEREROPTIONS); Cvar_Register (&gl_fontedgeclamp, GRAPHICALNICETIES); @@ -478,6 +477,10 @@ void Renderer_Init(void) // Cvar_Register (&vid_stretch, VIDCOMMANDGROUP); Cvar_Register (&vid_bpp, VIDCOMMANDGROUP); + Cvar_Register (&vid_conwidth, VIDCOMMANDGROUP); + Cvar_Register (&vid_conheight, VIDCOMMANDGROUP); + Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP); + Cvar_Register (&vid_allow_modex, VIDCOMMANDGROUP); Cvar_Register (&vid_width, VIDCOMMANDGROUP); diff --git a/engine/dotnet2005/gas2masm.vcproj b/engine/dotnet2005/gas2masm.vcproj index 44700b273..e8cf953c0 100644 --- a/engine/dotnet2005/gas2masm.vcproj +++ b/engine/dotnet2005/gas2masm.vcproj @@ -15,8 +15,8 @@ diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 3efce90cd..835ea0b29 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -3755,6 +3755,7 @@ void GL_BuildLightmaps (void) else gl_lightmap_format = GL_LUMINANCE; +/* if (COM_CheckParm ("-lm_1")) gl_lightmap_format = GL_LUMINANCE; if (COM_CheckParm ("-lm_a")) @@ -3765,7 +3766,7 @@ void GL_BuildLightmaps (void) gl_lightmap_format = GL_RGB; if (COM_CheckParm ("-lm_4")) gl_lightmap_format = GL_RGBA; -/* if (*gl_lightmapmode.string) + if (*gl_lightmapmode.string) { switch(*gl_lightmapmode.string) { diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 6944694bb..474d1694c 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -131,7 +131,7 @@ needs almost the entire 256k of stack space! void GLSCR_UpdateScreen (void) { - extern cvar_t vid_conwidth, vid_conheight, gl_texturemode; + extern cvar_t vid_conwidth, vid_conheight, gl_texturemode, vid_conautoscale; int uimenu; #ifdef TEXTEDITOR extern qboolean editormodal; @@ -145,16 +145,40 @@ void GLSCR_UpdateScreen (void) return; } + if (vid_conautoscale.modified) + { + float xratio, yratio = 0; + + xratio = vid_conautoscale.value; + if (xratio > 0) + { + char *s = strchr(vid_conautoscale.string, ' '); + if (s) + yratio = atof(s + 1); + + if (yratio <= 0) + yratio = xratio; + + xratio = 1 / xratio; + yratio = 1 / yratio; + + Cvar_SetValue(&vid_conwidth, glwidth * xratio); + Cvar_SetValue(&vid_conheight, glheight * yratio); + } + + vid_conautoscale.modified = false; + } + if (vid_conwidth.modified || vid_conheight.modified) { //let let the user be too crazy - if (vid_conwidth.value > 2048) //anything higher is unreadable. - Cvar_Set(&vid_conwidth, "2048"); - if (vid_conwidth.value < 240) //lower would be wrong + if (vid_conwidth.value > (glwidth * 2)) //anything higher is unreadable. + Cvar_SetValue(&vid_conwidth, (float)(glwidth * 2)); + if (vid_conwidth.value < 320) //lower would be wrong Cvar_Set(&vid_conwidth, "320"); - if (vid_conheight.value > 1536) //anything higher is unreadable. - Cvar_Set(&vid_conheight, "1536"); - if (vid_conheight.value < 240) //lower would be wrong + if (vid_conheight.value > (glheight * 2)) //anything higher is unreadable. + Cvar_SetValue(&vid_conheight, (float)(glheight * 2)); + if (vid_conheight.value < 200) //lower would be wrong Cvar_Set(&vid_conheight, "200"); vid_conwidth.modified = false;