From f788edba07ae1680665e494d1e09e77b07772ac5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 13:06:12 +0000 Subject: [PATCH] Decompile fn_18952 (CMapChainEffect::OnProcess) Batch #15742 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_18952 CMapChainEffect::OnProcess: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/MapChainEffect.cpp | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/Source/Contents/Effects/MapChainEffect.cpp b/Source/Contents/Effects/MapChainEffect.cpp index 6b507de97..8238f2889 100644 --- a/Source/Contents/Effects/MapChainEffect.cpp +++ b/Source/Contents/Effects/MapChainEffect.cpp @@ -122,29 +122,27 @@ bool CMapChainEffect::IsAlive() { // FUNCTION: fn_18952 void CMapChainEffect::OnProcess() { for (std::vector::iterator it = this->particles.begin(); it != this->particles.end(); ++it) { + (*it)->position.x = this->position[0]; + (*it)->position.y = this->position[1]; + (*it)->position.z = this->position[2]; CParticle* particle = *it; - particle->position.x = this->position[0]; - particle->position.y = this->position[1]; - particle->position.z = this->position[2]; if (particle) { - float& angle = *reinterpret_cast(&particle->angleBits); - const float speed = *reinterpret_cast(particle->animationParameters); - angle += speed; + float angle = *reinterpret_cast(particle->animationParameters) + *reinterpret_cast(&particle->angleBits); if (angle >= 360.0f) { angle -= 360.0f; } + *reinterpret_cast(&particle->angleBits) = angle; if (particle->rowIndex > 5) { int delta = -3; if (particle->elapsedFrames % 600 <= 250) { delta = 3; } - particle->alpha += delta; - if (particle->alpha > 255) { - particle->alpha = 255; - } else if (particle->alpha < 0) { - particle->alpha = 0; + int alpha = particle->alpha + delta; + if (alpha >= 255) { + alpha = 255; } + particle->alpha = alpha > 0 ? alpha : 0; } const CView* view = static_cast(g_modeMgr.GetGameMode())->camera; @@ -154,9 +152,9 @@ void CMapChainEffect::OnProcess() { particle->transform = rotation; const int segment = particle->columnIndex; - const int index = static_cast(static_cast(static_cast(particle->angleParameter / 20.0f) * segment) + angle) % 360; + const int index = static_cast(static_cast(static_cast(particle->angleParameter / 20.0f) * segment) + *reinterpret_cast(&particle->angleBits)) % 360; - vector3d points[4] = {}; + MapChainPoint points[4]; const int tilt = particle->phaseParameter; const float sinIndex = g_sinTable[index]; @@ -164,17 +162,18 @@ void CMapChainEffect::OnProcess() { const float sinTilt = g_sinTable[tilt]; const float cosTilt = g_cosTable[tilt]; - const float termX = (sinTilt * particle->scale) * cosIndex; - const float termZ = (particle->scale * cosTilt) * cosIndex; - const float widthCos = particle->speedParameter * cosTilt; - const float widthSin = particle->speedParameter * sinTilt; + const float centerX = (sinTilt * particle->scale) * cosIndex; + const float centerY = particle->scale * sinIndex; + const float centerZ = (particle->scale * cosTilt) * cosIndex; + const float sideX = particle->speedParameter * cosTilt; + const float sideZ = -sinTilt * particle->speedParameter; - const float v1x = (termX - widthCos) + 0.0f; - const float v3x = (termX + widthCos) + 0.0f; - const float v1y = (particle->scale * sinIndex - 0.0f) + particle->animationParameter; - const float v3y = (particle->scale * sinIndex + 0.0f) + particle->animationParameter; - const float v1z = (termZ + widthSin) + 0.0f; - const float v3z = (termZ - widthSin) + 0.0f; + const float v1x = (centerX - sideX) + 0.0f; + const float v1y = (centerY - 0.0f) + particle->animationParameter; + const float v1z = (centerZ - sideZ) + 0.0f; + const float v3x = (sideX + centerX) + 0.0f; + const float v3y = (centerY + 0.0f) + particle->animationParameter; + const float v3z = (sideZ + centerZ) + 0.0f; particle->vertices[1].x = v1x; particle->vertices[1].y = v1y;