rodecomp/Source/Utility/Math/ClientAngles.cpp
ragnarok-clanker bed2f6cebd Decompile fn_24291 (CGraffiSkill::Render)
Batch #17229 by br4yan: 0 byte-identical, 1 confirmed by peer review.

- fn_24291 CGraffiSkill::Render: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, alisonrag, cremane
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-11 15:29:14 +00:00

64 lines
1.3 KiB
C++

#include "Utility/Math/AffineMatrix.h"
#include <bit>
#include <cmath>
// 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];
}