Fix extra lives given to game-overed players not re-entering them into the action when cv_coopstarposts is 0.

This commit is contained in:
toaster 2019-11-25 14:59:06 +00:00
parent a187460865
commit 2110fa6bd1

View file

@ -1223,6 +1223,7 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres)
// //
void P_GivePlayerLives(player_t *player, INT32 numlives) void P_GivePlayerLives(player_t *player, INT32 numlives)
{ {
UINT8 prevlives = player->lives;
if (!player) if (!player)
return; return;
@ -1239,10 +1240,9 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0)
{ {
UINT8 prevlives = player->lives;
P_GivePlayerRings(player, 100*numlives); P_GivePlayerRings(player, 100*numlives);
if (player->lives - prevlives >= numlives) if (player->lives - prevlives >= numlives)
return; goto docooprespawn;
numlives = (numlives + prevlives - player->lives); numlives = (numlives + prevlives - player->lives);
} }
@ -1256,6 +1256,15 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
player->lives = 99; player->lives = 99;
else if (player->lives < 1) else if (player->lives < 1)
player->lives = 1; player->lives = 1;
docooprespawn:
if (cv_coopstarposts.value)
return;
if (prevlives > 0)
return;
if (!player->spectator)
return;
P_SpectatorJoinGame(player);
} }
void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound) void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound)