Disable by default, add menu option

This commit is contained in:
Jaime Ita Passos 2020-12-19 14:25:03 -03:00
parent 7ca444cfd1
commit 928b236af3
4 changed files with 40 additions and 13 deletions

View file

@ -51,15 +51,15 @@ consvar_t cv_gif_optimize = CVAR_INIT ("gif_optimize", "On", CV_SAVE, CV_OnOff,
consvar_t cv_gif_downscale = CVAR_INIT ("gif_downscale", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_gif_dynamicdelay = CVAR_INIT ("gif_dynamicdelay", "On", CV_SAVE, gif_dynamicdelay_cons_t, NULL);
consvar_t cv_gif_localcolortable = CVAR_INIT ("gif_localcolortable", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_gif_split = CVAR_INIT ("gif_split", "Use last filename", CV_SAVE, gif_split_cons_t, NULL);
consvar_t cv_gif_sizelimit = CVAR_INIT ("gif_sizelimit", "8192", (CV_SAVE | CV_CALL), CV_Unsigned, CV_gifsizelimit_OnChange);
consvar_t cv_gif_showfilesize = CVAR_INIT ("gif_showfilesize", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_gif_showsplitcount = CVAR_INIT ("gif_showsplitcount", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_gif_split = CVAR_INIT ("gif_split", "Off", CV_SAVE, gif_split_cons_t, NULL);
consvar_t cv_gif_sizelimit = CVAR_INIT ("gif_sizelimit", "0", (CV_SAVE | CV_CALL), CV_Unsigned, CV_gifsizelimit_OnChange);
consvar_t cv_gif_showfilesize = CVAR_INIT ("gif_showfilesize", "Off", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_gif_showsplitcount = CVAR_INIT ("gif_showsplitcount", "Off", CV_SAVE, CV_OnOff, NULL);
#ifdef HAVE_ANIGIF
static boolean gif_optimize = false; // So nobody can do something dumb
static boolean gif_downscale = false; // like changing cvars mid output
static UINT8 gif_dynamicdelay = (UINT8)0; // and messing something up
static UINT8 gif_dynamicdelay = 0; // and messing something up
// Palette handling
static boolean gif_localcolortable = false;
@ -984,17 +984,22 @@ void GIF_displayinfo(void)
y += ((vid.dupx > 1) ? 5 : 10); \
}
if (!gif_sizelimit)
if (!gif_out)
return;
if (cv_gif_showfilesize.value)
{
GIF_getinfosize(gif_totalsize, &filesize[0], &unit[0][0]);
if (gif_sizelimit)
{
GIF_getinfosize(gif_sizelimit, &filesize[1], &unit[1][0]);
string = va(M_GetText("GIF size: %.2f%s/%.2f%s"), filesize[0], unit[0], filesize[1], unit[1]);
}
else
string = va(M_GetText("GIF size: %.2f%s"), filesize[0], unit[0]);
string = va("%.2f%s/%.2f%s", filesize[0], unit[0], filesize[1], unit[1]);
if ((!cv_gif_split.value)
if (gif_sizelimit && (!cv_gif_split.value)
&& (gif_totalsize > (gif_sizelimit - (gif_sizelimit / 4)))
&& (gif_frames/5 & 1)) // flashing
stringflags |= V_REDMAP;
@ -1008,6 +1013,22 @@ void GIF_displayinfo(void)
string = va("GIF count: %d\n", (gif_splitcount + 1));
infoline(string);
}
#undef infoline
}
boolean GIF_candisplayinfo(void)
{
if (!gif_out)
return false;
if (cv_gif_showfilesize.value)
return true;
if (cv_gif_split.value && gif_splitcount && cv_gif_showsplitcount.value)
return true;
return false;
}
//

View file

@ -26,6 +26,7 @@ INT32 GIF_open(const char *filename);
void GIF_frame(void);
INT32 GIF_close(void);
void GIF_displayinfo(void);
boolean GIF_candisplayinfo(void);
#endif
extern consvar_t cv_gif_optimize, cv_gif_downscale, cv_gif_dynamicdelay, cv_gif_localcolortable;

View file

@ -1557,6 +1557,7 @@ static menuitem_t OP_ScreenshotOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 100},
{IT_STRING|IT_CVAR, NULL, "Local Color Table", &cv_gif_localcolortable, 105},
{IT_STRING|IT_CVAR, NULL, "Dynamic Delay", &cv_gif_dynamicdelay, 110},
{IT_STRING|IT_CVAR, NULL, "Show File Size", &cv_gif_showfilesize, 115},
{IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_apng_downscale, 95},
{IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 100},
@ -1573,9 +1574,9 @@ enum
op_movie_folder = 11,
op_screenshot_capture = 12,
op_screenshot_gif_start = 13,
op_screenshot_gif_end = 16,
op_screenshot_apng_start = 17,
op_screenshot_apng_end = 21,
op_screenshot_gif_end = 17,
op_screenshot_apng_start = 18,
op_screenshot_apng_end = 22,
};
static menuitem_t OP_EraseDataMenu[] =

View file

@ -518,7 +518,11 @@ boolean SCR_UseDelayedOverlay(void)
boolean SCR_NeedsDelayedOverlay(void)
{
return (moviemode == MM_GIF);
#ifdef HAVE_ANIGIF
return (moviemode == MM_GIF && GIF_candisplayinfo());
#else
return false;
#endif
}
// XMOD FPS display