summaryrefslogtreecommitdiff
path: root/src/i_video.c
diff options
context:
space:
mode:
authorSimon Howard2010-11-24 22:43:37 +0000
committerSimon Howard2010-11-24 22:43:37 +0000
commit288d322c0b679675a80c0fc763b1063613c77ce5 (patch)
tree020ec93e9f2a79cc3c10d5c261cc1d59f85221b2 /src/i_video.c
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
Diffstat (limited to 'src/i_video.c')
-rw-r--r--src/i_video.c42
1 files changed, 34 insertions, 8 deletions
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)