mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-29 03:34:07 +00:00
fix Math_GetAtan2Tbl (#1132)
This commit is contained in:
parent
c8f4d66b00
commit
b41489c443
1 changed files with 8 additions and 4 deletions
|
@ -78,16 +78,20 @@ static u16 sATan2Tbl[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
u16 Math_GetAtan2Tbl(f32 x, f32 y) {
|
u16 Math_GetAtan2Tbl(f32 x, f32 y) {
|
||||||
s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
|
|
||||||
u16 ret;
|
u16 ret;
|
||||||
|
|
||||||
if (y == 0.0f) {
|
if (y == 0.0f) {
|
||||||
ret = sATan2Tbl[0];
|
ret = sATan2Tbl[0];
|
||||||
} else if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
|
} else {
|
||||||
|
s32 tblIdx = ((x / y) * 1024.0f) + 0.5f;
|
||||||
|
|
||||||
|
if (tblIdx >= ARRAY_COUNT(sATan2Tbl)) {
|
||||||
ret = sATan2Tbl[0];
|
ret = sATan2Tbl[0];
|
||||||
} else {
|
} else {
|
||||||
ret = sATan2Tbl[tblIdx];
|
ret = sATan2Tbl[tblIdx];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue