diff --git a/src/d_player.h b/src/d_player.h index 95604f0bd..abd463590 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 d552a3140..97061852e 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 741887cab..785bacf9c 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 236f4d319..49495c19f 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;