Skip to content

Commit

Permalink
Toggle for big window auto-downscaling
Browse files Browse the repository at this point in the history
Although well-meaning, said auto-downscaling hinders my ability to take full-size screenshots, especially with my relatively-low-resolution display. That's why I'll implement this toggle, hidden away in the CFG; I don't think many other people, if any, will use it.

Additionally, some reformatting, and comment and CVAR tweaks.
  • Loading branch information
MrAlaux committed Nov 10, 2023
1 parent 445385a commit 236b586
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
23 changes: 14 additions & 9 deletions src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ boolean integer_scaling; // [FG] force integer scales
boolean vga_porch_flash; // emulate VGA "porch" behaviour
boolean smooth_scaling;

boolean no_downscaling; // [Nugget]

boolean need_reset;
boolean toggle_fullscreen;
boolean toggle_exclusive_fullscreen;
Expand Down Expand Up @@ -286,16 +288,19 @@ static boolean FindMinWindowSize(const int desired_width, const int desired_heig
*width = desired_width;
*height = desired_height;

do
if (!no_downscaling)
{
const int aspect_height = use_aspect ? (6 * (*height) / 5) : *height;
if (*width < mode.w && aspect_height < mode.h)
{
break;
}
*width >>= 1;
*height >>= 1;
} while (*width && *height);
do
{
const int aspect_height = use_aspect ? (6 * (*height) / 5) : *height;
if (*width < mode.w && aspect_height < mode.h)
{
break;
}
*width >>= 1;
*height >>= 1;
} while (*width && *height);
}

if (*width < SCREENWIDTH || *height < SCREENHEIGHT)
{
Expand Down
2 changes: 2 additions & 0 deletions src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ extern boolean smooth_scaling;
extern boolean toggle_fullscreen;
extern boolean toggle_exclusive_fullscreen;

extern boolean no_downscaling; // [Nugget]

// [Nugget]
#define GAMMA2MAX 30
extern const float gammalevels[GAMMA2MAX+1];
Expand Down
39 changes: 23 additions & 16 deletions src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ default_t defaults[] = {
"1 to stretch viewport to fit window"
},

{ // [Nugget]
"no_downscaling",
(config_t *) &no_downscaling, NULL,
{0}, {0, 1}, number, ss_none, wad_no,
"1 to prevent auto-downscaling of window if it exceeds the display boundaries"
},

// [FG] save fullscren mode
{
"fullscreen",
Expand Down Expand Up @@ -481,14 +488,14 @@ default_t defaults[] = {
{
"snd_absorption",
(config_t *) &snd_absorption, NULL,
{5}, {0, 10}, number, ss_none, wad_no, // [Nugget] Enabled by default
{5}, {0, 10}, number, ss_gen, wad_no, // [Nugget] Enabled by default
"[OpenAL 3D] Air absorption effect (0 = Off, 10 = Max)"
},

{
"snd_doppler",
(config_t *) &snd_doppler, NULL,
{5}, {0, 10}, number, ss_none, wad_no, // [Nugget] Enabled by default
{5}, {0, 10}, number, ss_gen, wad_no, // [Nugget] Enabled by default
"[OpenAL 3D] Doppler effect (0 = Off, 10 = Max)"
},

Expand Down Expand Up @@ -660,7 +667,7 @@ default_t defaults[] = {
"0 to disable palette tint changes"
},

{ // [Nugget] Replace screen melt toggle
{ // [Nugget] Replaces screen melt toggle
"wipe_type",
(config_t *) &wipe_type, NULL,
{1}, {0,3}, number, ss_gen, wad_yes,
Expand Down Expand Up @@ -706,7 +713,7 @@ default_t defaults[] = {
"1 to enable pistol start"
},

// [Nugget] /-----------------------------------------------------------
// [Nugget] /---------------------------------------------------------------

{
"over_under",
Expand Down Expand Up @@ -920,7 +927,7 @@ default_t defaults[] = {
"0 to disable the Invulnerability colormap"
},

// [Nugget] -----------------------------------------------------------/
// [Nugget] ---------------------------------------------------------------/

//
// Weapons options
Expand Down Expand Up @@ -979,7 +986,7 @@ default_t defaults[] = {
"1 to center the weapon sprite during attack, 2 to keep it bobbing, 3 to center it horizontally"
},

// [Nugget] /-----------------------------------------------------------
// [Nugget] /---------------------------------------------------------------

{
"no_hor_autoaim",
Expand Down Expand Up @@ -1058,7 +1065,7 @@ default_t defaults[] = {
"1 to correct first person sprite centering"
},

// [Nugget] -----------------------------------------------------------/
// [Nugget] ---------------------------------------------------------------/

{ // killough 2/8/98: weapon preferences set by user:
"weapon_choice_1",
Expand Down Expand Up @@ -1197,7 +1204,7 @@ default_t defaults[] = {
"1 to enable dogs to jump"
},

// [Nugget] /-----------------------------------------------------------
// [Nugget] /---------------------------------------------------------------

{
"extra_gibbing",
Expand Down Expand Up @@ -1241,7 +1248,7 @@ default_t defaults[] = {
"1 to enable ZDoom-like item drops for dying enemies"
},

// [Nugget] -----------------------------------------------------------/
// [Nugget] ---------------------------------------------------------------/

{
"colored_blood",
Expand Down Expand Up @@ -1490,7 +1497,7 @@ default_t defaults[] = {
"1 to enable donut overrun emulation"
},

// [Nugget] /-----------------------------------------------------------
// [Nugget] /---------------------------------------------------------------

{
"comp_bruistarget",
Expand Down Expand Up @@ -1618,7 +1625,7 @@ default_t defaults[] = {
"Key pickup resets palette"
},

// [Nugget] -----------------------------------------------------------/
// [Nugget] ---------------------------------------------------------------/

// default compatibility
{
Expand Down Expand Up @@ -2552,7 +2559,7 @@ default_t defaults[] = {
"1 to invert gamepad look axis"
},

// [Nugget] /-----------------------------------------------------------
// [Nugget] /---------------------------------------------------------------

{
"input_jump",
Expand Down Expand Up @@ -2640,7 +2647,7 @@ default_t defaults[] = {
"Use effects when teleporting to pointer (fog, sound and zoom)"
},

// [Nugget] -----------------------------------------------------------/
// [Nugget] ---------------------------------------------------------------/

{ //jff 4/3/98 allow unlimited sensitivity
"mouse_sensitivity",
Expand Down Expand Up @@ -3126,7 +3133,7 @@ default_t defaults[] = {
{
"hud_secret_message",
(config_t *) &hud_secret_message, NULL,
{0}, {0,2}, number, ss_mess, wad_no, // [Nugget]
{0}, {0,2}, number, ss_mess, wad_no, // [Nugget] "Count" mode from Crispy
"\"A secret is revealed!\" message"
},

Expand Down Expand Up @@ -3361,14 +3368,14 @@ default_t defaults[] = {
{ // [Nugget] Incomplete milestone color
"hudcolor_ms_incomp",
(config_t *) &hudcolor_ms_incomp, NULL,
{CR_GRAY}, {CR_BRICK,CR_NONE}, number, ss_mess, wad_yes,
{CR_GRAY}, {CR_BRICK,CR_NONE}, number, ss_stat, wad_yes,
"Color used for incomplete milestones in Stats display"
},

{ // [Nugget] Complete milestone color
"hudcolor_ms_comp",
(config_t *) &hudcolor_ms_comp, NULL,
{CR_BLUE1}, {CR_BRICK,CR_NONE}, number, ss_mess, wad_yes,
{CR_BLUE1}, {CR_BRICK,CR_NONE}, number, ss_stat, wad_yes,
"Color used for complete milestones in Stats display"
},

Expand Down

0 comments on commit 236b586

Please sign in to comment.