diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 6df3190..0021112 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -26,6 +26,7 @@ struct tagRECT; struct tagSIZE; struct ActionFrame; class CSprRes; +class CBitmapRes; struct UIWindowContext { RenderPrimitivePool& primitives; @@ -147,6 +148,8 @@ public: void DrawPanelBackground(TextureNames& names, int y, int width, const char* bitmapName); void DrawPanelBackgroundAt(TextureNames& names, int x, int y, int width, const char* bitmapName); int DrawButtonBar(TextureNames& names, int style, int width, int rows); + int DrawButtonBarAt(TextureNames& names, int style, int x, int width, int rows); + CBitmapRes* LoadStyledBitmap(TextureNames& names, int style, const char* format, const char* name); // INLINED bool HasTextBackground() const { diff --git a/Source/UI/WindowLowerBorder.cpp b/Source/UI/WindowLowerBorder.cpp new file mode 100644 index 0000000..c2039f5 --- /dev/null +++ b/Source/UI/WindowLowerBorder.cpp @@ -0,0 +1,77 @@ +#include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" +#include "UI/Window/UIWindow.h" +#include "Utility/Text/FormatString.h" + +#include +#include + +// OFFSET: 0x008D0BE0 +// FUNCTION: fn_12089 +int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, int rows) { + if (width == 0) { + width = this->geometry.width - x; + } + + const int height = this->geometry.height; + int leftWidth = 0; + int rightWidth = 0; + int barHeight = 0; + + CBitmapRes* left = + this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_left%d.bmp", "유저인터페이스\\basic_interface\\btnbar_left.bmp"); + if (left) { + leftWidth = left->image.width; + barHeight = left->image.height; + + for (int row = 1; row <= rows; ++row) { + this->DrawBitmap(x, height - row * barHeight, &left->image, false); + } + } + + CBitmapRes* right = + this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_right%d.bmp", "유저인터페이스\\basic_interface\\btnbar_right.bmp"); + if (right) { + rightWidth = right->image.width; + + for (int row = 1; row <= rows; ++row) { + this->DrawBitmap(x - rightWidth + width, height - row * barHeight, &right->image, false); + } + } + + CBitmapRes* middle = + this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_mid%d.bmp", "유저인터페이스\\basic_interface\\btnbar_mid.bmp"); + if (!middle) { + return 0; + } + + const int middleWidth = middle->image.width; + const int extent = width - rightWidth - leftWidth; + const int count = extent / middleWidth + (extent % middleWidth != 0); + const int startX = leftWidth + x; + + for (int row = 1; row <= rows; ++row) { + int columnX = startX; + for (int column = 0; column < count; ++column) { + this->DrawBitmap(columnX, height - row * barHeight, &middle->image, false); + columnX += middleWidth; + } + } + + return middle->image.height; +} + +// OFFSET: 0x008D7570 +// FUNCTION: fn_12120 +CBitmapRes* UIWindow::LoadStyledBitmap(TextureNames& names, int style, const char* format, const char* name) { + if (style > 0) { + if (format && std::strlen(format) != 0) { + std::string filename = FormatOwnedString(format, style); + return static_cast(ResourceMgr::Instance().Load(names.Resolve(filename.c_str()))); + } + } else if (name && std::strlen(name) != 0) { + return static_cast(ResourceMgr::Instance().Load(names.Resolve(name))); + } + return nullptr; +} diff --git a/data/compile.json b/data/compile.json index 5919c3e..efa3b9c 100644 --- a/data/compile.json +++ b/data/compile.json @@ -644,6 +644,7 @@ "Source/UI/Window/WindowRegistration.cpp": 2, "Source/UI/Window/WindowRetirement.cpp": 2, "Source/UI/WindowBackground.cpp": 2, + "Source/UI/WindowLowerBorder.cpp": 2, "Source/UI/WindowTitlebar.cpp": 2, "Source/Utility/AES.cpp": 0, "Source/Utility/Async/AsyncDiagnostic.cpp": 0,