From fa4384640ec1f5f6af73a6c85043aeafc806466c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 21:46:47 +0000 Subject: [PATCH] Decompile fn_04158 (UILapineScrollBar::Paint) Batch #1730 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_04158 UILapineScrollBar::Paint: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- Source/UI/UILapineScrollBar.cpp | 70 +++++++++++++++++++++++++++++++++ Source/UI/UILapineScrollBar.h | 11 ++++++ 2 files changed, 81 insertions(+) create mode 100644 Source/UI/UILapineScrollBar.h diff --git a/Source/UI/UILapineScrollBar.cpp b/Source/UI/UILapineScrollBar.cpp index b0c5d19..eb46b8a 100644 --- a/Source/UI/UILapineScrollBar.cpp +++ b/Source/UI/UILapineScrollBar.cpp @@ -1,4 +1,9 @@ #include "UI/UIIngredientInfoWnd.h" +#include "UI/UILapineScrollBar.h" + +#include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" // OFFSET: 0x005FF810 // FUNCTION: fn_04149 @@ -11,3 +16,68 @@ void UIIngredientInfoWnd::Slot10(int argument1, int argument2, std::intptr_t arg void UIIngredientInfoWnd::Move(int x, int y) { UIWindow::Move(x, y); } + +// OFFSET: 0x00600270 +// FUNCTION: fn_04158 +void UILapineScrollBar::Paint() { + const auto load = [](const char* name) { + return static_cast(ResourceMgr::Instance().Load(Resolve(name))); + }; + this->ClearSurface(0xFFFF00FF); + if (this->maximum == 0) { + return; + } + + if (this->vertical == 1) { + CBitmapRes* top = load("유저인터페이스\\lapine\\scrollbar_bg_top.bmp"); + CBitmapRes* bottom = load("유저인터페이스\\lapine\\scrollbar_bg_btm.bmp"); + CBitmapRes* middle = load("유저인터페이스\\lapine\\scrollbar_bg_mid.bmp"); + this->DrawBitmap(0, 0, &top->image, true); + + const int interior = this->geometry.height - bottom->image.height - top->image.height; + const int count = interior / middle->image.height + (interior % middle->image.height != 0); + for (int index = 0; index < count; ++index) { + this->DrawBitmap(0, middle->image.height * index + top->image.height, &middle->image, true); + } + this->DrawBitmap(0, this->geometry.height - bottom->image.height, &bottom->image, true); + + const int travel = this->geometry.height - bottom->image.height - top->image.height; + const int thumbLength = this->visible * travel / this->total; + const int thumbOffset = this->position * travel / this->total; + + const char* thumbTop; + const char* thumbBottom; + const char* thumbMiddle; + if (this->state == 0) { + thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_out_top.bmp"; + thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_out_btm.bmp"; + thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_out_mid.bmp"; + } else if (this->state == 3) { + thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_over_top.bmp"; + thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_over_btm.bmp"; + thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_over_mid.bmp"; + } else if (this->state == 6) { + thumbTop = "유저인터페이스\\lapine\\scrollbar_thumb_press_top.bmp"; + thumbBottom = "유저인터페이스\\lapine\\scrollbar_thumb_press_btm.bmp"; + thumbMiddle = "유저인터페이스\\lapine\\scrollbar_thumb_press_mid.bmp"; + } else { + this->minimumThumb = 0; + this->parent->Invalidate(); + return; + } + + CBitmapRes* capTop = load(thumbTop); + CBitmapRes* capBottom = load(thumbBottom); + CBitmapRes* fill = load(thumbMiddle); + const int span = thumbLength - capBottom->image.height - capTop->image.height; + const int pieces = span / fill->image.height + (span % fill->image.height != 0); + for (int index = 0; index < pieces; ++index) { + this->DrawBitmap(0, fill->image.height * index + thumbOffset + capTop->image.height + top->image.height, &fill->image, true); + } + this->DrawBitmap(0, top->image.height + thumbOffset, &capTop->image, true); + this->DrawBitmap(0, thumbOffset - capBottom->image.height + thumbLength + top->image.height, &capBottom->image, true); + } + + this->minimumThumb = 0; + this->parent->Invalidate(); +} diff --git a/Source/UI/UILapineScrollBar.h b/Source/UI/UILapineScrollBar.h new file mode 100644 index 0000000..8d6338e --- /dev/null +++ b/Source/UI/UILapineScrollBar.h @@ -0,0 +1,11 @@ +#ifndef RAGNAROK_SOURCE_UI_UILAPINESCROLLBAR_H +#define RAGNAROK_SOURCE_UI_UILAPINESCROLLBAR_H + +#include "UI/Lists/UIScrollBar.h" + +class UILapineScrollBar : public UIScrollBar { +public: + void Paint() override; +}; + +#endif