Merge branch 'master' of https://github.com/raa-eruanna/qzdoom into qzdoom

This commit is contained in:
Magnus Norddahl 2016-10-23 17:43:27 +02:00
commit 6cd214c2b9
6 changed files with 21 additions and 6 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

@ -640,6 +640,12 @@ static void ReadOnePlayer(FSerializer &arc, bool skipload)
playerTemp.Serialize(arc); playerTemp.Serialize(arc);
if (!skipload) if (!skipload)
{ {
// This temp player has undefined pitch limits, so set them to something
// that should leave the pitch stored in the savegame intact when
// rendering. The real pitch limits will be set by P_SerializePlayers()
// via a net command, but that won't be processed in time for a screen
// wipe, so we need something here.
playerTemp.MaxPitch = playerTemp.MinPitch = playerTemp.mo->Angles.Pitch;
CopyPlayer(&players[i], &playerTemp, name); CopyPlayer(&players[i], &playerTemp, name);
} }
else else

View file

@ -65,6 +65,9 @@ static FRandom pr_skullpop ("SkullPop");
// [RH] # of ticks to complete a turn180 // [RH] # of ticks to complete a turn180
#define TURN180_TICKS ((TICRATE / 4) + 1) #define TURN180_TICKS ((TICRATE / 4) + 1)
// [SP] Allows respawn in single player
CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH)
// 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)
@ -2212,7 +2215,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;

View file

@ -3160,7 +3160,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
rereadcolormap = false; rereadcolormap = false;
} }
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep; rw_light = rw_lightleft + (x1 - savecoord.sx1) * rw_lightstep;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev)); R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)