Added recordmap for recording demos from console

recordmap <filename> <map name>
Starts a new game from the specified map recording to the specified
filename
This commit is contained in:
Edward Richardson 2014-11-01 17:47:29 +13:00
parent 31611c17d5
commit eceb37aa64
5 changed files with 60 additions and 0 deletions

View file

@ -61,6 +61,7 @@ typedef enum
ga_loadlevel,
ga_newgame,
ga_newgame2,
ga_recordgame,
ga_loadgame,
ga_loadgamehidecon,
ga_loadgameplaydemo,

View file

@ -1338,6 +1338,7 @@ CCMD (endgame)
{
gameaction = ga_fullconsole;
demosequence = -1;
G_CheckDemoStatus();
}
}

View file

@ -136,6 +136,8 @@ extern int consoleplayer;
// Disable save/end game?
extern bool usergame;
extern FString newdemoname;
extern FString newdemomap;
extern bool demoplayback;
extern bool demorecording;
extern int demover;

View file

@ -162,6 +162,8 @@ int consoleplayer; // player taking events
int gametic;
CVAR(Bool, demo_compress, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
FString newdemoname;
FString newdemomap;
FString demoname;
bool demorecording;
bool demoplayback;
@ -1048,6 +1050,10 @@ void G_Ticker ()
case ga_loadlevel:
G_DoLoadLevel (-1, false);
break;
case ga_recordgame:
G_CheckDemoStatus();
G_RecordDemo(newdemoname);
G_BeginRecording(newdemomap);
case ga_newgame2: // Silence GCC (see above)
case ga_newgame:
G_DoNewGame ();
@ -2434,6 +2440,16 @@ void G_DeferedPlayDemo (const char *name)
CCMD (playdemo)
{
if (netgame)
{
Printf("End your current netgame first!");
return;
}
if (demorecording)
{
Printf("End your current demo first!");
return;
}
if (argv.argc() > 1)
{
G_DeferedPlayDemo (argv[1]);

View file

@ -199,6 +199,46 @@ CCMD (map)
//
//==========================================================================
CCMD(recordmap)
{
if (netgame)
{
Printf("You cannot record a new game while in a netgame.");
return;
}
if (argv.argc() > 2)
{
try
{
if (!P_CheckMapData(argv[2]))
{
Printf("No map %s\n", argv[2]);
}
else
{
G_DeferedInitNew(argv[2]);
gameaction = ga_recordgame;
newdemoname = argv[1];
newdemomap = argv[2];
}
}
catch (CRecoverableError &error)
{
if (error.GetMessage())
Printf("%s", error.GetMessage());
}
}
else
{
Printf("Usage: recordmap <filename> <map name>\n");
}
}
//==========================================================================
//
//
//==========================================================================
CCMD (open)
{
if (netgame)