foxygit / doom Log in
commit 4ec7c7b066c4754b8ef8b01397111f6177b0d9b2
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri May 26 15:37:09 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri May 26 15:37:09 2006 +0000

    Add an option to disable autoadjusting the video mode.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 532
---
 src/i_video.c | 21 ++++++++++++++++++---
 src/i_video.h |  5 +++--
 src/m_misc.c  | 23 ++++++++++++-----------
 3 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 240a2bf4..acb8af1b 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 526 2006-05-25 20:18:19Z fraggle $
+// $Id: i_video.c 532 2006-05-26 15:37:09Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -175,7 +175,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: i_video.c 526 2006-05-25 20:18:19Z fraggle $";
+rcsid[] = "$Id: i_video.c 532 2006-05-26 15:37:09Z fraggle $";

 #include <SDL.h>
 #include <ctype.h>
@@ -231,24 +231,34 @@ extern int usemouse;

 static boolean native_surface;

+// Automatically adjust video settings if the selected mode is
+// not a valid video mode.
+
+int autoadjust_video_settings = 1;
+
 // Run in full screen mode?  (int type for config code)
+
 int fullscreen = FULLSCREEN_ON;

 // Time to wait for the screen to settle on startup before starting the
 // game (ms)
+
 int startup_delay = 0;

 // Grab the mouse? (int type for config code)
+
 int grabmouse = true;

 // Flag indicating whether the screen is currently visible:
 // when the screen isnt visible, don't render the screen
+
 boolean screenvisible;

 // Blocky mode,
 // replace each 320x200 pixel with screenmultiply*screenmultiply pixels.
 // According to Dave Taylor, it still is a bonehead thing
 // to use ....
+
 int screenmultiply = 1;

 // disk image data and background overwritten by the disk to be
@@ -1085,7 +1095,7 @@ void I_InitGraphics(void)
     if (screenmultiply > 4)
         screenmultiply = 4;

-    if (fullscreen)
+    if (fullscreen && autoadjust_video_settings)
     {
         int oldw, oldh;
         int old_fullscreen, old_screenmultiply;
@@ -1138,6 +1148,11 @@ void I_InitGraphics(void)
                 printf("\tletterbox mode on (fullscreen=2)\n");
             if (screenmultiply != old_screenmultiply)
                 printf("\tscreenmultiply=%i\n", screenmultiply);
+
+            printf("NOTE: Your video settings have been adjusted.  "
+                   "To disable this behavior,\n"
+                   "set autoadjust_video_settings to 0 in your "
+                   "configuration file.");
         }

         if (!CheckValidFSMode())
diff --git a/src/i_video.h b/src/i_video.h
index d3ca7376..3b9b673f 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.h 484 2006-05-19 20:01:59Z fraggle $
+// $Id: i_video.h 532 2006-05-26 15:37:09Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -60,9 +60,10 @@ void I_EndRead (void);
 void I_SetWindowCaption(void);
 void I_SetWindowIcon(void);

+extern int autoadjust_video_settings;
 extern boolean screenvisible;
 extern int screenmultiply;
-extern boolean fullscreen;
+extern int fullscreen;
 extern boolean grabmouse;
 extern float mouse_acceleration;
 extern int startup_delay;
diff --git a/src/m_misc.c b/src/m_misc.c
index 898c087b..57840604 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: m_misc.c 484 2006-05-19 20:01:59Z fraggle $
+// $Id: m_misc.c 532 2006-05-26 15:37:09Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -106,7 +106,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: m_misc.c 484 2006-05-19 20:01:59Z fraggle $";
+rcsid[] = "$Id: m_misc.c 532 2006-05-26 15:37:09Z fraggle $";

 #include <stdio.h>
 #include <stdlib.h>
@@ -395,16 +395,17 @@ static default_collection_t doom_defaults =

 static default_t extra_defaults_list[] =
 {
-    {"grabmouse",              &grabmouse},
-    {"fullscreen",             &fullscreen},
-    {"screenmultiply",         &screenmultiply},
-    {"novert",                 &novert},
-    {"mouse_acceleration",     &mouse_acceleration,   DEFAULT_FLOAT},
-    {"show_endoom",            &show_endoom},
-    {"vanilla_savegame_limit", &vanilla_savegame_limit},
-    {"startup_delay",          &startup_delay},
+    {"autoadjust_video_settings",   &autoadjust_video_settings},
+    {"fullscreen",                  &fullscreen},
+    {"startup_delay",               &startup_delay},
+    {"screenmultiply",              &screenmultiply},
+    {"grabmouse",                   &grabmouse},
+    {"novert",                      &novert},
+    {"mouse_acceleration",          &mouse_acceleration,       DEFAULT_FLOAT},
+    {"show_endoom",                 &show_endoom},
+    {"vanilla_savegame_limit",      &vanilla_savegame_limit},
 #ifdef FEATURE_MULTIPLAYER
-    {"player_name",            &net_player_name,      DEFAULT_STRING},
+    {"player_name",                 &net_player_name,          DEFAULT_STRING},
 #endif
 };