- took GetMaxViewPitch out of renderer interfaces.

With live switching and both renderers on the same backend the old approach will no longer work.
This commit is contained in:
Christoph Oelckers 2018-04-03 19:18:16 +02:00
commit 51bf2eb9fa
6 changed files with 29 additions and 40 deletions

View file

@ -730,13 +730,38 @@ bool player_t::GetPainFlash(FName type, PalEntry *color) const
//
//===========================================================================
EXTERN_CVAR(Float, maxviewpitch)
EXTERN_CVAR(Bool, r_polyrenderer)
EXTERN_CVAR(Bool, cl_oldfreelooklimit);
extern int currentrenderer;
static int GetSoftPitch(bool down)
{
int MAX_DN_ANGLE = MIN(56, (int)maxviewpitch); // Max looking down angle
int MAX_UP_ANGLE = MIN(32, (int)maxviewpitch); // Max looking up angle
return (down ? MAX_DN_ANGLE : ((cl_oldfreelooklimit) ? MAX_UP_ANGLE : MAX_DN_ANGLE));
}
void player_t::SendPitchLimits() const
{
if (this - players == consoleplayer)
{
int uppitch, downpitch;
if (currentrenderer == 0 && !r_polyrenderer)
{
uppitch = GetSoftPitch(false);
downpitch = GetSoftPitch(true);
}
else
{
uppitch = downpitch = (int)maxviewpitch;
}
Net_WriteByte(DEM_SETPITCHLIMIT);
Net_WriteByte(Renderer->GetMaxViewPitch(false)); // up
Net_WriteByte(Renderer->GetMaxViewPitch(true)); // down
Net_WriteByte(uppitch);
Net_WriteByte(downpitch);
}
}