mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-27 15:42:42 -04:00
Fix rotations on optimization builds
I have literally zero idea why this broke. Optimizations are wild.
This commit is contained in:
@@ -10,7 +10,11 @@
|
||||
#define S2RAD_CONSTANT (M_PI / 0x8000)
|
||||
#define RAD2S_CONSTANT (0x8000 / M_PI)
|
||||
|
||||
#if TARGET_PC
|
||||
#define DEG2S(x) cAngle_degreeToS16((x))
|
||||
#else
|
||||
#define DEG2S(x) ((s16)((x) * DEG2S_CONSTANT))
|
||||
#endif
|
||||
#define S2DEG(x) ((x) * S2DEG_CONSTANT)
|
||||
#define S2RAD(x) ((x) * S2RAD_CONSTANT)
|
||||
#define RAD2S(x) ((x) * RAD2S_CONSTANT)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#define C_MATH_H
|
||||
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#if TARGET_PC
|
||||
#include "angle_utils.h"
|
||||
#endif
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include <limits>
|
||||
@@ -32,7 +35,11 @@ inline f32 cM_ssin(s16 x) {
|
||||
}
|
||||
|
||||
inline s16 cM_deg2s(f32 deg) {
|
||||
#if TARGET_PC
|
||||
return cAngle_degreeToS16(deg);
|
||||
#else
|
||||
return deg * 182.04445f;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline s16 i_cM_deg2s(f32 deg) {
|
||||
|
||||
@@ -85,4 +85,15 @@
|
||||
#define ANGLE_SUB_2 S16_SUB_2
|
||||
#define ANGLE_MULT_2 S16_MULT_2
|
||||
|
||||
#if TARGET_PC
|
||||
static inline s16 cAngle_degreeToS16(f32 deg) {
|
||||
s32 angle = (s32)(deg * (0x8000 / 180.0f));
|
||||
angle &= 0xFFFF;
|
||||
if (angle >= 0x8000) {
|
||||
angle -= 0x10000;
|
||||
}
|
||||
return (s16)angle;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !_ANGLE_UTILS_H_
|
||||
|
||||
Reference in New Issue
Block a user