- Fixed: Player pitch limits were reset to 0 when changing levels and loading

saved games.



SVN r3332 (trunk)
This commit is contained in:
Randy Heit 2011-12-14 00:16:19 +00:00
parent b1905c16ef
commit 7279e2ad62
4 changed files with 29 additions and 6 deletions

View file

@ -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;

View file

@ -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)
{

View file

@ -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();
}
}

View file

@ -408,6 +408,26 @@ int player_t::GetSpawnClass()
return static_cast<APlayerPawn*>(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;