Made Triangle.cpp ASM-accurate

This commit is contained in:
Clownacy 2019-04-08 16:57:20 +01:00
parent f8f46fc1e4
commit cfcee6d4c3

View file

@ -9,6 +9,8 @@ int16_t gTan[0x21];
void InitTriangleTable() void InitTriangleTable()
{ {
int i; int i;
float a;
float b;
//Sine //Sine
for (i = 0; i < 0x100; ++i) for (i = 0; i < 0x100; ++i)
@ -19,9 +21,9 @@ void InitTriangleTable()
//Tangent //Tangent
for (i = 0; i < 0x21; ++i) for (i = 0; i < 0x21; ++i)
{ {
float a = (float)(i * 6.2831855 / 256.0); a = (float)(i * 6.2831855f / 256.0f);
float b = sinf(a) / cosf(a); b = sinf(a) / cosf(a);
gTan[i] = (int16_t)(b * 8192.0); gTan[i] = (int16_t)(b * 8192.0f);
} }
} }
@ -63,7 +65,7 @@ uint8_t GetArktan(int x, int y)
} }
else else
{ {
if (-y < x) if (x > -y)
{ {
k = (-y * 0x2000) / x; k = (-y * 0x2000) / x;
while (k > gTan[a]) while (k > gTan[a])