- buildutils: Replace sintable[] use within Exhumed with bsin()/bcos().

This commit is contained in:
Mitchell Richters 2020-11-14 20:19:28 +11:00 committed by Christoph Oelckers
parent d6d74c2712
commit bae4d77427
7 changed files with 8 additions and 8 deletions

View file

@ -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);

View file

@ -68,8 +68,9 @@ template<typename T> 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);

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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);