mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Merge branch 'dev' of https://github.com/coop-deluxe/sm64coopdx into dev
This commit is contained in:
commit
f61ff7613c
1 changed files with 4 additions and 1 deletions
|
|
@ -849,8 +849,11 @@ inline s16 atan2s(f32 y, f32 x) {
|
||||||
static const s16 offsets[] = {0x4000, 0x4000, 0xC000, 0xC000, 0x0000, 0x8000, 0x0000, 0x8000};
|
static const s16 offsets[] = {0x4000, 0x4000, 0xC000, 0xC000, 0x0000, 0x8000, 0x0000, 0x8000};
|
||||||
static const s8 signs[] = {-1, 1, 1, -1, 1, -1, -1, 1};
|
static const s8 signs[] = {-1, 1, 1, -1, 1, -1, -1, 1};
|
||||||
|
|
||||||
|
// Adjust output for (0, 0) edge case
|
||||||
|
s16 zeroAdj = (x == 0.0f && y == 0.0f) * -0x4000;
|
||||||
|
|
||||||
// Ensure the result fits into 16 bits via an explicit cast on angle
|
// Ensure the result fits into 16 bits via an explicit cast on angle
|
||||||
return (offsets[idx] + (signs[idx] * (s16)angle)) & 0xFFFF;
|
return ((offsets[idx] + (signs[idx] * (s16)angle)) + zeroAdj) & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue