From 3a2a86df2b0a74beaea003bf1e2a6b310bb2f8fc Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 12:15:44 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/Effects/MeteorEffect.cpp Batch #15965 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_07058 CMeteorEffect::OnProcess: logic confirmed by peer review - fn_07059 CMeteorEffect::Render: logic confirmed by peer review Peer-reviewed-by: eAthena, bgamez23 Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/MeteorEffect.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Contents/Effects/MeteorEffect.cpp b/Source/Contents/Effects/MeteorEffect.cpp index b1f3dd3ad..8addf86aa 100644 --- a/Source/Contents/Effects/MeteorEffect.cpp +++ b/Source/Contents/Effects/MeteorEffect.cpp @@ -11,6 +11,24 @@ #include #include +namespace { +// INLINED +__forceinline int RandomIndex(int range) { + if (range == 0) { + return 0; + } + return std::ranges::max(rand() % range, 0); +} + +// INLINED +__forceinline bool IsParticleAlive(const CParticle* particle) { + if (0.0f == particle->life) { + return true; + } + return particle->life * 60.0f > static_cast(particle->elapsedFrames); +} +} + // OFFSET: 0x007077D0 // FUNCTION: fn_07055 void CMeteorEffect::Close() { @@ -113,7 +131,7 @@ bool CMeteorEffect::IsAlive() { void CMeteorEffect::OnProcess() { for (auto it = this->particles.begin(); it != this->particles.end(); ) { CParticle* particle = *it; - if (particle->life == 0.0f || static_cast(particle->elapsedFrames) < particle->life * 60.0f) { + if (IsParticleAlive(particle) == true) { if (particle) { CSpriteParticle* spriteParticle = static_cast(particle); spriteParticle->UpdateFrame(); @@ -135,7 +153,7 @@ void CMeteorEffect::OnProcess() { void CMeteorEffect::Render() { for (auto it = this->particles.begin(); it != this->particles.end(); ++it) { CParticle* particle = *it; - if ((particle->life == 0.0f || particle->life * 60.0f > static_cast(particle->elapsedFrames)) && particle) { + if (IsParticleAlive(particle) == true && particle) { static_cast(particle)->Draw(0); } }