rodecomp/Source/UI/WindowBackground.cpp
ragnarok-clanker dcecaa8a09 Decompile 5 functions in Source/UI/WindowTitlebar.cpp, Source/UI/WindowBackground.cpp, ...
Batch #1396 by Yommy: 0 byte-identical, 5 confirmed by peer review.

- fn_12098 UIWindow::DrawTitleBar: logic confirmed by peer review
- fn_12099 UIWindow::DrawTitleBarAt: logic confirmed by peer review
- fn_12085 UIWindow::DrawPanelBackground: logic confirmed by peer review
- fn_12086 UIWindow::DrawPanelBackgroundAt: logic confirmed by peer review
- fn_12088 UIWindow::DrawButtonBar: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/UI/WindowTitlebar.cpp, Source/UI/WindowBackground.cpp
2026-10-28 12:16:43 +00:00

64 lines
2.2 KiB
C++

#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/SkinPalette.h"
#include "Resource/TextureNames.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowBorder.h"
#include <cstring>
#include <windows.h>
// OFFSET: 0x008D03E0
// FUNCTION: fn_12085
void UIWindow::DrawPanelBackground(TextureNames& names, int y, int width, const char* bitmapName) {
if (std::strlen(bitmapName) != 0) {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(names.Resolve(bitmapName)));
if (bitmap) {
this->DrawBitmap(0, y, &bitmap->image, false);
}
return;
}
if (width == 0) {
width = this->geometry.width;
}
unsigned red;
unsigned green;
unsigned blue;
SkinPaletteChannels(ResourceMgr::Instance(), names, 14, 6, red, green, blue);
DrawRoundedBorder(*this, 0, y, width, this->geometry.height - y, RGB(red, green, blue));
this->FillRegion(0, y, width, 5, RGB(red, green, blue));
SkinPaletteChannels(ResourceMgr::Instance(), names, 2, 2, red, green, blue);
this->FillRegion(1, y, width - 2, this->geometry.height - y - 2, RGB(red, green, blue));
this->FillRegion(2, this->geometry.height - 2, width - 4, 1, RGB(red, green, blue));
}
// OFFSET: 0x008D0530
// FUNCTION: fn_12086
void UIWindow::DrawPanelBackgroundAt(TextureNames& names, int x, int y, int width, const char* bitmapName) {
if (bitmapName && std::strlen(bitmapName) != 0) {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(names.Resolve(bitmapName)));
if (bitmap) {
this->DrawBitmap(x, y, &bitmap->image, false);
}
return;
}
if (width == 0) {
width = this->geometry.width - x;
}
const int height = this->geometry.height;
unsigned red;
unsigned green;
unsigned blue;
SkinPaletteChannels(ResourceMgr::Instance(), names, 14, 6, red, green, blue);
DrawRoundedBorder(*this, x, y, width, height - y, RGB(red, green, blue));
this->FillRegion(x, y, width, 5, RGB(red, green, blue));
SkinPaletteChannels(ResourceMgr::Instance(), names, 2, 2, red, green, blue);
this->FillRegion(x + 1, y, width - 2, height - y - 2, RGB(red, green, blue));
this->FillRegion(x + 2, height - 2, width - 4, 1, RGB(red, green, blue));
}