Setup Menu can handle custom resolutions now (Bug #693)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1603 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-03-31 09:16:16 +00:00
parent 9f03fe280a
commit 52ca25712d
3 changed files with 54 additions and 9 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.4: Changes towards version 0.4:
- Setup Menu no longer crashes or misbehaves on custom resolutions (bug
#693) - Michael
- Quit confirmation window (on F10) undraws correctly during intro slides - Quit confirmation window (on F10) undraws correctly during intro slides
(bug #673) -Alex (bug #673) -Alex
- Attempting to set to a mode that Doesn't Work in Setup no longer ends - Attempting to set to a mode that Doesn't Work in Setup no longer ends
+50 -8
View File
@@ -198,7 +198,12 @@ static OPTION resdriver_opts[] = {
{ "1024x768 resolution.", { "1024x768 resolution.",
"Uses OpenGL graphics drivers.", "Uses OpenGL graphics drivers.",
"" ""
} } } },
{ "Custom",
{ "Custom resolution set from the commandline.",
"Uses OpenGL graphics drivers.",
""
} },
#endif #endif
}; };
@@ -256,6 +261,14 @@ SetDefaults (void)
GLOBALOPTS opts; GLOBALOPTS opts;
GetGlobalOptions (&opts); GetGlobalOptions (&opts);
if (opts.driver == OPTVAL_CUSTOM_GL)
{
cmdline_opts[0].numopts = RES_OPTS + 1;
}
else
{
cmdline_opts[0].numopts = RES_OPTS;
}
cmdline_opts[0].selected = opts.driver; cmdline_opts[0].selected = opts.driver;
cmdline_opts[1].selected = opts.depth; cmdline_opts[1].selected = opts.depth;
cmdline_opts[2].selected = opts.scaler; cmdline_opts[2].selected = opts.scaler;
@@ -529,8 +542,6 @@ GetGlobalOptions (GLOBALOPTS *opts)
break; break;
} }
/* Warning: This is a filthy lie, as it's assuming that the
* res must be one of the options. */
switch (ScreenWidthActual) switch (ScreenWidthActual)
{ {
case 320: case 320:
@@ -540,7 +551,14 @@ GetGlobalOptions (GLOBALOPTS *opts)
} }
else else
{ {
opts->driver = OPTVAL_320_240_GL; if (ScreenHeightActual != 240)
{
opts->driver = OPTVAL_CUSTOM_GL;
}
else
{
opts->driver = OPTVAL_320_240_GL;
}
} }
break; break;
case 640: case 640:
@@ -550,14 +568,38 @@ GetGlobalOptions (GLOBALOPTS *opts)
} }
else else
{ {
opts->driver = OPTVAL_640_480_GL; if (ScreenHeightActual != 480)
{
opts->driver = OPTVAL_CUSTOM_GL;
}
else
{
opts->driver = OPTVAL_640_480_GL;
}
} }
break; break;
case 800: case 800:
opts->driver = OPTVAL_800_600_GL; if (ScreenHeightActual != 600)
{
opts->driver = OPTVAL_CUSTOM_GL;
}
else
{
opts->driver = OPTVAL_800_600_GL;
}
break; break;
case 1024: case 1024:
opts->driver = OPTVAL_1024_768_GL; if (ScreenHeightActual != 768)
{
opts->driver = OPTVAL_CUSTOM_GL;
}
else
{
opts->driver = OPTVAL_1024_768_GL;
}
break;
default:
opts->driver = OPTVAL_CUSTOM_GL;
break; break;
} }
} }
@@ -608,7 +650,7 @@ SetGlobalOptions (GLOBALOPTS *opts)
NewDriver = TFB_GFXDRIVER_SDL_OPENGL; NewDriver = TFB_GFXDRIVER_SDL_OPENGL;
break; break;
default: default:
fprintf (stderr, "Can't Happen: Impossible value for Driver/Resolution\n"); /* Don't mess with the custom value */
break; break;
} }
+2 -1
View File
@@ -43,7 +43,8 @@ typedef enum {
OPTVAL_320_240_GL, OPTVAL_320_240_GL,
OPTVAL_640_480_GL, OPTVAL_640_480_GL,
OPTVAL_800_600_GL, OPTVAL_800_600_GL,
OPTVAL_1024_768_GL OPTVAL_1024_768_GL,
OPTVAL_CUSTOM_GL
} OPT_RESDRIVERTYPE; } OPT_RESDRIVERTYPE;
typedef enum { typedef enum {