diff --git a/source/games/whaven/src/animatesprites.cpp b/source/games/whaven/src/animatesprites.cpp index be4dddcdc..51f77065a 100644 --- a/source/games/whaven/src/animatesprites.cpp +++ b/source/games/whaven/src/animatesprites.cpp @@ -362,8 +362,8 @@ void analyzesprites(PLAYER& plr, int dasmoothratio) SPRITE& tshadow = tsprite[spritesortcnt]; tshadow = tspr; int camangle = getangle(plr.x - tshadow.x, plr.y - tshadow.y); - tshadow.x -= mulscale(sintable[(camangle + 512) & 2047], 100, 16); - tshadow.y += mulscale(sintable[(camangle + 1024) & 2047], 100, 16); + tshadow.x -= mulscale(bcos(camangle), 100, 16); + tshadow.y += mulscale(-bsin(camangle), 100, 16); tshadow.z = fz + 1; tshadow.statnum = 99; diff --git a/source/games/whaven/src/input.cpp b/source/games/whaven/src/input.cpp index 91d42d540..0088fb738 100644 --- a/source/games/whaven/src/input.cpp +++ b/source/games/whaven/src/input.cpp @@ -477,7 +477,7 @@ void processinput(int num) { dist >>= 2; if (dist > 0 && feetoffground <= (plr.height << 8) || onsprite != -1) { - oldhoriz = ((dist * sintable[(lockclock << 5) & 2047]) >> 19) >> 2; + oldhoriz = ((dist * bsin(lockclock << 5)) >> 19) >> 2; plr.horizon.addadjustment(oldhoriz); } else diff --git a/source/games/whaven/src/main.cpp b/source/games/whaven/src/main.cpp index a4bd45fcf..f14a7ded5 100644 --- a/source/games/whaven/src/main.cpp +++ b/source/games/whaven/src/main.cpp @@ -358,11 +358,11 @@ void GameInterface::Ticker() if (followmode) { followa += followang; - followx += (followvel * sintable[(512 + 2048 - followa) & 2047]) >> 10; - followy += (followvel * sintable[(512 + 1024 - 512 - followa) & 2047]) >> 10; + followx += MulScale(-bsin(followa), followvel, 10); + followy += MulScale(-bcos(followa), followvel, 10); - followx += (followsvel * sintable[(512 + 1024 - 512 - followa) & 2047]) >> 10; - followy -= (followsvel * sintable[(512 + 2048 - followa) & 2047]) >> 10; + followx += MulScale(-bcos(followa), followsvel, 10); + followy -= MulScale(-bsin(followa), followsvel, 10); } lockclock += TICSPERFRAME; diff --git a/source/games/whaven/src/wh.cpp b/source/games/whaven/src/wh.cpp index 7e1847ec5..eb60fd688 100644 --- a/source/games/whaven/src/wh.cpp +++ b/source/games/whaven/src/wh.cpp @@ -44,8 +44,8 @@ int hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz, Hitsc Point rotatepoint(int xpivot, int ypivot, int x, int y, short daang) { // jfBuild Point rotatepoint; - int dacos = sintable[(daang + 2560) & 2047]; - int dasin = sintable[(daang + 2048) & 2047]; + int dacos = bcos(daang); + int dasin = bsin(daang); x -= xpivot; y -= ypivot; rotatepoint.x = dmulscale(x, dacos, -y, dasin, 14) + xpivot; diff --git a/source/games/whaven/src/whfx.cpp b/source/games/whaven/src/whfx.cpp index 24aa3a985..8de217af0 100644 --- a/source/games/whaven/src/whfx.cpp +++ b/source/games/whaven/src/whfx.cpp @@ -398,7 +398,7 @@ void revolvefx() { void bobbingsector() { for (int i = 0; i < bobbingsectorcnt; i++) { short dasector = bobbingsectorlist[i]; - sector[dasector].floorz += (sintable[(lockclock << 4) & 2047] >> 6); + sector[dasector].floorz += bsin(lockclock << 4, -6); } } @@ -663,7 +663,7 @@ void dofx() { GLRenderer gl = glrender(); if (gl != nullptr) { if (player[pyrn].poisoned != 0) { - int tilt = mulscale(sintable[(3 * lockclock) & 2047], 20, 16); + int tilt = mulscale(bsin(3 * lockclock), 20, 16); if (tilt != 0) gl.setdrunk(tilt); } else @@ -826,8 +826,8 @@ void makeasplash(int picnum, PLAYER& plr) { break; } - movesprite((short) j, ((sintable[(sprite[j].ang + 512) & 2047]) * TICSPERFRAME) << 3, - ((sintable[sprite[j].ang & 2047]) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); + movesprite((short) j, (bcos(sprite[j].ang) * TICSPERFRAME) << 3, + (bsin(sprite[j].ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); } void makemonstersplash(int picnum, int i) { @@ -1020,8 +1020,8 @@ void warpfxsprite(int s) { int daz = (((sprite[j].zvel) * TICSPERFRAME) >> 3); - movesprite((short) j, ((sintable[(daang + 512) & 2047]) * TICSPERFRAME) << 3, - ((sintable[daang & 2047]) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1); + movesprite((short) j, (bcos(daang) * TICSPERFRAME) << 3, + (bsin(daang) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1); } void FadeInit() { diff --git a/source/games/whaven/src/whplr.cpp b/source/games/whaven/src/whplr.cpp index ed1acdd24..6607ef8aa 100644 --- a/source/games/whaven/src/whplr.cpp +++ b/source/games/whaven/src/whplr.cpp @@ -247,8 +247,8 @@ void plruse(PLAYER& plr) { int daz2 = -mulscale16(plr.horizon.horiz.asq16(), 2000); Hitscan pHitInfo; hitscan(plr.x, plr.y, plr.z, plr.sector, // Start position - sintable[(daang + 2560) & 2047], // X vector of 3D ang - sintable[(daang + 2048) & 2047], // Y vector of 3D ang + bcos(daang), // X vector of 3D ang + bsin(daang), // Y vector of 3D ang daz2, // Z vector of 3D ang pHitInfo, CLIPMASK1); @@ -430,8 +430,8 @@ void chunksofmeat(PLAYER& plr, int hitsprite, int hitx, int hity, int hitz, shor sprite[j].lotag = 512; sprite[j].hitag = 0; sprite[j].pal = 0; - movesprite((short) j, ((sintable[(sprite[j].ang + 512) & 2047]) * TICSPERFRAME) << 3, - ((sintable[sprite[j].ang & 2047]) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); + movesprite((short) j, (bcos(sprite[j].ang) * TICSPERFRAME) << 3, + (bsin(sprite[j].ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0); } } @@ -612,7 +612,7 @@ void dophysics(PLAYER& plr, int goalz, int flyupdn, int v) { if (flyupdn < 0) { plr.hvel += (TICSPERFRAME << 7); } - plr.hvel += (sintable[(lockclock << 4) & 2047] >> 6); + plr.hvel += bsin(lockclock << 4, -6); plr.fallz = 0; } diff --git a/source/games/whaven/src/whtag.cpp b/source/games/whaven/src/whtag.cpp index 0f56b923b..a4338ab4f 100644 --- a/source/games/whaven/src/whtag.cpp +++ b/source/games/whaven/src/whtag.cpp @@ -938,7 +938,7 @@ void animatetags(int nPlayer) { #pragma message ("setinterpolation") //game.pInt.setceilinterpolate(dasector, sector[dasector]); - sector[dasector].floorz = dragfloorz[i] + (sintable[(lockclock << 4) & 2047] >> 3); + sector[dasector].floorz = dragfloorz[i] + bsin(lockclock << 4, -3); if (plr.sector == dasector) {