- create sintable sintablef[2048] as sintables of doubles.

* Also change BANG2RAD define to be a double and not a float.
This commit is contained in:
Mitchell Richters 2020-08-02 14:36:28 +10:00 committed by Christoph Oelckers
parent 18c3d9b240
commit 7b8e40c7e1
2 changed files with 11 additions and 1 deletions

View file

@ -43,7 +43,7 @@ enum rendmode_t {
#define PI 3.14159265358979323846
#define fPI 3.14159265358979323846f
#define BANG2RAD (fPI * (1.f/1024.f))
#define BANG2RAD (PI * (1./1024.))
#define MAXSECTORSV8 4096
#define MAXWALLSV8 16384
@ -370,6 +370,7 @@ static inline int32_t BGetTime(void) { return (int32_t) totalclock; }
EXTERN int32_t numframes, randomseed;
EXTERN int16_t sintable[2048];
EXTERN double sintablef[2048];
EXTERN int16_t numshades;
EXTERN uint8_t paletteloaded;

View file

@ -588,11 +588,20 @@ static int32_t engineLoadTables(void)
reciptable[i] = divscale30(2048, i+2048);
for (i=0; i<=512; i++)
{
sintable[i] = (int16_t)(16384.f * sinf((float)i * BANG2RAD) + 0.0001f);
sintablef[i] = 16384. * sin(BANG2RAD * i);
}
for (i=513; i<1024; i++)
{
sintable[i] = sintable[1024-i];
sintablef[i] = sintablef[1024-i];
}
for (i=1024; i<2048; i++)
{
sintable[i] = -sintable[i-1024];
sintablef[i] = -sintablef[i-1024];
}
for (i=0; i<640; i++)
radarang[i] = (int16_t)(atanf(((float)(640-i)-0.5f) * (1.f/160.f)) * (-64.f * (1.f/BANG2RAD)) + 0.0001f);