* Respawn players that are spectators if it's not a special stage.

* No need to call a function for changing the number of lives when we're within bounds.
This commit is contained in:
toasterbabe 2017-05-29 21:59:24 +01:00
parent da05371e69
commit fd873185ae
2 changed files with 28 additions and 3 deletions

View File

@ -84,6 +84,8 @@ static void TeamScramble_OnChange(void);
static void NetTimeout_OnChange(void);
static void JoinTimeout_OnChange(void);
static void PlayStyle_OnChange(void);
static void Ringslinger_OnChange(void);
static void Gravity_OnChange(void);
static void ForceSkin_OnChange(void);
@ -350,7 +352,7 @@ static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NUL
consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t playstyle_cons_t[] = {{0, "Individual"}, {1, "Sharing"}, {2, "Together"}, {0, NULL}};
consvar_t cv_playstyle = {"playstyle", "Together", CV_NETVAR|CV_CHEAT, playstyle_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playstyle = {"playstyle", "Together", CV_NETVAR|CV_CHEAT|CV_CALL, playstyle_cons_t, PlayStyle_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_steallives = {"steallives", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -3402,6 +3404,29 @@ static void JoinTimeout_OnChange(void)
jointimeout = (tic_t)cv_jointimeout.value;
}
static void PlayStyle_OnChange(void)
{
if (!(netgame || multiplayer) || gametype != GT_COOP || G_IsSpecialStage(gamemap))
return;
if (cv_playstyle.value != 2)
{
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
if (!players[i].spectator)
continue;
if (players[i].lives <= 0)
continue;
players[i].playerstate = PST_REBORN;
}
}
}
UINT32 timelimitintics = 0;
/** Deals with a timelimit change by printing the change to the console.

View File

@ -8123,8 +8123,8 @@ boolean P_GetLives(player_t *player)
{
if (players[maxlivesplayer].mo)
S_StartSound(players[maxlivesplayer].mo, sfx_jshard); // placeholder
P_GivePlayerLives(&players[maxlivesplayer], -1);
P_GivePlayerLives(player, 1);
players[maxlivesplayer].lives--;
player->lives++;
if (netgame && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusname, mapmusflags, true);
else if (player == &players[displayplayer] || player == &players[secondarydisplayplayer])