summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2010-11-24 22:43:37 +0000
committerSimon Howard2010-11-24 22:43:37 +0000
commit288d322c0b679675a80c0fc763b1063613c77ce5 (patch)
tree020ec93e9f2a79cc3c10d5c261cc1d59f85221b2
parentcf82ce9d7bb8d71ae583753aab642c5ba4ee8d06 (diff)
downloadchocolate-doom-288d322c0b679675a80c0fc763b1063613c77ce5.tar.gz
chocolate-doom-288d322c0b679675a80c0fc763b1063613c77ce5.tar.bz2
chocolate-doom-288d322c0b679675a80c0fc763b1063613c77ce5.zip
Add configuration file parameter and command line option to specify the
screen pixel depth. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2166
-rw-r--r--setup/configfile.c1
-rw-r--r--setup/display.c1
-rw-r--r--setup/display.h1
-rw-r--r--src/i_video.c42
-rw-r--r--src/i_video.h1
-rw-r--r--src/m_config.c6
6 files changed, 44 insertions, 8 deletions
diff --git a/setup/configfile.c b/setup/configfile.c
index 2a3cb845..885bbd8f 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -265,6 +265,7 @@ static default_t extra_defaults_list[] =
{"startup_delay", &startup_delay, DEFAULT_INT, 0, 0},
{"screen_width", &screen_width, DEFAULT_INT, 0, 0},
{"screen_height", &screen_height, DEFAULT_INT, 0, 0},
+ {"screen_bpp", &screen_bpp, DEFAULT_INT, 0, 0},
{"grabmouse", &grabmouse, DEFAULT_INT, 0, 0},
{"novert", &novert, DEFAULT_INT, 0, 0},
{"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT, 0, 0},
diff --git a/setup/display.c b/setup/display.c
index 596b8a43..f9e2f712 100644
--- a/setup/display.c
+++ b/setup/display.c
@@ -75,6 +75,7 @@ int aspect_ratio_correct = 1;
int fullscreen = 1;
int screen_width = 320;
int screen_height = 200;
+int screen_bpp = 8;
int startup_delay = 1000;
int show_endoom = 1;
diff --git a/setup/display.h b/setup/display.h
index f0c76184..2419e807 100644
--- a/setup/display.h
+++ b/setup/display.h
@@ -26,6 +26,7 @@ extern int autoadjust_video_settings;
extern int aspect_ratio_correct;
extern int fullscreen;
extern int screen_width, screen_height;
+extern int screen_bpp;
extern int startup_delay;
extern int show_endoom;
extern char *video_driver;
diff --git a/src/i_video.c b/src/i_video.c
index 1139157d..577b7415 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -126,6 +126,10 @@ static boolean native_surface;
int screen_width = SCREENWIDTH;
int screen_height = SCREENHEIGHT;
+// Color depth.
+
+int screen_bpp = 8;
+
// Automatically adjust video settings if the selected mode is
// not a valid video mode.
@@ -1407,6 +1411,33 @@ static void CheckCommandLine(void)
//!
// @category video
+ // @arg <bpp>
+ //
+ // Specify the color depth of the screen, in bits per pixel.
+ //
+
+ i = M_CheckParm("-bpp");
+
+ if (i > 0)
+ {
+ screen_bpp = atoi(myargv[i + 1]);
+ }
+
+ // Because we love Eternity:
+
+ //!
+ // @category video
+ //
+ // Set the color depth of the screen to 32 bits per pixel.
+ //
+
+ if (M_CheckParm("-8in32"))
+ {
+ screen_bpp = 32;
+ }
+
+ //!
+ // @category video
// @arg <WxY>
//
// Specify the screen mode (when running fullscreen) or the window
@@ -1558,7 +1589,6 @@ static void SetVideoMode(screen_mode_t *mode, int w, int h)
{
byte *doompal;
int flags = 0;
- int bpp = 8;
doompal = W_CacheLumpName(DEH_String("PLAYPAL"), PU_CACHE);
@@ -1573,11 +1603,7 @@ static void SetVideoMode(screen_mode_t *mode, int w, int h)
flags |= SDL_SWSURFACE;
- if (M_CheckParm("-8in32"))
- {
- bpp = 32;
- }
- else
+ if (screen_bpp == 8)
{
flags |= SDL_HWPALETTE | SDL_DOUBLEBUF;
}
@@ -1591,12 +1617,12 @@ static void SetVideoMode(screen_mode_t *mode, int w, int h)
flags |= SDL_RESIZABLE;
}
- screen = SDL_SetVideoMode(w, h, bpp, flags);
+ screen = SDL_SetVideoMode(w, h, screen_bpp, flags);
if (screen == NULL)
{
I_Error("Error setting video mode %ix%ix%ibpp: %s\n",
- w, h, bpp, SDL_GetError());
+ w, h, screen_bpp, SDL_GetError());
}
if (screen->format->BitsPerPixel == 8)
diff --git a/src/i_video.h b/src/i_video.h
index 94ffcc29..44fe1cd2 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -89,6 +89,7 @@ extern char *video_driver;
extern int autoadjust_video_settings;
extern boolean screenvisible;
extern int screen_width, screen_height;
+extern int screen_bpp;
extern int fullscreen;
extern int aspect_ratio_correct;
extern int grabmouse;
diff --git a/src/m_config.c b/src/m_config.c
index 2065700e..a4cacd95 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -616,6 +616,12 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_INT(screen_height, screen_height),
//!
+ // Color depth of the screen, in bits.
+ //
+
+ CONFIG_VARIABLE_INT(screen_bpp, screen_bpp),
+
+ //!
// If this is non-zero, the mouse will be "grabbed" when running
// in windowed mode so that it can be used as an input device.
// When running full screen, this has no effect.