mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 13:10:55 +00:00
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:
parent
8625c8bfbd
commit
05ebc93f6c
3 changed files with 27 additions and 25 deletions
|
@ -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",
|
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);
|
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);
|
||||||
|
|
||||||
if (netgame || multiplayer)
|
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
|
||||||
FLS = false;
|
FLS = false;
|
||||||
|
|
||||||
if (delay != 2)
|
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
|
// don't use a gametype the map doesn't support
|
||||||
if (cv_debug || COM_CheckParm("-force") || cv_skipmapcheck.value)
|
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
|
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||||
// Alternatively, bail if the map header is completely missing anyway.
|
// Alternatively, bail if the map header is completely missing anyway.
|
||||||
else if (!mapheaderinfo[newmapnum-1]
|
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);
|
CONS_Alert(CONS_WARNING, M_GetText("%s doesn't support %s mode!\n(Use -force to override)\n"), mapname, gametypestring);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP)));
|
||||||
|
|
||||||
// Prevent warping to locked levels
|
D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect);
|
||||||
// ... 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Receives a map command and changes the map.
|
/** Receives a map command and changes the map.
|
||||||
|
@ -1802,17 +1803,14 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||||
if (demoplayback && !timingdemo)
|
if (demoplayback && !timingdemo)
|
||||||
precache = false;
|
precache = false;
|
||||||
|
|
||||||
if (resetplayer)
|
if (resetplayer && !FLS)
|
||||||
{
|
emeralds = 0;
|
||||||
if (!FLS || (netgame || multiplayer))
|
|
||||||
emeralds = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
LUAh_MapChange();
|
LUAh_MapChange();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene);
|
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
|
||||||
if (demoplayback && !timingdemo)
|
if (demoplayback && !timingdemo)
|
||||||
precache = true;
|
precache = true;
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
|
|
12
src/g_game.c
12
src/g_game.c
|
@ -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
|
// This is the map command interpretation something like Command_Map_f
|
||||||
//
|
//
|
||||||
// called at: map cmd execution, doloadgame, doplaydemo
|
// 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;
|
INT32 i;
|
||||||
|
|
||||||
|
@ -3571,7 +3571,8 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
|
|
||||||
if (netgame || multiplayer)
|
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;
|
players[i].continues = 0;
|
||||||
}
|
}
|
||||||
else if (pultmode)
|
else if (pultmode)
|
||||||
|
@ -3585,13 +3586,16 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
players[i].continues = 1;
|
players[i].continues = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!((netgame || multiplayer) && (FLS)))
|
||||||
|
players[i].score = 0;
|
||||||
|
|
||||||
// The latter two should clear by themselves, but just in case
|
// The latter two should clear by themselves, but just in case
|
||||||
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
||||||
|
|
||||||
// Clear cheatcodes too, just in case.
|
// Clear cheatcodes too, just in case.
|
||||||
players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
|
players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
|
||||||
|
|
||||||
players[i].score = players[i].xtralife = 0;
|
players[i].xtralife = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset unlockable triggers
|
// Reset unlockable triggers
|
||||||
|
@ -5142,7 +5146,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
memset(playeringame,0,sizeof(playeringame));
|
memset(playeringame,0,sizeof(playeringame));
|
||||||
playeringame[0] = true;
|
playeringame[0] = true;
|
||||||
P_SetRandSeed(randseed);
|
P_SetRandSeed(randseed);
|
||||||
G_InitNew(false, G_BuildMapName(gamemap), true, true);
|
G_InitNew(false, G_BuildMapName(gamemap), true, true, false);
|
||||||
|
|
||||||
// Set skin
|
// Set skin
|
||||||
SetPlayerSkin(0, skin);
|
SetPlayerSkin(0, skin);
|
||||||
|
|
|
@ -89,7 +89,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo);
|
||||||
void G_DoReborn(INT32 playernum);
|
void G_DoReborn(INT32 playernum);
|
||||||
void G_PlayerReborn(INT32 player);
|
void G_PlayerReborn(INT32 player);
|
||||||
void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer,
|
void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer,
|
||||||
boolean skipprecutscene);
|
boolean skipprecutscene, boolean FLS);
|
||||||
char *G_BuildMapTitle(INT32 mapnum);
|
char *G_BuildMapTitle(INT32 mapnum);
|
||||||
|
|
||||||
// XMOD spawning
|
// XMOD spawning
|
||||||
|
|
Loading…
Reference in a new issue