- Implemented sv_singleplayerrespawn

This commit is contained in:
Rachael Alexanderson 2016-10-23 06:06:59 -04:00
parent 5ba5da0dcc
commit a39807eb9a
4 changed files with 12 additions and 5 deletions

View file

@ -1655,9 +1655,10 @@ static void G_QueueBody (AActor *body)
// //
// G_DoReborn // G_DoReborn
// //
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
void G_DoReborn (int playernum, bool freshbot) void G_DoReborn (int playernum, bool freshbot)
{ {
if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN)) if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn)
{ {
if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars())) if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()))
{ // Load game from the last point it was saved { // Load game from the last point it was saved

View file

@ -526,6 +526,8 @@ static bool unloading;
// //
//========================================================================== //==========================================================================
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill) void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill)
{ {
level_info_t *nextinfo = NULL; level_info_t *nextinfo = NULL;
@ -634,7 +636,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill
// If this is co-op, respawn any dead players now so they can // If this is co-op, respawn any dead players now so they can
// keep their inventory on the next map. // keep their inventory on the next map.
if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN) && !deathmatch && player->playerstate == PST_DEAD) if ((multiplayer || level.flags2 & LEVEL2_ALLOWRESPAWN || sv_singleplayerrespawn) && !deathmatch && player->playerstate == PST_DEAD)
{ {
// Copied from the end of P_DeathThink [[ // Copied from the end of P_DeathThink [[
player->cls = NULL; // Force a new class if the player is using a random class player->cls = NULL; // Force a new class if the player is using a random class

View file

@ -1,4 +1,4 @@
// Emacs style mode select -*- C++ -*- // Emacs style mode select -*- C++ -*-
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Id:$ // $Id:$
@ -4495,6 +4495,7 @@ void AActor::AdjustFloorClip ()
// Most of the player structure stays unchanged between levels. // Most of the player structure stays unchanged between levels.
// //
EXTERN_CVAR (Bool, chasedemo) EXTERN_CVAR (Bool, chasedemo)
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
extern bool demonew; extern bool demonew;
@ -4682,7 +4683,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
{ // Give all cards in death match mode. { // Give all cards in death match mode.
p->mo->GiveDeathmatchInventory (); p->mo->GiveDeathmatchInventory ();
} }
else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) && state == PST_REBORN && oldactor != NULL) else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn) && state == PST_REBORN && oldactor != NULL)
{ // Special inventory handling for respawning in coop { // Special inventory handling for respawning in coop
p->mo->FilterCoopRespawnInventory (oldactor); p->mo->FilterCoopRespawnInventory (oldactor);
} }

View file

@ -68,6 +68,7 @@ static FRandom pr_skullpop ("SkullPop");
// Variables for prediction // Variables for prediction
CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, cl_predict_specials, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, cl_predict_specials, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH)
CUSTOM_CVAR(Float, cl_predict_lerpscale, 0.05f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Float, cl_predict_lerpscale, 0.05f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{ {
@ -2211,7 +2212,9 @@ void P_DeathThink (player_t *player)
if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL)) if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL))
{ {
player->cls = NULL; // Force a new class if the player is using a random class player->cls = NULL; // Force a new class if the player is using a random class
player->playerstate = (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER; player->playerstate =
(multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn)
? PST_REBORN : PST_ENTER;
if (player->mo->special1 > 2) if (player->mo->special1 > 2)
{ {
player->mo->special1 = 0; player->mo->special1 = 0;