mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- binaryangle.h
: Change binangle
bitshift operators to operate on signed value to properly handle angles > 1024.
This commit is contained in:
parent
a1570c185f
commit
eb8b075727
4 changed files with 9 additions and 9 deletions
|
@ -183,24 +183,24 @@ public:
|
|||
|
||||
constexpr binangle &operator<<= (const uint8_t shift)
|
||||
{
|
||||
value <<= shift;
|
||||
value = tosigned() << shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle &operator>>= (const uint8_t shift)
|
||||
{
|
||||
value >>= shift;
|
||||
value = tosigned() >> shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle operator<< (const uint8_t shift) const
|
||||
{
|
||||
return binangle(value << shift);
|
||||
return binangle(tosigned() << shift);
|
||||
}
|
||||
|
||||
constexpr binangle operator>> (const uint8_t shift) const
|
||||
{
|
||||
return binangle(value >> shift);
|
||||
return binangle(tosigned() >> shift);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const
|
|||
if (*actions & SB_LOOK_LEFT)
|
||||
{
|
||||
// start looking left
|
||||
look_ang += buildfang(scaleAdjust * -(4560. / GameTicRate));
|
||||
look_ang -= buildfang(scaleAdjust * (4560. / GameTicRate));
|
||||
rotscrnang += buildfang(scaleAdjust * (720. / GameTicRate));
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const
|
|||
{
|
||||
// start looking right
|
||||
look_ang += buildfang(scaleAdjust * (4560. / GameTicRate));
|
||||
rotscrnang += buildfang(scaleAdjust * -(720. / GameTicRate));
|
||||
rotscrnang -= buildfang(scaleAdjust * (720. / GameTicRate));
|
||||
}
|
||||
|
||||
if (!movementlocked())
|
||||
|
|
|
@ -459,7 +459,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->actorsqu != nullptr)
|
||||
{
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s->x - p->pos.x, p->actorsqu->s->y - p->pos.y)).signedbuild() >> 2);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s->x - p->pos.x, p->actorsqu->s->y - p->pos.y)) >> 2);
|
||||
}
|
||||
|
||||
if (spri->extra > 0)
|
||||
|
@ -482,7 +482,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->wackedbyactor != nullptr && p->wackedbyactor->s->statnum < MAXSTATUS)
|
||||
{
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s->x - p->pos.x, p->wackedbyactor->s->y - p->pos.y)).signedbuild() >> 1);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s->x - p->pos.x, p->wackedbyactor->s->y - p->pos.y)) >> 1);
|
||||
}
|
||||
}
|
||||
spri->ang = p->angle.ang.asbuild();
|
||||
|
|
|
@ -6142,7 +6142,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
|
||||
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
|
||||
{
|
||||
pp->angle.addadjustment(getincanglebam(pp->angle.ang, bvectangbam(kp->x - pp->posx, kp->y - pp->posy)).signedbuild() >> 4);
|
||||
pp->angle.addadjustment(getincanglebam(pp->angle.ang, bvectangbam(kp->x - pp->posx, kp->y - pp->posy)) >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue