Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas. 449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
137 lines
4.7 KiB
C++
137 lines
4.7 KiB
C++
#include "Client/Mode/ModeEvents.h"
|
|
#include "Client/ReplayPacketRecorder.h"
|
|
#include "Resource/Bitmap/BitmapResource.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "UI/Buttons/UIBitmapButton.h"
|
|
#include "UI/Acceptance/UIJoinPartyAcceptWnd.h"
|
|
#include "UI/Text/UITextViewer.h"
|
|
#include "UI/Window/WindowManagerWindows.h"
|
|
|
|
#include <cstring>
|
|
|
|
namespace {
|
|
constexpr char prefix[] = "\xC0\xAF\xC0\xFA\xC0\xCE\xC5\xCD\xC6\xE4\xC0\xCC\xBD\xBA\\";
|
|
}
|
|
|
|
// 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: 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);
|
|
}
|