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).
This commit is contained in:
ragnarok-clanker 2026-10-28 22:49:51 +00:00
commit d7862ef5c4
19 changed files with 217 additions and 119 deletions

View file

@ -13,55 +13,53 @@ 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 {
struct AngleTables {
float radians[361];
float negativeRadians[361];
float sine[361];
float negativeSine[361];
float cosine[361];
float negativeCosine[361];
// OFFSET: 0x00554280
// FUNCTION: fn_02021
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: 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 tables.radians[index >= 0 ? index : 361 + index];
return g_radTable[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];
return g_sinTable[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];
return g_cosTable[index >= 0 ? index : 361 + index];
}