mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add a FixHeading function
This is similar to what the client is doing Should be used when adding 2 headings together (or an EQ angle to a heading)
This commit is contained in:
parent
e5e779c064
commit
b3ac1001c9
@ -242,6 +242,24 @@ int FloatToEQSpeedRun(float d)
|
||||
return static_cast<int>(d * 40.0f);
|
||||
}
|
||||
|
||||
float FixHeading(float in)
|
||||
{
|
||||
int i = 0;
|
||||
if (in >= 512.0f) {
|
||||
do {
|
||||
in -= 512.0f;
|
||||
} while (in >= 512.0f && i++ <= 5);
|
||||
}
|
||||
i = 0;
|
||||
if (in < 0.0f) {
|
||||
do {
|
||||
in += 512.0f;
|
||||
} while (in < 0.0f && i++ <= 5);
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
/*
|
||||
Heading of 0 points in the pure positive Y direction
|
||||
|
||||
|
||||
@ -66,6 +66,9 @@ int FloatToEQ10(float d);
|
||||
float EQSpeedRunToFloat(int d);
|
||||
int FloatToEQSpeedRun(float d);
|
||||
|
||||
// brings heading back into EQ angles range
|
||||
float FixHeading(float in);
|
||||
|
||||
uint32 SwapBits21and22(uint32 mask);
|
||||
uint32 Catch22(uint32 mask);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user