From b4d89cbac391080c12455d6e8793b8217ab62d3a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Apr 2021 12:10:28 +0200 Subject: [PATCH] - got rid of the remaining occurences of gethiq16angle and all related tables. --- source/build/include/build.h | 1 - source/build/src/engine.cpp | 26 -------------------------- source/build/src/polymost.cpp | 2 +- source/games/sw/src/draw.cpp | 4 ++-- source/games/sw/src/player.cpp | 2 +- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index e523bde57..92da9f8c4 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -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) { diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a74aa8737..bbbfa8948 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -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. diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 44423429a..307111c3c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -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; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index e100ee4a5..1b8e8b2e0 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -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)) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 351df2422..766b511f0 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -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)