Make demosaves more robust (fixes #167)
This commit is contained in:
parent
8b777cb251
commit
4a735d7d66
3 changed files with 36 additions and 4 deletions
|
|
@ -4110,7 +4110,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
CON_LogMessage(M_GetText("Speeding off to level...\n"));
|
||||
}
|
||||
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savemode = (G_DemoWillAutoSave()) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savebutton = 0;
|
||||
|
||||
// clear this demo before recording a new one
|
||||
|
|
|
|||
30
src/g_demo.c
30
src/g_demo.c
|
|
@ -56,8 +56,15 @@
|
|||
#include "k_grandprix.h"
|
||||
#include "k_vote.h"
|
||||
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
consvar_t cv_recordmultiplayerdemos = CVAR_INIT ("netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL);
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {
|
||||
{DEMOSAVE_NONE, "Disabled"},
|
||||
{DEMOSAVE_MANUAL, "Manual Save"},
|
||||
{DEMOSAVE_AUTO_NETONLY, "Auto Save Online"},
|
||||
{DEMOSAVE_AUTO, "Auto Save All"},
|
||||
{0, NULL}};
|
||||
|
||||
consvar_t cv_recordmultiplayerdemos =
|
||||
CVAR_INIT("netdemo_record", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL);
|
||||
|
||||
static CV_PossibleValue_t netdemosyncquality_cons_t[] = {{1, "MIN"}, {35, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_netdemosyncquality = CVAR_INIT ("netdemo_syncquality", "1", CV_SAVE, netdemosyncquality_cons_t, NULL);
|
||||
|
|
@ -190,6 +197,23 @@ static ticcmd_t oldcmd[MAXPLAYERS];
|
|||
#define FZT_SCALE 0x10 // different scale to object
|
||||
// spare FZT slots 0x20 to 0x80
|
||||
|
||||
//
|
||||
// Checks if auto-saving demos is allowed.
|
||||
//
|
||||
boolean G_DemoWillAutoSave(void)
|
||||
{
|
||||
if (cv_recordmultiplayerdemos.value == DEMOSAVE_AUTO_NETONLY)
|
||||
{
|
||||
return (netgame);
|
||||
}
|
||||
else if (cv_recordmultiplayerdemos.value == DEMOSAVE_AUTO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
|
|
@ -4614,7 +4638,7 @@ boolean G_DemoTitleResponder(event_t *ev)
|
|||
// Only ESC and non-keyboard keys abort connection
|
||||
if (ch == KEY_ESCAPE)
|
||||
{
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savemode = (G_DemoWillAutoSave()) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@ extern "C" {
|
|||
// DEMO playback/recording related stuff.
|
||||
// ======================================
|
||||
|
||||
typedef enum {
|
||||
DEMOSAVE_NONE = 0,
|
||||
DEMOSAVE_MANUAL,
|
||||
DEMOSAVE_AUTO_NETONLY,
|
||||
DEMOSAVE_AUTO
|
||||
} demosavemode_e;
|
||||
|
||||
extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_netdemosize;
|
||||
extern consvar_t cv_resyncdemo;
|
||||
|
||||
|
|
@ -183,6 +190,7 @@ extern demoghost *ghosts;
|
|||
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
|
||||
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
|
||||
|
||||
boolean G_DemoWillAutoSave(void);
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_SetupDemoPlayer(INT32 i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue