foxygit / doom Log in
commit 85b1dacd10a913c4988fa62251c4553e8d19ca98
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Feb 6 22:18:16 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Feb 6 22:18:16 2008 +0000

    Make 320x240 a "good" mode when aspect ratio correction is turned off.
    Don't switch to "bad" modes when changing other settings.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1055
---
 setup/display.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/setup/display.c b/setup/display.c
index 0ead83fe..1f48a9a6 100644
--- a/setup/display.c
+++ b/setup/display.c
@@ -136,13 +136,23 @@ static int GoodFullscreenMode(screen_mode_t *mode)
     w = mode->w;
     h = mode->h;

-    // 320x200 and 640x400 are always good
+    // 320x200 and 640x400 are always good (special case)

     if ((w == 320 && h == 200) || (w == 640 && h == 400))
     {
         return 1;
     }

+    // Special case: 320x240 letterboxed mode is okay (but not aspect
+    // ratio corrected 320x240)
+
+    if (w == 320 && h == 240 && !aspect_ratio_correct)
+    {
+        return 1;
+    }
+
+    // Ignore all modes less than 640x480
+
     return w >= 640 && h >= 480;
 }

@@ -207,6 +217,11 @@ static int FindBestMode(screen_mode_t *modes)

     for (i=0; modes[i].w != 0; ++i)
     {
+        if (fullscreen && !GoodFullscreenMode(&modes[i]))
+        {
+            continue;
+        }
+
         diff = (selected_screen_width - modes[i].w)
                   * (selected_screen_width - modes[i].w)
              + (selected_screen_height - modes[i].h)