From 0f36b9d63fdbaeff3fa281de678aead2fdd0e3ac Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 17 May 2018 06:24:21 -0400 Subject: [PATCH] - cleaned up vid_scaleto____ code a bit, also set a sane lower limit for vid_scalefactor, removed some code redundancy --- src/r_videoscale.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index 752e34518..379538783 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -55,7 +55,7 @@ namespace CUSTOM_CVAR(Float, vid_scalefactor, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (self <= 0.0 || self > 2.0) + if (self < 0.05 || self > 2.0) self = 1.0; } @@ -123,12 +123,8 @@ CCMD (vid_scaletowidth) return; if (argv.argc() > 1) - newscalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayWidth); - else - newscalefactor = vid_scalefactor; - if ( newscalefactor > 2.0 || newscalefactor <= 0.0 ) - newscalefactor = 1.0; - vid_scalefactor = newscalefactor; + vid_scalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayWidth); + R_ShowCurrentScaling(); } @@ -140,11 +136,7 @@ CCMD (vid_scaletoheight) return; if (argv.argc() > 1) - newscalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayHeight); - else - newscalefactor = vid_scalefactor; - if ( newscalefactor > 2.0 || newscalefactor <= 0.0 ) - newscalefactor = 1.0; - vid_scalefactor = newscalefactor; + vid_scalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayHeight); + R_ShowCurrentScaling(); }