- Duke/SW: Move each game's check of cl_slopetilting into calcviewpitch() backend function.

This commit is contained in:
Mitchell Richters 2021-01-02 00:34:44 +11:00
parent 6d12159006
commit 8003753989
3 changed files with 42 additions and 46 deletions

View file

@ -377,6 +377,8 @@ void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void calcviewpitch(vec2_t const pos, fixedhoriz* horizoff, binangle const ang, bool const aimmode, bool const canslopetilt, int const cursectnum, double const scaleAdjust, bool const climbing) void calcviewpitch(vec2_t const pos, fixedhoriz* horizoff, binangle const ang, bool const aimmode, bool const canslopetilt, int const cursectnum, double const scaleAdjust, bool const climbing)
{
if (cl_slopetilting)
{ {
if (aimmode && canslopetilt) // If the floor is sloped if (aimmode && canslopetilt) // If the floor is sloped
{ {
@ -426,6 +428,7 @@ void calcviewpitch(vec2_t const pos, fixedhoriz* horizoff, binangle const ang, b
} }
} }
} }
}
FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, PlayerAngle* def)
{ {

View file

@ -194,13 +194,10 @@ inline double get16thOfHoriz(int const snum, bool const interpolate, double cons
} }
inline void doslopetilting(player_struct* p, double const scaleAdjust) inline void doslopetilting(player_struct* p, double const scaleAdjust)
{
if (cl_slopetilting)
{ {
bool const canslopetilt = p->on_ground && sector[p->cursectnum].lotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat & 2); bool const canslopetilt = p->on_ground && sector[p->cursectnum].lotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat & 2);
calcviewpitch(p->pos.vec2, &p->horizon.horizoff, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust); calcviewpitch(p->pos.vec2, &p->horizon.horizoff, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust);
} }
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -1666,13 +1666,9 @@ void SlipSlope(PLAYERp pp)
void void
DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust) DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust)
{
if (cl_slopetilting)
{ {
bool const canslopetilt = !TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE); bool const canslopetilt = !TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE);
calcviewpitch(pp->pos.vec2, &pp->horizon.horizoff, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursectnum, scaleAdjust, TEST(pp->Flags, PF_CLIMBING)); calcviewpitch(pp->pos.vec2, &pp->horizon.horizoff, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursectnum, scaleAdjust, TEST(pp->Flags, PF_CLIMBING));
}
sethorizon(&pp->horizon.horiz, horz, &pp->input.actions, scaleAdjust); sethorizon(&pp->horizon.horiz, horz, &pp->input.actions, scaleAdjust);
} }