mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 15:42:03 +00:00
Handle invalid resolutions, make Backspace work in resolution menu.
This commit is contained in:
parent
3da52592f2
commit
7d1faf7e2c
2 changed files with 23 additions and 2 deletions
16
src/m_menu.c
16
src/m_menu.c
|
@ -13226,11 +13226,11 @@ static void M_DrawVideoMode(void)
|
||||||
vid.width, vid.height));
|
vid.width, vid.height));
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 116, (cv_fullscreen.value ? 0 : V_TRANSLUCENT),
|
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 116, (cv_fullscreen.value ? 0 : V_TRANSLUCENT),
|
||||||
va("Default mode is %c%dx%d",
|
va("Default mode is %c%dx%d",
|
||||||
(SCR_IsAspectCorrect(cv_scr_width.value, cv_scr_height.value)) ? 0x83 : 0x80,
|
(SCR_IsAspectCorrect(cv_scr_width.value, cv_scr_height.value)) ? 0x83 : (!(VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value)+1) ? 0x85 : 0x80),
|
||||||
cv_scr_width.value, cv_scr_height.value));
|
cv_scr_width.value, cv_scr_height.value));
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 124, (cv_fullscreen.value ? V_TRANSLUCENT : 0),
|
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 124, (cv_fullscreen.value ? V_TRANSLUCENT : 0),
|
||||||
va("Windowed mode is %c%dx%d",
|
va("Windowed mode is %c%dx%d",
|
||||||
(SCR_IsAspectCorrect(cv_scr_width_w.value, cv_scr_height_w.value)) ? 0x83 : 0x80,
|
(SCR_IsAspectCorrect(cv_scr_width_w.value, cv_scr_height_w.value)) ? 0x83 : (!(VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value)+1) ? 0x85 : 0x80),
|
||||||
cv_scr_width_w.value, cv_scr_height_w.value));
|
cv_scr_width_w.value, cv_scr_height_w.value));
|
||||||
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
|
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
|
||||||
|
@ -13448,6 +13448,18 @@ static void M_HandleVideoMode(INT32 ch)
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KEY_BACKSPACE:
|
||||||
|
S_StartSound(NULL, sfx_menu1);
|
||||||
|
CV_Set(&cv_scr_width, cv_scr_width.defaultvalue);
|
||||||
|
CV_Set(&cv_scr_height, cv_scr_height.defaultvalue);
|
||||||
|
CV_Set(&cv_scr_width_w, cv_scr_width_w.defaultvalue);
|
||||||
|
CV_Set(&cv_scr_height_w, cv_scr_height_w.defaultvalue);
|
||||||
|
if (cv_fullscreen.value)
|
||||||
|
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value)+1;
|
||||||
|
else
|
||||||
|
setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value)+1;
|
||||||
|
break;
|
||||||
|
|
||||||
case KEY_F11:
|
case KEY_F11:
|
||||||
S_StartSound(NULL, sfx_menu1);
|
S_StartSound(NULL, sfx_menu1);
|
||||||
CV_SetValue(&cv_fullscreen, !cv_fullscreen.value);
|
CV_SetValue(&cv_fullscreen, !cv_fullscreen.value);
|
||||||
|
|
|
@ -375,6 +375,9 @@ void SCR_CheckDefaultMode(void)
|
||||||
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1; // see note above
|
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1; // see note above
|
||||||
else
|
else
|
||||||
setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value) + 1; // see note above
|
setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value) + 1; // see note above
|
||||||
|
|
||||||
|
if (setmodeneeded <= 0)
|
||||||
|
CONS_Alert(CONS_WARNING, "Invalid resolution given, defaulting to base resolution\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_renderer.value != (signed)rendermode)
|
if (cv_renderer.value != (signed)rendermode)
|
||||||
|
@ -412,6 +415,12 @@ void SCR_ChangeFullscreen(void)
|
||||||
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
|
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
|
||||||
else
|
else
|
||||||
setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value) + 1;
|
setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value) + 1;
|
||||||
|
|
||||||
|
if (setmodeneeded <= 0) // hacky safeguard
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "Invalid resolution given, defaulting to base resolution.\n");
|
||||||
|
setmodeneeded = VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue