Merge branch 'remove-screenshot-option' into 'master'

Remove options to change screenshot, movie and addons folders

See merge request KartKrew/Kart!1048
This commit is contained in:
James R 2023-03-15 03:48:28 +00:00
commit b6aed379b5
10 changed files with 13 additions and 146 deletions

View file

@ -894,12 +894,8 @@ void D_RegisterClientCommands(void)
COM_AddCommand("stopmovie", Command_StopMovie_f);
COM_AddCommand("minigen", M_MinimapGenerate);
CV_RegisterVar(&cv_screenshot_option);
CV_RegisterVar(&cv_screenshot_folder);
CV_RegisterVar(&cv_screenshot_colorprofile);
CV_RegisterVar(&cv_moviemode);
CV_RegisterVar(&cv_movie_option);
CV_RegisterVar(&cv_movie_folder);
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
M_AVRecorder_AddCommands();
@ -1013,8 +1009,6 @@ void D_RegisterClientCommands(void)
}
// filesrch.c
CV_RegisterVar(&cv_addons_option);
CV_RegisterVar(&cv_addons_folder);
CV_RegisterVar(&cv_addons_md5);
CV_RegisterVar(&cv_addons_showall);
CV_RegisterVar(&cv_addons_search_type);

View file

@ -32,7 +32,6 @@
#include "d_netfil.h"
#include "m_misc.h"
#include "z_zone.h"
#include "k_menu.h" // Addons_option_Onchange
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && defined (_MSC_VER) && !defined (_XBOX)
@ -311,15 +310,6 @@ closedir (DIR * dirp)
}
#endif
static CV_PossibleValue_t addons_cons_t[] = {{0, "Addons"},
#if 1
{1, "HOME"}, {2, "IWAD"},
#endif
{3, "CUSTOM"}, {0, NULL}};
consvar_t cv_addons_option = CVAR_INIT ("addons_option", "Addons", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange);
consvar_t cv_addons_folder = CVAR_INIT ("addons_folder", "", CV_SAVE, NULL, NULL);
static CV_PossibleValue_t addons_md5_cons_t[] = {{0, "Name"}, {1, "Contents"}, {0, NULL}};
consvar_t cv_addons_md5 = CVAR_INIT ("addons_md5", "Name", CV_SAVE, addons_md5_cons_t, NULL);

View file

@ -12,7 +12,7 @@
extern "C" {
#endif
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
extern consvar_t cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
/** \brief The filesearch function

View file

@ -464,9 +464,6 @@ typedef enum
// K_MENUFUNC.C
// Moviemode menu updating
void Moviemode_option_Onchange(void);
extern menu_t *currentMenu;
extern menu_t *restoreMenu;
@ -565,8 +562,6 @@ extern consvar_t cv_autorecord;
void M_SetMenuDelay(UINT8 i);
void Moviemode_mode_Onchange(void);
void Screenshot_option_Onchange(void);
void Addons_option_Onchange(void);
void M_SortServerList(void);

View file

@ -112,18 +112,11 @@ typedef off_t off64_t;
#endif
#endif
static CV_PossibleValue_t screenshot_cons_t[] = {{0, "Default"}, {1, "HOME"}, {2, "SRB2"}, {3, "CUSTOM"}, {0, NULL}};
consvar_t cv_screenshot_option = CVAR_INIT ("screenshot_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Screenshot_option_Onchange);
consvar_t cv_screenshot_folder = CVAR_INIT ("screenshot_folder", "", CV_SAVE, NULL, NULL);
consvar_t cv_screenshot_colorprofile = CVAR_INIT ("screenshot_colorprofile", "Yes", CV_SAVE, CV_YesNo, NULL);
static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {MM_AVRECORDER, "WebM"}, {0, NULL}};
consvar_t cv_moviemode = CVAR_INIT ("moviemode_mode", "WebM", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange);
consvar_t cv_movie_option = CVAR_INIT ("movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange);
consvar_t cv_movie_folder = CVAR_INIT ("movie_folder", "", CV_SAVE, NULL, NULL);
static CV_PossibleValue_t zlib_mem_level_t[] = {
{1, "(Min Memory) 1"},
{2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"},
@ -1331,20 +1324,9 @@ void M_StartMovie(void)
if (moviemode)
return;
if (cv_movie_option.value == 0)
strcpy(pathname, usehome ? srb2home : srb2path);
else if (cv_movie_option.value == 1)
strcpy(pathname, srb2home);
else if (cv_movie_option.value == 2)
strcpy(pathname, srb2path);
else if (cv_movie_option.value == 3 && *cv_movie_folder.string != '\0')
strcpy(pathname, cv_movie_folder.string);
if (cv_movie_option.value != 3)
{
strcat(pathname, PATHSEP "media" PATHSEP "movies" PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
}
strcpy(pathname, srb2home);
strcat(pathname, PATHSEP "media" PATHSEP "movies" PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
if (rendermode == render_none)
I_Error("Can't make a movie without a render system\n");
@ -1799,20 +1781,9 @@ void M_DoScreenShot(UINT32 width, UINT32 height, tcb::span<const std::byte> data
if (rendermode == render_none)
return;
if (cv_screenshot_option.value == 0)
strcpy(pathname, usehome ? srb2home : srb2path);
else if (cv_screenshot_option.value == 1)
strcpy(pathname, srb2home);
else if (cv_screenshot_option.value == 2)
strcpy(pathname, srb2path);
else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0')
strcpy(pathname, cv_screenshot_folder.string);
if (cv_screenshot_option.value != 3)
{
strcat(pathname, PATHSEP "media" PATHSEP "screenshots" PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
}
strcpy(pathname, srb2home);
strcat(pathname, PATHSEP "media" PATHSEP "screenshots" PATHSEP);
M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755);
#ifdef USE_PNG
freename = Newsnapshotfile(pathname,"png");

View file

@ -42,8 +42,8 @@ typedef enum {
} moviemode_t;
extern moviemode_t moviemode;
extern consvar_t cv_screenshot_option, cv_screenshot_folder, cv_screenshot_colorprofile;
extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option;
extern consvar_t cv_screenshot_colorprofile;
extern consvar_t cv_moviemode;
extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits;
extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa;
extern consvar_t cv_apng_delay, cv_apng_downscale;

View file

@ -43,17 +43,7 @@ void M_Addons(INT32 choice)
(void)choice;
#if 1
if (cv_addons_option.value == 0)
pathname = addonsdir;
else if (cv_addons_option.value == 1)
pathname = srb2home;
else if (cv_addons_option.value == 2)
pathname = srb2path;
else
#endif
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
pathname = cv_addons_folder.string;
pathname = addonsdir;
strlcpy(menupath, pathname, 1024);
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath) + 1;
@ -86,7 +76,7 @@ char *M_AddonsHeaderPath(void)
UINT32 len;
static char header[1024];
strlcpy(header, va("%s folder%s", cv_addons_option.string, menupath+menupathindex[menudepth-1]-1), 1024);
strlcpy(header, va("addons%s", menupath+menupathindex[menudepth-1]-1), 1024);
len = strlen(header);
if (len > 34)
{

View file

@ -101,10 +101,7 @@ void M_InitOptions(INT32 choice)
OPTIONS_MainDef.prevMenu = currentMenu;
// This will disable or enable the textboxes of the affected menus before we get to them.
Screenshot_option_Onchange();
Moviemode_mode_Onchange();
Moviemode_option_Onchange();
Addons_option_Onchange();
M_SetupNextMenu(&OPTIONS_MainDef, false);
}

View file

@ -10,12 +10,6 @@ menuitem_t OPTIONS_DataAddon[] =
{IT_HEADER, "MENU", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Location", "Where to start searching addons from in the menu.",
NULL, {.cvar = &cv_addons_option}, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to start searching from if the location is set to custom.",
NULL, {.cvar = &cv_addons_folder}, 24, 0},
{IT_STRING | IT_CVAR, "Identify Addons via", "Set whether to consider the extension or contents of a file.",
NULL, {.cvar = &cv_addons_md5}, 0, 0},
@ -51,11 +45,3 @@ menu_t OPTIONS_DataAddonDef = {
NULL,
NULL,
};
void Addons_option_Onchange(void)
{
// Option 2 will always be the textbar.
// (keep in mind this is a 0 indexed array and the first element is a header...)
OPTIONS_DataAddon[2].status =
(cv_addons_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
}

View file

@ -9,19 +9,6 @@
menuitem_t OPTIONS_DataScreenshot[] =
{
{IT_HEADER, "SCREENSHOTS (F8)", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Storage Location", "Sets where to store screenshots.",
NULL, {.cvar = &cv_screenshot_option}, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to save screenshots in.",
NULL, {.cvar = &cv_screenshot_folder}, 24, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
{IT_HEADER, "MOVIE RECORDING (F9)", NULL,
NULL, {NULL}, 0, 0},
@ -35,12 +22,6 @@ menuitem_t OPTIONS_DataScreenshot[] =
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
#endif
{IT_STRING | IT_CVAR, "Storage Location", "Sets where to store movies.",
NULL, {.cvar = &cv_movie_option}, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to save videos in.",
NULL, {.cvar = &cv_movie_folder}, 24, 0},
};
menu_t OPTIONS_DataScreenshotDef = {
@ -59,46 +40,9 @@ menu_t OPTIONS_DataScreenshotDef = {
NULL,
};
void Screenshot_option_Onchange(void)
{
// Screenshot opt is at #3, 0 based array obv.
OPTIONS_DataScreenshot[2].status =
(cv_screenshot_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
}
void Moviemode_mode_Onchange(void)
{
// opt 7 in a 0 based array, you get the idea...
OPTIONS_DataScreenshot[6].status =
// opt 3 in a 0 based array, you get the idea...
OPTIONS_DataScreenshot[2].status =
(cv_moviemode.value == MM_AVRECORDER ? IT_CVAR|IT_STRING : IT_DISABLED);
#if 0
INT32 i, cstart, cend;
for (i = op_screenshot_gif_start; i <= op_screenshot_apng_end; ++i)
OP_ScreenshotOptionsMenu[i].status = IT_DISABLED;
switch (cv_moviemode.value)
{
case MM_GIF:
cstart = op_screenshot_gif_start;
cend = op_screenshot_gif_end;
break;
case MM_APNG:
cstart = op_screenshot_apng_start;
cend = op_screenshot_apng_end;
break;
default:
return;
}
for (i = cstart; i <= cend; ++i)
OP_ScreenshotOptionsMenu[i].status = IT_STRING|IT_CVAR;
#endif
}
void Moviemode_option_Onchange(void)
{
// opt 9 in a 0 based array, you get the idea...
OPTIONS_DataScreenshot[8].status =
(cv_movie_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
}