mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 17:31:00 +00:00
- Eliminate bvectangbam()
.
This commit is contained in:
parent
ad908719ec
commit
c25493762b
5 changed files with 11 additions and 16 deletions
|
@ -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)
|
inline int getangle(double xvect, double yvect)
|
||||||
{
|
{
|
||||||
return bvectangbam(xvect, yvect).asbuild();
|
return DVector2(xvect, yvect).Angle().Buildang();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int getangle(const DVector2& vec)
|
inline int getangle(const DVector2& vec)
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, bcos, bcos)
|
||||||
|
|
||||||
int raze_getangle(double x, double y)
|
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)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, getangle, raze_getangle)
|
||||||
|
|
|
@ -540,16 +540,16 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
|
||||||
double newx = x * 2 + dx * i / j - view.X;
|
double newx = x * 2 + dx * i / j - view.X;
|
||||||
double newy = y * 2 + dy * i / j - view.Y;
|
double newy = y * 2 + dy * i / j - view.Y;
|
||||||
|
|
||||||
auto myan = bvectangbam(dx, dy);
|
auto myan = RAD2BAM(atan2(dy, dx));
|
||||||
auto newan = myan + myan - bamang(vp.RotAngle);
|
auto newan = myan + myan - vp.RotAngle;
|
||||||
|
|
||||||
vp.RotAngle = newan.asbam();
|
vp.RotAngle = newan;
|
||||||
vp.SectNums = nullptr;
|
vp.SectNums = nullptr;
|
||||||
vp.SectCount = line->sector;
|
vp.SectCount = line->sector;
|
||||||
|
|
||||||
vp.Pos.X = newx;
|
vp.Pos.X = newx;
|
||||||
vp.Pos.Y = -newy;
|
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);
|
double FocalTangent = tan(vp.FieldOfView.Radians() / 2);
|
||||||
DAngle an = DAngle::fromDeg(270. - vp.HWAngles.Yaw.Degrees());
|
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 dx2 = line->point2Wall()->x - line->x;
|
||||||
int dy2 = line->point2Wall()->y - line->y;
|
int dy2 = line->point2Wall()->y - line->y;
|
||||||
|
|
||||||
auto srcang = bvectangbam(dx, dy);
|
auto srcang = RAD2BAM(atan2(dy, dx));
|
||||||
auto destang = bvectangbam(-dx, -dy);
|
auto destang = RAD2BAM(atan2(-dy, -dx));
|
||||||
|
|
||||||
vp.RotAngle += (destang - srcang).asbam();
|
vp.RotAngle += destang - srcang;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Nothing in the entire setup mandates that both lines have the same length.
|
// Nothing in the entire setup mandates that both lines have the same length.
|
||||||
|
|
|
@ -808,7 +808,7 @@ loc_flag:
|
||||||
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
|
DExhumedActor* t = sPlayerInput[nPlayer].pTarget;
|
||||||
// only autoaim if target is in front of the player.
|
// only autoaim if target is in front of the player.
|
||||||
assert(t->sector());
|
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;
|
int anglediff = (pPlayerActor->int_ang() - angletotarget) & 2047;
|
||||||
if (anglediff < 512 || anglediff > 1536)
|
if (anglediff < 512 || anglediff > 1536)
|
||||||
{
|
{
|
||||||
|
|
|
@ -167,7 +167,7 @@ struct SWPlayer native
|
||||||
SPRITEp last_camera_sp;
|
SPRITEp last_camera_sp;
|
||||||
PlayerHorizon horizon;
|
PlayerHorizon horizon;
|
||||||
PlayerAngle angle;
|
PlayerAngle angle;
|
||||||
binangle RevolveAng;
|
double RevolveAng;
|
||||||
// under vars are for wading and swimming
|
// under vars are for wading and swimming
|
||||||
//int16 PlayerSprite, PlayerUnderSprite;
|
//int16 PlayerSprite, PlayerUnderSprite;
|
||||||
SPRITEp SpriteP, UnderSpriteP;
|
SPRITEp SpriteP, UnderSpriteP;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue