diff --git a/src/configuration.c b/src/configuration.c index 335d770..f73dcce 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -48,6 +48,7 @@ game_init () debug = 0; gfx.res.x = 640; gfx.res.y = 480; + gfx.bpp = 16; bman.fieldsize.x = 25; bman.fieldsize.y = 17; sprintf (bman.datapath, "data/bomberclone.gfx"); @@ -144,6 +145,9 @@ ReadConfig () if (!strcmp (keyword, "fullscreen")) { gfx.fullscreen = atoi (value); } + if (!strcmp (keyword, "bitsperpixel")) { + gfx.bpp = atoi (value); + } if (!strcmp (keyword, "ai_family")) { bman.net_ai_family = atoi (value); } @@ -198,6 +202,8 @@ WriteConfig () fprintf (config, "debug=%d\n", debug); fprintf (config, "selectplayer=%d\n", bman.selectplayer); fprintf (config, "playername=%s\n", bman.playername); + fprintf (config, "bitsperpixel=%d\n", gfx.bpp); + fclose (config); return 0; } @@ -214,7 +220,8 @@ change_res () {2, "800x600"}, {3, "1024x768"}, {4, "1280x1024"}, - {5, "Return To Configuration Menu"}, + {5, "BPP"}, + {6, "Return To Configuration Menu"}, {-1, ""} }; while (1) { @@ -223,7 +230,11 @@ change_res () else sprintf (menu[0].text, "Enable Full Screen"); - + if (gfx.bpp == 16) + sprintf (menu[5].text, "16 Bit Per Pixel"); + else + sprintf (menu[5].text, "32 Bit Per Pixel"); + menuselect = menu_loop ("Video Options", menu, menuselect); switch (menuselect) { @@ -250,7 +261,13 @@ change_res () gfx.res.x = 1280; gfx.res.y = 1024; break; - case (5): // Return + case (5): + if (gfx.bpp == 16) + gfx.bpp = 32; + else + gfx.bpp = 16; + break; + case (6): // Return menuselect = -1; break; } diff --git a/src/gfx.c b/src/gfx.c index d67abbe..93e42a6 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -495,10 +495,10 @@ void gfx_game_shutdown () { /* init the whole GFX Part */ void gfx_init () { if (gfx.fullscreen) - gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, 16, + gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN); else - gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, 16, + gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL); if (gfx.screen == NULL) { diff --git a/src/gfx.h b/src/gfx.h index c1402b0..ee4d2d0 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -33,6 +33,7 @@ struct __gfx { SDL_Surface *screen; _point res; // resolution _point block; // block size + short int bpp; // bits per pixel unsigned char fullscreen;