mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 20:17:58 -04:00
optional support for PNG screenshots
You need to have SDL2_Image installed and run ./configure --with-sdlimage
This commit is contained in:
parent
1b0777bd84
commit
f4acd9d6bd
@ -78,5 +78,5 @@ winmbf_SOURCES = \
|
|||||||
w_wad.c w_wad.h \
|
w_wad.c w_wad.h \
|
||||||
wi_stuff.c wi_stuff.h \
|
wi_stuff.c wi_stuff.h \
|
||||||
z_zone.c z_zone.h
|
z_zone.c z_zone.h
|
||||||
winmbf_CFLAGS = @SDL_CFLAGS@ @SDL_mixer_CFLAGS@ @SDL_net_CFLAGS@
|
winmbf_CFLAGS = @SDL_CFLAGS@ @SDL_image_CFLAGS@ @SDL_mixer_CFLAGS@ @SDL_net_CFLAGS@
|
||||||
winmbf_LDADD = @SDL_LIBS@ @SDL_mixer_LIBS@ @SDL_net_LIBS@
|
winmbf_LDADD = @SDL_LIBS@ @SDL_image_LIBS@ @SDL_mixer_LIBS@ @SDL_net_LIBS@
|
||||||
|
@ -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 "SDL.h" // haleyjd
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_SDL_IMAGE
|
||||||
|
#include "SDL_image.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "z_zone.h" /* memory allocation wrappers -- killough */
|
#include "z_zone.h" /* memory allocation wrappers -- killough */
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "v_video.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 boolean setsizeneeded;
|
||||||
|
|
||||||
extern void I_InitKeyboard();
|
extern void I_InitKeyboard();
|
||||||
|
@ -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 disk_icon; // killough 10/98
|
||||||
extern int hires; // killough 11/98
|
extern int hires; // killough 11/98
|
||||||
|
|
||||||
|
boolean I_WritePNGfile(char *filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -3065,7 +3065,11 @@ setup_menu_t gen_settings1[] = { // General Settings screen1
|
|||||||
{"Translucency filter percentage", S_NUM, m_null, G_X,
|
{"Translucency filter percentage", S_NUM, m_null, G_X,
|
||||||
G_Y + general_transpct*8, {"tran_filter_pct"}, 0, 0, M_Trans},
|
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,
|
{"PCX instead of BMP for screenshots", S_YESNO, m_null, G_X,
|
||||||
|
#endif
|
||||||
G_Y + general_pcx*8, {"screenshot_pcx"}},
|
G_Y + general_pcx*8, {"screenshot_pcx"}},
|
||||||
|
|
||||||
{"Flash Icon During Disk IO", S_YESNO, m_null, G_X,
|
{"Flash Icon During Disk IO", S_YESNO, m_null, G_X,
|
||||||
|
@ -1031,7 +1031,11 @@ default_t defaults[] = {
|
|||||||
"screenshot_pcx",
|
"screenshot_pcx",
|
||||||
&screenshot_pcx, NULL,
|
&screenshot_pcx, NULL,
|
||||||
1, {0,1}, number, ss_gen, wad_no,
|
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"
|
"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
|
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
|
// M_ScreenShot
|
||||||
//
|
//
|
||||||
@ -2381,7 +2391,11 @@ void M_ScreenShot (void)
|
|||||||
|
|
||||||
do
|
do
|
||||||
sprintf(lbmname, //jff 3/30/98 pcx or bmp?
|
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++);
|
screenshot_pcx ? "doom%02d.pcx" : "doom%02d.bmp", shot++);
|
||||||
|
#endif
|
||||||
while (!access(lbmname,0) && --tries);
|
while (!access(lbmname,0) && --tries);
|
||||||
|
|
||||||
if (tries)
|
if (tries)
|
||||||
@ -2399,7 +2413,11 @@ void M_ScreenShot (void)
|
|||||||
|
|
||||||
// killough 10/98: detect failure and remove file if error
|
// killough 10/98: detect failure and remove file if error
|
||||||
// killough 11/98: add hires support
|
// killough 11/98: add hires support
|
||||||
|
#ifdef HAVE_SDL_IMAGE
|
||||||
|
if (!(success = (screenshot_pcx ? WritePCXfile : WritePNGfile)
|
||||||
|
#else
|
||||||
if (!(success = (screenshot_pcx ? WritePCXfile : WriteBMPfile)
|
if (!(success = (screenshot_pcx ? WritePCXfile : WriteBMPfile)
|
||||||
|
#endif
|
||||||
(lbmname,linear, SCREENWIDTH<<hires, SCREENHEIGHT<<hires,pal)))
|
(lbmname,linear, SCREENWIDTH<<hires, SCREENHEIGHT<<hires,pal)))
|
||||||
{
|
{
|
||||||
int t = errno;
|
int t = errno;
|
||||||
|
@ -17,6 +17,13 @@ PKG_CHECK_MODULES([SDL_mixer], [SDL2_mixer])
|
|||||||
PKG_CHECK_MODULES([SDL_net], [SDL2_net])
|
PKG_CHECK_MODULES([SDL_net], [SDL2_net])
|
||||||
AC_DEFINE([MY_SDL_VER], [1], [This is WinMBF])
|
AC_DEFINE([MY_SDL_VER], [1], [This is WinMBF])
|
||||||
|
|
||||||
|
AC_ARG_WITH([sdlimage], AS_HELP_STRING([--with-sdlimage], [Build with SDL2_Image for PNG screenshots]))
|
||||||
|
AS_IF([test "x$with_sdlimage" = "xyes"],
|
||||||
|
[PKG_CHECK_MODULES([SDL_image], [SDL2_image],
|
||||||
|
[AC_DEFINE([HAVE_SDL_IMAGE], [1], [PNG screenshots])]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
|
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user