- slight rearrange of vid_scalemode and menu update

This commit is contained in:
Rachael Alexanderson 2019-12-31 10:41:30 -05:00
parent 903f448461
commit 4bc923dddf
3 changed files with 28 additions and 10 deletions

View file

@ -66,6 +66,7 @@ EXTERN_CVAR (Int, gl_texture_hqresizemode)
EXTERN_CVAR (Int, gl_texture_hqresizemult) EXTERN_CVAR (Int, gl_texture_hqresizemult)
EXTERN_CVAR (Int, vid_preferbackend) EXTERN_CVAR (Int, vid_preferbackend)
EXTERN_CVAR (Float, vid_scale_custompixelaspect) EXTERN_CVAR (Float, vid_scale_custompixelaspect)
EXTERN_CVAR (Bool, vid_scale_linear)
FGameConfigFile::FGameConfigFile () FGameConfigFile::FGameConfigFile ()
{ {
@ -514,7 +515,7 @@ void FGameConfigFile::DoGlobalSetup ()
} }
if (v.Int == 2) // 320x200 if (v.Int == 2) // 320x200
{ {
newvalue.Int = 7; newvalue.Int = 6;
var->SetGenericRep(newvalue, CVAR_Int); var->SetGenericRep(newvalue, CVAR_Int);
} }
} }
@ -539,6 +540,25 @@ void FGameConfigFile::DoGlobalSetup ()
else else
vid_scale_custompixelaspect = 1.0; 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;
}
}
} }
} }
} }

View file

@ -125,12 +125,11 @@ namespace
v_ScaleTable vScaleTable[NUMSCALEMODES] = 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 }, // 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 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 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 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 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 { 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) bool isOutOfBounds(int x)
@ -257,7 +256,7 @@ CCMD (vid_setscale)
vid_scale_linear = atob(argv[3]); vid_scale_linear = atob(argv[3]);
if (argv.argc() > 4) if (argv.argc() > 4)
{ {
vid_scale_custompixelaspect = atof(argv[4]); vid_scale_custompixelaspect = (float)atof(argv[4]);
} }
} }
vid_scalemode = 5; vid_scalemode = 5;
@ -284,11 +283,11 @@ CCMD (vid_scaletolowest)
vid_scale_customheight = v_mfillY(screen->GetClientWidth(), screen->GetClientHeight()); vid_scale_customheight = v_mfillY(screen->GetClientWidth(), screen->GetClientHeight());
break; break;
case 2: // Method 2: use the actual downscaling mode directly case 2: // Method 2: use the actual downscaling mode directly
vid_scalemode = 6; vid_scalemode = 1;
vid_scalefactor = 1.0; vid_scalefactor = 1.0;
break; break;
default: // Default method: use vid_scalefactor to achieve the result on a default scaling mode 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()); vid_scalefactor = v_MinimumToFill(screen->GetClientWidth(), screen->GetClientHeight());
break; break;
} }

View file

@ -2197,13 +2197,12 @@ OptionValue Ratios
OptionValue ScaleModes OptionValue ScaleModes
{ {
0, "$OPTVAL_SCALENEAREST" 0, "$OPTVAL_SCALENEAREST"
1, "$OPTVAL_SCALELINEAR" 6, "320x200"
7, "320x200"
2, "640x400" 2, "640x400"
3, "960x600" 3, "960x600"
4, "1280x800" 4, "1280x800"
5, "$OPTVAL_CUSTOM" 5, "$OPTVAL_CUSTOM"
6, "$OPTVAL_LOWEST" 1, "$OPTVAL_LOWEST"
} }
OptionValue CropAspect OptionValue CropAspect
{ {
@ -2242,7 +2241,7 @@ OptionMenu VideoModeMenu protected
StaticText "$VIDMNU_CUSTOMRES" StaticText "$VIDMNU_CUSTOMRES"
TextField "$VIDMNU_CUSTOMX", menu_resolution_custom_width TextField "$VIDMNU_CUSTOMX", menu_resolution_custom_width
TextField "$VIDMNU_CUSTOMY", menu_resolution_custom_height TextField "$VIDMNU_CUSTOMY", menu_resolution_custom_height
Option "$VIDMNU_USELINEAR", "vid_scale_customlinear", "YesNo" Option "$VIDMNU_USELINEAR", "vid_scale_linear", "YesNo"
StaticText "" StaticText ""
Command "$VIDMNU_APPLYW", "menu_resolution_commit_changes 0" Command "$VIDMNU_APPLYW", "menu_resolution_commit_changes 0"
Command "$VIDMNU_APPLYFS", "menu_resolution_commit_changes 1" Command "$VIDMNU_APPLYFS", "menu_resolution_commit_changes 1"