Add shadow detail setting

This commit is contained in:
Petr Bartos 2022-03-29 18:33:10 +02:00
parent c10f4b03fb
commit 8ab1439347
4 changed files with 95 additions and 14 deletions

View file

@ -251,8 +251,10 @@ GRAPHICS OPTIONS MENU
#define ID_REFRESHRATE 111
#define ID_DYNAMICLIGHTS 112
#define ID_SYNCEVERYFRAME 113
#define ID_SHADOWS 114
#define NUM_REFRESHRATE 4
#define NUM_SHADOWS 2
typedef struct {
menuframework_s menu;
@ -282,6 +284,7 @@ typedef struct {
menulist_s refreshrate;
menuradiobutton_s dynamiclights;
menuradiobutton_s synceveryframe;
menulist_s shadows;
menubitmap_s apply;
menubitmap_s back;
@ -302,6 +305,7 @@ typedef struct
int refreshrate;
qboolean dynamiclights;
qboolean synceveryframe;
int shadows;
} InitialVideoOptions_s;
static InitialVideoOptions_s s_ivo;
@ -493,6 +497,7 @@ static void GraphicsOptions_GetInitialVideo( void )
s_ivo.refreshrate = s_graphicsoptions.refreshrate.curvalue;
s_ivo.dynamiclights = s_graphicsoptions.dynamiclights.curvalue;
s_ivo.synceveryframe = s_graphicsoptions.synceveryframe.curvalue;
s_ivo.shadows = s_graphicsoptions.refreshrate.curvalue;
}
/*
@ -816,6 +821,20 @@ static void GraphicsOptions_Event( void* ptr, int event ) {
trap_Cvar_SetValue( "r_finish", s_graphicsoptions.synceveryframe.curvalue );
break;
case ID_SHADOWS: {
int shadows;
switch (s_graphicsoptions.shadows.curvalue) {
case 0:
shadows = 1;
break;
default:
shadows = 3;
break;
}
trap_Cvar_SetValue("cg_shadows", shadows);
}
break;
case ID_LIST:
ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue];
@ -1016,6 +1035,17 @@ static void GraphicsOptions_SetMenuItems( void )
s_graphicsoptions.refreshrate.curvalue = 3;
break;
}
switch ( (int) trap_Cvar_VariableValue( "cg_shadows" ) )
{
case 1:
s_graphicsoptions.shadows.curvalue = 0;
break;
default:
s_graphicsoptions.shadows.curvalue = 1;
break;
}
s_graphicsoptions.dynamiclights.curvalue = trap_Cvar_VariableValue( "r_dynamiclight" ) != 0;
s_graphicsoptions.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) != 0;
}
@ -1087,7 +1117,8 @@ void GraphicsOptions_MenuInit( void )
"On",
NULL
};
*/ static const char *s_refreshrate[] =
*/
static const char *s_refreshrate[] =
{
"60",
"72 (Recommended)",
@ -1095,6 +1126,12 @@ void GraphicsOptions_MenuInit( void )
"90",
NULL
};
static const char *s_shadows[] =
{
"Low",
"High",
NULL
};
int y;
@ -1173,7 +1210,7 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.network.style = UI_RIGHT;
s_graphicsoptions.network.color = color_red;
y = 272 - 7 * (BIGCHAR_HEIGHT + 2);
y = 254 - 7 * (BIGCHAR_HEIGHT + 2);
s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.list.generic.name = "Graphics Settings:";
s_graphicsoptions.list.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
@ -1282,6 +1319,18 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.dynamiclights.generic.id = ID_DYNAMICLIGHTS;
y += BIGCHAR_HEIGHT+2;
// references "cg_shadows"
s_graphicsoptions.shadows.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.shadows.generic.name = "Shadow Detail:";
s_graphicsoptions.shadows.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_graphicsoptions.shadows.generic.x = 400;
s_graphicsoptions.shadows.generic.y = y;
s_graphicsoptions.shadows.itemnames = s_shadows;
s_graphicsoptions.shadows.generic.callback = GraphicsOptions_Event;
s_graphicsoptions.shadows.generic.id = ID_SHADOWS;
s_graphicsoptions.shadows.numitems = NUM_SHADOWS;
y += BIGCHAR_HEIGHT+2;
// references/modifies "r_lodBias" & "subdivisions"
s_graphicsoptions.geometry.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.geometry.generic.name = "Geometric Detail:";
@ -1371,6 +1420,7 @@ void GraphicsOptions_MenuInit( void )
// Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.dynamiclights );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.shadows );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.tq );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.texturebits );

View file

@ -208,8 +208,7 @@ itemDef {
textaligny 17
textscale .25
forecolor 1 1 1 1
visible 0
decoration
visible 0
}
itemDef {
@ -277,6 +276,22 @@ itemDef {
visible 0
}
itemDef {
name graphics
group grpSystem
type ITEM_TYPE_MULTI
text "Shadow Detail:"
cvar "cg_shadows"
cvarFloatList { "Low" 1 "High" 3 }
rect 0 170 306 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17
textscale .25
forecolor 1 1 1 1
visible 0
}
itemDef {
name graphics
group grpSystem
@ -284,7 +299,7 @@ itemDef {
text "Geometric Detail:"
cvar "r_lodbias"
cvarFloatList { "High" 0 "Medium" 1 "Low" 2 }
rect 0 170 256 20
rect 0 190 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17
@ -301,7 +316,7 @@ itemDef {
text "Texture Detail:"
cvar "r_picmip"
cvarFloatList { "Low" 2 "Normal" 1 "High" 0 }
rect 0 190 256 20
rect 0 210 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17
@ -318,7 +333,7 @@ itemDef {
text "Texture Quality:"
cvar "r_texturebits"
cvarFloatList { "Default" 0 "16 bit" 16 "32 bit" 32 }
rect 0 210 256 20
rect 0 230 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17
@ -334,7 +349,7 @@ itemDef {
text "Texture Filter:"
cvar "r_texturemode"
cvarStrList { "Bilinear", "GL_LINEAR_MIPMAP_NEAREST", "Trilinear", "GL_LINEAR_MIPMAP_LINEAR" }
rect 0 230 256 20
rect 0 250 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17
@ -350,7 +365,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Compress Textures:"
cvar "r_ext_compressed_textures"
rect 0 250 256 20
rect 0 270 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 133
textaligny 17

View file

@ -179,6 +179,22 @@ itemDef {
visible 1
}
itemDef {
name graphics
group grpSystem
type ITEM_TYPE_MULTI
text "Shadow Detail:"
cvar "cg_shadows"
cvarFloatList { "Low" 1 "High" 3 }
rect 99 192 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
textscale .333
forecolor 1 1 1 1
visible 0
}
itemDef {
name graphics
group grpSystem
@ -186,7 +202,7 @@ itemDef {
text "Geometric Detail:"
cvar "r_lodbias"
cvarFloatList { "High" 0 "Medium" 1 "Low" 2 }
rect 99 192 256 20
rect 99 217 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -203,7 +219,7 @@ itemDef {
text "Texture Detail:"
cvar "r_picmip"
cvarFloatList { "Low" 2 "Normal" 1 "High" 0 }
rect 99 217 256 20
rect 99 242 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -220,7 +236,7 @@ itemDef {
text "Texture Quality:"
cvar "r_texturebits"
cvarFloatList { "Default" 0 "16 bit" 16 "32 bit" 32 }
rect 99 244 256 20
rect 99 267 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -236,7 +252,7 @@ itemDef {
text "Texture Filter:"
cvar "r_texturemode"
cvarStrList { "Bilinear", "GL_LINEAR_MIPMAP_NEAREST", "Trilinear", "GL_LINEAR_MIPMAP_LINEAR" }
rect 99 269 256 20
rect 99 292 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20
@ -251,7 +267,7 @@ itemDef {
type ITEM_TYPE_YESNO
text "Compress Textures:"
cvar "r_ext_compressed_textures"
rect 99 294 256 20
rect 99 317 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 128
textaligny 20