mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Interalise slope tilting checks for DCorePlayer::doViewPitch()
.
This commit is contained in:
parent
59366d3ffc
commit
1c725377ea
9 changed files with 25 additions and 25 deletions
|
@ -154,9 +154,9 @@ void DCorePlayer::doYawInput()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DCorePlayer::doViewPitch(const bool canslopetilt, const bool climbing)
|
||||
void DCorePlayer::doViewPitch(const bool climbing)
|
||||
{
|
||||
if (cl_slopetilting && canslopetilt)
|
||||
if (cl_slopetilting && canSlopeTilt())
|
||||
{
|
||||
const auto actorsect = actor->sector();
|
||||
if (actorsect && (actorsect->floorstat & CSTAT_SECTOR_SLOPE)) // If the floor is sloped
|
||||
|
|
|
@ -36,13 +36,14 @@ public:
|
|||
|
||||
// All overridable methods.
|
||||
virtual DCoreActor* GetActor() = 0;
|
||||
virtual const bool canSlopeTilt() const { return false; }
|
||||
virtual const DVector2& GetInputVelocity() const { return actor->vel.XY(); }
|
||||
virtual const double GetMaxInputVel() const = 0;
|
||||
|
||||
// Angle prototypes.
|
||||
void doPitchInput();
|
||||
void doYawInput();
|
||||
void doViewPitch(const bool canslopetilt, const bool climbing = false);
|
||||
void doViewPitch(const bool climbing = false);
|
||||
void doViewYaw();
|
||||
void doRollInput(const bool bUnderwater);
|
||||
|
||||
|
|
|
@ -276,6 +276,13 @@ public:
|
|||
{
|
||||
return (36211. / 3000.);
|
||||
}
|
||||
|
||||
const bool canSlopeTilt() const override
|
||||
{
|
||||
const auto pActor = static_cast<DBloodActor*>(actor);
|
||||
const int florhit = pActor->hit.florhit.type;
|
||||
return pActor->xspr.height < 16 && (florhit == kHitSector || florhit == 0);
|
||||
}
|
||||
};
|
||||
|
||||
inline DBloodPlayer* getPlayer(int index)
|
||||
|
|
|
@ -1705,8 +1705,7 @@ void ProcessInput(DBloodPlayer* pPlayer)
|
|||
pInput->actions &= ~SB_OPEN;
|
||||
}
|
||||
|
||||
const int florhit = pPlayer->GetActor()->hit.florhit.type;
|
||||
pPlayer->doViewPitch(actor->xspr.height < 16 && (florhit == kHitSector || florhit == 0));
|
||||
pPlayer->doViewPitch();
|
||||
pPlayer->doPitchInput();
|
||||
|
||||
pPlayer->slope = pPlayer->GetActor()->spr.Angles.Pitch.Tan();
|
||||
|
|
|
@ -1569,7 +1569,7 @@ void processinput_d(DDukePlayer* const p)
|
|||
pact->floorz = floorz;
|
||||
pact->ceilingz = ceilingz;
|
||||
|
||||
p->doslopetilting();
|
||||
p->doViewPitch();
|
||||
|
||||
if (chz.type == kHitSprite)
|
||||
{
|
||||
|
|
|
@ -2346,7 +2346,7 @@ void processinput_r(DDukePlayer* const p)
|
|||
pact->floorz = floorz;
|
||||
pact->ceilingz = ceilingz;
|
||||
|
||||
p->doslopetilting();
|
||||
p->doViewPitch();
|
||||
|
||||
if (chz.type == kHitSprite)
|
||||
{
|
||||
|
|
|
@ -405,9 +405,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
inline void doslopetilting()
|
||||
const bool canSlopeTilt() const override
|
||||
{
|
||||
doViewPitch(aim_mode == 0 && on_ground && cursector->lotag != ST_2_UNDERWATER);
|
||||
return aim_mode == 0 && on_ground && cursector->lotag != ST_2_UNDERWATER;
|
||||
}
|
||||
|
||||
inline bool itemUsed(int num)
|
||||
|
|
|
@ -1856,6 +1856,11 @@ public:
|
|||
return vect;
|
||||
}
|
||||
|
||||
const bool canSlopeTilt() const override
|
||||
{
|
||||
return (cmd.ucmd.actions & SB_AIMMODE) && !(Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING));
|
||||
}
|
||||
|
||||
inline DSWActor* GetActor() override
|
||||
{
|
||||
return static_cast<DSWActor*>(actor);
|
||||
|
|
|
@ -1487,18 +1487,6 @@ void SlipSlope(DSWPlayer* pp)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DoPlayerSlopeTilting(DSWPlayer* pp)
|
||||
{
|
||||
const bool canslopetilt = (pp->cmd.ucmd.actions & SB_AIMMODE) && !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING));
|
||||
pp->doViewPitch(canslopetilt, pp->Flags & PF_CLIMBING);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DoPlayerBob(DSWPlayer* pp)
|
||||
{
|
||||
double amt;
|
||||
|
@ -1979,7 +1967,7 @@ void DoPlayerMove(DSWPlayer* pp)
|
|||
|
||||
DoPlayerSetWadeDepth(pp);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->doViewPitch(pp->Flags & PF_CLIMBING);
|
||||
pp->doPitchInput();
|
||||
|
||||
if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA))
|
||||
|
@ -2565,7 +2553,7 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
|
|||
OperateSectorObject(pp->sop, plActor->spr.Angles.Yaw, plActor->spr.pos.XY());
|
||||
pp->cursector = save_sect; // for speed
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->doViewPitch(pp->Flags & PF_CLIMBING);
|
||||
pp->doPitchInput();
|
||||
|
||||
DoTankTreads(pp);
|
||||
|
@ -2621,7 +2609,7 @@ void DoPlayerMoveTurret(DSWPlayer* pp)
|
|||
else
|
||||
pp->Flags |= (PF_PLAYER_MOVED);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->doViewPitch(pp->Flags & PF_CLIMBING);
|
||||
pp->doPitchInput();
|
||||
}
|
||||
|
||||
|
@ -3206,7 +3194,7 @@ void DoPlayerClimb(DSWPlayer* pp)
|
|||
// setsprite to players location
|
||||
ChangeActorSect(pp->GetActor(), pp->cursector);
|
||||
|
||||
DoPlayerSlopeTilting(pp);
|
||||
pp->doViewPitch(pp->Flags & PF_CLIMBING);
|
||||
pp->doPitchInput();
|
||||
|
||||
if (FAF_ConnectArea(pp->cursector))
|
||||
|
|
Loading…
Reference in a new issue