- Eliminate bvectangbam().

This commit is contained in:
Mitchell Richters 2022-08-27 23:33:03 +10:00 committed by Christoph Oelckers
parent ad908719ec
commit c25493762b
5 changed files with 11 additions and 16 deletions

View file

@ -372,14 +372,9 @@ inline FSerializer &Serialize(FSerializer &arc, const char *key, fixedhoriz &obj
//
//---------------------------------------------------------------------------
inline binangle bvectangbam(double x, double y)
{
return radang(atan2(y, x));
}
inline int getangle(double xvect, double yvect)
{
return bvectangbam(xvect, yvect).asbuild();
return DVector2(xvect, yvect).Angle().Buildang();
}
inline int getangle(const DVector2& vec)

View file

@ -1537,7 +1537,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, bcos, bcos)
int raze_getangle(double x, double y)
{
return bvectangbam(x, y).asbuild();
return VecToAngle(x, y).Buildang();
}
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, getangle, raze_getangle)

View file

@ -540,16 +540,16 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
double newx = x * 2 + dx * i / j - view.X;
double newy = y * 2 + dy * i / j - view.Y;
auto myan = bvectangbam(dx, dy);
auto newan = myan + myan - bamang(vp.RotAngle);
auto myan = RAD2BAM(atan2(dy, dx));
auto newan = myan + myan - vp.RotAngle;
vp.RotAngle = newan.asbam();
vp.RotAngle = newan;
vp.SectNums = nullptr;
vp.SectCount = line->sector;
vp.Pos.X = newx;
vp.Pos.Y = -newy;
vp.HWAngles.Yaw = FAngle::fromDeg( - 90.f + newan.asdeg());
vp.HWAngles.Yaw = FAngle::fromBam(-ANGLE_90 + newan);
double FocalTangent = tan(vp.FieldOfView.Radians() / 2);
DAngle an = DAngle::fromDeg(270. - vp.HWAngles.Yaw.Degrees());
@ -613,10 +613,10 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
int dx2 = line->point2Wall()->x - line->x;
int dy2 = line->point2Wall()->y - line->y;
auto srcang = bvectangbam(dx, dy);
auto destang = bvectangbam(-dx, -dy);
auto srcang = RAD2BAM(atan2(dy, dx));
auto destang = RAD2BAM(atan2(-dy, -dx));
vp.RotAngle += (destang - srcang).asbam();
vp.RotAngle += destang - srcang;
#endif
// Nothing in the entire setup mandates that both lines have the same length.

View file

@ -808,7 +808,7 @@ loc_flag:
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
// only autoaim if target is in front of the player.
assert(t->sector());
int angletotarget = bvectangbam(t->int_pos().X - pPlayerActor->int_pos().X, t->int_pos().Y - pPlayerActor->int_pos().Y).asbuild();
int angletotarget = VecToAngle(t->int_pos().X - pPlayerActor->int_pos().X, t->int_pos().Y - pPlayerActor->int_pos().Y).Buildang();
int anglediff = (pPlayerActor->int_ang() - angletotarget) & 2047;
if (anglediff < 512 || anglediff > 1536)
{

View file

@ -167,7 +167,7 @@ struct SWPlayer native
SPRITEp last_camera_sp;
PlayerHorizon horizon;
PlayerAngle angle;
binangle RevolveAng;
double RevolveAng;
// under vars are for wading and swimming
//int16 PlayerSprite, PlayerUnderSprite;
SPRITEp SpriteP, UnderSpriteP;