From 7279e2ad62cf0294ba931489e9a1c6e91ea6d137 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 14 Dec 2011 00:16:19 +0000 Subject: [PATCH] - Fixed: Player pitch limits were reset to 0 when changing levels and loading saved games. SVN r3332 (trunk) --- src/d_player.h | 2 ++ src/g_level.cpp | 2 ++ src/p_saveg.cpp | 2 ++ src/p_user.cpp | 29 +++++++++++++++++++++++------ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 95604f0bde..abd4635906 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -256,6 +256,7 @@ public: void SetLogNumber (int num); void SetLogText (const char *text); + void SendPitchLimits() const; APlayerPawn *mo; BYTE playerstate; @@ -283,6 +284,7 @@ public: bool centering; BYTE turnticks; + bool attackdown; bool usedown; DWORD oldbuttons; diff --git a/src/g_level.cpp b/src/g_level.cpp index d552a31406..97061852e7 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -666,6 +666,7 @@ void G_DoCompleted (void) { + level_info_t *nextinfo = FindLevelInfo (nextlevel); wminfo.next = nextinfo->mapname; wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)]; @@ -1148,6 +1149,7 @@ void G_FinishTravel () pawn->LinkToWorld (); pawn->AddToHash (); pawn->SetState(pawn->SpawnState); + pawn->player->SendPitchLimits(); for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) { diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 741887cabe..785bacf9cc 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -112,6 +112,8 @@ void P_SerializePlayers (FArchive &arc, bool skipload) { SpawnExtraPlayers (); } + // Redo pitch limits, since the spawned player has them at 0. + players[consoleplayer].SendPitchLimits(); } } diff --git a/src/p_user.cpp b/src/p_user.cpp index 236f4d3198..49495c19fe 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -408,6 +408,26 @@ int player_t::GetSpawnClass() return static_cast(GetDefaultByType(type))->SpawnMask; } +//=========================================================================== +// +// player_t :: SendPitchLimits +// +// Ask the local player's renderer what pitch restrictions should be imposed +// and let everybody know. Only sends data for the consoleplayer, since the +// local player is the only one our data is valid for. +// +//=========================================================================== + +void player_t::SendPitchLimits() const +{ + if (this - players == consoleplayer) + { + Net_WriteByte(DEM_SETPITCHLIMIT); + Net_WriteByte(Renderer->GetMaxViewPitch(false)); // up + Net_WriteByte(Renderer->GetMaxViewPitch(true)); // down + } +} + //=========================================================================== // // APlayerPawn @@ -522,13 +542,9 @@ void APlayerPawn::PostBeginPlay() P_FindFloorCeiling(this, true); z = floorz; } - else if (player - players == consoleplayer) + else { - // Ask the local player's renderer what pitch restrictions - // should be imposed and let everybody know. - Net_WriteByte(DEM_SETPITCHLIMIT); - Net_WriteByte(Renderer->GetMaxViewPitch(false)); // up - Net_WriteByte(Renderer->GetMaxViewPitch(true)); // down + player->SendPitchLimits(); } } @@ -2505,6 +2521,7 @@ void P_UnPredictPlayer () { player_t *player = &players[consoleplayer]; + if (player->cheats & CF_PREDICTING) { AActor *act = player->mo;