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

@ -1,6 +1,7 @@
#include "Contents/Effects/EffectPrimitiveMotion.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ActiveGameMode.h"
#include "Client/Session.h"
#include "Contents/Camera/Camera.h"
#include "Contents/World/WorldScene.h"
#include "Resource/Sprites/ActionResource.h"
@ -23,8 +24,8 @@
namespace {
// INLINED
EffectVector3 Forward(float distance, const float* matrix) {
const EffectVector3 point{0.0f, 0.0f, distance};
vector3d Forward(float distance, const float* matrix) {
const vector3d point{0.0f, 0.0f, distance};
return {
((matrix[3] * point.y + matrix[0] * point.x) + point.z * matrix[6]) + matrix[9],
((matrix[4] * point.y + matrix[1] * point.x) + point.z * matrix[7]) + matrix[10],
@ -33,8 +34,8 @@ namespace {
}
// INLINED
EffectVector3 Upward(float distance, const float* matrix) {
const EffectVector3 point{0.0f, -distance, 0.0f};
vector3d Upward(float distance, const float* matrix) {
const vector3d point{0.0f, -distance, 0.0f};
return {
((matrix[3] * point.y + matrix[0] * point.x) + point.z * matrix[6]) + matrix[9],
((matrix[4] * point.y + matrix[1] * point.x) + point.z * matrix[7]) + matrix[10],
@ -43,8 +44,8 @@ namespace {
}
// INLINED
EffectVector3 Lift(float distance, const float* matrix) {
const EffectVector3 point{0.0f, distance, 0.0f};
vector3d Lift(float distance, const float* matrix) {
const vector3d point{0.0f, distance, 0.0f};
return {
((matrix[3] * point.y + matrix[0] * point.x) + point.z * matrix[6]) + matrix[9],
((matrix[4] * point.y + matrix[1] * point.x) + point.z * matrix[7]) + matrix[10],
@ -868,7 +869,7 @@ void EffectParticle::PrimBottom2() {
slot.fullDisplayAngle -= 360;
}
slot.maxHeight = 20.0f + 10.0f * ClientSine(slot.fullDisplayAngle);
slot.maxHeight = 20.0f + 10.0f * g_sinTable[slot.fullDisplayAngle];
}
}
@ -930,7 +931,7 @@ void EffectParticle::PrimBottom() {
slot.vecBNow.x = this->render.position[0];
slot.vecBNow.z = this->render.position[2];
slot.vecBPre.y = this->render.position[1] - 6.0f;
slot.vecBNow.y = slot.vecBPre.y + 3.0f * ClientSine(slot.rotStart);
slot.vecBNow.y = slot.vecBPre.y + 3.0f * g_sinTable[slot.rotStart];
if (slot.flag1[2] == 7) {
slot.fullDisplayAngle += 10;
@ -1399,6 +1400,91 @@ void EffectParticle::PrimGuard() {
}
}
// OFFSET: 0x00BBFAA0
bool EffectParticle::PrimLineLink() {
CGameMode* gameMode = static_cast<CGameMode*>(g_world.ActiveGameMode());
const CRenderObject* target = nullptr;
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
EffectPrimitiveSlot& slot = this->state.slots[0];
++slot.process;
slot.vecTNow = {this->render.position[0], this->render.position[1], this->render.position[2]};
slot.vecTNow.y -= 8.0f;
if (slot.height[4] == 2.0f) {
if (slot.process > 40) {
slot.alphaB -= 3;
if (slot.alphaB < 0) {
slot.alphaB = 0;
}
} else if (slot.process < 20) {
slot.alphaB += 6;
}
} else if (slot.height[4] == 3.0f) {
const int phase = slot.process % 360;
if (slot.process <= 80) {
++slot.alphaB;
}
slot.maxHeight += g_sinTable[phase] * 0.005f;
} else if (slot.process % 10 < 5) {
slot.alphaB += 2;
} else {
slot.alphaB -= 2;
}
if (slot.height[0] > 0.0f) {
if (slot.height[0] == static_cast<float>(g_session.m_aid)) {
target = reinterpret_cast<const CRenderObject*>(gameMode->scene->player);
} else {
target = gameMode->scene->GetGameActorByAID(static_cast<std::uint32_t>(slot.height[0]));
}
}
if (target == nullptr) {
slot.life = 0;
slot.alphaB = 0;
} else {
slot.vecTPre = {target->render.position[0], target->render.position[1], target->render.position[2]};
slot.vecTPre.y -= 8.0f;
}
return true;
}
// OFFSET: 0x00BC1AA0
void EffectParticle::PrimSMA() {
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
if (slot.life != 1) {
continue;
}
++slot.process;
if (slot.process <= 0) {
continue;
}
if (slot.process == 1) {
const float x = this->state.offset.x - this->render.position[0];
const float z = this->state.offset.z - this->render.position[2];
CalculateVectorAngle(x, z, &slot.rotStart);
}
slot.vecBNow.x += slot.height[1] * g_cosTable[slot.rotStart];
slot.vecBNow.z += slot.height[1] * g_sinTable[slot.rotStart];
}
}
// OFFSET: 0x00BB6F30
// FUNCTION: fn_19779
bool EffectParticle::UpdateHit6() {