diff --git a/Source/Makefile.am b/Source/Makefile.am index 94343656..45b79e78 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -78,5 +78,5 @@ winmbf_SOURCES = \ w_wad.c w_wad.h \ wi_stuff.c wi_stuff.h \ z_zone.c z_zone.h -winmbf_CFLAGS = @SDL_CFLAGS@ @SDL_mixer_CFLAGS@ @SDL_net_CFLAGS@ -winmbf_LDADD = @SDL_LIBS@ @SDL_mixer_LIBS@ @SDL_net_LIBS@ +winmbf_CFLAGS = @SDL_CFLAGS@ @SDL_image_CFLAGS@ @SDL_mixer_CFLAGS@ @SDL_net_CFLAGS@ +winmbf_LDADD = @SDL_LIBS@ @SDL_image_LIBS@ @SDL_mixer_LIBS@ @SDL_net_LIBS@ diff --git a/Source/i_video.c b/Source/i_video.c index 357d0fa9..a860b910 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -31,6 +31,11 @@ rcsid[] = "$Id: i_video.c,v 1.12 1998/05/03 22:40:35 killough Exp $"; #include "SDL.h" // haleyjd +#include "config.h" +#ifdef HAVE_SDL_IMAGE +#include "SDL_image.h" +#endif + #include "z_zone.h" /* memory allocation wrappers -- killough */ #include "doomstat.h" #include "v_video.h" @@ -685,6 +690,13 @@ void I_ShutdownGraphics(void) } } +boolean I_WritePNGfile(char *filename) +{ +#ifdef HAVE_SDL_IMAGE + return IMG_SavePNG(sdlscreen, filename) == 0; +#endif +} + extern boolean setsizeneeded; extern void I_InitKeyboard(); diff --git a/Source/i_video.h b/Source/i_video.h index b11d59e0..388267aa 100644 --- a/Source/i_video.h +++ b/Source/i_video.h @@ -60,6 +60,8 @@ extern int page_flip; // killough 8/15/98: enables page flipping (320x200) extern int disk_icon; // killough 10/98 extern int hires; // killough 11/98 +boolean I_WritePNGfile(char *filename); + #endif //---------------------------------------------------------------------------- diff --git a/Source/m_menu.c b/Source/m_menu.c index e8eeca29..1a051cb9 100644 --- a/Source/m_menu.c +++ b/Source/m_menu.c @@ -3065,7 +3065,11 @@ setup_menu_t gen_settings1[] = { // General Settings screen1 {"Translucency filter percentage", S_NUM, m_null, G_X, G_Y + general_transpct*8, {"tran_filter_pct"}, 0, 0, M_Trans}, +#ifdef HAVE_SDL_IMAGE + {"PCX instead of PNG for screenshots", S_YESNO, m_null, G_X, +#else {"PCX instead of BMP for screenshots", S_YESNO, m_null, G_X, +#endif G_Y + general_pcx*8, {"screenshot_pcx"}}, {"Flash Icon During Disk IO", S_YESNO, m_null, G_X, diff --git a/Source/m_misc.c b/Source/m_misc.c index b8afe962..06d8a2b0 100644 --- a/Source/m_misc.c +++ b/Source/m_misc.c @@ -1031,7 +1031,11 @@ default_t defaults[] = { "screenshot_pcx", &screenshot_pcx, NULL, 1, {0,1}, number, ss_gen, wad_no, +#ifdef HAVE_SDL_IMAGE + "1 to take a screenshot in PCX format, 0 for PNG" +#else "1 to take a screenshot in PCX format, 0 for BMP" +#endif }, { @@ -2359,6 +2363,12 @@ boolean WriteBMPfile(char *filename, byte *data, int width, return I_EndRead(), true; // killough 10/98 } +boolean WritePNGfile(char *filename, byte *data, int width, + int height, byte *palette) +{ + return I_WritePNGfile(filename); +} + // // M_ScreenShot // @@ -2381,7 +2391,11 @@ void M_ScreenShot (void) do sprintf(lbmname, //jff 3/30/98 pcx or bmp? +#ifdef HAVE_SDL_IMAGE + screenshot_pcx ? "doom%02d.pcx" : "doom%02d.png", shot++); +#else screenshot_pcx ? "doom%02d.pcx" : "doom%02d.bmp", shot++); +#endif while (!access(lbmname,0) && --tries); if (tries) @@ -2399,7 +2413,11 @@ void M_ScreenShot (void) // killough 10/98: detect failure and remove file if error // killough 11/98: add hires support +#ifdef HAVE_SDL_IMAGE + if (!(success = (screenshot_pcx ? WritePCXfile : WritePNGfile) +#else if (!(success = (screenshot_pcx ? WritePCXfile : WriteBMPfile) +#endif (lbmname,linear, SCREENWIDTH<