rodecomp/Source/Utility/Math/ClientAngles.cpp
ragnarok-clanker aece70c99f Decompile 3 functions in Source/Utility/Math/ClientAngles.cpp
Batch #11733 by cremane: 3 byte-identical, 0 confirmed by peer review.

- fn_02023 ClientCosine: byte-identical
- fn_02024 GetRadian: byte-identical
- fn_02025 ClientSine: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-05 04:32:48 +00:00

74 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);
}
// GLOBAL: gl_24568
float g_radTable[722];
// GLOBAL: gl_24572
float g_sinTable[722];
// GLOBAL: gl_24574
float g_cosTable[722];
// INLINED
static void Wrap(int& degrees) {
if (degrees > 360 || degrees < -360) {
degrees %= 360;
}
}
// OFFSET: 0x00554280
// FUNCTION: fn_02021
void CreateTrigonometricTable() {
for (int index = 0; index <= 360; ++index) {
const float angle = (static_cast<float>(index) / 180.0f) * 3.141592f;
g_radTable[index] = angle;
g_sinTable[index] = ClientSin(angle);
g_cosTable[index] = ClientCos(angle);
g_radTable[index + 361] = -angle;
g_sinTable[index + 361] = -g_sinTable[index];
g_cosTable[index + 361] = -g_cosTable[index];
}
}
// OFFSET: 0x00554420
// FUNCTION: fn_02024
float GetRadian(int degrees) {
Wrap(degrees);
if (degrees < 0) {
return g_radTable[361 + degrees];
}
return g_radTable[degrees];
}
// OFFSET: 0x00554470
// FUNCTION: fn_02025
float ClientSine(int degrees) {
Wrap(degrees);
if (degrees < 0) {
return g_sinTable[361 + degrees];
}
return g_sinTable[degrees];
}
// OFFSET: 0x005543D0
// FUNCTION: fn_02023
float ClientCosine(int degrees) {
Wrap(degrees);
if (degrees < 0) {
return g_cosTable[361 + degrees];
}
return g_cosTable[degrees];
}