rodecomp/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp
ragnarok-clanker a19f0b332e Decompile 15 functions in Source/UI/Acceptance/UIChooseSellBuyWnd.cpp, Source/UI/Chat/UIWhisperWnd.h, ...
Batch #1419 by Yommy: 15 byte-identical, 0 confirmed by peer review.

- fn_12217 UIComboBoxIDWnd::Paint: byte-identical
- fn_12218 UIComboBoxWnd::Paint: byte-identical
- fn_12228 UILoadingWnd::Paint: byte-identical
- fn_12235 UINotifyLevelUpWnd::Paint: byte-identical
- fn_12236 UINotifyQuestWnd::Paint: byte-identical
- fn_12261 UInCash_CallWnd::Paint: byte-identical
- fn_12269 UICombinedCardItemCollection_ComparisonWnd::Slot25: byte-identical
- fn_12272 UIItemCollection_ComparisonWnd::Slot25: byte-identical
- fn_12274 UIMinimapZoomWnd::Slot25: byte-identical
- fn_12281 UICombinedCardItemCollection_ComparisonWnd::Slot31: byte-identical
- fn_12284 UIItemCollection_ComparisonWnd::Slot31: byte-identical
- fn_12294 UIEquipWnd::Slot19: byte-identical
- fn_12300 UISayDialogWnd::Slot19: byte-identical
- fn_12307 UIItemIdentifyWnd::Slot33: byte-identical
- fn_12308 UIWhisperWnd::Slot33: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-10-28 12:39:59 +00:00

289 lines
7.6 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
// OFFSET: 0x008EECD0
// FUNCTION: fn_12228
void UILoadingWnd::Paint() {
}
// OFFSET: 0x008EF590
// OFFSET: 0x008EF7F0
// FUNCTION: fn_12235
void UINotifyLevelUpWnd::Paint() {
}
// OFFSET: 0x008EF800
// FUNCTION: fn_12236
void UINotifyQuestWnd::Paint() {
}
// OFFSET: 0x008EFF60
// OFFSET: 0x008EFFA0
// OFFSET: 0x008F2A90
// OFFSET: 0x008F2DE0
// FUNCTION: fn_12261
void UInCash_CallWnd::Paint() {
}
// OFFSET: 0x008F32D0
// OFFSET: 0x008F3300
// OFFSET: 0x008F3630
// OFFSET: 0x008F3650
// FUNCTION: fn_12269
void UICombinedCardItemCollection_ComparisonWnd::Slot25(int, int) {
}
// OFFSET: 0x008F38D0
// FUNCTION: fn_12272
void UIItemCollection_ComparisonWnd::Slot25(int, int) {
}
// OFFSET: 0x008F38E0
// OFFSET: 0x008F39B0
// FUNCTION: fn_12274
void UIMinimapZoomWnd::Slot25(int, int) {
}
// OFFSET: 0x008F39C0
// OFFSET: 0x008F39E0
// OFFSET: 0x008F3A40
// OFFSET: 0x008F3A60
// OFFSET: 0x008F3BA0
// FUNCTION: fn_12281
void UICombinedCardItemCollection_ComparisonWnd::Slot31(int, int) {
}
// OFFSET: 0x008F3BB0
// OFFSET: 0x008F3C50
// FUNCTION: fn_12284
void UIItemCollection_ComparisonWnd::Slot31(int, int) {
}
// OFFSET: 0x008F4A80
// OFFSET: 0x008F4AB0
// OFFSET: 0x008F4D40
// FUNCTION: fn_12294
void UIEquipWnd::Slot19() {
}
// OFFSET: 0x008F4F80
// 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
// OFFSET: 0x008F5A50
// OFFSET: 0x008F66B0
// OFFSET: 0x008F6700
// 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);
}