After discussion with Mystic and Rob, you now keep your lives, score and emerald count when changing maps in Co-op mode. Reset when you declare -force.

This commit is contained in:
toasterbabe 2017-02-01 21:31:35 +00:00
parent 8625c8bfbd
commit 05ebc93f6c
3 changed files with 27 additions and 25 deletions

View File

@ -1537,7 +1537,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);
if (netgame || multiplayer)
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
FLS = false;
if (delay != 2)
@ -1703,9 +1703,19 @@ static void Command_Map_f(void)
}
}
// Prevent warping to locked levels
// ... unless you're in a dedicated server. Yes, technically this means you can view any level by
// running a dedicated server and joining it yourself, but that's better than making dedicated server's
// lives hell.
if (!dedicated && M_MapLocked(newmapnum))
{
CONS_Alert(CONS_NOTICE, M_GetText("You need to unlock this level before you can warp to it!\n"));
return;
}
// don't use a gametype the map doesn't support
if (cv_debug || COM_CheckParm("-force") || cv_skipmapcheck.value)
; // The player wants us to trek on anyway. Do so.
fromlevelselect = false; // The player wants us to trek on anyway. Do so.
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
// Alternatively, bail if the map header is completely missing anyway.
else if (!mapheaderinfo[newmapnum-1]
@ -1724,19 +1734,10 @@ static void Command_Map_f(void)
CONS_Alert(CONS_WARNING, M_GetText("%s doesn't support %s mode!\n(Use -force to override)\n"), mapname, gametypestring);
return;
}
else
fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP)));
// Prevent warping to locked levels
// ... unless you're in a dedicated server. Yes, technically this means you can view any level by
// running a dedicated server and joining it yourself, but that's better than making dedicated server's
// lives hell.
if (!dedicated && M_MapLocked(newmapnum))
{
CONS_Alert(CONS_NOTICE, M_GetText("You need to unlock this level before you can warp to it!\n"));
return;
}
fromlevelselect = false;
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, false);
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);
}
/** Receives a map command and changes the map.
@ -1802,17 +1803,14 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (demoplayback && !timingdemo)
precache = false;
if (resetplayer)
{
if (!FLS || (netgame || multiplayer))
emeralds = 0;
}
if (resetplayer && !FLS)
emeralds = 0;
#ifdef HAVE_BLUA
LUAh_MapChange();
#endif
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene);
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo)
precache = true;
CON_ToggleOff();

View File

@ -3541,7 +3541,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
// This is the map command interpretation something like Command_Map_f
//
// called at: map cmd execution, doloadgame, doplaydemo
void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean skipprecutscene)
void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean skipprecutscene, boolean FLS)
{
INT32 i;
@ -3571,7 +3571,8 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
if (netgame || multiplayer)
{
players[i].lives = cv_startinglives.value;
if (!FLS || (players[i].lives < cv_startinglives.value))
players[i].lives = cv_startinglives.value;
players[i].continues = 0;
}
else if (pultmode)
@ -3585,13 +3586,16 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
players[i].continues = 1;
}
if (!((netgame || multiplayer) && (FLS)))
players[i].score = 0;
// The latter two should clear by themselves, but just in case
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
// Clear cheatcodes too, just in case.
players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
players[i].score = players[i].xtralife = 0;
players[i].xtralife = 0;
}
// Reset unlockable triggers
@ -5142,7 +5146,7 @@ void G_DoPlayDemo(char *defdemoname)
memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true;
P_SetRandSeed(randseed);
G_InitNew(false, G_BuildMapName(gamemap), true, true);
G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
// Set skin
SetPlayerSkin(0, skin);

View File

@ -89,7 +89,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo);
void G_DoReborn(INT32 playernum);
void G_PlayerReborn(INT32 player);
void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer,
boolean skipprecutscene);
boolean skipprecutscene, boolean FLS);
char *G_BuildMapTitle(INT32 mapnum);
// XMOD spawning