diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 15694a7c5..c1e084919 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.5: +- Split config.alwaysgl and config.usegl so that "Use Pure Mode If Possible" + persists across runs even when using a GL mode - Michael - Fixed Yehat Rebel left hand doubling up problem (bug #807) - Alex - Fixed the problem with Melnorme stripping Chmmr bomb/crystal modules from the ship in a fuel deal (bug #803) - Alex diff --git a/sc2/src/sc2code/setupmenu.c b/sc2/src/sc2code/setupmenu.c index 4b3ea0115..ce86bc7be 100644 --- a/sc2/src/sc2code/setupmenu.c +++ b/sc2/src/sc2code/setupmenu.c @@ -841,17 +841,18 @@ GetGlobalOptions (GLOBALOPTS *opts) break; } + /* Work out resolution. On the way, try to guess a good default + * for config.alwaysgl, then overwrite it if it was set previously. */ + opts->driver = OPTVAL_PURE_IF_POSSIBLE; switch (ScreenWidthActual) { case 320: if (GraphicsDriver == TFB_GFXDRIVER_SDL_PURE) { opts->res = OPTVAL_320_240; - opts->driver = OPTVAL_PURE_IF_POSSIBLE; } else { - opts->driver = OPTVAL_ALWAYS_GL; if (ScreenHeightActual != 240) { opts->res = OPTVAL_CUSTOM; @@ -859,6 +860,7 @@ GetGlobalOptions (GLOBALOPTS *opts) else { opts->res = OPTVAL_320_240; + opts->driver = OPTVAL_ALWAYS_GL; } } break; @@ -866,11 +868,9 @@ GetGlobalOptions (GLOBALOPTS *opts) if (GraphicsDriver == TFB_GFXDRIVER_SDL_PURE) { opts->res = OPTVAL_640_480; - opts->driver = OPTVAL_PURE_IF_POSSIBLE; } else { - opts->driver = OPTVAL_ALWAYS_GL; if (ScreenHeightActual != 480) { opts->res = OPTVAL_CUSTOM; @@ -878,11 +878,11 @@ GetGlobalOptions (GLOBALOPTS *opts) else { opts->res = OPTVAL_640_480; + opts->driver = OPTVAL_ALWAYS_GL; } } break; case 800: - opts->driver = OPTVAL_ALWAYS_GL; if (ScreenHeightActual != 600) { opts->res = OPTVAL_CUSTOM; @@ -893,7 +893,6 @@ GetGlobalOptions (GLOBALOPTS *opts) } break; case 1024: - opts->driver = OPTVAL_ALWAYS_GL; if (ScreenHeightActual != 768) { opts->res = OPTVAL_CUSTOM; @@ -904,11 +903,22 @@ GetGlobalOptions (GLOBALOPTS *opts) } break; default: - opts->driver = OPTVAL_ALWAYS_GL; opts->res = OPTVAL_CUSTOM; break; } + if (res_HasKey ("config.alwaysgl")) + { + if (res_GetBoolean ("config.alwaysgl")) + { + opts->driver = OPTVAL_ALWAYS_GL; + } + else + { + opts->driver = OPTVAL_PURE_IF_POSSIBLE; + } + } + opts->musicvol = (((int)(musicVolumeScale * 100.0f) + 2) / 5) * 5; opts->sfxvol = (((int)(sfxVolumeScale * 100.0f) + 2) / 5) * 5; opts->speechvol = (((int)(speechVolumeScale * 100.0f) + 2) / 5) * 5; @@ -978,7 +988,7 @@ SetGlobalOptions (GLOBALOPTS *opts) res_PutInteger ("config.resheight", NewHeight); res_PutInteger ("config.bpp", NewDepth); res_PutBoolean ("config.alwaysgl", opts->driver == OPTVAL_ALWAYS_GL); - + res_PutBoolean ("config.usegl", NewDriver == TFB_GFXDRIVER_SDL_OPENGL); switch (opts->scaler) { case OPTVAL_BILINEAR_SCALE: diff --git a/sc2/src/starcon2.c b/sc2/src/starcon2.c index fd7314812..454b2e69c 100644 --- a/sc2/src/starcon2.c +++ b/sc2/src/starcon2.c @@ -191,8 +191,15 @@ main (int argc, char *argv[]) } if (res_HasKey ("config.alwaysgl")) { - options.gfxDriver = res_GetBoolean ("config.alwaysgl") ? - TFB_GFXDRIVER_SDL_OPENGL : TFB_GFXDRIVER_SDL_PURE; + if (res_GetBoolean ("config.alwaysgl")) + { + options.gfxDriver = TFB_GFXDRIVER_SDL_OPENGL; + } + } + if (res_HasKey ("config.usegl")) + { + options.gfxDriver = res_GetBoolean ("config.usegl") ? TFB_GFXDRIVER_SDL_OPENGL : + TFB_GFXDRIVER_SDL_PURE; } if (res_HasKey ("config.scaler")) {