From 1310bace1558eb99bbc596a151ad4f994f59ec1b Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 09:35:13 +0000 Subject: [PATCH] Decompile fn_10810 (UIHeadsprButton::Paint) Batch #5224 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_10810 UIHeadsprButton::Paint: logic confirmed by peer review Peer-reviewed-by: eAthena, youko, Qwenkler3.8 Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/CashEmotionMgr.cpp | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 561f3e8d..4a3ccf4c 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -1935,6 +1935,57 @@ UISpriteButton2::~UISpriteButton2() { UISpriteButton::~UISpriteButton() = default; // OFFSET: 0x0085CF90 +// FUNCTION: fn_10810 +void UIHeadsprButton::Paint() { + if (!this->geometry.surface) { + return; + } + + CActRes* action = static_cast(ResourceMgr::Instance().Load(this->actionName.c_str())); + if (!action) { + return; + } + + CSprRes* sprite = static_cast(ResourceMgr::Instance().Load(this->spriteName.c_str())); + if (!sprite) { + return; + } + + const std::uint32_t* palette; + if (this->unknown_00FC.size() != 0) { + palette = dynamic_cast(ResourceMgr::Instance().Load(this->unknown_00FC.c_str()))->palette; + } else { + palette = sprite->palette; + } + + const SpriteFrameCell& cell = action->Frame(this->unknown_00BC, 0).Cell(1); + const SpriteRleImage* image = sprite->images[cell.imageType][cell.image]; + if (!image) { + return; + } + + SpriteAtlasRecord record{}; + CTexture* texture; + if (cell.imageType == 0) { + texture = g_renderer->atlas.Find(image, palette, record); + if (!texture) { + texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + } + } else { + texture = static_cast(const_cast(image->unknown_0008)); + } + + if (!texture) { + return; + } + + const int sourceY = static_cast(record.v0 * 256.0f); + const int sourceX = static_cast(record.u0 * 256.0f); + this->geometry.surface->DrawSurface( + 0, 0, texture, sourceX < 0 ? 0 : sourceX, sourceY < 0 ? 0 : sourceY, image->width, image->height, cell.mirrored != 0, image->unknown_0004 + 1, + image->unknown_0006 + 1, 0, 0 + ); +} // OFFSET: 0x0085D6C0