- got rid of the remaining occurences of gethiq16angle and all related tables.

This commit is contained in:
Christoph Oelckers 2021-04-10 12:10:28 +02:00
parent 35221188db
commit b4d89cbac3
5 changed files with 4 additions and 31 deletions

View file

@ -436,7 +436,6 @@ inline int32_t ksqrt(uint32_t num)
}
int32_t getangle(int32_t xvect, int32_t yvect);
fixed_t gethiq16angle(int32_t xvect, int32_t yvect);
inline constexpr uint32_t uhypsq(int32_t const dx, int32_t const dy)
{

View file

@ -62,7 +62,6 @@ static int8_t tempbuf[MAXWALLS];
static int32_t no_radarang2 = 0;
static int16_t radarang[1280];
static int32_t qradarang[10240];
const char *engineerrstr = "No error";
@ -215,11 +214,6 @@ static int32_t engineLoadTables(void)
for (i=0; i<640; i++)
radarang[1279-i] = -radarang[i];
for (i=0; i<5120; i++)
qradarang[i] = FloatToFixed(atan((5119.5 - i) / 1280.) * (-64. / BAngRadian));
for (i=0; i<5120; i++)
qradarang[10239-i] = -qradarang[i];
tablesloaded = 1;
}
@ -873,26 +867,6 @@ int32_t getangle(int32_t xvect, int32_t yvect)
return rv;
}
fixed_t gethiq16angle(int32_t xvect, int32_t yvect)
{
fixed_t rv;
if ((xvect | yvect) == 0)
rv = 0;
else if (xvect == 0)
rv = IntToFixed(512 + ((yvect < 0) << 10));
else if (yvect == 0)
rv = IntToFixed(((xvect < 0) << 10));
else if (xvect == yvect)
rv = IntToFixed(256 + ((xvect < 0) << 10));
else if (xvect == -yvect)
rv = IntToFixed(768 + ((xvect > 0) << 10));
else if (abs(xvect) > abs(yvect))
rv = ((qradarang[5120 + Scale(1280, yvect, xvect)] >> 6) + IntToFixed(((xvect < 0) << 10))) & 0x7FFFFFF;
else rv = ((qradarang[5120 - Scale(1280, xvect, yvect)] >> 6) + IntToFixed(512 + ((yvect < 0) << 10))) & 0x7FFFFFF;
return rv;
}
// Gets the BUILD unit height and z offset of a sprite.
// Returns the z offset, 'height' may be NULL.

View file

@ -3315,7 +3315,7 @@ void renderPrepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang, f
*tposx = (x << 1) + Scale(dx, i, j) - dax;
*tposy = (y << 1) + Scale(dy, i, j) - day;
*tang = ((gethiq16angle(dx, dy) << 1) - daang) & 0x7FFFFFF;
*tang = ((bvectangq16(dx, dy) << 1) - daang) & 0x7FFFFFF;
inpreparemirror = 1;

View file

@ -1123,7 +1123,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, binangle
{
sp = &sprite[i];
ang = q16ang(gethiq16angle(*tx - sp->x, *ty - sp->y));
ang = bvectangbam(*tx - sp->x, *ty - sp->y);
ang_test = getincangle(ang.asbuild(), sp->ang) < sp->lotag;
FAFcansee_test =
@ -1568,7 +1568,7 @@ drawscreen(PLAYERp pp, double smoothratio)
if (TEST_BOOL1(pp->remote_sprite))
tang = buildang(pp->remote_sprite->ang);
else
tang = q16ang(gethiq16angle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty));
tang = bvectangbam(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty);
}
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))

View file

@ -5471,7 +5471,7 @@ DoPlayerStopOperate(PLAYERp pp)
if (TEST_BOOL1(pp->remote_sprite))
pp->angle.ang = pp->angle.oang = buildang(pp->remote_sprite->ang);
else
pp->angle.ang = pp->angle.oang = q16ang(gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy));
pp->angle.ang = pp->angle.oang = bvectangbam(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy);
}
if (pp->sop_control)