From f75a170ec04d4cdd8dcda0bb9c4616954f75e2e5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 00:39:25 +0000 Subject: [PATCH] Decompile 4 functions in Source/Contents/Effects/EZ2STREffectEx.cpp, Source/Contents/Effects/EZ2STREffectEx.h Batch #4035 by kyoshi: 2 byte-identical, 2 confirmed by peer review. - fn_06962 CEZ2STREffectEx::CEZ2STREffectEx: logic confirmed by peer review - fn_06964 CEZ2STREffectEx::Close: byte-identical - fn_06965 CEZ2STREffectEx::Slot31: byte-identical - fn_06966 ScreenAngle: logic confirmed by peer review Peer-reviewed-by: youko, tayoba Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/Contents/Effects/EZ2STREffectEx.cpp --- Source/Contents/Effects/EZ2STREffectEx.cpp | 54 ++++++++++++++++++++++ Source/Contents/Effects/EZ2STREffectEx.h | 29 ++++++++++++ data/compile.json | 1 + 3 files changed, 84 insertions(+) create mode 100644 Source/Contents/Effects/EZ2STREffectEx.cpp create mode 100644 Source/Contents/Effects/EZ2STREffectEx.h diff --git a/Source/Contents/Effects/EZ2STREffectEx.cpp b/Source/Contents/Effects/EZ2STREffectEx.cpp new file mode 100644 index 00000000..276d4e60 --- /dev/null +++ b/Source/Contents/Effects/EZ2STREffectEx.cpp @@ -0,0 +1,54 @@ +#include "Contents/Effects/EZ2STREffectEx.h" + +#include "Contents/Effects/EffectMemoryMgr.h" +#include "Render/Renderer.h" +#include "Utility/Math/AffineMatrix.h" + +#include + +// OFFSET: 0x006FF480 +// FUNCTION: fn_06962 +CEZ2STREffectEx::CEZ2STREffectEx() : CEffect(-1), particle(nullptr), finished(0), unknown_00D4(0), unknown_00D8(0) { +} + +// OFFSET: 0x006FF740 +// FUNCTION: fn_06964 +void CEZ2STREffectEx::Close() { + if (this->particle) { + FreeParticle(this->particle); + this->particle = nullptr; + } +} + +// OFFSET: 0x006FF770 +// FUNCTION: fn_06965 +void CEZ2STREffectEx::Slot31() { + this->finished = 1; +} + +// OFFSET: 0x006FF780 +// FUNCTION: fn_06966 +float ScreenAngle(const float* from, const float* to, const float* matrix) { + float fromX; + float fromY; + float fromDepth = 0.0f; + float toX; + float toY; + float toDepth = 0.0f; + g_renderer->ProjectViewport(from, matrix, &fromX, &fromY, &fromDepth); + g_renderer->ProjectViewport(to, matrix, &toX, &toY, &toDepth); + + const float dx = toX - fromX; + const float dy = toY - fromY; + const float length = SquareRoot(dy * dy + dx * dx); + if (length == 0.0f) { + return 0.0f; + } + + const float angle = static_cast(std::acos(static_cast(dx / length))) / 3.141592f * 180.0f; + if (fromY > toY) { + return 360.0f - angle; + } + + return angle; +} diff --git a/Source/Contents/Effects/EZ2STREffectEx.h b/Source/Contents/Effects/EZ2STREffectEx.h new file mode 100644 index 00000000..5fbeb13a --- /dev/null +++ b/Source/Contents/Effects/EZ2STREffectEx.h @@ -0,0 +1,29 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_EFFECTS_EZ2STREFFECTEX_H +#define RAGNAROK_SOURCE_CONTENTS_EFFECTS_EZ2STREFFECTEX_H + +#include "Contents/Effects/Effect.h" + +#include + +class CParticle; + +class CEZ2STREffectEx : public CEffect { +public: + CEZ2STREffectEx(); + void Close() override; + void Slot31() override; + + /* 00CC */ CParticle* particle; + /* 00D0 */ unsigned char finished; + /* 00D4 */ int unknown_00D4; + /* 00D8 */ unsigned char unknown_00D8; +}; + +float ScreenAngle(const float* from, const float* to, const float* matrix); + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(CEZ2STREffectEx, particle) == 0xCC); +static_assert(offsetof(CEZ2STREffectEx, unknown_00D8) == 0xD8); +#endif + +#endif diff --git a/data/compile.json b/data/compile.json index a1c1ad2d..93aed984 100644 --- a/data/compile.json +++ b/data/compile.json @@ -336,6 +336,7 @@ "Source/Contents/Effects/CommonFloorEffect.cpp": 4, "Source/Contents/Effects/Competentia.cpp": 4, "Source/Contents/Effects/CresciveBolt.cpp": 4, + "Source/Contents/Effects/EZ2STREffectEx.cpp": 4, "Source/Contents/Effects/Effect.cpp": 0, "Source/Contents/Effects/EffectActor.cpp": 4, "Source/Contents/Effects/EffectAttachments.cpp": 4,