added MakeScreenShot and MakeAutoSave functions to FLevelLocals

This commit is contained in:
Alexander 2019-03-03 12:01:00 +07:00 committed by Christoph Oelckers
parent 525b0214a7
commit 77cb9ae866
5 changed files with 27 additions and 2 deletions

View file

@ -108,6 +108,7 @@ CVAR (Bool, storesavepic, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR (Bool, enablescriptscreenshot, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
EXTERN_CVAR (Float, con_midtime); EXTERN_CVAR (Float, con_midtime);
//========================================================================== //==========================================================================
@ -1715,7 +1716,7 @@ void G_DoPlayerPop(int playernum)
players[playernum].DestroyPSprites(); players[playernum].DestroyPSprites();
} }
void G_ScreenShot (char *filename) void G_ScreenShot (const char *filename)
{ {
shotfile = filename; shotfile = filename;
gameaction = ga_screenshot; gameaction = ga_screenshot;
@ -2876,6 +2877,26 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, StartSlideshow)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION(FLevelLocals, MakeScreenShot)
{
if (enablescriptscreenshot)
{
G_ScreenShot("");
}
return 0;
}
void G_MakeAutoSave()
{
gameaction = ga_autosave;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, MakeAutoSave)
{
G_MakeAutoSave();
return 0;
}
DEFINE_GLOBAL(players) DEFINE_GLOBAL(players)
DEFINE_GLOBAL(playeringame) DEFINE_GLOBAL(playeringame)
DEFINE_GLOBAL(PlayerClasses) DEFINE_GLOBAL(PlayerClasses)

View file

@ -95,7 +95,7 @@ bool G_CheckDemoStatus (void);
void G_Ticker (void); void G_Ticker (void);
bool G_Responder (event_t* ev); bool G_Responder (event_t* ev);
void G_ScreenShot (char *filename); void G_ScreenShot (const char* filename);
void G_StartSlideshow(FLevelLocals *Level, FName whichone); void G_StartSlideshow(FLevelLocals *Level, FName whichone);
FString G_BuildSaveName (const char *prefix, int slot); FString G_BuildSaveName (const char *prefix, int slot);

View file

@ -1986,6 +1986,7 @@ MISCMNU_ALLCHEATS = "Enable cheats from all games";
MISCMNU_ENABLEAUTOSAVES = "Enable autosaves"; MISCMNU_ENABLEAUTOSAVES = "Enable autosaves";
MISCMNU_AUTOSAVECOUNT = "Number of autosaves"; MISCMNU_AUTOSAVECOUNT = "Number of autosaves";
MISCMNU_SAVELOADCONFIRMATION = "Save/Load confirmation"; MISCMNU_SAVELOADCONFIRMATION = "Save/Load confirmation";
MISCMNU_ENABLESCRIPTSCREENSHOTS = "Enable making screenshots by scripts";
MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps"; MISCMNU_DEHLOAD = "Load *.deh/*.bex lumps";
MISCMNU_CACHENODES = "Cache nodes"; MISCMNU_CACHENODES = "Cache nodes";
MISCMNU_CACHETIME = "Time threshold for node caching"; MISCMNU_CACHETIME = "Time threshold for node caching";

View file

@ -1131,6 +1131,7 @@ OptionMenu "MiscOptions" protected
Option "$MISCMNU_SAVELOADCONFIRMATION", "saveloadconfirmation", "OnOff" Option "$MISCMNU_SAVELOADCONFIRMATION", "saveloadconfirmation", "OnOff"
Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0 Slider "$MISCMNU_AUTOSAVECOUNT", "autosavecount", 1, 20, 1, 0
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt" Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
Option "$MISCMNU_ENABLESCRIPTSCREENSHOTS", "enablescriptscreenshot", "OnOff"
Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn" Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn"
StaticText " " StaticText " "
Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff" Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff"

View file

@ -711,6 +711,8 @@ struct LevelLocals native
native play int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0); native play int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true); native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
native void StartSlideshow(Name whichone = 'none'); native void StartSlideshow(Name whichone = 'none');
native static void MakeScreenShot();
native static void MakeAutoSave();
native void WorldDone(); native void WorldDone();
deprecated("3.8") static void RemoveAllBots(bool fromlist) { /* intentionally left as no-op. */ } deprecated("3.8") static void RemoveAllBots(bool fromlist) { /* intentionally left as no-op. */ }
native ui Vector2 GetAutomapPosition(); native ui Vector2 GetAutomapPosition();