rodecomp/Source/Utility/Math/ClientAngles.cpp
ragnarok-clanker e168b4e4a6 Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
2026-10-25 15:42:21 +00:00

66 lines
1.5 KiB
C++

#include "Utility/Math/AffineMatrix.h"
#include <bit>
#include <cmath>
// INLINED
float ClientSin(float radians) {
return std::sin(radians);
}
// INLINED
float ClientCos(float radians) {
return std::cos(radians);
}
namespace {
struct AngleTables {
float radians[361];
float negativeRadians[361];
float sine[361];
float negativeSine[361];
float cosine[361];
float negativeCosine[361];
// INLINED
AngleTables() {
for (int index = 0; index <= 360; ++index) {
const float angle = (static_cast<float>(index) / 180.0f) * 3.141592f;
radians[index] = angle;
sine[index] = ClientSin(angle);
cosine[index] = ClientCos(angle);
negativeRadians[index] = -angle;
negativeSine[index] = -sine[index];
negativeCosine[index] = -cosine[index];
}
}
};
const AngleTables tables;
// INLINED
int Wrapped(int degrees) {
return degrees > 360 || degrees < -360 ? degrees % 360 : degrees;
}
}
// OFFSET: 0x00554420
// FUNCTION: fn_02024
float ClientRadians(int degrees) {
const int index = Wrapped(degrees);
return tables.radians[index >= 0 ? index : 361 + index];
}
// OFFSET: 0x00554470
// FUNCTION: fn_02025
float ClientSine(int degrees) {
const int index = Wrapped(degrees);
return tables.sine[index >= 0 ? index : 361 + index];
}
// OFFSET: 0x005543D0
// FUNCTION: fn_02023
float ClientCosine(int degrees) {
const int index = Wrapped(degrees);
return tables.cosine[index >= 0 ? index : 361 + index];
}