Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quality of life changes #44

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions quakespasm/Quake/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ 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;

#define MAX_TEMP_ENTITIES 256 //johnfitz -- was 64

Expand Down
4 changes: 2 additions & 2 deletions quakespasm/Quake/gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion quakespasm/Quake/gl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
5 changes: 5 additions & 0 deletions quakespasm/Quake/gl_texmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ static glmode_t glmodes[] = {
#define NUM_GLMODES (int)(sizeof(glmodes)/sizeof(glmodes[0]))
static int glmode_idx = 5; /* trilinear */

qboolean TexMgr_TextureModeIsLinear(void)
{
return glmodes[glmode_idx].magfilter == GL_LINEAR;
}

/*
===============
TexMgr_DescribeTextureModes_f -- report available texturemodes
Expand Down
1 change: 1 addition & 0 deletions quakespasm/Quake/gl_texmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
qboolean TexMgr_TextureModeIsLinear(void);

typedef uintptr_t src_offset_t;

Expand Down
156 changes: 155 additions & 1 deletion quakespasm/Quake/gl_vidsdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <SDL2/SDL.h>
Expand Down Expand Up @@ -1844,6 +1845,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,
Expand Down Expand Up @@ -2123,6 +2129,8 @@ VID_MenuKey
*/
static void VID_MenuKey (int key)
{
int f = r_scale.value;

switch (key)
{
case K_ESCAPE:
Expand Down Expand Up @@ -2150,6 +2158,44 @@ 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 (TexMgr_TextureModeIsLinear())
Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n");
else
Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n");
break;
case VID_OPT_INTERPOLATION:
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)
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;
Expand All @@ -2174,6 +2220,44 @@ 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 (TexMgr_TextureModeIsLinear())
Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n");
else
Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n");
break;
case VID_OPT_INTERPOLATION:
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)
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;
Expand All @@ -2200,6 +2284,44 @@ 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 (TexMgr_TextureModeIsLinear())
Cbuf_AddText("gl_texturemode GL_NEAREST_MIPMAP_LINEAR\n");
else
Cbuf_AddText("gl_texturemode GL_LINEAR_MIPMAP_LINEAR\n");
break;
case VID_OPT_INTERPOLATION:
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)
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;
Expand Down Expand Up @@ -2268,6 +2390,38 @@ 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");
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");
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));
Expand Down Expand Up @@ -2393,4 +2547,4 @@ void VID_SetCursor(qcvm_t *vm, const char *cursorname, float hotspot[2], float c
VID_UpdateCursor();
if (oldcursor)
SDL_FreeCursor(oldcursor);
}
}
24 changes: 24 additions & 0 deletions quakespasm/Quake/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ enum
OPT_CUSTOMIZE = 0,
OPT_CONSOLE, // 1
OPT_DEFAULTS, // 2
OPT_FOV,
OPT_FPS,
OPT_SCALE,
OPT_SCRSIZE,
OPT_GAMMA,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down