Warn when going to OpenGL from the menu

This commit is contained in:
James R 2019-12-29 18:37:22 -08:00
parent c394ad056c
commit 569453ee93
4 changed files with 49 additions and 2 deletions

View File

@ -842,6 +842,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_fullscreen);
CV_RegisterVar(&cv_renderview);
CV_RegisterVar(&cv_renderer);
CV_RegisterVar(&cv_newrenderer);
CV_RegisterVar(&cv_scr_depth);
CV_RegisterVar(&cv_scr_width);
CV_RegisterVar(&cv_scr_height);

View File

@ -389,6 +389,7 @@ static void M_ResetCvars(void);
// Consvar onchange functions
static void Newgametype_OnChange(void);
static void Newrenderer_OnChange(void);
static void Dummymares_OnChange(void);
// ==========================================================================
@ -413,6 +414,9 @@ CV_PossibleValue_t gametype_cons_t[NUMGAMETYPES+1];
consvar_t cv_newgametype = {"newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_newrenderer = {"newrenderer", "Software", CV_HIDEN|CV_CALL, cv_renderer_t, Newrenderer_OnChange, 0, NULL, NULL, 0, 0, NULL};
static int newrenderer_set = 1;/* Software doesn't need confirmation! */
static CV_PossibleValue_t serversort_cons_t[] = {
{0,"Ping"},
{1,"Modified State"},
@ -1210,7 +1214,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11},
#endif
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16},
{IT_STRING | IT_CVAR, NULL, "Renderer", &cv_renderer, 21},
{IT_STRING | IT_CVAR, NULL, "Renderer", &cv_newrenderer, 21},
{IT_HEADER, NULL, "Color Profile", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36},
@ -2223,6 +2227,43 @@ static void Newgametype_OnChange(void)
}
}
static void Newrenderer_AREYOUSURE(INT32 c)
{
int n;
switch (c)
{
case 'y':
case KEY_ENTER:
n = cv_newrenderer.value;
newrenderer_set |= n;
CV_SetValue(&cv_renderer, n);
break;
default:
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
}
}
static void Newrenderer_OnChange(void)
{
/* Well this works for now because there's only two options. */
int n;
n = cv_newrenderer.value;
if (( newrenderer_set & n ))
CV_SetValue(&cv_renderer, n);
else
{
M_StartMessage(
"The OpenGL renderer is incomplete.\n"
"Some visuals may fail to appear, or\n"
"appear incorrectly.\n"
"Do you still want to switch to it?\n"
"\n"
"(Press 'y' or 'n')",
Newrenderer_AREYOUSURE, MM_YESNO
);
}
}
void Screenshot_option_Onchange(void)
{
OP_ScreenshotOptionsMenu[op_screenshot_folder].status =

View File

@ -64,7 +64,7 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void SCR_ActuallyChangeRenderer(void);
static CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}};
CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}};
consvar_t cv_renderer = {"renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL};
static void SCR_ChangeFullscreen(void);
@ -477,6 +477,7 @@ void SCR_ChangeRendererCVars(INT32 mode)
CV_StealthSetValue(&cv_renderer, 1);
else if (mode == render_opengl)
CV_StealthSetValue(&cv_renderer, 2);
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
}
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)

View File

@ -170,6 +170,7 @@ extern boolean R_SSE2;
// ----------------
// screen variables
// ----------------
extern viddef_t vid;
extern INT32 setmodeneeded; // mode number to set if needed, or 0
@ -180,7 +181,10 @@ extern UINT8 setrenderneeded;
extern INT32 scr_bpp;
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
extern CV_PossibleValue_t cv_renderer_t[];
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
extern consvar_t cv_newrenderer;
// wait for page flipping to end or not
extern consvar_t cv_vidwait;