From ae0f53f0db7dc90d442c21180eee969dd538d607 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:30:36 -0300 Subject: [PATCH 01/14] Archive scr_fov value --- quakespasm/Quake/gl_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quakespasm/Quake/gl_screen.c b/quakespasm/Quake/gl_screen.c index ce4a6653a..b7e2fe4a1 100644 --- a/quakespasm/Quake/gl_screen.c +++ b/quakespasm/Quake/gl_screen.c @@ -89,7 +89,7 @@ cvar_t scr_clock = {"scr_clock", "0", CVAR_NONE}; //johnfitz cvar_t scr_viewsize = {"viewsize","100", CVAR_ARCHIVE}; -cvar_t scr_fov = {"fov","90",CVAR_NONE}; // 10 - 170 +cvar_t scr_fov = {"fov","90",CVAR_ARCHIVE}; // 10 - 170 cvar_t scr_fov_adapt = {"fov_adapt","1",CVAR_ARCHIVE}; cvar_t scr_conspeed = {"scr_conspeed","500",CVAR_ARCHIVE}; cvar_t scr_centertime = {"scr_centertime","2",CVAR_NONE}; From 1d8c2479be45c9291e779323ed570b5573d8ff33 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:31:46 -0300 Subject: [PATCH 02/14] Archive r_lerpmodels/r_lerpmove values --- quakespasm/Quake/gl_rmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quakespasm/Quake/gl_rmain.c b/quakespasm/Quake/gl_rmain.c index aed15fb1e..c40b8e96f 100644 --- a/quakespasm/Quake/gl_rmain.c +++ b/quakespasm/Quake/gl_rmain.c @@ -95,8 +95,8 @@ cvar_t r_oldskyleaf = {"r_oldskyleaf", "0", CVAR_NONE}; cvar_t r_drawworld = {"r_drawworld", "1", CVAR_NONE}; cvar_t r_showtris = {"r_showtris", "0", CVAR_NONE}; cvar_t r_showbboxes = {"r_showbboxes", "0", CVAR_NONE}; -cvar_t r_lerpmodels = {"r_lerpmodels", "1", CVAR_NONE}; -cvar_t r_lerpmove = {"r_lerpmove", "1", CVAR_NONE}; +cvar_t r_lerpmodels = {"r_lerpmodels", "1", CVAR_ARCHIVE}; +cvar_t r_lerpmove = {"r_lerpmove", "1", CVAR_ARCHIVE}; cvar_t r_nolerp_list = {"r_nolerp_list", "progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl", CVAR_NONE}; cvar_t r_noshadow_list = {"r_noshadow_list", "progs/flame2.mdl,progs/flame.mdl,progs/bolt1.mdl,progs/bolt2.mdl,progs/bolt3.mdl,progs/laser.mdl", CVAR_NONE}; From 9a7f22019633f4777d47ffae007ed1b36586d54b Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:33:00 -0300 Subject: [PATCH 03/14] Add extern cvars for usage in options menu/video options menu --- quakespasm/Quake/client.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/quakespasm/Quake/client.h b/quakespasm/Quake/client.h index eef4f646c..858aafbe6 100644 --- a/quakespasm/Quake/client.h +++ b/quakespasm/Quake/client.h @@ -352,6 +352,17 @@ extern cvar_t m_yaw; extern cvar_t m_forward; extern cvar_t m_side; +extern cvar_t scr_fov; +extern cvar_t host_maxfps; + +extern cvar_t r_scale; +extern cvar_t r_lerpmodels; +extern cvar_t r_lerpmove; +extern cvar_t r_particles; +extern cvar_t r_viewmodel_quake; + +extern int filtering; + #define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64 From 7c5bbdee7add3272ad59aff09efc557df1d48fe8 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:33:50 -0300 Subject: [PATCH 04/14] Add field of view/frames per second option --- quakespasm/Quake/menu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/quakespasm/Quake/menu.c b/quakespasm/Quake/menu.c index eb67f5f36..86a43cfde 100644 --- a/quakespasm/Quake/menu.c +++ b/quakespasm/Quake/menu.c @@ -950,6 +950,8 @@ enum OPT_CUSTOMIZE = 0, OPT_CONSOLE, // 1 OPT_DEFAULTS, // 2 + OPT_FOV, + OPT_FPS, OPT_SCALE, OPT_SCRSIZE, OPT_GAMMA, @@ -1002,6 +1004,18 @@ void M_AdjustSliders (int dir) switch (options_cursor) { + case OPT_FOV: // field of view + f = scr_fov.value + dir * 1; + if (f > 120) f = 120; + else if (f < 90) f = 90; + Cvar_SetValue("fov", f); + break; + case OPT_FPS: // frames per second + f = host_maxfps.value + dir * 10; + if (f > 500) f = 500; + else if (f < 72) f = 72; + Cvar_SetValue("host_maxfps", f); + break; case OPT_SCALE: // console and menu scale l = ((vid.width + 31) / 32) / 10.0; f = scr_conscale.value + dir * .1; @@ -1155,6 +1169,16 @@ void M_Options_Draw (void) // OPT_DEFAULTS: M_Print (16, 32 + 8*OPT_DEFAULTS, " Reset config"); + // OPT_FOV: + M_Print(16, 32 + 8 * OPT_FOV, " Field of view"); + r = (scr_fov.value - 90) / (120 - 90); + M_DrawSlider(220, 32 + 8 * OPT_FOV, r); + + // OPT_FPS: + M_Print(16, 32 + 8 * OPT_FPS, " Frames per second"); + r = (host_maxfps.value - 72) / (500 - 72); + M_DrawSlider(220, 32 + 8 * OPT_FPS, r); + // OPT_SCALE: M_Print (16, 32 + 8*OPT_SCALE, " Scale"); l = (vid.width / 320.0) - 1; From c70c2dab2f21d91da4e3875d552cba7190196138 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:34:27 -0300 Subject: [PATCH 05/14] Add render scale/filtering/interpolation/particles/viewmodel options --- quakespasm/Quake/gl_vidsdl.c | 128 ++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/gl_vidsdl.c b/quakespasm/Quake/gl_vidsdl.c index 68bd23f92..c102aac56 100644 --- a/quakespasm/Quake/gl_vidsdl.c +++ b/quakespasm/Quake/gl_vidsdl.c @@ -1844,6 +1844,11 @@ void VID_SyncCvars (void) //========================================================================== enum { + VID_OPT_RENDERSCALE, + VID_OPT_FILTERING, + VID_OPT_INTERPOLATION, + VID_OPT_PARTICLES, + VID_OPT_VIEWMODEL, VID_OPT_MODE, VID_OPT_BPP, VID_OPT_REFRESHRATE, @@ -2123,6 +2128,8 @@ VID_MenuKey */ static void VID_MenuKey (int key) { + int f = r_scale.value; + switch (key) { case K_ESCAPE: @@ -2150,6 +2157,36 @@ static void VID_MenuKey (int key) S_LocalSound ("misc/menu3.wav"); switch (video_options_cursor) { + case VID_OPT_RENDERSCALE: + if (f > 1) + { + f = r_scale.value - 1; + Cvar_SetValue("r_scale", f); + } + else + { + Cvar_SetValue("r_scale", 4); + } + break; + case VID_OPT_FILTERING: + if (filtering == 1) + Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); + else if (filtering == 0) + Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); + break; + case VID_OPT_INTERPOLATION: + Cbuf_AddText("toggle r_lerpmodels\n"); + Cbuf_AddText("toggle r_lerpmove\n"); + break; + case VID_OPT_PARTICLES: + if (r_particles.value == 1) + Cbuf_AddText("r_particles 2\n"); + else if (r_particles.value == 2) + Cbuf_AddText("r_particles 1\n"); + break; + case VID_OPT_VIEWMODEL: + Cbuf_AddText("toggle r_viewmodel_quake\n"); + break; case VID_OPT_MODE: VID_Menu_ChooseNextMode (1); break; @@ -2174,6 +2211,36 @@ static void VID_MenuKey (int key) S_LocalSound ("misc/menu3.wav"); switch (video_options_cursor) { + case VID_OPT_RENDERSCALE: + if (f < 4) + { + f = r_scale.value + 1; + Cvar_SetValue("r_scale", f); + } + else + { + Cvar_SetValue("r_scale", 1); + } + break; + case VID_OPT_FILTERING: + if (filtering == 1) + Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); + else if (filtering == 0) + Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); + break; + case VID_OPT_INTERPOLATION: + Cbuf_AddText("toggle r_lerpmodels\n"); + Cbuf_AddText("toggle r_lerpmove\n"); + break; + case VID_OPT_PARTICLES: + if (r_particles.value == 1) + Cbuf_AddText("r_particles 2\n"); + else if (r_particles.value == 2) + Cbuf_AddText("r_particles 1\n"); + break; + case VID_OPT_VIEWMODEL: + Cbuf_AddText("toggle r_viewmodel_quake\n"); + break; case VID_OPT_MODE: VID_Menu_ChooseNextMode (-1); break; @@ -2200,6 +2267,36 @@ static void VID_MenuKey (int key) m_entersound = true; switch (video_options_cursor) { + case VID_OPT_RENDERSCALE: + if (f > 1) + { + f = r_scale.value - 1; + Cvar_SetValue("r_scale", f); + } + else + { + Cvar_SetValue("r_scale", 4); + } + break; + case VID_OPT_FILTERING: + if (filtering == 1) + Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); + else if (filtering == 0) + Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); + break; + case VID_OPT_INTERPOLATION: + Cbuf_AddText("toggle r_lerpmodels\n"); + Cbuf_AddText("toggle r_lerpmove\n"); + break; + case VID_OPT_PARTICLES: + if (r_particles.value == 1) + Cbuf_AddText("r_particles 2\n"); + else if (r_particles.value == 2) + Cbuf_AddText("r_particles 1\n"); + break; + case VID_OPT_VIEWMODEL: + Cbuf_AddText("toggle r_viewmodel_quake\n"); + break; case VID_OPT_MODE: VID_Menu_ChooseNextMode (1); break; @@ -2268,6 +2365,35 @@ static void VID_MenuDraw (void) { switch (i) { + case VID_OPT_RENDERSCALE: + M_Print(16, y, " Render scale"); + if ((int)r_scale.value == 1) + M_Print(184, y, "native"); + else + M_Print(184, y, va("1/%i", (int)r_scale.value)); + break; + case VID_OPT_FILTERING: + M_Print(16, y, " Filtering"); + M_DrawCheckbox(184, y, filtering); + break; + case VID_OPT_INTERPOLATION: + M_Print(16, y, " Interpolation"); + M_DrawCheckbox(184, y, (int)r_lerpmodels.value && (int)r_lerpmove.value); + break; + case VID_OPT_PARTICLES: + M_Print(16, y, " Particles"); + if ((int)r_particles.value == 1) + M_Print(184, y, "circle"); + else if ((int)r_particles.value == 2) + M_Print(184, y, "square"); + break; + case VID_OPT_VIEWMODEL: + M_Print(16, y, " Viewmodel"); + if ((int)r_viewmodel_quake.value) + M_Print(184, y, "vanilla"); + else + M_Print(184, y, "quakespasm"); + break; case VID_OPT_MODE: M_Print (16, y, " Video mode"); M_Print (184, y, va("%ix%i", (int)vid_width.value, (int)vid_height.value)); @@ -2393,4 +2519,4 @@ void VID_SetCursor(qcvm_t *vm, const char *cursorname, float hotspot[2], float c VID_UpdateCursor(); if (oldcursor) SDL_FreeCursor(oldcursor); -} \ No newline at end of file +} From be72794c88425f20f0972655ff66d78233c0110c Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 13:35:24 -0300 Subject: [PATCH 06/14] Change filtering int depending on gl_texturemode value for filtering toggle in gl_vidsdl.c --- quakespasm/Quake/gl_texmgr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index dce850d3c..dc2ec5d13 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" +int filtering; + const int gl_solid_format = 3; const int gl_alpha_format = 4; @@ -156,11 +158,13 @@ static void TexMgr_SetFilterModes (gltexture_t *glt) if (glt->flags & TEXPREF_NEAREST) { + filtering = 0; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } else if (glt->flags & TEXPREF_LINEAR) { + filtering = 1; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } @@ -200,6 +204,15 @@ static void TexMgr_TextureMode_f (cvar_t *var) Sbar_Changed (); //sbar graphics need to be redrawn with new filter mode //FIXME: warpimages need to be redrawn, too. } + + if (glmode_idx < 3 || glmode_idx > 5 && glmode_idx < 9) + { + filtering = 0; + } + else if (glmode_idx > 2 && glmode_idx < 6 || glmode_idx > 8) + { + filtering = 1; + } return; } } From e32b2f79ed1ef64ff51a4e8d38bf7b54fbaf883f Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 15:34:50 -0300 Subject: [PATCH 07/14] Fixed minor issue related to changing filter toggle in-game --- quakespasm/Quake/gl_texmgr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index dc2ec5d13..a8f1d5d56 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -158,13 +158,11 @@ static void TexMgr_SetFilterModes (gltexture_t *glt) if (glt->flags & TEXPREF_NEAREST) { - filtering = 0; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } else if (glt->flags & TEXPREF_LINEAR) { - filtering = 1; glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } @@ -179,6 +177,15 @@ static void TexMgr_SetFilterModes (gltexture_t *glt) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmodes[glmode_idx].magfilter); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glmodes[glmode_idx].magfilter); } + + if (glmode_idx < 3 || glmode_idx > 5 && glmode_idx < 9) + { + filtering = 0; + } + else if (glmode_idx > 2 && glmode_idx < 6 || glmode_idx > 8) + { + filtering = 1; + } } /* From 5ae303511634f526d8cc5b4b64395fba477a4e3d Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 17:39:21 -0300 Subject: [PATCH 08/14] Improve filtering option logic --- quakespasm/Quake/gl_texmgr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/quakespasm/Quake/gl_texmgr.h b/quakespasm/Quake/gl_texmgr.h index cb540c935..b02ac274f 100644 --- a/quakespasm/Quake/gl_texmgr.h +++ b/quakespasm/Quake/gl_texmgr.h @@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA, SRC_EXTERNAL, SRC_FIRSTCOMPRESSED}; extern qboolean gl_texture_s3tc, gl_texture_rgtc, gl_texture_bptc, gl_texture_etc2, gl_texture_astc; +extern qboolean TexMgr_TextureModeIsLinear; typedef uintptr_t src_offset_t; From 5609ca109d59c786b09aff062aa0b9c8b547383b Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 17:40:20 -0300 Subject: [PATCH 09/14] Improve filtering option logic & fix interpolation option --- quakespasm/Quake/gl_vidsdl.c | 51 +++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/quakespasm/Quake/gl_vidsdl.c b/quakespasm/Quake/gl_vidsdl.c index c102aac56..cd8acc467 100644 --- a/quakespasm/Quake/gl_vidsdl.c +++ b/quakespasm/Quake/gl_vidsdl.c @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cfgfile.h" #include "bgmusic.h" #include "resource.h" +#include "gl_texmgr.h" #if defined(SDL_FRAMEWORK) || defined(NO_SDL_CONFIG) #if defined(USE_SDL2) #include @@ -2169,14 +2170,22 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (filtering == 1) + if (TexMgr_TextureModeIsLinear == true) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (filtering == 0) + else if (TexMgr_TextureModeIsLinear == false) Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: - Cbuf_AddText("toggle r_lerpmodels\n"); - Cbuf_AddText("toggle r_lerpmove\n"); + if (r_lerpmodels.value == 1 && r_lerpmove.value == 1) + { + Cbuf_AddText("r_lerpmodels 0\n"); + Cbuf_AddText("r_lerpmove 0\n"); + } + else if (!(r_lerpmodels.value == 1 && r_lerpmove.value == 1)) + { + Cbuf_AddText("r_lerpmodels 1\n"); + Cbuf_AddText("r_lerpmove 1\n"); + } break; case VID_OPT_PARTICLES: if (r_particles.value == 1) @@ -2223,14 +2232,22 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (filtering == 1) + if (TexMgr_TextureModeIsLinear == true) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (filtering == 0) + else if (TexMgr_TextureModeIsLinear == false) Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: - Cbuf_AddText("toggle r_lerpmodels\n"); - Cbuf_AddText("toggle r_lerpmove\n"); + if (r_lerpmodels.value == 0 && r_lerpmove.value == 0) + { + Cbuf_AddText("r_lerpmodels 1\n"); + Cbuf_AddText("r_lerpmove 1\n"); + } + else if (!(r_lerpmodels.value == 0 && r_lerpmove.value == 0)) + { + Cbuf_AddText("r_lerpmodels 0\n"); + Cbuf_AddText("r_lerpmove 0\n"); + } break; case VID_OPT_PARTICLES: if (r_particles.value == 1) @@ -2279,14 +2296,22 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (filtering == 1) + if (TexMgr_TextureModeIsLinear == true) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (filtering == 0) + else if (TexMgr_TextureModeIsLinear == false) Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: - Cbuf_AddText("toggle r_lerpmodels\n"); - Cbuf_AddText("toggle r_lerpmove\n"); + if (r_lerpmodels.value == 1 && r_lerpmove.value == 1) + { + Cbuf_AddText("r_lerpmodels 0\n"); + Cbuf_AddText("r_lerpmove 0\n"); + } + else if (!(r_lerpmodels.value == 1 && r_lerpmove.value == 1)) + { + Cbuf_AddText("r_lerpmodels 1\n"); + Cbuf_AddText("r_lerpmove 1\n"); + } break; case VID_OPT_PARTICLES: if (r_particles.value == 1) @@ -2374,7 +2399,7 @@ static void VID_MenuDraw (void) break; case VID_OPT_FILTERING: M_Print(16, y, " Filtering"); - M_DrawCheckbox(184, y, filtering); + M_DrawCheckbox(184, y, (qboolean)TexMgr_TextureModeIsLinear); break; case VID_OPT_INTERPOLATION: M_Print(16, y, " Interpolation"); From b6baf22e356683cff870b5b5b2b4b4e29b9ea736 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 17:41:12 -0300 Subject: [PATCH 10/14] Clean up file --- quakespasm/Quake/client.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/quakespasm/Quake/client.h b/quakespasm/Quake/client.h index 858aafbe6..1e4d5b40e 100644 --- a/quakespasm/Quake/client.h +++ b/quakespasm/Quake/client.h @@ -361,9 +361,6 @@ extern cvar_t r_lerpmove; extern cvar_t r_particles; extern cvar_t r_viewmodel_quake; -extern int filtering; - - #define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64 extern client_state_t cl; From 6b906faddd92c36fc3eeb570cc2ed83efc5e6d15 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sat, 26 Jun 2021 17:42:25 -0300 Subject: [PATCH 11/14] Improve filtering option logic --- quakespasm/Quake/gl_texmgr.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index a8f1d5d56..29f8eb6fc 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -int filtering; - const int gl_solid_format = 3; const int gl_alpha_format = 4; @@ -131,6 +129,7 @@ static glmode_t glmodes[] = { }; #define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0])) static int glmode_idx = 5; /* trilinear */ +qboolean TexMgr_TextureModeIsLinear; /* =============== @@ -177,14 +176,14 @@ static void TexMgr_SetFilterModes (gltexture_t *glt) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmodes[glmode_idx].magfilter); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glmodes[glmode_idx].magfilter); } - - if (glmode_idx < 3 || glmode_idx > 5 && glmode_idx < 9) + + if (glmodes[glmode_idx].magfilter == GL_LINEAR) { - filtering = 0; + TexMgr_TextureModeIsLinear = true; } - else if (glmode_idx > 2 && glmode_idx < 6 || glmode_idx > 8) + else if (glmodes[glmode_idx].magfilter == GL_NEAREST) { - filtering = 1; + TexMgr_TextureModeIsLinear = false; } } @@ -212,13 +211,13 @@ static void TexMgr_TextureMode_f (cvar_t *var) //FIXME: warpimages need to be redrawn, too. } - if (glmode_idx < 3 || glmode_idx > 5 && glmode_idx < 9) + if (glmodes[glmode_idx].magfilter == GL_LINEAR) { - filtering = 0; + TexMgr_TextureModeIsLinear = true; } - else if (glmode_idx > 2 && glmode_idx < 6 || glmode_idx > 8) + else if (glmodes[glmode_idx].magfilter == GL_NEAREST) { - filtering = 1; + TexMgr_TextureModeIsLinear = false; } return; } From a511f6f59199c900438362754cc1df59806d25ae Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sun, 27 Jun 2021 17:13:51 -0300 Subject: [PATCH 12/14] Updated terminology for filtering option --- quakespasm/Quake/gl_vidsdl.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/quakespasm/Quake/gl_vidsdl.c b/quakespasm/Quake/gl_vidsdl.c index cd8acc467..26193baee 100644 --- a/quakespasm/Quake/gl_vidsdl.c +++ b/quakespasm/Quake/gl_vidsdl.c @@ -2170,9 +2170,9 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (TexMgr_TextureModeIsLinear == true) + if (TexMgr_TextureModeIsLinear()) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (TexMgr_TextureModeIsLinear == false) + else Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: @@ -2232,9 +2232,9 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (TexMgr_TextureModeIsLinear == true) + if (TexMgr_TextureModeIsLinear()) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (TexMgr_TextureModeIsLinear == false) + else Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: @@ -2296,9 +2296,9 @@ static void VID_MenuKey (int key) } break; case VID_OPT_FILTERING: - if (TexMgr_TextureModeIsLinear == true) + if (TexMgr_TextureModeIsLinear()) Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n"); - else if (TexMgr_TextureModeIsLinear == false) + else Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n"); break; case VID_OPT_INTERPOLATION: @@ -2399,7 +2399,10 @@ static void VID_MenuDraw (void) break; case VID_OPT_FILTERING: M_Print(16, y, " Filtering"); - M_DrawCheckbox(184, y, (qboolean)TexMgr_TextureModeIsLinear); + if ((qboolean)TexMgr_TextureModeIsLinear()) + M_Print(184, y, "linear"); + else + M_Print(184, y, "nearest"); break; case VID_OPT_INTERPOLATION: M_Print(16, y, " Interpolation"); From fd5ed205d5c5337b30f8d5ae20c2468e55ae9297 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sun, 27 Jun 2021 17:14:26 -0300 Subject: [PATCH 13/14] Removed global qboolean --- quakespasm/Quake/gl_texmgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quakespasm/Quake/gl_texmgr.h b/quakespasm/Quake/gl_texmgr.h index b02ac274f..7f50f828b 100644 --- a/quakespasm/Quake/gl_texmgr.h +++ b/quakespasm/Quake/gl_texmgr.h @@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA, SRC_EXTERNAL, SRC_FIRSTCOMPRESSED}; extern qboolean gl_texture_s3tc, gl_texture_rgtc, gl_texture_bptc, gl_texture_etc2, gl_texture_astc; -extern qboolean TexMgr_TextureModeIsLinear; +qboolean TexMgr_TextureModeIsLinear(void); typedef uintptr_t src_offset_t; From 3242d3603ad12d58e222ad62937c22f2c948fd26 Mon Sep 17 00:00:00 2001 From: nullp01nter-exception <86529179+nullp01nter-exception@users.noreply.github.com> Date: Sun, 27 Jun 2021 17:14:45 -0300 Subject: [PATCH 14/14] Removed global qboolean --- quakespasm/Quake/gl_texmgr.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/quakespasm/Quake/gl_texmgr.c b/quakespasm/Quake/gl_texmgr.c index 29f8eb6fc..2f3b80eba 100644 --- a/quakespasm/Quake/gl_texmgr.c +++ b/quakespasm/Quake/gl_texmgr.c @@ -129,7 +129,11 @@ static glmode_t glmodes[] = { }; #define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0])) static int glmode_idx = 5; /* trilinear */ -qboolean TexMgr_TextureModeIsLinear; + +qboolean TexMgr_TextureModeIsLinear(void) +{ + return glmodes[glmode_idx].magfilter == GL_LINEAR; +} /* =============== @@ -176,15 +180,6 @@ static void TexMgr_SetFilterModes (gltexture_t *glt) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmodes[glmode_idx].magfilter); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glmodes[glmode_idx].magfilter); } - - if (glmodes[glmode_idx].magfilter == GL_LINEAR) - { - TexMgr_TextureModeIsLinear = true; - } - else if (glmodes[glmode_idx].magfilter == GL_NEAREST) - { - TexMgr_TextureModeIsLinear = false; - } } /* @@ -210,15 +205,6 @@ static void TexMgr_TextureMode_f (cvar_t *var) Sbar_Changed (); //sbar graphics need to be redrawn with new filter mode //FIXME: warpimages need to be redrawn, too. } - - if (glmodes[glmode_idx].magfilter == GL_LINEAR) - { - TexMgr_TextureModeIsLinear = true; - } - else if (glmodes[glmode_idx].magfilter == GL_NEAREST) - { - TexMgr_TextureModeIsLinear = false; - } return; } }