rodecomp/Source/Utility/Math/ClientAngles.cpp
ragnarok-clanker d7862ef5c4 Decompile 9 functions in Source/Utility/Math/Vector3d.h, Source/Utility/Math/AffineMatrix.h, ...
Batch #1843 by ragnarok-clanker: 1 byte-identical, 8 confirmed by peer review.

- fn_02024 ClientRadians: logic confirmed by peer review
- fn_17668 WorldScene::GetGameActorByAID: logic confirmed by peer review
- fn_21057 CRenderObject::GetTargetPos: logic confirmed by peer review
- fn_17667 WorldScene::GetGameActorByAidIncludeMe: logic confirmed by peer review
- fn_21290 CGameMode::NotifyItemBounds: logic confirmed by peer review
- fn_03089 CEffect::Slot25: logic confirmed by peer review
- fn_08405 CellWorldPosition: logic confirmed by peer review
- fn_19762 EffectPrimitiveSlot::EffectPrimitiveSlot: byte-identical (already on main)
- fn_19865 DrawEffectPrimitive15: logic confirmed by peer review

Peer-reviewed-by: Yommy, eAthena, ragnarok-clanker
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-28 22:49:51 +00:00

65 lines
1.4 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];
namespace {
// INLINED
int Wrapped(int degrees) {
return degrees > 360 || degrees < -360 ? degrees % 360 : degrees;
}
}
// 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 ClientRadians(int degrees) {
const int index = Wrapped(degrees);
return g_radTable[index >= 0 ? index : 361 + index];
}
// OFFSET: 0x00554470
// FUNCTION: fn_02025
float ClientSine(int degrees) {
const int index = Wrapped(degrees);
return g_sinTable[index >= 0 ? index : 361 + index];
}
// OFFSET: 0x005543D0
// FUNCTION: fn_02023
float ClientCosine(int degrees) {
const int index = Wrapped(degrees);
return g_cosTable[index >= 0 ? index : 361 + index];
}