mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 16:40:56 +00:00
- Corrected syntax error messages for mpmap, mpopen, mprecordmap
- Added initial state for "multiplayernext" to prevent possible initialization errors. - Implemented "mpmap", "mpopen", and "mprecordmap". All 3 commands do exactly as their non-"mp" counterparts do, except they turn on multiplayer (botmode) emulation before doing so.
This commit is contained in:
parent
43b2584f79
commit
bc319dce1d
3 changed files with 119 additions and 1 deletions
|
@ -71,6 +71,9 @@ extern bool netgame;
|
||||||
// Bot game? Like netgame, but doesn't involve network communication.
|
// Bot game? Like netgame, but doesn't involve network communication.
|
||||||
extern bool multiplayer;
|
extern bool multiplayer;
|
||||||
|
|
||||||
|
// [SP] MPMap implementation - invokes fake multiplayer without bots
|
||||||
|
extern bool multiplayernext;
|
||||||
|
|
||||||
// Flag: true only if started as net deathmatch.
|
// Flag: true only if started as net deathmatch.
|
||||||
EXTERN_CVAR (Int, deathmatch)
|
EXTERN_CVAR (Int, deathmatch)
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,7 @@ bool viewactive;
|
||||||
|
|
||||||
bool netgame; // only true if packets are broadcast
|
bool netgame; // only true if packets are broadcast
|
||||||
bool multiplayer;
|
bool multiplayer;
|
||||||
|
bool multiplayernext = false; // [SP] MPMap implementation
|
||||||
player_t players[MAXPLAYERS];
|
player_t players[MAXPLAYERS];
|
||||||
bool playeringame[MAXPLAYERS];
|
bool playeringame[MAXPLAYERS];
|
||||||
|
|
||||||
|
|
116
src/g_level.cpp
116
src/g_level.cpp
|
@ -268,6 +268,119 @@ CCMD (open)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CCMD (mpmap)
|
||||||
|
{
|
||||||
|
if (netgame)
|
||||||
|
{
|
||||||
|
Printf ("Use " TEXTCOLOR_BOLD "changemap" TEXTCOLOR_NORMAL " instead. " TEXTCOLOR_BOLD "Map"
|
||||||
|
TEXTCOLOR_NORMAL " is for single-player only.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (argv.argc() > 1)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!P_CheckMapData(argv[1]))
|
||||||
|
{
|
||||||
|
Printf ("No map %s\n", argv[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
multiplayernext = true;
|
||||||
|
G_DeferedInitNew (argv[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(CRecoverableError &error)
|
||||||
|
{
|
||||||
|
if (error.GetMessage())
|
||||||
|
Printf("%s", error.GetMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf ("Usage: mpmap <map name>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CCMD(mprecordmap)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
multiplayernext = true;
|
||||||
|
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: mprecordmap <filename> <map name>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CCMD (mpopen)
|
||||||
|
{
|
||||||
|
if (netgame)
|
||||||
|
{
|
||||||
|
Printf ("You cannot use open in multiplayer games.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (argv.argc() > 1)
|
||||||
|
{
|
||||||
|
d_mapname = "file:";
|
||||||
|
d_mapname += argv[1];
|
||||||
|
if (!P_CheckMapData(d_mapname))
|
||||||
|
{
|
||||||
|
Printf ("No map %s\n", d_mapname.GetChars());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameaction = ga_newgame2;
|
||||||
|
d_skill = -1;
|
||||||
|
multiplayernext = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf ("Usage: mpopen <map file>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -293,7 +406,8 @@ void G_NewInit ()
|
||||||
G_ClearSnapshots ();
|
G_ClearSnapshots ();
|
||||||
ST_SetNeedRefresh();
|
ST_SetNeedRefresh();
|
||||||
netgame = false;
|
netgame = false;
|
||||||
multiplayer = false;
|
multiplayer = multiplayernext;
|
||||||
|
multiplayernext = false;
|
||||||
if (demoplayback)
|
if (demoplayback)
|
||||||
{
|
{
|
||||||
C_RestoreCVars ();
|
C_RestoreCVars ();
|
||||||
|
|
Loading…
Reference in a new issue