diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e95d0792c..55ac67720 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -154,6 +154,7 @@ static void Command_Playdemo_f(void); static void Command_Timedemo_f(void); static void Command_Stopdemo_f(void); static void Command_StartMovie_f(void); +static void Command_StartLossless_f(void); static void Command_StopMovie_f(void); static void Command_Map_f(void); static void Command_RandomMap(void); @@ -891,11 +892,12 @@ void D_RegisterClientCommands(void) COM_AddCommand("screenshot", M_ScreenShot); COM_AddCommand("startmovie", Command_StartMovie_f); + COM_AddCommand("startlossless", Command_StartLossless_f); COM_AddCommand("stopmovie", Command_StopMovie_f); COM_AddCommand("minigen", M_MinimapGenerate); CV_RegisterVar(&cv_screenshot_colorprofile); - CV_RegisterVar(&cv_moviemode); + CV_RegisterVar(&cv_lossless_recorder); #ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES M_AVRecorder_AddCommands(); @@ -2503,7 +2505,12 @@ static void Command_Stopdemo_f(void) static void Command_StartMovie_f(void) { - M_StartMovie(); + M_StartMovie(MM_AVRECORDER); +} + +static void Command_StartLossless_f(void) +{ + M_StartMovie(cv_lossless_recorder.value); } static void Command_StopMovie_f(void) diff --git a/src/k_menu.h b/src/k_menu.h index 305722615..caefb7eba 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -561,8 +561,6 @@ extern consvar_t cv_autorecord; void M_SetMenuDelay(UINT8 i); -void Moviemode_mode_Onchange(void); - void M_SortServerList(void); void M_MapMenuControls(event_t *ev); diff --git a/src/m_misc.cpp b/src/m_misc.cpp index f50962e0c..a8c6ccf0c 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -114,8 +114,8 @@ typedef off_t off64_t; 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); +static CV_PossibleValue_t lossless_recorder_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}}; +consvar_t cv_lossless_recorder = CVAR_INIT ("lossless_recorder", "GIF", CV_SAVE, lossless_recorder_cons_t, NULL); static CV_PossibleValue_t zlib_mem_level_t[] = { {1, "(Min Memory) 1"}, @@ -1316,22 +1316,36 @@ static inline moviemode_t M_StartMovieAVRecorder(const char *pathname) #endif } -void M_StartMovie(void) +void M_StartMovie(moviemode_t mode) { #if NUMSCREENS > 2 + const char *folder; char pathname[MAX_WADPATH]; if (moviemode) return; - strcpy(pathname, srb2home); - strcat(pathname, PATHSEP "media" PATHSEP "movies" PATHSEP); + switch (mode) + { + case MM_GIF: + folder = "gifs"; + break; + + case MM_AVRECORDER: + folder = "movies"; + break; + + default: + folder = "slideshows"; + } + + sprintf(pathname, "%s" PATHSEP "media" PATHSEP "%s" PATHSEP, srb2home, folder); M_MkdirEach(pathname, M_PathParts(pathname) - 2, 0755); if (rendermode == render_none) I_Error("Can't make a movie without a render system\n"); - switch (cv_moviemode.value) + switch (mode) { case MM_GIF: moviemode = M_StartMovieGIF(pathname); @@ -1842,12 +1856,38 @@ boolean M_ScreenshotResponder(event_t *ev) if (ch >= NUMKEYS && menuactive) // If it's not a keyboard key, then don't allow it in the menus! return false; - if (ch == KEY_F8 /*|| ch == gamecontrol[0][gc_screenshot][0] || ch == gamecontrol[0][gc_screenshot][1]*/) // remappable F8 + switch (ch) + { + case KEY_F8: M_ScreenShot(); - else if (ch == KEY_F9 /*|| ch == gamecontrol[0][gc_recordgif][0] || ch == gamecontrol[0][gc_recordgif][1]*/) // remappable F9 - ((moviemode) ? M_StopMovie : M_StartMovie)(); - else + break; + + case KEY_F9: + if (moviemode) + { + M_StopMovie(); + } + else + { + M_StartMovie(MM_AVRECORDER); + } + break; + + case KEY_F10: + if (moviemode) + { + M_StopMovie(); + } + else + { + M_StartMovie(static_cast(cv_lossless_recorder.value)); + } + break; + + default: return false; + } + return true; } diff --git a/src/m_misc.h b/src/m_misc.h index 45a35d149..f11617612 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -43,12 +43,12 @@ typedef enum { extern moviemode_t moviemode; extern consvar_t cv_screenshot_colorprofile; -extern consvar_t cv_moviemode; +extern consvar_t cv_lossless_recorder; 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; -void M_StartMovie(void); +void M_StartMovie(moviemode_t mode); void M_LegacySaveFrame(void); void M_StopMovie(void); diff --git a/src/menus/options-1.c b/src/menus/options-1.c index 0d2cdb341..b853c89a6 100644 --- a/src/menus/options-1.c +++ b/src/menus/options-1.c @@ -100,9 +100,6 @@ void M_InitOptions(INT32 choice) // So that pause doesn't go to the main menu... OPTIONS_MainDef.prevMenu = currentMenu; - // This will disable or enable the textboxes of the affected menus before we get to them. - Moviemode_mode_Onchange(); - M_SetupNextMenu(&OPTIONS_MainDef, false); } diff --git a/src/menus/options-data-screenshots.c b/src/menus/options-data-screenshots.c index 1693c9400..d67c2dc5e 100644 --- a/src/menus/options-data-screenshots.c +++ b/src/menus/options-data-screenshots.c @@ -9,19 +9,23 @@ menuitem_t OPTIONS_DataScreenshot[] = { +#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES {IT_HEADER, "MOVIE RECORDING (F9)", NULL, NULL, {NULL}, 0, 0}, - {IT_STRING | IT_CVAR, "Recording Format", "What file format will movies will be recorded in?", - NULL, {.cvar = &cv_moviemode}, 0, 0}, - -#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES {IT_STRING | IT_CVAR, "Real-Time Data", "If enabled, shows fps, duration and filesize of recording in real-time.", NULL, {.cvar = &cv_movie_showfps}, 0, 0}, -#else - {IT_SPACE | IT_NOTHING, NULL, NULL, - NULL, {NULL}, 0, 0}, #endif + + {IT_SPACE | IT_NOTHING, NULL, NULL, + NULL, {NULL}, 0, 0}, + + {IT_HEADER, "LOSSLESS RECORDING (F10)", NULL, + NULL, {NULL}, 0, 0}, + + {IT_STRING | IT_CVAR, "Recording Format", "What file format will lossless recordings use?", + NULL, {.cvar = &cv_lossless_recorder}, 0, 0}, + }; menu_t OPTIONS_DataScreenshotDef = { @@ -39,10 +43,3 @@ menu_t OPTIONS_DataScreenshotDef = { NULL, NULL, }; - -void Moviemode_mode_Onchange(void) -{ - // 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); -}