- Extended map, recordmap, and open commands to accept "dm/coop" as an extra parameter - to open maps in multiplayer mode with the requested ruleset.

This commit is contained in:
Rachael Alexanderson 2016-11-01 03:30:59 -04:00 committed by Christoph Oelckers
parent 6e0defdc69
commit f72ebe6768
3 changed files with 41 additions and 4 deletions

View file

@ -71,6 +71,9 @@ extern bool netgame;
// Bot game? Like netgame, but doesn't involve network communication.
extern bool multiplayer;
// [SP] MPMap implementation - invokes fake multiplayer without bots
extern bool multiplayernext;
// Flag: true only if started as net deathmatch.
EXTERN_CVAR (Int, deathmatch)

View file

@ -164,6 +164,7 @@ bool viewactive;
bool netgame; // only true if packets are broadcast
bool multiplayer;
bool multiplayernext = false; // [SP] MPMap implementation
player_t players[MAXPLAYERS];
bool playeringame[MAXPLAYERS];

View file

@ -90,6 +90,8 @@
#include "g_hub.h"
#include <string.h>
void STAT_StartNewGame(const char *lev);
void STAT_ChangeLevel(const char *newl);
@ -181,6 +183,16 @@ CCMD (map)
}
else
{
if (argv.argc() > 2 && strcmp(argv[2], "coop") == 0)
{
deathmatch = false;
multiplayernext = true;
}
else if (argv.argc() > 2 && strcmp(argv[2], "dm") == 0)
{
deathmatch = true;
multiplayernext = true;
}
G_DeferedInitNew (argv[1]);
}
}
@ -192,7 +204,7 @@ CCMD (map)
}
else
{
Printf ("Usage: map <map name>\n");
Printf ("Usage: map <map name> [coop|dm]\n");
}
}
@ -218,6 +230,16 @@ CCMD(recordmap)
}
else
{
if (argv.argc() > 3 && strcmp(argv[3], "coop") == 0)
{
deathmatch = false;
multiplayernext = true;
}
else if (argv.argc() > 3 && strcmp(argv[3], "dm") == 0)
{
deathmatch = true;
multiplayernext = true;
}
G_DeferedInitNew(argv[2]);
gameaction = ga_recordgame;
newdemoname = argv[1];
@ -232,7 +254,7 @@ CCMD(recordmap)
}
else
{
Printf("Usage: recordmap <filename> <map name>\n");
Printf("Usage: recordmap <filename> <map name> [coop|dm]\n");
}
}
@ -258,13 +280,23 @@ CCMD (open)
}
else
{
if (argv.argc() > 2 && strcmp(argv[2], "coop") == 0)
{
deathmatch = false;
multiplayernext = true;
}
else if (argv.argc() > 2 && strcmp(argv[2], "dm") == 0)
{
deathmatch = true;
multiplayernext = true;
}
gameaction = ga_newgame2;
d_skill = -1;
}
}
else
{
Printf ("Usage: open <map file>\n");
Printf ("Usage: open <map file> [coop|dm]\n");
}
}
@ -293,7 +325,8 @@ void G_NewInit ()
G_ClearSnapshots ();
ST_SetNeedRefresh();
netgame = false;
multiplayer = false;
multiplayer = multiplayernext;
multiplayernext = false;
if (demoplayback)
{
C_RestoreCVars ();