From f2e6ca4cedd073bc3704e82999c1f533f0826d39 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 17 May 2018 19:25:32 -0400 Subject: [PATCH] - add 'vid_showcurrentscaling' ccmd, expanded output for 'vid_scaletowidth' and 'vid_scaletoheight' commands - made the vid_scaleto____ commands less hacky - after finding out I could route the calls through screen->, found the correct screen-> commands, and do scaling based on the real screen dimensions --- src/r_videoscale.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index a245990c6..12103e457 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -102,7 +102,9 @@ bool ViewportIsScaled43() void R_ShowCurrentScaling() { + int x1 = screen->GetClientWidth(), y1 = screen->GetClientHeight(), x2 = x1 * vid_scalefactor, y2 = y1 * vid_scalefactor; Printf("Current Scale: %f\n", (float)(vid_scalefactor)); + Printf("Real resolution: %i x %i\nEmulated resolution: %i x %i\n", x1, y1, x2, y2); } bool R_CalcsShouldBeBlocked() @@ -115,13 +117,18 @@ bool R_CalcsShouldBeBlocked() return false; } +CCMD (vid_showcurrentscaling) +{ + R_ShowCurrentScaling(); +} + CCMD (vid_scaletowidth) { if (R_CalcsShouldBeBlocked()) return; if (argv.argc() > 1) - vid_scalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayWidth); + vid_scalefactor = (float)((double)atof(argv[1]) / screen->GetClientWidth()); R_ShowCurrentScaling(); } @@ -132,7 +139,7 @@ CCMD (vid_scaletoheight) return; if (argv.argc() > 1) - vid_scalefactor = (float)((double)vid_scalefactor * (double)atof(argv[1]) / (double)DisplayHeight); + vid_scalefactor = (float)((double)atof(argv[1]) / screen->GetClientHeight()); R_ShowCurrentScaling(); }