From 31f01d076e92afb27ef1ed62476c64d68b239c60 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 22 Oct 2016 20:27:02 -0500 Subject: [PATCH 1/4] Fixed: Decals calculated "lighting" wrong - Instead of calculating lighting based from the left edge of the wall segment the decal was on, it was calculated from the left edge of the wall instead. --- src/r_segs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index d1ec04f6d..48d8f1651 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -3186,7 +3186,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, rereadcolormap = false; } - rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep; + rw_light = rw_lightleft + (x1 - savecoord.sx1) * rw_lightstep; if (fixedlightlev >= 0) dc_colormap = (r_fullbrightignoresectorcolor) ? (FullNormalLight.Maps + fixedlightlev) : (usecolormap->Maps + fixedlightlev); else if (fixedcolormap != NULL) From 5ba5da0dcc3deb9fbce0da00e9a7d804aeb5aea7 Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 22 Oct 2016 20:56:31 -0500 Subject: [PATCH 2/4] Fixed: Loading a savegame momentarily left players with undefined pitch limits - This was only visible when using a screen wipe because the initial frame wiped to would clamp the pitch to whatever undefined pitch range the player had before the proper range was received. --- src/p_saveg.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 46cdd767b..c2f79a5c6 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -638,6 +638,12 @@ static void ReadOnePlayer(FSerializer &arc, bool skipload) playerTemp.Serialize(arc); 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); } else From a39807eb9aee0d97403fbf4a12843896e1c47e4c Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Oct 2016 06:06:59 -0400 Subject: [PATCH 3/4] - Implemented sv_singleplayerrespawn --- src/g_game.cpp | 3 ++- src/g_level.cpp | 4 +++- src/p_mobj.cpp | 5 +++-- src/p_user.cpp | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 48bda24f5..b0c8775fc 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1655,9 +1655,10 @@ static void G_QueueBody (AActor *body) // // G_DoReborn // +EXTERN_CVAR(Bool, sv_singleplayerrespawn) 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())) { // Load game from the last point it was saved diff --git a/src/g_level.cpp b/src/g_level.cpp index 119cde378..d3a8c4015 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -526,6 +526,8 @@ static bool unloading; // //========================================================================== +EXTERN_CVAR(Bool, sv_singleplayerrespawn) + void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill) { 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 // 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 [[ player->cls = NULL; // Force a new class if the player is using a random class diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 8f926ea77..3e2011878 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ @@ -4495,6 +4495,7 @@ void AActor::AdjustFloorClip () // Most of the player structure stays unchanged between levels. // EXTERN_CVAR (Bool, chasedemo) +EXTERN_CVAR(Bool, sv_singleplayerrespawn) extern bool demonew; @@ -4682,7 +4683,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) { // Give all cards in death match mode. 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 p->mo->FilterCoopRespawnInventory (oldactor); } diff --git a/src/p_user.cpp b/src/p_user.cpp index e48712042..6ac39c2a5 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -68,6 +68,7 @@ static FRandom pr_skullpop ("SkullPop"); // Variables for prediction CVAR (Bool, cl_noprediction, false, 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) { @@ -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)) { 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) { player->mo->special1 = 0; From 1e9d3b1917d8c877d0307efa9694b30964a8de76 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Oct 2016 08:14:54 -0400 Subject: [PATCH 4/4] - Putting the CVAR definition right in the middle of prediction stuff probably wasn't the best idea. --- src/p_user.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 6ac39c2a5..b7bd4c2ec 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -65,10 +65,12 @@ static FRandom pr_skullpop ("SkullPop"); // [RH] # of ticks to complete a turn180 #define TURN180_TICKS ((TICRATE / 4) + 1) +// [SP] Allows respawn in single player +CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH) + // Variables for prediction CVAR (Bool, cl_noprediction, false, 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) {