From 32395bcbed1390d79b58d9c4da7b5736fc07da67 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 12 Nov 2026 08:50:27 +0000 Subject: [PATCH] Decompile fn_18903 (CHealSp::OnProcess) Batch #18074 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_18903 CHealSp::OnProcess: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- .../Contents/Effects/Skills/HealSpEffect.cpp | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/Source/Contents/Effects/Skills/HealSpEffect.cpp b/Source/Contents/Effects/Skills/HealSpEffect.cpp index 9a2a935b8..d3d0e32b8 100644 --- a/Source/Contents/Effects/Skills/HealSpEffect.cpp +++ b/Source/Contents/Effects/Skills/HealSpEffect.cpp @@ -9,6 +9,16 @@ #include #include +namespace { +// INLINED +__forceinline bool IsParticleActive(const CSpriteParticle* particle) { + if (0.0f == particle->life) { + return true; + } + return particle->life * 60.0f > static_cast(particle->elapsedFrames); +} +} + // OFFSET: 0x00B45200 // FUNCTION: fn_18896 CHealSp::~CHealSp() { @@ -76,7 +86,8 @@ bool CHealSp::IsAlive() { void CHealSp::OnProcess() { matrix rotation; if (this->frame % 2 == 0) { - const float angle = static_cast(std::max(rand() % 360, 0)); + const int roll = rand() % 360; + const float angle = static_cast(roll >= 0 ? roll : 0); rotation.MakeYRotation(GetRadian(static_cast(angle))); const float* values = rotation.values; const float x = values[3] * 0.0f + values[0] * 0.0f + values[6] * 3.0f + values[9]; @@ -115,7 +126,14 @@ void CHealSp::OnProcess() { fade = -(alpha / static_cast(this->effectLifetime - this->frame)); } - const float level = std::min(std::max(alpha + fade, 0.0f), static_cast(static_cast(maxAlpha))); + float level = alpha + fade; + if (level < 0.0f) { + level = 0.0f; + } + const float limit = static_cast(static_cast(maxAlpha)); + if (level > limit) { + level = limit; + } this->alphaLevel = static_cast(level); params[2] = fade; params[5] = spin + angle; @@ -127,7 +145,7 @@ void CHealSp::OnProcess() { for (std::list::iterator it = this->sprites.begin(); it != this->sprites.end();) { CSpriteParticle* sprite = *it; - if (sprite->life == 0.0f || static_cast(sprite->elapsedFrames) < sprite->life * 60.0f) { + if (IsParticleActive(sprite) == true) { float* params = &sprite->animationParameter; const float radius = params[0]; const float delay = params[4]; @@ -148,13 +166,21 @@ void CHealSp::OnProcess() { fade = -(alpha / static_cast(30 - sprite->elapsedFrames)); } - level = std::min(std::max(alpha + fade, 0.0f), 255.0f); + level = alpha + fade; + if (level < 0.0f) { + level = 0.0f; + } + if (level > 255.0f) { + level = 255.0f; + } } else { level = static_cast(this->alphaLevel); } params[2] = lift; - sprite->velocity = velocity; + sprite->velocity.x = velocity.x; + sprite->velocity.y = velocity.y; + sprite->velocity.z = velocity.z; sprite->alpha = static_cast(level); params[5] = fade; sprite->position.x = x;