diff --git a/source/exhumed/src/gun.cpp b/source/exhumed/src/gun.cpp index cd22d859f..613981525 100644 --- a/source/exhumed/src/gun.cpp +++ b/source/exhumed/src/gun.cpp @@ -302,7 +302,7 @@ int CheckCloseRange(short nPlayer, int *x, int *y, int *z, short *nSector) hitSect = hitData.sect; hitWall = hitData.wall; - int ecx = sintable[150] >> 3; + int ecx = bsin(150, -3); uint32_t xDiff = klabs(hitX - *x); uint32_t yDiff = klabs(hitY - *y); diff --git a/source/exhumed/src/map.cpp b/source/exhumed/src/map.cpp index b5e7fe763..213792ad6 100644 --- a/source/exhumed/src/map.cpp +++ b/source/exhumed/src/map.cpp @@ -68,8 +68,9 @@ template void GetSpriteExtents(T const* const pSprite, int* top, int bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a) { - int nCos = z * sintable[(0 - a) & 2047]; - int nSin = z * sintable[(1536 - a) & 2047]; + // [MR]: Confirm that this is correct as math doesn't match the variable names. + int nCos = z * -bsin(a); + int nSin = z * -bcos(a); int nCos2 = mulscale16(nCos, yxaspect); int nSin2 = mulscale16(nSin, yxaspect); diff --git a/source/exhumed/src/mummy.cpp b/source/exhumed/src/mummy.cpp index d6ea30cfd..0a266bf11 100644 --- a/source/exhumed/src/mummy.cpp +++ b/source/exhumed/src/mummy.cpp @@ -240,7 +240,7 @@ void FuncMummy(int a, int nDamage, int nRun) MummyList[nMummy].G = 90; sprite[nSprite].xvel = bcos(sprite[nSprite].ang, -2); - sprite[nSprite].yvel = sintable[sprite[nSprite].ang] >> 2; // NOTE no angle masking in original code + sprite[nSprite].yvel = bsin(sprite[nSprite].ang, -2); } } } diff --git a/source/exhumed/src/queen.cpp b/source/exhumed/src/queen.cpp index 676a04771..e77b8b0aa 100644 --- a/source/exhumed/src/queen.cpp +++ b/source/exhumed/src/queen.cpp @@ -966,7 +966,6 @@ __MOVEQS: // DEMO-TODO: in disassembly angle was used without masking and thus causing OOB issue. // This behavior probably would be needed emulated for demo compatibility - // int dx = sintable[nAngle + 512] << 10; int dx = bcos(nAngle, 10); int dy = bsin(nAngle, 10); int dz = (RandomSize(5) - RandomSize(5)) << 7; diff --git a/source/exhumed/src/snake.cpp b/source/exhumed/src/snake.cpp index 86dd6772a..986029f80 100644 --- a/source/exhumed/src/snake.cpp +++ b/source/exhumed/src/snake.cpp @@ -158,7 +158,7 @@ int BuildSnake(short nPlayer, short zVal) int nSqrt = ksqrt(sqrtNum); - if (nSqrt < (sintable[512] >> 4)) + if (nSqrt < bsin(512, -4)) { BackUpBullet(&hitx, &hity, nAngle); nSprite = insertsprite(hitsect, 202); diff --git a/source/exhumed/src/spider.cpp b/source/exhumed/src/spider.cpp index 64b784ce5..f1ff26cf8 100644 --- a/source/exhumed/src/spider.cpp +++ b/source/exhumed/src/spider.cpp @@ -193,7 +193,7 @@ void FuncSpider(int a, int nDamage, int nRun) SpiderList[nSpider].nTarget = nTarget; sprite[nSprite].xvel = bcos(sprite[nSprite].ang); - sprite[nSprite].yvel = sintable[sprite[nSprite].ang]; // NOTE - not angle masking here in original code + sprite[nSprite].yvel = bsin(sprite[nSprite].ang); return; } } diff --git a/source/exhumed/src/status.cpp b/source/exhumed/src/status.cpp index 8c5083f5b..f9c59ae16 100644 --- a/source/exhumed/src/status.cpp +++ b/source/exhumed/src/status.cpp @@ -745,7 +745,7 @@ private: { int s = -8; if (althud_flashing && pp->nHealth > 800) - s += (sintable[(leveltime << 7) & 2047] >> 10); + s += bsin(leveltime << 7, -10); int intens = clamp(255 - 4 * s, 0, 255); auto pe = PalEntry(255, intens, intens, intens); format.Format("%d", pp->nHealth >> 3);