An accuracy improvement in Triangle.cpp
This one's weird: it doesn't affect the actual generation of ASM in the function, but rather it affects the ASM of sinf and cosf. You see, sinf and cosf are static - they're built right into the EXE. Since the previous code used cosf and sinf, they were embedded into the EXE, and InitTriangleTable would call them directly. However, this isn't what the original EXE does: instead, InitTriangleTable calls an intermediary function, that in turn calls the real cosf and sinf. Turns out this strange code generation is caused by calling cos and sin instead of cosf and sinf, but still using float parameters.
This commit is contained in:
parent
af7d8222a8
commit
7f7553bef2
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ void InitTriangleTable()
|
|||
for (i = 0; i < 0x21; ++i)
|
||||
{
|
||||
a = (float)(i * 6.2831855f / 256.0f);
|
||||
b = sinf(a) / cosf(a);
|
||||
b = sin(a) / cos(a);
|
||||
gTan[i] = (short)(b * 8192.0f);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue