mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- Replace binangle
usage in PlayerHorizon::calcviewpitch()
with DAngle
object.
This commit is contained in:
parent
dbc46e2a75
commit
7a6f5c0864
5 changed files with 10 additions and 10 deletions
|
@ -448,16 +448,16 @@ enum
|
|||
BLOODVIEWPITCH = (0x4000 >> SINSHIFTDELTA) - (DEFVIEWPITCH << (SINSHIFTDELTA - 1)), // 1408.
|
||||
};
|
||||
|
||||
void PlayerHorizon::calcviewpitch(vec2_t const pos, binangle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust, bool const climbing)
|
||||
void PlayerHorizon::calcviewpitch(vec2_t const pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust, bool const climbing)
|
||||
{
|
||||
if (cl_slopetilting && cursectnum != nullptr)
|
||||
{
|
||||
if (aimmode && canslopetilt) // If the floor is sloped
|
||||
{
|
||||
// Get a point, 512 (64 for Blood) units ahead of player's position
|
||||
int const shift = -(isBlood() ? BLOODSINSHIFT : DEFSINSHIFT);
|
||||
int const x = pos.X + ang.bcos(shift);
|
||||
int const y = pos.Y + ang.bsin(shift);
|
||||
int const shift = isBlood() ? BLOODSINSHIFT : DEFSINSHIFT;
|
||||
int const x = pos.X + int(ang.Cos() * (1 << (BUILDSINBITS - shift)));
|
||||
int const y = pos.Y + int(ang.Sin() * (1 << (BUILDSINBITS - shift)));
|
||||
auto tempsect = cursectnum;
|
||||
updatesector(x, y, &tempsect);
|
||||
|
||||
|
|
|
@ -24,13 +24,13 @@ struct PlayerHorizon
|
|||
|
||||
// Prototypes for functions in gameinput.cpp.
|
||||
void applyinput(float const horz, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
void calcviewpitch(vec2_t const pos, binangle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false);
|
||||
void calcviewpitch(const DVector2& pos, binangle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false)
|
||||
void calcviewpitch(vec2_t const pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false);
|
||||
void calcviewpitch(const DVector2& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false)
|
||||
{
|
||||
vec2_t ps = { int(pos.X * worldtoint), int(pos.Y * worldtoint) };
|
||||
calcviewpitch(ps, ang, aimmode, canslopetilt, cursectnum, scaleAdjust, climbing);
|
||||
}
|
||||
void calcviewpitch(const DVector3& pos, binangle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false)
|
||||
void calcviewpitch(const DVector3& pos, DAngle const ang, bool const aimmode, bool const canslopetilt, sectortype* const cursectnum, double const scaleAdjust = 1, bool const climbing = false)
|
||||
{
|
||||
vec2_t ps = { int(pos.X * worldtoint), int(pos.Y * worldtoint) };
|
||||
calcviewpitch(ps, ang, aimmode, canslopetilt, cursectnum, scaleAdjust, climbing);
|
||||
|
|
|
@ -1518,7 +1518,7 @@ void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1)
|
|||
auto plActor = pPlayer->actor;
|
||||
int const florhit = pPlayer->actor->hit.florhit.type;
|
||||
bool const va = plActor->xspr.height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0;
|
||||
pPlayer->horizon.calcviewpitch(plActor->int_pos().vec2, buildang(plActor->int_ang()), va, plActor->sector()->floorstat & CSTAT_SECTOR_SLOPE, plActor->sector(), scaleAdjust);
|
||||
pPlayer->horizon.calcviewpitch(plActor->int_pos().vec2, DAngle::fromBuild(plActor->int_ang()), va, plActor->sector()->floorstat & CSTAT_SECTOR_SLOPE, plActor->sector(), scaleAdjust);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -208,7 +208,7 @@ inline bool playrunning()
|
|||
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
|
||||
{
|
||||
bool const canslopetilt = p->on_ground && p->insector() && p->cursector->lotag != ST_2_UNDERWATER && (p->cursector->floorstat & CSTAT_SECTOR_SLOPE);
|
||||
p->horizon.calcviewpitch(p->pos, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
|
||||
p->horizon.calcviewpitch(p->pos.XY(), DAngle::fromBam(p->angle.ang.asbam()), p->aim_mode == 0, canslopetilt, p->cursector, scaleAdjust);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -1592,7 +1592,7 @@ void SlipSlope(PLAYER* pp)
|
|||
void DoPlayerHorizon(PLAYER* pp, float const horz, double const scaleAdjust)
|
||||
{
|
||||
bool const canslopetilt = !(pp->Flags & (PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) && pp->cursector && (pp->cursector->floorstat & CSTAT_SECTOR_SLOPE);
|
||||
pp->horizon.calcviewpitch(pp->pos.vec2, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING));
|
||||
pp->horizon.calcviewpitch(pp->pos.vec2, DAngle::fromBam(pp->angle.ang.asbam()), pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, (pp->Flags & PF_CLIMBING));
|
||||
pp->horizon.applyinput(horz, &pp->input.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue