rodecomp/Source/UI/Chat/UISubChatHisWnd.cpp
ragnarok-clanker 38f040504e Maintenance: B4': DrawColoredText/DrawStyledColoredText/DrawOutlinedText/DrawOutlinedColoredText are UIWindow thiscall members in the
Batch #18182 by ragnarok-clanker: forced by an admin (6 lower score(s), 45 changed function(s)); checked with 415 compiled unit(s), including every includer of Source/UI/Text/ColoredText.h, Source/UI/Window/UIWindow.h.
2026-11-12 11:23:37 +00:00

229 lines
8 KiB
C++

#include "UI/Window/WindowId.h"
#include "UI/Window/UIEnums.h"
#include "UI/Chat/UISubChatHisWnd.h"
#include "Contents/UserData/NormalItemSlots.h"
#include "Client/Session/Session.h"
#include "Network/TextEncoding.h"
#include "Render/Text/FontCache.h"
#include "Render/Text/TextContext.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/Chat/UINewChatWnd.h"
#include "UI/Chat/UINewChatWnd.h"
#include "UI/Edit/UIEditCtrl.h"
#include "UI/Text/ColoredText.h"
#include "UI/Window/InputFocus.h"
#include "UI/Lists/UIChatHisBox.h"
#include "UI/Window/UIResizer.h"
#include "UI/Window/UIWindowMgr.h"
#include <cstring>
#include <string>
// OFFSET: 0x009312E0
// FUNCTION: fn_12700
void UISubChatHisWnd::OnLBtnDown(int x, int y) {
if (g_session.m_canDragWnd) {
if (UIWindow* window = g_windowMgr.LookupWindow(WID_BATTLEMSGOPTIONWND)) {
window->SendMsg(this, UM_COMMAND, ID_OPTION, this->m_index, 0, 2);
}
this->UIFrameWnd::OnLBtnDown(x, y);
}
}
// OFFSET: 0x009309B0
// FUNCTION: fn_12690
void UISubChatHisWnd::OnLBtnDblClk(int x, int y) {
if (g_session.m_canDragWnd && x > 0 && x < this->m_inputWidth && y > 0 && y < this->m_inputHeight) {
this->m_edit->SetText("");
this->m_edit->Resize(this->m_inputWidth - 10, this->m_inputHeight - 2);
this->m_edit->Move(5, 2);
g_windowMgr.SetFocus(this->m_edit);
}
}
// OFFSET: 0x00932B70
// FUNCTION: fn_12715
void UISubChatHisWnd::OnMouseMove(int x, int y) {
if (g_windowMgr.Capture() == this) {
this->UIFrameWnd::OnMouseMove(x, y);
}
}
// OFFSET: 0x00931710
// FUNCTION: fn_12706
void UISubChatHisWnd::OnLBtnUp(int x, int y) {
this->UIFrameWnd::OnLBtnUp(x, y);
if (g_session.m_canDragWnd) {
int screenX = 0;
int screenY = 0;
this->ToScreen(screenX, screenY);
UIWindow* window = g_windowMgr.LookupWindow(WID_CHATWND);
if (window && window->geometry.x <= screenX && screenX <= window->geometry.width + window->geometry.x) {
const int bottom = this->geometry.height + screenY;
if (window->geometry.y <= bottom && bottom <= window->geometry.height + window->geometry.y) {
window->SendMsg(this, UM_ATTACH_CHAT_TAB, 0, 0, 0, 0);
}
}
}
}
// OFFSET: 0x0091EA90
// FUNCTION: fn_12633
void UISubChatHisWnd::Move(int x, int y) {
this->UIFrameWnd::Move(x, y);
int screenX = 0;
int screenY = 0;
this->ToScreen(screenX, screenY);
this->m_state.x = screenX;
this->m_state.y = screenY + this->m_inputHeight;
g_session.m_subChatWnds[this->m_index].x = screenX;
g_session.m_subChatWnds[this->m_index].y = screenY;
}
// OFFSET: 0x0091C9E0
// FUNCTION: fn_12619
bool UISubChatHisWnd::GetCustomTransBoxInfo(void* output) {
*static_cast<SubChatHistoryState*>(output) = this->m_state;
return true;
}
// OFFSET: 0x00930370
// FUNCTION: fn_12682
void UISubChatHisWnd::Paint() {
this->ClearSurface(0xFFFF00FF);
std::uint32_t color = 0xFFFFFF;
this->DrawTextAt(5, 4, this->m_name.c_str(), 0, 0, 12, 0, 0, 0);
this->DrawColoredText(4, 3, this->m_name.c_str(), 0, color, 0, 12, false);
this->FillRegion(2, 0, this->m_inputWidth - 5, 1, color);
this->FillRegion(1, 1, 1, 1, color);
this->FillRegion(0, 2, 1, this->geometry.height - 4, color);
this->FillRegion(this->m_inputWidth, this->m_inputHeight, this->geometry.width - this->m_inputWidth - 3, 1, color);
this->FillRegion(this->m_inputWidth - 3, 0, 1, 1, 0x8E8E8E);
this->FillRegion(this->m_inputWidth - 2, 1, 1, 1, 0x8E8E8E);
this->FillRegion(this->m_inputWidth - 1, 2, 1, this->m_inputHeight - 1, 0x8E8E8E);
this->FillRegion(this->geometry.width - 3, this->m_inputHeight, 1, 1, 0x8E8E8E);
this->FillRegion(this->geometry.width - 2, this->m_inputHeight + 1, 1, 1, 0x8E8E8E);
this->FillRegion(this->geometry.width - 1, this->m_inputHeight + 2, 1, this->geometry.height - this->m_inputHeight - 4, 0x8E8E8E);
this->FillRegion(1, this->geometry.height - 2, 1, 1, 0x8E8E8E);
this->FillRegion(this->geometry.width - 2, this->geometry.height - 2, 1, 1, 0x8E8E8E);
this->FillRegion(2, this->geometry.height - 1, this->geometry.width - 4, 1, 0x8E8E8E);
}
// OFFSET: 0x00941020
// FUNCTION: fn_12788
void UISubChatHisWnd::StoreInfo() {
if (this->m_saved) {
this->m_saved->width = this->geometry.width;
this->m_saved->height = this->geometry.height;
this->m_saved->x = this->geometry.x;
this->m_saved->y = this->geometry.y;
}
}
// OFFSET: 0x0092A710
// FUNCTION: fn_12655
void UISubChatHisWnd::OnCreate(int width, int height) {
{
const std::string name = "유저인터페이스\\basic_interface\\stickon";
this->m_stickButton = new UIBitmapButton();
this->m_stickButton->SetBitmap((name + "_a.bmp").c_str(), 0, 0);
this->m_stickButton->SetBitmap((name + "_b.bmp").c_str(), 1, 0);
this->m_stickButton->SetBitmap((name + "_b.bmp").c_str(), 2, 0);
this->m_stickButton->SetSize(this->m_stickButton->BitmapWidth(), this->m_stickButton->BitmapHeight());
this->m_stickButton->Move(this->m_inputWidth + 1, 4);
this->m_stickButton->SetId(357);
this->AddChild(this->m_stickButton);
}
{
std::string name = "유저인터페이스\\basic_interface\\battle_option";
name += "2";
this->m_optionButton = new UIBitmapButton();
this->m_optionButton->SetBitmap((name + "_a.bmp").c_str(), 0, 0);
this->m_optionButton->SetBitmap((name + "_b.bmp").c_str(), 1, 0);
this->m_optionButton->SetBitmap((name + "_b.bmp").c_str(), 2, 0);
this->m_optionButton->SetSize(this->m_optionButton->BitmapWidth(), this->m_optionButton->BitmapHeight());
this->m_optionButton->Move(this->m_inputWidth + 15, 5);
this->m_optionButton->SetId(193);
this->AddChild(this->m_optionButton);
}
{
const std::string name = "유저인터페이스\\basic_interface\\wnd_mini";
this->m_miniButton = new UIBitmapButton();
this->m_miniButton->SetBitmap((name + "_a.bmp").c_str(), 0, 0);
this->m_miniButton->SetBitmap((name + "_b.bmp").c_str(), 1, 0);
this->m_miniButton->SetBitmap((name + "_b.bmp").c_str(), 2, 0);
this->m_miniButton->SetSize(this->m_miniButton->BitmapWidth(), this->m_miniButton->BitmapHeight());
this->m_miniButton->SetId(202);
this->AddChild(this->m_miniButton);
}
this->m_chatBox = new UIChatHisBox();
this->m_chatBox->Configure(0, 0, this->geometry.width - 8, this->geometry.height - this->headerHeight - this->m_inputHeight - 4, 0);
this->m_chatBox->Move(5, this->m_inputHeight + 4);
this->AddChild(this->m_chatBox);
this->m_resizer = new UIResizer();
this->m_resizer->SetSize(14, 14);
this->m_resizer->SetDirection(7);
this->m_resizer->SetBitmapName("유저인터페이스\\btn_resize.bmp");
this->m_resizer->Move(this->geometry.width - 15, this->geometry.height - 15);
this->m_resizer->SetColors(0xFFFF00FF, 0xFFFF00FF);
this->AddChild(this->m_resizer);
int x = 0;
int y = 0;
this->ToScreen(x, y);
this->m_state.x = x;
this->m_state.backgroundColor = 0x66000000;
this->m_state.y = y + this->m_inputHeight;
this->m_state.width = this->geometry.width;
this->m_state.flags = 0;
this->m_state.height = this->geometry.height - this->m_inputHeight;
this->m_state.borderStyle = 0;
const auto found = g_session.m_subChatWnds.find(this->m_index);
if (found != g_session.m_subChatWnds.end()) {
this->m_name = found->second.name;
this->m_inputWidth = this->TextWidth(this->m_name.c_str(), 0, 0, 12, 0, 0) + 10;
std::memcpy(this->m_options, found->second.options, sizeof(this->m_options));
if (this->m_inputWidth < 25) {
this->m_inputWidth = 25;
}
}
this->m_edit = new UIEditCtrl2();
this->m_edit->SetSize(100, 19);
this->m_edit->Move(-100, -100);
this->AddChild(this->m_edit);
this->ApplyButtonLayout();
}
// OFFSET: 0x00912340
// FUNCTION: fn_12529
UISubChatHisWnd::UISubChatHisWnd()
: UIFrameWnd(0) {
this->m_saved = nullptr;
this->m_resizer = nullptr;
this->m_chatBox = nullptr;
this->m_inputHeight = 16;
this->m_inputWidth = 71;
this->headerHeight = 15;
switch (g_serviceType) {
case 10:
this->m_inputWidth = 71;
break;
case 18:
this->m_inputWidth = 90;
break;
case 1:
case 7:
case 11:
this->m_inputWidth = 110;
break;
}
}