shithub: choc

Download patch

ref: bdb14111e00c37da25fbbb863d4b93088bf88469
parent: 98d59e65b60022823a43a57a73e3662525ad2930
parent: 76ca4ec01f1d6f9c5ae2f2cf84ceb43cf2e54872
author: Simon Howard <fraggle+github@gmail.com>
date: Sat Mar 24 16:20:59 EDT 2018

Merge pull request #1002 from chungy/unrestricted_aspect

video: Don't enforce an 8:5 ratio when correction is not enabled.

--- a/NEWS.md
+++ b/NEWS.md
@@ -12,6 +12,9 @@
     loaded.  (thanks Zodomaniac, chungy)
   * Fixed an exception thrown by the Windows kernel when debugging with
     GDB.  (thanks AXDOOMER)
+  * With aspect ratio correction disabled, the game can scale to any
+    arbitrary size and remove all black borders in full screen mode.
+    (thanks chungy)
 
 ### Build systems
   * Microsoft Visual Studio files have been removed due to technical
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -290,16 +290,19 @@
 // ratio consistent with the aspect_ratio_correct variable.
 static void AdjustWindowSize(void)
 {
-    if (window_width * actualheight <= window_height * SCREENWIDTH)
+    if (aspect_ratio_correct || integer_scaling)
     {
-        // We round up window_height if the ratio is not exact; this leaves
-        // the result stable.
-        window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
+        if (window_width * actualheight <= window_height * SCREENWIDTH)
+        {
+            // We round up window_height if the ratio is not exact; this leaves
+            // the result stable.
+            window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
+        }
+        else
+        {
+            window_width = window_height * SCREENWIDTH / actualheight;
+        }
     }
-    else
-    {
-        window_width = window_height * SCREENWIDTH / actualheight;
-    }
 }
 
 static void HandleWindowEvent(SDL_WindowEvent *event)
@@ -1240,9 +1243,12 @@
     // time this also defines the aspect ratio that is preserved while scaling
     // and stretching the texture into the window.
 
-    SDL_RenderSetLogicalSize(renderer,
-                             SCREENWIDTH,
-                             actualheight);
+    if (aspect_ratio_correct || integer_scaling)
+    {
+        SDL_RenderSetLogicalSize(renderer,
+                                 SCREENWIDTH,
+                                 actualheight);
+    }
 
     // Force integer scales for resolution-independent rendering.
 
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -194,7 +194,7 @@
     TXT_SetColumnWidths(window, 40);
 
     TXT_AddWidgets(window,
-        ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
+        ar_checkbox = TXT_NewCheckBox("Force correct aspect ratio",
                                       &aspect_ratio_correct),
         TXT_If(gamemission == heretic || gamemission == hexen
             || gamemission == strife,