- Change walltype::clipangle from binangle to angle_t.

This commit is contained in:
Mitchell Richters 2022-08-27 19:22:52 +10:00 committed by Christoph Oelckers
parent d3022947eb
commit 36d76a71ea
4 changed files with 18 additions and 7 deletions

View file

@ -91,16 +91,27 @@ inline double DEG2RAD(double deg)
return deg * (M_PI / 180.0);
}
inline float RAD2DEG(float deg)
inline float RAD2DEG(float rad)
{
return deg * float(180. / M_PI);
return rad * float(180. / M_PI);
}
inline double RAD2DEG(double deg)
inline double RAD2DEG(double rad)
{
return deg * (180. / M_PI);
return rad * (180. / M_PI);
}
inline angle_t RAD2BAM(float rad)
{
return angle_t(rad * float(0x80000000u / M_PI));
}
inline angle_t RAD2BAM(double rad)
{
return angle_t(rad * (0x80000000u / M_PI));
}
// This is needed in common code, despite being Doom specific.
enum EStateUseFlags
{

View file

@ -406,7 +406,7 @@ struct walltype
uint8_t yrepeat;
// extensions not from the binary map format.
binangle clipangle;
angle_t clipangle;
int length; // cached value to avoid calling sqrt repeatedly.
uint16_t portalnum;

View file

@ -73,7 +73,7 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, binangle a1, b
{
// Precalculate the clip angles to avoid doing this repeatedly during level traversal.
auto vv = w.wall_int_pos() - view;
w.clipangle = bvectangbam(vv.X, vv.Y);
w.clipangle = RAD2BAM(atan2(vv.Y, vv.X));
}
memset(sectionstartang.Data(), -1, sectionstartang.Size() * sizeof(sectionstartang[0]));
memset(sectionendang.Data(), -1, sectionendang.Size() * sizeof(sectionendang[0]));

View file

@ -45,7 +45,7 @@ private:
CL_Pass = 2,
};
binangle ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
binangle ClipAngle(int wal) { return bamang(wall[wal].clipangle) - ang1; }
void StartScene();
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
bool AddLineToBunch(int line, binangle newan);