Skip to content

Commit

Permalink
- slight rearrange of vid_scalemode and menu update
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Dec 31, 2019
1 parent 903f448 commit 4bc923d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
22 changes: 21 additions & 1 deletion src/gameconfigfile.cpp
Expand Up @@ -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 ()
{
Expand Down Expand Up @@ -514,7 +515,7 @@ void FGameConfigFile::DoGlobalSetup ()
}
if (v.Int == 2) // 320x200
{
newvalue.Int = 7;
newvalue.Int = 6;
var->SetGenericRep(newvalue, CVAR_Int);
}
}
Expand All @@ -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;
}
}
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/rendering/r_videoscale.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
7 changes: 3 additions & 4 deletions wadsrc/static/menudef.txt
Expand Up @@ -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
{
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 4bc923d

Please sign in to comment.