From cc3ced6e1c21fac4d612cb60b06ace9cd6d84fd6 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 13:05:29 +0000 Subject: [PATCH] Decompile fn_08063 (CSprRes::EncodeSpriteRuns) Batch #15726 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_08063 CSprRes::EncodeSpriteRuns: 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/Resource/Sprites/SpriteEncoding.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/Resource/Sprites/SpriteEncoding.cpp b/Source/Resource/Sprites/SpriteEncoding.cpp index f786e2e5d..288def3f4 100644 --- a/Source/Resource/Sprites/SpriteEncoding.cpp +++ b/Source/Resource/Sprites/SpriteEncoding.cpp @@ -13,16 +13,14 @@ std::uint8_t* CSprRes::EncodeSpriteRuns(const std::uint8_t* pixels, int width, i for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x, ++index) { if (pixels[index] == 0) { - if (zeroRun) { - if (++zeroCount >= 255) { - encoded.push_back(static_cast(zeroCount)); - zeroRun = 0; - zeroCount = 0; - } - } else { + if (!zeroRun) { encoded.push_back(0); zeroRun = 1; ++zeroCount; + } else if (++zeroCount >= 255) { + encoded.push_back(static_cast(zeroCount)); + zeroRun = 0; + zeroCount = 0; } } else { if (zeroRun) {