From 4bc923dddf364316c1ec0ab051a90da869365e30 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 31 Dec 2019 10:41:30 -0500 Subject: [PATCH] - slight rearrange of vid_scalemode and menu update --- src/gameconfigfile.cpp | 22 +++++++++++++++++++++- src/rendering/r_videoscale.cpp | 9 ++++----- wadsrc/static/menudef.txt | 7 +++---- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 83c0bc89c8b..17d361a1e9b 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -66,6 +66,7 @@ EXTERN_CVAR (Int, gl_texture_hqresizemode) EXTERN_CVAR (Int, gl_texture_hqresizemult) EXTERN_CVAR (Int, vid_preferbackend) EXTERN_CVAR (Float, vid_scale_custompixelaspect) +EXTERN_CVAR (Bool, vid_scale_linear) FGameConfigFile::FGameConfigFile () { @@ -514,7 +515,7 @@ void FGameConfigFile::DoGlobalSetup () } if (v.Int == 2) // 320x200 { - newvalue.Int = 7; + newvalue.Int = 6; var->SetGenericRep(newvalue, CVAR_Int); } } @@ -539,6 +540,25 @@ void FGameConfigFile::DoGlobalSetup () else vid_scale_custompixelaspect = 1.0; } + var = FindCVar("vid_scalemode", NULL); + UCVarValue newvalue; + if (var != NULL) + { + UCVarValue v = var->GetGenericRep(CVAR_Int); + switch (v.Int) + { + case 1: + newvalue.Int = 0; + var->SetGenericRep(newvalue, CVAR_Int); + case 3: + case 4: + vid_scale_linear = true; + break; + default: + vid_scale_linear = false; + break; + } + } } } } diff --git a/src/rendering/r_videoscale.cpp b/src/rendering/r_videoscale.cpp index da1ab849ba6..8d6bc81eb60 100644 --- a/src/rendering/r_videoscale.cpp +++ b/src/rendering/r_videoscale.cpp @@ -125,12 +125,11 @@ namespace v_ScaleTable vScaleTable[NUMSCALEMODES] = { { true, [](uint32_t Width, uint32_t Height)->uint32_t { return Width; }, [](uint32_t Width, uint32_t Height)->uint32_t { return Height; }, 1.0f, false }, // 0 - Native - { true, [](uint32_t Width, uint32_t Height)->uint32_t { return Width; }, [](uint32_t Width, uint32_t Height)->uint32_t { return Height; }, 1.0f, false }, // 1 - Native (Linear) + { true, [](uint32_t Width, uint32_t Height)->uint32_t { return v_mfillX(Width, Height); }, [](uint32_t Width, uint32_t Height)->uint32_t { return v_mfillY(Width, Height); }, 1.0f, false }, // 6 - Minimum Scale to Fill Entire Screen { true, [](uint32_t Width, uint32_t Height)->uint32_t { return 640; }, [](uint32_t Width, uint32_t Height)->uint32_t { return 400; }, 1.2f, false }, // 2 - 640x400 (formerly 320x200) { true, [](uint32_t Width, uint32_t Height)->uint32_t { return 960; }, [](uint32_t Width, uint32_t Height)->uint32_t { return 600; }, 1.2f, false }, // 3 - 960x600 (formerly 640x400) { true, [](uint32_t Width, uint32_t Height)->uint32_t { return 1280; }, [](uint32_t Width, uint32_t Height)->uint32_t { return 800; }, 1.2f, false }, // 4 - 1280x800 { true, [](uint32_t Width, uint32_t Height)->uint32_t { return vid_scale_customwidth; }, [](uint32_t Width, uint32_t Height)->uint32_t { return vid_scale_customheight; }, 1.0f, true }, // 5 - Custom - { true, [](uint32_t Width, uint32_t Height)->uint32_t { return v_mfillX(Width, Height); }, [](uint32_t Width, uint32_t Height)->uint32_t { return v_mfillY(Width, Height); }, 1.0f, false }, // 6 - Minimum Scale to Fill Entire Screen { true, [](uint32_t Width, uint32_t Height)->uint32_t { return 320; }, [](uint32_t Width, uint32_t Height)->uint32_t { return 200; }, 1.2f, false }, // 7 - 320x200 }; bool isOutOfBounds(int x) @@ -257,7 +256,7 @@ CCMD (vid_setscale) vid_scale_linear = atob(argv[3]); if (argv.argc() > 4) { - vid_scale_custompixelaspect = atof(argv[4]); + vid_scale_custompixelaspect = (float)atof(argv[4]); } } vid_scalemode = 5; @@ -284,11 +283,11 @@ CCMD (vid_scaletolowest) vid_scale_customheight = v_mfillY(screen->GetClientWidth(), screen->GetClientHeight()); break; case 2: // Method 2: use the actual downscaling mode directly - vid_scalemode = 6; + vid_scalemode = 1; vid_scalefactor = 1.0; break; default: // Default method: use vid_scalefactor to achieve the result on a default scaling mode - vid_scalemode = 1; + vid_scalemode = 0; vid_scalefactor = v_MinimumToFill(screen->GetClientWidth(), screen->GetClientHeight()); break; } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 8784ee5802b..6d08e0cd684 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2197,13 +2197,12 @@ OptionValue Ratios OptionValue ScaleModes { 0, "$OPTVAL_SCALENEAREST" - 1, "$OPTVAL_SCALELINEAR" - 7, "320x200" + 6, "320x200" 2, "640x400" 3, "960x600" 4, "1280x800" 5, "$OPTVAL_CUSTOM" - 6, "$OPTVAL_LOWEST" + 1, "$OPTVAL_LOWEST" } OptionValue CropAspect { @@ -2242,7 +2241,7 @@ OptionMenu VideoModeMenu protected StaticText "$VIDMNU_CUSTOMRES" TextField "$VIDMNU_CUSTOMX", menu_resolution_custom_width TextField "$VIDMNU_CUSTOMY", menu_resolution_custom_height - Option "$VIDMNU_USELINEAR", "vid_scale_customlinear", "YesNo" + Option "$VIDMNU_USELINEAR", "vid_scale_linear", "YesNo" StaticText "" Command "$VIDMNU_APPLYW", "menu_resolution_commit_changes 0" Command "$VIDMNU_APPLYFS", "menu_resolution_commit_changes 1"