From 5706086de1ec5bf79e075e34ed172d48299d1188 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 01:27:50 +0000 Subject: [PATCH] Decompile 3 functions in Source/Contents/EffectResourceSwitcher.cpp, Source/Contents/EffectResourceSwitcher.h, ... Batch #4142 by Yommy: 0 byte-identical, 3 confirmed by peer review. - fn_06968 CEZ2STREffect::Slot01: logic confirmed by peer review - fn_06970 CEZ2STREffect::Slot03: logic confirmed by peer review - fn_06971 CEZ2STREffect::Slot04: logic confirmed by peer review Peer-reviewed-by: eAthena, KWDev, OrangeCat, youko Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/EffectResourceSwitcher.cpp | 109 +++++++++++++++++++++ Source/Contents/EffectResourceSwitcher.h | 3 + Source/Contents/Effects/EffectEmitter.h | 7 +- 3 files changed, 118 insertions(+), 1 deletion(-) diff --git a/Source/Contents/EffectResourceSwitcher.cpp b/Source/Contents/EffectResourceSwitcher.cpp index 661f9548..1ba9b605 100644 --- a/Source/Contents/EffectResourceSwitcher.cpp +++ b/Source/Contents/EffectResourceSwitcher.cpp @@ -1,9 +1,15 @@ #include "Contents/EffectResourceSwitcher.h" +#include "Client/Mode/CGameMode.h" +#include "Client/Mode/ModeMgr.h" #include "Contents/Actors/RenderObject.h" +#include "Contents/Camera/Camera.h" #include "Contents/Effects/Effect.h" #include "Contents/Effects/EffectLists.h" +#include "Contents/Effects/EffectMemoryMgr.h" #include "Contents/Effects/EffectPrimitiveState.h" +#include "Contents/Effects/Particle.h" #include "Contents/World/World.h" +#include "Resource/World/TerrainResource.h" #include #include @@ -247,6 +253,55 @@ bool CEZ2STREffect::IsFinished() { return this->emitter->currentFrame >= this->emitter->frameCount; } +// OFFSET: 0x006FFA20 +// FUNCTION: fn_06968 +void CEZ2STREffect::Slot01() { + EZ2STREffectInfo* info = CEZ2STREffectMgr::GetInstance()->FindById(this->id); + if (!info) { + return; + } + + CEZ2STRParticle* particle = static_cast(CreateEZ2STRParticle(reinterpret_cast(this->position), 5)); + if (!particle) { + return; + } + + InitParticleQuad(particle->vertices); + particle->m_actorId = this->actor; + particle->Load(info->name); + + EZ2STREmitter* emitter = reinterpret_cast(particle); + emitter->offset.x = info->offsetX; + emitter->offset.y = info->offsetY; + emitter->offset.z = 0.0f; + if (info->unknown_0024 & 1) { + this->retained = 1; + emitter->looping = 1; + } + + emitter->duration = info->unknown_0040[1]; + this->frameStep = info->unknown_0040[1] / 16; + if (!info->unknown_0028.empty()) { + this->AddEvent(0, info->unknown_0028.c_str(), this->frameStep + 1, 0); + } + + if (info->unknown_0040[0] >= 0) { + this->AddEvent(1, nullptr, info->unknown_0040[0], 0); + } + + if (info->unknown_0024 & 2) { + particle->flags = 0xD; + } + + if (info->unknown_0024 & 4) { + particle->flags = 0x205; + } + + emitter->unknown_3FEA = (info->unknown_0024 >> 3) & 1; + emitter->unknown_3FEB = (info->unknown_0024 >> 4) & 1; + this->emitter = emitter; +} + // OFFSET: 0x006FFBF0 // FUNCTION: fn_06969 bool CEZ2STREffect::Slot06() { @@ -270,6 +325,60 @@ bool CEZ2STREffect::Slot06() { return static_cast(emitter->elapsed) < emitter->lifetime * 60.0f; } +// OFFSET: 0x006FFC60 +// FUNCTION: fn_06970 +void CEZ2STREffect::Slot03() { + if (!this->emitter) { + return; + } + + if (this->timed == 1) { + this->emitter->remainingTime -= 0.05f; + } + + if (this->emitter->unknown_3FEB) { + CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); + this->position[1] = mode->scene->terrain->Grid().Height(this->position[0], this->position[2]); + } + + if (EZ2STREmitter* emitter = this->emitter) { + const float* view = static_cast(g_modeMgr.GetGameMode())->camera->frame.view.values; + const float* inverse = static_cast(g_modeMgr.GetGameMode())->camera->frame.inverse.values; + + const float x = this->position[0]; + const float y = this->position[1]; + const float z = this->position[2]; + const float viewX = x * view[0] + y * view[3] + z * view[6] + view[9] + emitter->offset.x; + const float viewY = x * view[1] + y * view[4] + z * view[7] + view[10] - emitter->offset.y; + const float viewZ = x * view[2] + y * view[5] + z * view[8] + view[11]; + + emitter->position.x = viewX * inverse[0] + viewY * inverse[3] + viewZ * inverse[6] + inverse[9]; + emitter->position.y = viewX * inverse[1] + viewY * inverse[4] + viewZ * inverse[7] + inverse[10]; + emitter->position.z = viewX * inverse[2] + viewY * inverse[5] + viewZ * inverse[8] + inverse[11]; + reinterpret_cast(emitter)->Process(0.0f, 0.0f, 0.0f); + } + + if (this->emitter->unknown_3FEA == 1 && this->emitter->unknown_3F58 == 1) { + this->frame = this->frameStep; + } + + ++this->emitter->elapsed; +} + +// OFFSET: 0x006FFEA0 +// FUNCTION: fn_06971 +void CEZ2STREffect::Slot04() { + if (!this->emitter) { + return; + } + + if (this->alternateRender) { + reinterpret_cast(this->emitter)->DrawGround(static_cast(g_modeMgr.GetGameMode())->camera->frame.view); + } else { + reinterpret_cast(this->emitter)->DrawScreen(static_cast(g_modeMgr.GetGameMode())->camera->frame.view); + } +} + // OFFSET: 0x006FFEF0 // FUNCTION: fn_06972 void CEZ2STREffect::Slot23(float argument) { diff --git a/Source/Contents/EffectResourceSwitcher.h b/Source/Contents/EffectResourceSwitcher.h index a5dfc8af..ee532970 100644 --- a/Source/Contents/EffectResourceSwitcher.h +++ b/Source/Contents/EffectResourceSwitcher.h @@ -36,6 +36,9 @@ public: /* 00D4 */ int frameStep; /* 00D8 */ unsigned char alternateRender; + void Slot01() override; + void Slot03() override; + void Slot04() override; bool Slot06() override; void Slot14(int argument) override; void Slot16(int argument) override; diff --git a/Source/Contents/Effects/EffectEmitter.h b/Source/Contents/Effects/EffectEmitter.h index 8e949897..23e05b37 100644 --- a/Source/Contents/Effects/EffectEmitter.h +++ b/Source/Contents/Effects/EffectEmitter.h @@ -26,7 +26,8 @@ struct EZ2STREmitter { /* 02DC */ unsigned char unknown_02DC[0x39E8]; /* 3CC4 */ int currentFrame; /* 3CC8 */ int frameCount; - /* 3CCC */ unsigned char unknown_3CCC[0x290]; + /* 3CCC */ unsigned char unknown_3CCC[0x28C]; + /* 3F58 */ int unknown_3F58; /* 3F5C */ unsigned char looping; /* 3F5D */ unsigned char fadeOut; /* 3F5E */ unsigned char unknown_3F5E[0x3A]; @@ -41,6 +42,8 @@ struct EZ2STREmitter { /* 3FB8 */ unsigned char unknown_3FB8[0x30]; /* 3FE8 */ unsigned char unknown_3FE8; /* 3FE9 */ unsigned char unknown_3FE9; + /* 3FEA */ unsigned char unknown_3FEA; + /* 3FEB */ unsigned char unknown_3FEB; }; #if defined(_WIN32) && !defined(_WIN64) @@ -51,6 +54,8 @@ static_assert(offsetof(EZ2STREmitter, elapsed) == 0xE8); static_assert(offsetof(EZ2STREmitter, velocity) == 0x2C8); static_assert(offsetof(EZ2STREmitter, speed) == 0x2D8); static_assert(offsetof(EZ2STREmitter, currentFrame) == 0x3CC4); +static_assert(offsetof(EZ2STREmitter, unknown_3F58) == 0x3F58); +static_assert(offsetof(EZ2STREmitter, unknown_3FEB) == 0x3FEB); #endif #endif