rodecomp/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp
ragnarok-clanker f464cd3f17 Decompile 41 functions in Source/Client/Input/InputCharset.cpp, Source/Client/Input/InputCharset.h, ...
Batch #1607 by ragnarok-clanker: 0 byte-identical, 41 confirmed by peer review.

- fn_11718 DrawItemIconById: logic confirmed by peer review
- fn_11719 DrawItemSlotBackground: logic confirmed by peer review
- fn_11721 UICntWnd::DrawBorder: logic confirmed by peer review
- fn_11760 UIBank_NewWnd::Paint: logic confirmed by peer review
- fn_11761 UIChatRoomWnd::Paint: logic confirmed by peer review
- fn_11767 UIMerInfoWnd::Paint: 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
- fn_12089 UIWindow::DrawButtonBarAt: logic confirmed by peer review
- fn_12098 UIWindow::DrawTitleBar: logic confirmed by peer review
- fn_12099 UIWindow::DrawTitleBarAt: logic confirmed by peer review
- fn_12120 UIWindow::LoadStyledBitmap: logic confirmed by peer review
- fn_12219 UIDisconnectedServerMsgWnd::Paint: logic confirmed by peer review
- fn_12233 UINoticeConfirmWnd::Paint: logic confirmed by peer review
- fn_12245 UIQuitWnd::Paint: logic confirmed by peer review
- fn_12246 UIRestartWnd::Paint: logic confirmed by peer review
- fn_12258 UIWaitWnd::Paint: logic confirmed by peer review
- fn_14470 CUIFrameWnd::RefreshSkinColors: logic confirmed by peer review
- fn_14471 CUIFrameWnd::Paint: logic confirmed by peer review
- fn_14472 CUIFrameWnd::SetSkinColors: logic confirmed by peer review
- fn_14635 CUIControl::LoadBitmapResource: logic confirmed by peer review
- fn_17781 InputCharset::Prefix: logic confirmed by peer review
- fn_17788 InputCharset::ServiceName: logic confirmed by peer review
- fn_17847 FadeOutMode: logic confirmed by peer review
- fn_18378 Resolve: logic confirmed by peer review
- fn_02111 RendererDX7Operations::SaveLogo: logic confirmed by peer review
- fn_09446 UICashEmotionPack::Paint: logic confirmed by peer review
- fn_09453 UICashEmotionPack::SetSaleBadge: logic confirmed by peer review
- fn_09483 UICashEmotionPiece::Paint: logic confirmed by peer review
- fn_45445 CSkinMgr::CSkinMgr: logic confirmed by peer review
- fn_09681 CSkinMgr::~CSkinMgr: logic confirmed by peer review
- fn_09683 CSkinMgr::Prepare: logic confirmed by peer review
- fn_09684 SkinPaletteColor: logic confirmed by peer review
- fn_09685 SkinPaletteChannels: logic confirmed by peer review
- fn_09686 CSkinMgr::Name: logic confirmed by peer review
- fn_09687 CSkinMgr::Prefix: logic confirmed by peer review
- fn_09688 CSkinMgr::Name: logic confirmed by peer review
- fn_09690 CSkinMgr::Selected: logic confirmed by peer review
- fn_10758 UIEditCtrl::DrawSelectionAt: logic confirmed by peer review
- fn_10759 UIEditCtrl::DrawSelection: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/Contents/SkinMgr.cpp
2026-10-28 19:13:07 +00:00

460 lines
12 KiB
C++

#include "Client/Mode/ActiveGameMode.h"
#include "Client/Mode/ModeEvents.h"
#include "Client/Replay.h"
#include "Client/ReplayPacketRecorder.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/TextureNames.h"
#include "UI/Acceptance/UIJoinPartyAcceptWnd.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/Chat/UIWhisperWnd.h"
#include "UI/Dialogs/UIBookWnd.h"
#include "UI/Dialogs/UIDisconnectedServerMsgWnd.h"
#include "UI/Dialogs/UILoadingWnd.h"
#include "UI/Dialogs/UIMenuWnd.h"
#include "UI/Dialogs/UIMinimapZoomWnd.h"
#include "UI/Dialogs/UINoticeConfirmWnd.h"
#include "UI/Dialogs/UINotifyLevelUpWnd.h"
#include "UI/Dialogs/UINotifyQuestWnd.h"
#include "UI/Dialogs/UIPetTamingDeceiveWnd.h"
#include "UI/Dialogs/UIQuitWnd.h"
#include "UI/Dialogs/UIRestartWnd.h"
#include "UI/Dialogs/UISayDialogWnd.h"
#include "UI/Dialogs/UISelectCartWnd.h"
#include "UI/Dialogs/UIWaitWnd.h"
#include "UI/Items/UIEquipWnd.h"
#include "UI/Items/UIExchangeWnd.h"
#include "UI/Items/UIItemCollectionWnd.h"
#include "UI/Items/UIItemIdentifyWnd.h"
#include "UI/Lists/UIComboBoxWnd.h"
#include "UI/Lists/UIListBox.h"
#include "UI/Party/UIPartySettingWnd.h"
#include "UI/Shop/UInCash_CallWnd.h"
#include "UI/Status/UIStatusWnd.h"
#include "UI/Text/UITextViewer.h"
#include "UI/Window/WindowManagerWindows.h"
#include <cstring>
#include <windows.h>
#include <timeapi.h>
namespace {
constexpr char prefix[] = "유저인터페이스\\";
}
// OFFSET: 0x008C73C0
// FUNCTION: fn_11930
UIChooseSellBuyWnd::UIChooseSellBuyWnd(UIWindowContext& windows, UIFrameContext& frames, UIAcceptanceContext& acceptance)
: UIFrameWnd(windows, frames, 0), identity(0), m_acceptance(&acceptance) {
}
// OFFSET: 0x008CC430
UIChooseSellBuyWnd::~UIChooseSellBuyWnd() = default;
// INLINED
void UIChooseSellBuyWnd::AddChoice(const char* name, int id, int x, int y) {
auto* button = new UIBitmapButton(*this->m_context, this->m_acceptance->text.buttons);
const char* suffixes[] = {"", "_a", "_b"};
for (int state = 0; state < 3; ++state) {
const std::string path = std::string(prefix) + name + suffixes[state] + ".bmp";
button->SetBitmap(path.c_str(), state, 0);
}
button->SetSize(button->BitmapWidth(), button->BitmapHeight());
button->Move(x, y);
button->SetId(id);
this->AddChild(button);
}
// INLINED
void UIChooseSellBuyWnd::CreateViewer(int width, int height) {
auto& text = this->m_acceptance->text;
this->viewer = new UITextViewer(*this->m_context, text);
this->viewer->Configure(10, 22, width - 20, height - 55, 0);
const std::string chip = std::string(prefix) + "colorchip.bmp";
const auto* bitmap = static_cast<CBitmapRes*>(text.buttons.resources.Load(chip.c_str()));
const auto& image = bitmap->image;
const std::uint32_t pixel = image.width > 2 && image.height > 2 ? image.pixels[2 + 2 * image.width] : 0x00FF0000u;
this->viewer->textColor = 0xFF000000u | ((pixel & 255) << 16) | (pixel & 0xFF00) | ((pixel >> 16) & 255);
this->viewer->Invalidate();
this->AddChild(this->viewer);
}
// OFFSET: 0x008DD290
// FUNCTION: fn_12162
void UIChooseSellBuyWnd::Slot15(int width, int height) {
this->AddChoice("btn_buy", 224, 144, 96);
this->AddChoice("btn_sell", 223, 189, 96);
this->AddChoice("btn_cancel", 185, 234, 96);
this->m_message0 = 224;
this->CreateViewer(width, height);
this->viewer->SendMsg(nullptr, 29, reinterpret_cast<std::intptr_t>(this->m_acceptance->text.buttons.services.MessageText(92)), 38, 0, 0);
}
// OFFSET: 0x008ED130
// FUNCTION: fn_12214
void UIChooseSellBuyWnd::Paint() {
const std::string path = std::string(prefix) + "win_msgbox.bmp";
const auto* bitmap = static_cast<CBitmapRes*>(this->m_acceptance->text.buttons.resources.Load(path.c_str()));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008ED190
// FUNCTION: fn_12217
void UIComboBoxIDWnd::Paint() {
this->ClearSurface(0xFFFF00FF);
}
// OFFSET: 0x008ED1A0
// FUNCTION: fn_12218
void UIComboBoxWnd::Paint() {
this->ClearSurface(0xFFFF00FF);
}
// OFFSET: 0x008ED1B0
// FUNCTION: fn_12219
void UIDisconnectedServerMsgWnd::Paint() {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp")));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008EECD0
// FUNCTION: fn_12228
void UILoadingWnd::Paint() {
}
// OFFSET: 0x008EF590
// FUNCTION: fn_12233
void UINoticeConfirmWnd::Paint() {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp")));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008EF7F0
// FUNCTION: fn_12235
void UINotifyLevelUpWnd::Paint() {
}
// OFFSET: 0x008EF800
// FUNCTION: fn_12236
void UINotifyQuestWnd::Paint() {
}
// OFFSET: 0x008EFF60
// FUNCTION: fn_12245
void UIQuitWnd::Paint() {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp")));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008EFFA0
// FUNCTION: fn_12246
void UIRestartWnd::Paint() {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp")));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008F2A90
// FUNCTION: fn_12258
void UIWaitWnd::Paint() {
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp")));
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
}
// OFFSET: 0x008F2DE0
// FUNCTION: fn_12261
void UInCash_CallWnd::Paint() {
}
// OFFSET: 0x008F32D0
// FUNCTION: fn_12264
void UIItemIdentifyWnd::Slot26(int x, int y) {
this->Slot25(x, y);
this->SendMsg(nullptr, 6, 184, 0, 0, 0);
}
// OFFSET: 0x008F3300
// FUNCTION: fn_12265
void UIStatusWnd::Slot26(int, int y) {
if (y < 17) {
this->SendMsg(this, 6, 202, 0, 0, 0);
}
}
// OFFSET: 0x008F3630
// FUNCTION: fn_12268
void UIBookWnd::Slot25(int x, int y) {
if (y < 17) {
this->UIFrameWnd::Slot25(x, y);
}
}
// OFFSET: 0x008F3650
// FUNCTION: fn_12269
void UICombinedCardItemCollection_ComparisonWnd::Slot25(int, int) {
}
// OFFSET: 0x008F38D0
// FUNCTION: fn_12272
void UIItemCollection_ComparisonWnd::Slot25(int, int) {
}
// OFFSET: 0x008F38E0
// FUNCTION: fn_12273
void UIItemIdentifyWnd::Slot25(int x, int y) {
if (y < 17) {
this->UIFrameWnd::Slot25(x, y);
return;
}
if (g_replayAnimationScaling != 0) {
return;
}
const int previous = this->m_selected;
int selected = -1;
if (x <= this->geometry.width - 14 && x >= 4 && y >= 34 && y < this->m_rows * 32 + 34) {
const int row = (y - 34) / 32;
int visible = 0;
int index = 0;
for (auto it = this->m_items.begin(); it != this->m_items.end(); ++it, ++index) {
if (index >= this->m_scroll * this->m_columns) {
if (visible == this->m_columns * row) {
selected = index;
break;
}
++visible;
}
}
}
this->m_selected = selected;
if (previous != selected) {
this->Invalidate();
}
}
// OFFSET: 0x008F39B0
// FUNCTION: fn_12274
void UIMinimapZoomWnd::Slot25(int, int) {
}
// OFFSET: 0x008F39C0
// FUNCTION: fn_12275
void UIPartySettingWnd::Slot25(int x, int y) {
if (y < 17) {
this->UIFrameWnd::Slot25(x, y);
}
}
// OFFSET: 0x008F39E0
// FUNCTION: fn_12276
void UIPetTamingDeceiveWnd::Slot25(int, int) {
if (g_replayAnimationScaling != 0 || this->m_started != 0) {
return;
}
this->m_state = 1;
this->m_frame = 7;
this->m_started = 1;
g_world.ActiveGameMode()->SendMsg(149, this->m_target, 0, 0, 0);
}
// OFFSET: 0x008F3A40
// FUNCTION: fn_12277
void UISelectCartWnd::Slot25(int x, int y) {
if (y < 17) {
this->UIFrameWnd::Slot25(x, y);
}
}
// OFFSET: 0x008F3A60
// FUNCTION: fn_12278
void UIStatusWnd::Slot25(int x, int y) {
if (y < this->m_titleHeight) {
this->UIFrameWnd::Slot25(x, y);
}
}
// OFFSET: 0x008F3BA0
// FUNCTION: fn_12281
void UICombinedCardItemCollection_ComparisonWnd::Slot31(int, int) {
}
// OFFSET: 0x008F3BB0
// FUNCTION: fn_12282
void UIEquipWnd::Slot31(int x, int y) {
this->UIFrameWnd::Slot31(x, y);
if (this->m_page != 3) {
return;
}
for (int i = 0; i < 4; ++i) {
const int left = 6 + i * 68;
if (left <= x && x <= left + 64 && y >= 58 && y <= 150) {
const int slot = this->m_firstSlot + i;
if (slot >= 0 && this->m_hoverSlot != slot) {
this->m_hoverSlot = slot;
}
return;
}
}
}
// OFFSET: 0x008F3C50
// FUNCTION: fn_12284
void UIItemCollection_ComparisonWnd::Slot31(int, int) {
}
// OFFSET: 0x008F4A80
// FUNCTION: fn_12291
void UIEquipWnd::Slot27(int x, int y) {
this->UIFrameWnd::Slot27(x, y);
this->Slot28(x, y);
}
// OFFSET: 0x008F4AB0
// FUNCTION: fn_12292
void UIMenuWnd::Slot27(int x, int y) {
this->Slot28(x, y);
}
// OFFSET: 0x008F4D40
// FUNCTION: fn_12294
void UIEquipWnd::Slot19() {
}
// OFFSET: 0x008F4F80
// FUNCTION: fn_12296
void UIItemCollectionWnd::Slot19() {
if (this->m_previewTick != 0 && timeGetTime() > this->m_previewTick + 100) {
this->m_preview->Invalidate();
this->m_previewTick = timeGetTime();
}
}
// OFFSET: 0x008F50B0
// FUNCTION: fn_12300
void UISayDialogWnd::Slot19() {
for (UIWindow* child : this->m_children) {
child->Slot19();
}
}
// OFFSET: 0x008F5990
// FUNCTION: fn_12307
void UIItemIdentifyWnd::Slot33(int, int) {
}
// OFFSET: 0x008F59A0
// FUNCTION: fn_12308
void UIWhisperWnd::Slot33(int, int) {
this->SendMsg(nullptr, 49, 0, 0, 0, 0);
}
// OFFSET: 0x008F5A10
// FUNCTION: fn_12310
void UIExchangeWnd::Slot35(int delta) {
this->SendMsg(this->m_scrollBar, 7, delta < 0 ? 1 : -1, 0, 0, 0);
}
// OFFSET: 0x008F5A50
// FUNCTION: fn_12311
void UIItemIdentifyWnd::Slot35(int delta) {
if (this->m_scrollable == 0) {
return;
}
int step = this->m_rows - 1;
if (step > 3) {
step = 3;
}
this->SendMsg(this->m_scrollBar, 7, delta < 0 ? step : -step, 0, 0, 0);
}
// OFFSET: 0x008F66B0
// FUNCTION: fn_12320
void UIComboBoxIDWnd::Resize(int width, int height) {
this->UIFrameWnd::Resize(width, height);
this->m_list->Resize(width, height);
this->m_list->Refresh();
this->m_list->Invalidate();
}
// OFFSET: 0x008F6700
// FUNCTION: fn_12321
void UIComboBoxWnd::Resize(int width, int height) {
this->UIFrameWnd::Resize(width, height);
this->m_list->Resize(width, height);
this->m_list->Refresh();
this->m_list->Invalidate();
}
// OFFSET: 0x008F8860
// FUNCTION: fn_12332
int UIChooseSellBuyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
if (message == 6) {
const int response = static_cast<int>(a);
this->m_acceptance->recorder.Record(this->geometry.id, response, b, c, d);
if (this->geometry.visible != 0) {
if (response == 185) {
this->m_context->mode->SendModeMessage(40, 0, 0, 0, 0);
this->m_frameContext->windows.CloseWindow(25);
} else if (response == 223 || response == 224) {
this->m_context->mode->SendModeMessage(response == 223 ? 37 : 38, this->identity, 0, 0, 0);
this->m_frameContext->windows.LookupWindow(25)->Show(0);
} else {
return 0;
}
this->m_acceptance->firstShopItems.clear();
this->m_acceptance->secondShopItems.clear();
this->m_acceptance->thirdShopItems.clear();
}
return 0;
}
if (message == 28) {
this->identity = static_cast<std::uint32_t>(a);
return 0;
}
if (message == 123) {
const auto* bytes = reinterpret_cast<const unsigned char*>(a);
std::uint16_t marker;
std::memcpy(&marker, bytes, sizeof(marker));
unsigned offset = 6;
if (marker == 20850) {
while (static_cast<unsigned>(b) > offset) {
std::uint16_t kind;
std::uint32_t size;
std::memcpy(&kind, bytes + offset, sizeof(kind));
std::memcpy(&size, bytes + offset + 2, sizeof(size));
offset += 6;
if (kind == 20851) {
this->m_acceptance->replayShopState = 1;
this->SendMsg(nullptr, 28, 0, 0, 0, 0);
this->m_frameContext->windows.CloseWindow(22);
this->m_frameContext->windows.CloseWindow(23);
this->m_frameContext->windows.CloseWindow(24);
return 0;
}
offset += size;
}
}
return 0;
}
return this->UIFrameWnd::SendMsg(sender, message, a, b, c, d);
}