about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/ec_gfx.c68
-rw-r--r--src/game/client/components/menus_settings.cpp7
2 files changed, 39 insertions, 36 deletions
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c
index 36e9e9fa..888963ba 100644
--- a/src/engine/client/ec_gfx.c
+++ b/src/engine/client/ec_gfx.c
@@ -209,6 +209,41 @@ static int try_init()
 	return 0;
 }
 
+static int gfx_init_window()
+{
+	if(try_init() == 0)
+		return 0;
+	
+	/* try disabling fsaa */
+	while(config.gfx_fsaa_samples)
+	{
+		config.gfx_fsaa_samples--;
+		
+		if(config.gfx_fsaa_samples)
+			dbg_msg("gfx", "lowering FSAA to %d and trying again", config.gfx_fsaa_samples);
+		else
+			dbg_msg("gfx", "disabling FSAA and trying again");
+
+		if(try_init() == 0)
+			return 0;
+	}
+
+	/* try lowering the resolution */
+	if(config.gfx_screen_width != 640 || config.gfx_screen_height != 480)
+	{
+		dbg_msg("gfx", "setting resolution to 640x480 and trying again");
+		config.gfx_screen_width = 640;
+		config.gfx_screen_height = 480;
+
+		if(try_init() == 0)
+			return 0;
+	}
+
+	dbg_msg("gfx", "out of ideas. failed to init graphics");
+					
+	return -1;		
+}
+
 int gfx_init()
 {
 	int i;
@@ -230,36 +265,9 @@ int gfx_init()
 			if(!getenv("SDL_VIDEO_WINDOW_POS") && !getenv("SDL_VIDEO_CENTERED"))
 				putenv("SDL_VIDEO_WINDOW_POS=8,27");
 		#endif
-		do
-		{
-			if(try_init() == 0)
-				break;
-			
-			/* try disabling fsaa */
-			if(config.gfx_fsaa_samples)
-			{
-				dbg_msg("gfx", "disabling FSAA and trying again");
-				config.gfx_fsaa_samples = 0;
-
-				if(try_init() == 0)
-					break;
-			}
-
-			/* try lowering the resolution */
-			if(config.gfx_screen_width != 640 || config.gfx_screen_height != 480)
-			{
-				dbg_msg("gfx", "setting resolution to 640x480 and trying again");
-				config.gfx_screen_width = 640;
-				config.gfx_screen_height = 480;
-
-				if(try_init() == 0)
-					break;
-			}
-
-			dbg_msg("gfx", "out of ideas. failed to init graphics");
-							
-			return -1;			
-		} while(0);
+		
+		if(gfx_init_window() != 0)
+			return -1;
 	}
 	
 	/* Init vertices */
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index c461b542..15d9e507 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -502,12 +502,7 @@ void MENUS::render_settings_graphics(RECT main_view)
 	ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
 	if (ui_do_button(&config.gfx_fsaa_samples, "FSAA samples", config.gfx_fsaa_samples, &button, ui_draw_checkbox_number, 0))
 	{
-		if(config.gfx_fsaa_samples < 2) config.gfx_fsaa_samples = 2;
-		else if(config.gfx_fsaa_samples < 4) config.gfx_fsaa_samples = 4;
-		else if(config.gfx_fsaa_samples < 6) config.gfx_fsaa_samples = 6;
-		else if(config.gfx_fsaa_samples < 8) config.gfx_fsaa_samples = 8;
-		else if(config.gfx_fsaa_samples < 16) config.gfx_fsaa_samples = 16;
-		else if(config.gfx_fsaa_samples >= 16) config.gfx_fsaa_samples = 0;
+		config.gfx_fsaa_samples = (config.gfx_fsaa_samples+1)%17;
 		need_restart = true;
 	}