From be04fec77e4a1d9ef72925311ae91e51b151d6dd Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 3 Nov 2026 00:33:54 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Family G14: remove the chat bundle family (ChatSuggestions, ChatInputLayout, ChatHeaderLayout, C Batch #10220 by ragnarok-clanker: forced by an admin (5 lower score(s), 30 changed function(s)); checked with 24 compiled unit(s), including every includer of Source/UI/Chat/UINewChatWnd.h, Source/UI/Chat/UISubChatHisWnd.h, Source/UI/Chat/ChatSuggestions.h. Deletes: Source/UI/Chat/ChatSuggestions.h --- Source/Client/Input/Language.cpp | 24 +-- Source/Client/Mode/GameMode.cpp | 4 +- Source/Client/Mode/GameModeNotices.cpp | 2 +- Source/Client/Mode/GameModePackets.cpp | 2 +- Source/Contents/CashEmotionMgr.cpp | 46 ++-- Source/Script/LuaScript.cpp | 3 +- Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 4 +- Source/UI/Chat/ChatSuggestions.cpp | 220 +++++++++----------- Source/UI/Chat/ChatSuggestions.h | 88 -------- Source/UI/Chat/UINewChatWnd.h | 30 ++- Source/UI/Chat/UISubChatHisWnd.cpp | 4 +- Source/UI/Chat/UISubChatHisWnd.h | 1 + Source/UI/Edit/ItemTagRetirement.cpp | 6 +- Source/UI/Edit/UIEditBoxEx.cpp | 4 +- Source/UI/Edit/UIEditCtrl.cpp | 10 +- Source/UI/Edit/UIEditVariants.cpp | 4 +- Source/UI/Items/UISwapEquipmentWnd.cpp | 4 +- Source/UI/Shortcuts/UIShortCutWnd.cpp | 32 +-- Source/UI/Window/UIHotKeyWnd.cpp | 8 +- Source/UI/Window/UINewSkillListWnd.cpp | 6 +- Source/UI/Window/UIWindow.cpp | 10 +- Source/UI/Window/UIWindowMgr.cpp | 18 +- Source/UI/Window/WindowMouseHit.cpp | 16 +- 23 files changed, 226 insertions(+), 320 deletions(-) delete mode 100644 Source/UI/Chat/ChatSuggestions.h diff --git a/Source/Client/Input/Language.cpp b/Source/Client/Input/Language.cpp index 842e5095..1f65a145 100644 --- a/Source/Client/Input/Language.cpp +++ b/Source/Client/Input/Language.cpp @@ -7,7 +7,7 @@ #include "Utility/Lexicon/LexiconBoundary.h" #include "Utility/Text/LanguageCharset.h" #include "Utility/Text/TextTokens.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Lists/UIMemberListBox.h" #include "UI/UICaptchaPreviewWnd.h" #include "UI/UIRoundBoxTooltipWnd.h" @@ -53,7 +53,7 @@ void CLanguageBase::DeleteSelection() { this->cursor = begin; this->anchor = begin; - if (g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window && g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) { + if (g_windowMgr.unknown_0024 && ChatWindow() && ChatWindow()->m_suggestions && g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions) { g_cashEmotionMgr->ProcessChatCommand(this->text.c_str()); } } @@ -66,7 +66,7 @@ void CLanguageBase::Insert(const char* value) { this->anchor = this->cursor + static_cast(std::strlen(value)); this->cursor = this->anchor; - if (g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window && g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) { + if (g_windowMgr.unknown_0024 && ChatWindow() && ChatWindow()->m_suggestions && g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions) { g_cashEmotionMgr->ProcessChatCommand(this->text.c_str()); } } @@ -283,8 +283,8 @@ void CLanguageBase::Character(unsigned value, LPARAM) { this->anchor = this->cursor + static_cast(std::strlen(bytes)); this->cursor = this->anchor; - if (this->text.c_str() && g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window && - g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) { + if (this->text.c_str() && g_windowMgr.unknown_0024 && ChatWindow() && ChatWindow()->m_suggestions && + g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions) { g_cashEmotionMgr->ProcessChatCommand(this->text.c_str()); } } @@ -352,8 +352,8 @@ void CLanguageBase::KeyDown(unsigned key, LPARAM) { this->anchor = 0; break; case VK_LEFT: - if (g_chatSuggestions && g_chatSuggestions->Visible() && g_chatSuggestions->unknown_013C) { - g_chatSuggestions->unknown_013C->SendMsg(nullptr, 176, VK_LEFT, 0, 0, 0); + if (ChatWindow() && ChatWindow()->SuggestionsVisible() && ChatWindow()->m_suggestions) { + ChatWindow()->m_suggestions->SendMsg(nullptr, 176, VK_LEFT, 0, 0, 0); return; } @@ -361,8 +361,8 @@ void CLanguageBase::KeyDown(unsigned key, LPARAM) { this->anchor = this->cursor; break; case VK_RIGHT: - if (g_chatSuggestions && g_chatSuggestions->Visible() && g_chatSuggestions->unknown_013C) { - g_chatSuggestions->unknown_013C->SendMsg(nullptr, 176, VK_RIGHT, 0, 0, 0); + if (ChatWindow() && ChatWindow()->SuggestionsVisible() && ChatWindow()->m_suggestions) { + ChatWindow()->m_suggestions->SendMsg(nullptr, 176, VK_RIGHT, 0, 0, 0); return; } @@ -382,8 +382,8 @@ void CLanguageBase::KeyDown(unsigned key, LPARAM) { // OFFSET: 0x00ACEEB0 // FUNCTION: fn_45450 void SuggestChatCommand(const char* text) { - if (text && g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window && - g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) { + if (text && g_windowMgr.unknown_0024 && ChatWindow() && ChatWindow()->m_suggestions && + g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions) { g_cashEmotionMgr->ProcessChatCommand(text); } } @@ -528,7 +528,7 @@ void CLanguageBase::RefreshComposition() { std::memcpy(combined + committed, this->candidate.data(), pending); combined[committed + pending] = 0; - if (g_windowMgr.unknown_0024 && g_chatSuggestions && g_chatSuggestions->window && g_windowMgr.GetHoverWindow() == g_chatSuggestions->window) { + if (g_windowMgr.unknown_0024 && ChatWindow() && ChatWindow()->m_suggestions && g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions) { g_cashEmotionMgr->ProcessChatCommand(combined); } } diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index 06c50147..30b8ec36 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -29,7 +29,7 @@ #include "Resource/World/TerrainResource.h" #include "Script/LuaScript.h" #include "UI/UIBroadcastBalloon.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowDialogs.h" @@ -4842,7 +4842,7 @@ void CGameMode::UpdateHoverNameBalloon() { #include "Contents/Messenger/WhisperBlockMgr.h" #include "Contents/NavigationManager.h" #include "Network/TextEncoding.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include #include #include diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index c5080e5b..5b24917c 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -72,7 +72,7 @@ #include "Utility/Text/FormatString.h" #include "Utility/Math/AffineMatrix.h" #include "UI/UIBroadcastBalloon.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Text/NavigationLink.h" #include "UI/Text/UITextViewer.h" #include diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index d9748b02..24011a42 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -80,7 +80,7 @@ #include "Contents/Schedule/EmotionSchedule.h" #include "Contents/Schedule/TimeScheduler.h" #include "Contents/Messenger/WhisperBlockMgr.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Text/NavigationLink.h" #include "UI/Text/TextWrapping.h" #include "UI/Text/UITextViewer.h" diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 27196c08..918aae1a 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -28,7 +28,7 @@ #include "UI/Buttons/UICashEmotionSprBtn.h" #include "UI/CashEmotion/UICashEmotionPack.h" #include "UI/CashEmotion/UICashEmotionPiece.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "Contents/MessageTable.h" #include "UI/Buttons/UIButton.h" @@ -70,10 +70,6 @@ extern "C" { // GLOBAL: gl_24350 CCashEmotionMgr* g_cashEmotionMgr = nullptr; -// STATIC: 0x01457848 -// GLOBAL: gl_24484 -ChatSuggestions* g_chatSuggestions = nullptr; - extern "C" long long _Xtime_get_ticks(); class ICashEmotionAction { @@ -407,10 +403,10 @@ bool CCashEmotionAction_Register::Execute(int packId, int emotionId) { return true; } - ChatSuggestions* suggestions = g_chatSuggestions; - if (suggestions && suggestions->input) { - suggestions->input->SetText(name); - suggestions->input->Slot39(); + UINewChatWnd* suggestions = ChatWindow(); + if (suggestions && suggestions->m_chatEdit) { + suggestions->m_chatEdit->SetText(name); + suggestions->m_chatEdit->Slot39(); } return true; @@ -419,13 +415,13 @@ bool CCashEmotionAction_Register::Execute(int packId, int emotionId) { // OFFSET: 0x00591FB0 // FUNCTION: fn_02847 bool CCashEmotionAction_SelectedUnPurchasedPack::Execute(int packId, int) { - if (g_windowMgr.unknown_0024 == 1 && g_chatSuggestions) { - ChatSuggestions* suggestions = g_chatSuggestions; - suggestions->Show(0); - if (suggestions->input) { - suggestions->input->SetText(""); + if (g_windowMgr.unknown_0024 == 1 && ChatWindow()) { + UINewChatWnd* suggestions = ChatWindow(); + suggestions->ShowSuggestions(0); + if (suggestions->m_chatEdit) { + suggestions->m_chatEdit->SetText(""); } - reinterpret_cast(suggestions)->Toggle(); + suggestions->ToggleInput(); } UICashEmotionListWnd* listWnd = g_cashEmotionListWnd; @@ -609,8 +605,8 @@ void CCashEmotionMgr::Shutdown() { // OFFSET: 0x00599020 // FUNCTION: fn_02937 void CCashEmotionMgr::HideSuggestions() { - if (g_chatSuggestions) { - g_chatSuggestions->Show(0); + if (ChatWindow()) { + ChatWindow()->ShowSuggestions(0); } } @@ -642,12 +638,12 @@ void CCashEmotionMgr::RefreshCommands() { // OFFSET: 0x00599730 // FUNCTION: fn_02942 int CCashEmotionMgr::ProcessChatCommand(const char* command) { - if (!g_chatSuggestions || !g_chatSuggestions->window) { + if (!ChatWindow() || !ChatWindow()->m_suggestions) { return 0; } if (!command || std::strlen(command) < 1 || command[0] != '/') { - g_chatSuggestions->Show(0); + ChatWindow()->ShowSuggestions(0); return 0; } @@ -660,8 +656,8 @@ int CCashEmotionMgr::ProcessChatCommand(const char* command) { } if (actionId != 0) { - g_chatSuggestions->Show(1); - auto* miniWnd = reinterpret_cast(g_chatSuggestions->window); + ChatWindow()->ShowSuggestions(1); + auto* miniWnd = reinterpret_cast(ChatWindow()->m_suggestions); return static_cast(miniWnd->Select(actionId)); } else { this->HideSuggestions(); @@ -2911,11 +2907,11 @@ int UICashEmotionMiniWnd::SendMsg( int packId = data->id; if (packId == g_cashEmotionMgr->BasePackId() || g_cashEmotionMgr->IsOwnedPack(packId)) { - if (g_chatSuggestions) { - if (g_chatSuggestions->input) { - g_chatSuggestions->input->SetText(data->name.c_str()); + if (ChatWindow()) { + if (ChatWindow()->m_chatEdit) { + ChatWindow()->m_chatEdit->SetText(data->name.c_str()); } - g_chatSuggestions->Show(0); + ChatWindow()->ShowSuggestions(0); } } else if (this->m_action) { this->m_action->Execute(packId, 0); diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index 6f8a5237..a3c67f2b 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -12,7 +12,8 @@ #include "File/File.h" #include "File/ResourcePath.h" #include "Script/LuaFileOperations.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" +#include "UI/Edit/UIEditCtrl.h" #include "UI/Window/UIWindow.h" #include "UI/UICheckAttendanceWnd.h" #include "UI/UILapineScrollBar.h" diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index 8681728d..55849fa0 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -19,7 +19,7 @@ #include "Contents/Messenger/ClientMessenger.h" #include "Contents/Jobs/JobInheritance.h" #include "Contents/ClientItemLists.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Rodex/UIRodexComposeWnd.h" #include "Contents/Items/ItemNaming.h" #include "Contents/GuildInfo.h" @@ -8885,7 +8885,7 @@ void UIEquipWnd::Slot25(int x, int y) { } else if (g_windowMgr.GetHoverWindow()->geometry.id == 490) { static_cast(g_windowMgr.GetHoverWindow())->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 493) { - reinterpret_cast(g_chatSuggestions->unknown_00BC)->InsertItemLink(item); + reinterpret_cast(ChatWindow()->m_chatEdit)->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 491) { reinterpret_cast(g_windowMgr.unknown_0458)->sub_7FF710(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 494) { diff --git a/Source/UI/Chat/ChatSuggestions.cpp b/Source/UI/Chat/ChatSuggestions.cpp index 4318230b..4ff21218 100644 --- a/Source/UI/Chat/ChatSuggestions.cpp +++ b/Source/UI/Chat/ChatSuggestions.cpp @@ -1,83 +1,88 @@ #include "UI/Window/UIWindowMgr.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" +#include "UI/Chat/UISubChatHisWnd.h" #include "UI/Window/InputFocus.h" #include "UI/Edit/ItemTagRetirement.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Window/UIWindow.h" -#include "UI/Layout/WindowCoordinates.h" -#include "UI/Window/WindowManagerWindows.h" +#include "UI/Lists/UIChatHisBox.h" +#include "UI/Lists/UITabControl.h" // OFFSET: 0x0091E7E0 // FUNCTION: fn_12628 -bool ChatSuggestions::Visible() const { - return this->window && this->window->geometry.visible != 0; +bool UINewChatWnd::SuggestionsVisible() const { + return this->m_suggestions && this->m_suggestions->geometry.visible != 0; } // OFFSET: 0x0093D270 // FUNCTION: fn_12767 -void ChatSuggestions::Show(std::uint8_t visible) { - UIWindow* child = this->window; +void UINewChatWnd::ShowSuggestions(std::uint8_t visible) { + UIWindow* child = this->m_suggestions; if (!child) { return; } child->Show(visible); if (visible != 0) { - this->chat.RemoveChild(child, 0); - if (!this->chat.FindUid(child->Uid())) { - this->chat.AddChild(child); + this->RemoveChild(child, 0); + if (!this->FindUid(child->Uid())) { + this->AddChild(child); } } } // OFFSET: 0x00933980 // FUNCTION: fn_12732 -void ChatInputLayout::Apply() { - if (this->open != 0) { - const int base = this->chat.geometry.height - this->inputHeight; - (*this->children[0])->Move(6, base + 4); - (*this->children[1])->Move(110, base + 4); - UIWindow* child = *this->children[2]; - child->Move(3, this->chat.geometry.height - child->geometry.height); - (*this->children[3])->Move(97, base + 3); - (*this->children[4])->Move(586, base + 7); - (*this->children[5])->Move(572, base + 7); +void UINewChatWnd::ApplyInputLayout() { + if (g_inputSuggestionsEnabled) { + const int base = this->geometry.height - this->m_inputAreaHeight; + this->unknown_00C0->Move(6, base + 4); + this->m_chatEdit->Move(110, base + 4); + UIWindow* child = this->unknown_00B8; + child->Move(3, this->geometry.height - child->geometry.height); + this->m_inputButtons[0]->Move(97, base + 3); + this->m_inputButtons[1]->Move(586, base + 7); + this->m_inputButtons[2]->Move(572, base + 7); } else { - for (UIWindow** child : this->children) { - (*child)->Move(-100, -100); + this->unknown_00C0->Move(-100, -100); + this->m_chatEdit->Move(-100, -100); + this->unknown_00B8->Move(-100, -100); + for (UIWindow* child : this->m_inputButtons) { + child->Move(-100, -100); } } - this->chat.Invalidate(); + this->Invalidate(); } // OFFSET: 0x009337F0 // FUNCTION: fn_12730 -void ChatHeaderLayout::Apply() { - if (this->enabled == 0 && this->mode != 0) { - (*this->buttons[0])->Move(-100, -100); - (*this->buttons[1])->Move(-100, -100); - (*this->buttons[2])->Move(-100, -100); - UIWindow* button = *this->buttons[3]; - button->Move(this->width - button->geometry.width - 2, 4); +void UINewChatWnd::ApplyHeaderLayout() { + UIWindow* const buttons[] = {this->m_headerButtons[1], this->m_headerButtons[0], this->unknown_0128, this->m_chatModeButton}; + if (g_chatInputFlag == 0 && this->geometry.unknown_0030 != 0) { + buttons[0]->Move(-100, -100); + buttons[1]->Move(-100, -100); + buttons[2]->Move(-100, -100); + UIWindow* button = buttons[3]; + button->Move(this->m_lockButtonX - button->geometry.width - 2, 4); return; } - if (this->mode == 0) { - for (UIWindow** button : this->buttons) { - (*button)->Move(-100, -100); + if (this->geometry.unknown_0030 == 0) { + for (UIWindow* button : buttons) { + button->Move(-100, -100); } return; } - UIWindow* button = *this->buttons[0]; - int x = this->width - button->geometry.width - 2; + UIWindow* button = buttons[0]; + int x = this->m_lockButtonX - button->geometry.width - 2; button->Move(x, 4); - for (unsigned index = 1; index < this->buttons.size(); ++index) { - button = *this->buttons[index]; + for (unsigned index = 1; index < 4; ++index) { + button = buttons[index]; x -= (button->geometry.width + 2); button->Move(x, 4); } @@ -85,37 +90,37 @@ void ChatHeaderLayout::Apply() { // OFFSET: 0x009338F0 // FUNCTION: fn_12731 -void ChatButtonLayout::Apply() { - if (this->expanded == 0) { - (*this->buttons[0])->Move(-100, -100); - (*this->buttons[1])->Move(-100, -100); - UIWindow* button = *this->buttons[2]; - button->Move(this->width - button->geometry.width - 2, 4); +void UISubChatHisWnd::ApplyButtonLayout() { + if (g_chatInputFlag == 0) { + this->m_miniButton->Move(-100, -100); + this->m_stickButton->Move(-100, -100); + UIWindow* button = this->m_optionButton; + button->Move(this->geometry.width - button->geometry.width - 2, 4); return; } - UIWindow* button = *this->buttons[0]; - int x = this->width - button->geometry.width - 2; + UIWindow* button = this->m_miniButton; + int x = this->geometry.width - button->geometry.width - 2; button->Move(x, 4); - button = *this->buttons[1]; + button = this->m_stickButton; x -= (button->geometry.width + 2); button->Move(x, 4); - button = *this->buttons[2]; + button = this->m_optionButton; x -= (button->geometry.width + 2); button->Move(x, 4); } // OFFSET: 0x0093D2C0 // FUNCTION: fn_12768 -void ChatRowLayout::Resize(int count) { - if (this->popup26) { - this->windows.CloseWindow(26); +void UINewChatWnd::ResizeRows(int count) { + if (g_windowMgr.unknown_0214) { + g_windowMgr.CloseWindow(26); } - UIWindow& chat = this->input.chat; - if (this->capture == &chat) { + UIWindow& chat = *this; + if (g_windowMgr.Capture() == &chat) { return; } @@ -123,19 +128,19 @@ void ChatRowLayout::Resize(int count) { chat.geometry.unknown_0030 = static_cast(rowCount); chat.Invalidate(); const int previousHeight = chat.geometry.height; - const int height = rowCount == 0 ? this->input.inputHeight : this->input.inputHeight + (rowCount + 3) * 14 + this->headerHeight; + const int height = rowCount == 0 ? this->m_inputAreaHeight : this->m_inputAreaHeight + (rowCount + 3) * 14 + this->m_inputOffsetY; chat.Resize(chat.geometry.width, height); chat.Move(chat.geometry.x, chat.geometry.y - height + previousHeight); if (rowCount != 0) { - for (std::size_t index = 0; index < this->rows.size(); ++index) { - UIWindow* row = this->rows[index]; - row->Resize(chat.geometry.width - 8, height - this->headerHeight - this->input.inputHeight - 4); - this->rows[index]->Invalidate(); - row = this->rows[index]; + for (std::size_t index = 0; index < this->m_tabs.size(); ++index) { + UIWindow* row = this->m_tabs[index]; + row->Resize(chat.geometry.width - 8, height - this->m_inputOffsetY - this->m_inputAreaHeight - 4); + this->m_tabs[index]->Invalidate(); + row = this->m_tabs[index]; - if (index == static_cast(this->selected)) { - row->Move(5, this->headerHeight + 2); + if (index == static_cast(this->m_currentTab)) { + row->Move(5, this->m_inputOffsetY + 2); } else { row->Move(-100 - chat.geometry.width, -100); } @@ -143,90 +148,65 @@ void ChatRowLayout::Resize(int count) { chat.Invalidate(); } else { - for (std::size_t index = 0; index < this->rows.size(); ++index) { - this->rows[index]->Move(-100 - chat.geometry.width, -100); + for (std::size_t index = 0; index < this->m_tabs.size(); ++index) { + this->m_tabs[index]->Move(-100 - chat.geometry.width, -100); } } - (*this->input.children[0])->Move(6, chat.geometry.height - this->input.inputHeight + 4); - (*this->input.children[1])->Move(110, chat.geometry.height - this->input.inputHeight + 4); - UIWindow* child = *this->input.children[2]; + this->unknown_00C0->Move(6, chat.geometry.height - this->m_inputAreaHeight + 4); + this->m_chatEdit->Move(110, chat.geometry.height - this->m_inputAreaHeight + 4); + UIWindow* child = this->unknown_00B8; child->Move(3, chat.geometry.height - child->geometry.height); if (rowCount != 0) { - (*this->header.buttons[2])->Move(this->headerCellWidth * 2 + 4, 4); - (*this->header.buttons[3])->Move(this->headerCellWidth * 2 + 19, 4); - this->headerChild->Move(3, 0); + this->unknown_0128->Move(this->m_tabWidth * 2 + 4, 4); + this->m_chatModeButton->Move(this->m_tabWidth * 2 + 19, 4); + this->m_tabControl->Move(3, 0); } else { - (*this->header.buttons[2])->Move(-100, -100); - (*this->header.buttons[3])->Move(-100, -100); - this->headerChild->Move(-100, -100); + this->unknown_0128->Move(-100, -100); + this->m_chatModeButton->Move(-100, -100); + this->m_tabControl->Move(-100, -100); } - const int base = chat.geometry.height - this->input.inputHeight; + const int base = chat.geometry.height - this->m_inputAreaHeight; const int firstY = base + 3; const int lastY = base + 7; - (*this->input.children[3])->Move(97, firstY); - (*this->input.children[4])->Move(586, lastY); - (*this->input.children[5])->Move(572, lastY); + this->m_inputButtons[0]->Move(97, firstY); + this->m_inputButtons[1]->Move(586, lastY); + this->m_inputButtons[2]->Move(572, lastY); - if (this->suggestions) { - UIWindow* edit = *this->input.children[1]; - this->suggestions->Move(edit->geometry.x, edit->geometry.y - this->suggestions->geometry.height); + if (this->m_suggestions) { + UIWindow* edit = this->m_chatEdit; + this->m_suggestions->Move(edit->geometry.x, edit->geometry.y - this->m_suggestions->geometry.height); } - this->header.Apply(); - this->input.Apply(); + this->ApplyHeaderLayout(); + this->ApplyInputLayout(); } // OFFSET: 0x00916170 // FUNCTION: fn_12582 -void ChatInputFocus::Toggle() { - if (this->open != 0 && this->alternate != 0) { - if (*this->secondary->Text() == '\0') { - this->open = 0; - this->layout.Apply(); - SetPressedWindowRoot(this->pressedRoot, nullptr); +void UINewChatWnd::ToggleInput() { + if (g_inputSuggestionsEnabled && g_windowCloseByte) { + if (*this->m_chatEdit->Text() == '\0') { + g_inputSuggestionsEnabled = false; + this->ApplyInputLayout(); + SetPressedWindowRoot(g_windowMgr.window_4F1D4, nullptr); } } else { - this->open = 1; - this->layout.Apply(); - g_windowMgr.SetFocus(this->primary); - this->primary->SetText(""); + g_inputSuggestionsEnabled = true; + this->ApplyInputLayout(); + g_windowMgr.SetFocus(this->m_inputEdit); + this->m_inputEdit->SetText(""); - if (this->alternate == 0) { - this->rows.Resize(static_cast(this->layout.chat.geometry.unknown_0030)); + if (!g_windowCloseByte) { + this->ResizeRows(static_cast(this->geometry.unknown_0030)); } - SetPressedWindowRoot(this->pressedRoot, this->primary); + SetPressedWindowRoot(g_windowMgr.window_4F1D4, this->m_inputEdit); } - if (this->tags) { - this->tags->Clear(); - } -} - -// INLINED -void ChatInputFocus::DismissOutside(ChatSuggestions& suggestions, UIWindow* companion, int button, int x, int y) { - if (button != 1 || !suggestions.Visible()) { - return; - } - - int left; - int top; - int right; - int bottom; - WindowScreenBounds(suggestions.window, left, top, right, bottom); - const bool outside = x < left || x > right || y < top || y > bottom; - WindowScreenBounds(companion, left, top, right, bottom); - const bool outsideCompanion = x < left || x > right || y < top || y > bottom; - - if (outside && outsideCompanion) { - suggestions.Show(0); - if (this->secondary) { - this->secondary->SetText(""); - } - - this->Toggle(); + if (UIItemTagOnChat* tags = static_cast(this->m_chatEdit)->unknown_0144) { + reinterpret_cast(tags)->Clear(); } } diff --git a/Source/UI/Chat/ChatSuggestions.h b/Source/UI/Chat/ChatSuggestions.h deleted file mode 100644 index 002087f4..00000000 --- a/Source/UI/Chat/ChatSuggestions.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef RAGNAROK_SOURCE_UI_CHAT_CHATSUGGESTIONS_H -#define RAGNAROK_SOURCE_UI_CHAT_CHATSUGGESTIONS_H - -#include -#include -#include - -class UIWindow; -#include "UI/Window/WindowManagerWindows.h" -class UIEditCtrl; -struct ItemTagRetirement; - -struct ChatSuggestions { - UIWindow& chat; - UIWindow* const& window; - UIEditCtrl* const& input; - /* 000C */ unsigned char unknown_000C[0xB0]; - /* 00BC */ UIWindow* unknown_00BC; - /* 00C0 */ unsigned char unknown_00C0[0x78]; - /* 0138 */ UIWindow* unknown_0138; - /* 013C */ UIWindow* unknown_013C; - - bool Visible() const; - - void Show(std::uint8_t visible); -}; - -extern ChatSuggestions* g_chatSuggestions; -extern bool g_inputSuggestionsEnabled; - -struct ChatInputLayout { - UIWindow& chat; - const std::uint8_t& open; - const int& inputHeight; - std::array children; - - void Apply(); -}; - -struct ChatHeaderLayout { - const std::uint8_t& enabled; - const std::uint32_t& mode; - const int& width; - std::array buttons; - - void Apply(); -}; - -struct ChatButtonLayout { - const std::uint8_t& expanded; - const int& width; - std::array buttons; - - void Apply(); -}; - -struct ChatRowLayout { - ChatInputLayout& input; - ChatHeaderLayout& header; - WindowManagerWindows& windows; - UIWindow* const& capture; - UIWindow* const& popup26; - const std::vector& rows; - const int& selected; - const int& headerHeight; - const int& headerCellWidth; - UIWindow* const& headerChild; - UIWindow* const& suggestions; - - void Resize(int count); -}; - -struct ChatInputFocus { - ChatInputLayout& layout; - ChatRowLayout& rows; - std::uint8_t& open; - const std::uint8_t& alternate; - UIEditCtrl* const& primary; - UIEditCtrl* const& secondary; - UIWindow*& pressedRoot; - ItemTagRetirement* const& tags; - - void Toggle(); - - void DismissOutside(ChatSuggestions& suggestions, UIWindow* companion, int button, int x, int y); -}; - -#endif diff --git a/Source/UI/Chat/UINewChatWnd.h b/Source/UI/Chat/UINewChatWnd.h index d5f89ab0..ee0f20b4 100644 --- a/Source/UI/Chat/UINewChatWnd.h +++ b/Source/UI/Chat/UINewChatWnd.h @@ -2,12 +2,14 @@ #define RAGNAROK_SOURCE_UI_CHAT_UINEWCHATWND_H #include "UI/Window/UIFrameWnd.h" +#include "UI/Window/UIWindowMgr.h" #include #include class UIChatHisBox; class UITabControl; +class UIEditCtrl; extern std::uint8_t g_chatInputFlag; @@ -30,20 +32,27 @@ public: void SaveChatLogs(); void RefreshTabs(bool arrange); std::string ConvertChat(std::string text); + bool SuggestionsVisible() const; + void ShowSuggestions(std::uint8_t visible); + void ApplyInputLayout(); + void ApplyHeaderLayout(); + void ResizeRows(int count); + void ToggleInput(); -private: - /* 00BC */ int unknown_00BC; - /* 00C0 */ int unknown_00C0; + /* 00BC */ UIEditCtrl* m_chatEdit; + /* 00C0 */ UIWindow* unknown_00C0; /* 00C4 */ int m_inputX; /* 00C8 */ int m_inputY; /* 00CC */ int m_listWidth; /* 00D0 */ int m_listHeight; /* 00D4 */ unsigned char unknown_00D4[0x4]; /* 00D8 */ std::uint32_t m_listColor; - /* 00DC */ unsigned char unknown_00DC[0x14]; + /* 00DC */ unsigned char unknown_00DC[0x4]; + /* 00E0 */ UIWindow* m_inputButtons[3]; + /* 00EC */ unsigned char unknown_00EC[0x4]; /* 00F0 */ int unknown_00F0; /* 00F4 */ std::vector m_tabs; - /* 0100 */ unsigned char unknown_0100[0x8]; + /* 0100 */ UIWindow* m_headerButtons[2]; /* 0108 */ int m_lockButtonX; /* 010C */ int m_chatModeX; /* 0110 */ int unknown_0110; @@ -56,9 +65,14 @@ private: /* 012C */ UIWindow* m_chatModeButton; /* 0130 */ unsigned char unknown_0130[0x8]; /* 0138 */ UITabControl* m_tabControl; - UIWindow* m_inputEdit; - int unknown_00B8; - int unknown_013C; + /* 013C */ UIWindow* m_suggestions; + UIEditCtrl* m_inputEdit; + UIWindow* unknown_00B8; }; +// INLINED +inline UINewChatWnd* ChatWindow() { + return static_cast(g_windowMgr.window_01C8); +} + #endif diff --git a/Source/UI/Chat/UISubChatHisWnd.cpp b/Source/UI/Chat/UISubChatHisWnd.cpp index 32149e1f..e801ebc8 100644 --- a/Source/UI/Chat/UISubChatHisWnd.cpp +++ b/Source/UI/Chat/UISubChatHisWnd.cpp @@ -6,7 +6,7 @@ #include "Render/Text/FontCache.h" #include "Render/Text/TextContext.h" #include "UI/Buttons/UIBitmapButton.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Chat/UINewChatWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Text/ColoredText.h" @@ -201,7 +201,7 @@ void UISubChatHisWnd::Slot15(int width, int height) { this->m_edit->Move(-100, -100); this->AddChild(this->m_edit); - ChatButtonLayout{g_chatInputFlag, this->geometry.width, {&this->m_miniButton, &this->m_stickButton, &this->m_optionButton}}.Apply(); + this->ApplyButtonLayout(); } // OFFSET: 0x00912340 diff --git a/Source/UI/Chat/UISubChatHisWnd.h b/Source/UI/Chat/UISubChatHisWnd.h index b447a8f4..018a1a6d 100644 --- a/Source/UI/Chat/UISubChatHisWnd.h +++ b/Source/UI/Chat/UISubChatHisWnd.h @@ -39,6 +39,7 @@ public: bool Slot42(void* output) override; void Slot43() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + void ApplyButtonLayout(); UIChatHisBox* ChatBox() const { return m_chatBox; } std::string Name() const { return m_name; } diff --git a/Source/UI/Edit/ItemTagRetirement.cpp b/Source/UI/Edit/ItemTagRetirement.cpp index 565f4920..2de1a931 100644 --- a/Source/UI/Edit/ItemTagRetirement.cpp +++ b/Source/UI/Edit/ItemTagRetirement.cpp @@ -3,7 +3,7 @@ #include "Contents/Items/ItemInfo.h" #include "Contents/Items/ItemNaming.h" #include "UI/Buttons/UIItemTagButton.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Dialogs/UINpcEditDialogWnd.h" #include "UI/Window/InputFocus.h" #include "UI/Edit/ItemTagRetirement.h" @@ -40,8 +40,8 @@ void UIItemTagCtrl::RemoveTagChild(UIWindow* child) { // OFFSET: 0x00896EE0 // FUNCTION: fn_11520 void UIItemTagOnChat::RemoveTagChild(UIWindow* child) { - if (g_inputSuggestionsEnabled == 1 && g_chatSuggestions->unknown_00BC != nullptr && g_chatSuggestions->unknown_00BC->Contains(child)) { - g_chatSuggestions->unknown_00BC->RemoveChild(child, 1); + if (g_inputSuggestionsEnabled == 1 && ChatWindow()->m_chatEdit != nullptr && ChatWindow()->m_chatEdit->Contains(child)) { + ChatWindow()->m_chatEdit->RemoveChild(child, 1); return; } diff --git a/Source/UI/Edit/UIEditBoxEx.cpp b/Source/UI/Edit/UIEditBoxEx.cpp index 2c91c94f..c3f28df5 100644 --- a/Source/UI/Edit/UIEditBoxEx.cpp +++ b/Source/UI/Edit/UIEditBoxEx.cpp @@ -368,14 +368,14 @@ void CUIEditBoxEx::SetBackgroundColor(std::uint32_t color) { } #include "Client/Input/Language.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Window/InputFocus.h" #include "UI/Window/UIWindowMgr.h" // OFFSET: 0x009E4BF0 // FUNCTION: fn_14444 void CUIEditCtrlEx::HandleKeyDown(int key, std::intptr_t lparam) { - UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr; + UIWindow* const chatWindow = ChatWindow() ? ChatWindow()->m_suggestions : nullptr; switch (key) { case VK_BACK: diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index ee30d231..ba61e935 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -108,7 +108,7 @@ #include #include #include "Contents/Items/ItemLink.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Dialogs/UINpcEditDialogWnd.h" #include "UI/Rodex/UIRodexComposeWnd.h" #include "UI/UIBartermarketWnd.h" @@ -8488,7 +8488,7 @@ void UIItemWnd::Slot25(int x, int y) { } else if (g_windowMgr.GetHoverWindow()->geometry.id == 490) { static_cast(g_windowMgr.GetHoverWindow())->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 493) { - reinterpret_cast(g_chatSuggestions->unknown_00BC)->InsertItemLink(item); + reinterpret_cast(ChatWindow()->m_chatEdit)->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 491) { reinterpret_cast(g_windowMgr.unknown_0458)->sub_7FF710(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 494) { @@ -8525,7 +8525,7 @@ void UIMerchantItemWnd::Slot25(int x, int y) { } else if (g_windowMgr.GetHoverWindow()->geometry.id == 490) { static_cast(g_windowMgr.GetHoverWindow())->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 493) { - reinterpret_cast(g_chatSuggestions->unknown_00BC)->InsertItemLink(item); + reinterpret_cast(ChatWindow()->m_chatEdit)->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 491) { reinterpret_cast(g_windowMgr.unknown_0458)->sub_7FF710(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 494) { @@ -9256,8 +9256,8 @@ void UIItemDropCntWnd::Show(int visible) { this->Invalidate(); g_windowMgr.StoreSnapRectangle(this); } else { - if (this->m_edit == g_windowMgr.GetHoverWindow() && g_chatSuggestions) { - reinterpret_cast(g_chatSuggestions)->SendMsg(nullptr, 54, 0, 0, 0, 0); + if (this->m_edit == g_windowMgr.GetHoverWindow() && ChatWindow()) { + ChatWindow()->SendMsg(nullptr, 54, 0, 0, 0, 0); } g_windowMgr.RemoveSnapRectangle(this); } diff --git a/Source/UI/Edit/UIEditVariants.cpp b/Source/UI/Edit/UIEditVariants.cpp index 804de965..0a260a5e 100644 --- a/Source/UI/Edit/UIEditVariants.cpp +++ b/Source/UI/Edit/UIEditVariants.cpp @@ -11,7 +11,7 @@ #include "UI/Buttons/UIItemTagButton.h" #include "UI/Window/InputFocus.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Lists/UIScrollBar.h" #include "Network/TextEncoding.h" @@ -213,7 +213,7 @@ int UIEditCtrl3::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in // OFFSET: 0x0085E420 // FUNCTION: fn_10829 void UIEditCtrl3::HandleInputMessage(unsigned key, std::intptr_t data) { - UIWindow* const chatWindow = g_chatSuggestions ? g_chatSuggestions->window : nullptr; + UIWindow* const chatWindow = ChatWindow() ? ChatWindow()->m_suggestions : nullptr; this->unknown_0150 = 0; this->unknown_0154 = 0; diff --git a/Source/UI/Items/UISwapEquipmentWnd.cpp b/Source/UI/Items/UISwapEquipmentWnd.cpp index 527d4107..33ed9e0a 100644 --- a/Source/UI/Items/UISwapEquipmentWnd.cpp +++ b/Source/UI/Items/UISwapEquipmentWnd.cpp @@ -19,7 +19,7 @@ #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" #include "UI/Buttons/UIBasicButton.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Dialogs/UINpcEditDialogWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Rodex/UIRodexComposeWnd.h" @@ -412,7 +412,7 @@ void UISwapEquipmentWnd::Slot25(int x, int y) { } else if (g_windowMgr.GetHoverWindow()->geometry.id == 490) { static_cast(g_windowMgr.GetHoverWindow())->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 493) { - reinterpret_cast(g_chatSuggestions->unknown_00BC)->InsertItemLink(item); + reinterpret_cast(ChatWindow()->m_chatEdit)->InsertItemLink(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 491) { reinterpret_cast(g_windowMgr.unknown_0458)->sub_7FF710(item); } else if (g_windowMgr.GetHoverWindow()->geometry.id == 494) { diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index b8d8be71..4a1ad781 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -14,7 +14,7 @@ #include "UI/Shortcuts/ShortcutPress.h" #include "UI/Shortcuts/ShortcutVisibility.h" #include "UI/Shortcuts/UIShortCutWnd.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Chat/UINewChatWnd.h" #include "UI/Chat/UISubChatHisWnd.h" #include "UI/Chat/UISubChatMiniWnd.h" @@ -654,9 +654,9 @@ void UINewChatWnd::Slot25(int x, int y) { if (y < 14 && x > this->m_lockButtonX && x < this->m_lockButtonX + 9) { g_chatInputFlag = g_chatInputFlag == 0; - reinterpret_cast(this)->Apply(); + this->ApplyHeaderLayout(); for (unsigned int i = 0; i < g_windowMgr.retainedWindows.size(); ++i) { - reinterpret_cast(g_windowMgr.retainedWindows[i])->Apply(); + static_cast(g_windowMgr.retainedWindows[i])->ApplyButtonLayout(); g_windowMgr.retainedWindows[i]->Invalidate(); } @@ -671,8 +671,8 @@ void UINewChatWnd::Slot25(int x, int y) { if (g_windowMgr.unknown_0026 && y < 14 && x > this->m_chatModeX && x < this->m_chatModeX + 14) { g_windowMgr.unknown_0024 = g_windowMgr.unknown_0024 == 0; - if (g_chatSuggestions) { - reinterpret_cast(g_chatSuggestions)->Apply(); + if (ChatWindow()) { + ChatWindow()->ApplyInputLayout(); } this->Invalidate(); } @@ -1187,10 +1187,10 @@ UISubChatMiniWnd::UISubChatMiniWnd(UIWindowContext& windows) // OFFSET: 0x00911700 // FUNCTION: fn_12518 UINewChatWnd::UINewChatWnd(UIWindowContext& windows) : UIFrameWnd(windows, 0) { - this->unknown_00BC = 0; - this->unknown_00C0 = 0; + this->m_chatEdit = nullptr; + this->unknown_00C0 = nullptr; this->m_inputEdit = nullptr; - this->unknown_00B8 = 0; + this->unknown_00B8 = nullptr; this->unknown_0110 = 10; *reinterpret_cast(&g_windowMgr.unknown_03F4) = 1; this->geometry.unknown_0030 = 0; @@ -1213,7 +1213,7 @@ UINewChatWnd::UINewChatWnd(UIWindowContext& windows) : UIFrameWnd(windows, 0) { this->m_tabWidth = 90; break; } - this->unknown_013C = 0; + this->m_suggestions = nullptr; } // OFFSET: 0x00933D60 @@ -1304,8 +1304,8 @@ int UISubChatHisWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume this->m_edit->Move(-100, -100); this->m_edit->SetText(""); this->Invalidate(); - reinterpret_cast(this)->Apply(); - g_windowMgr.SetFocus(reinterpret_cast(g_chatSuggestions)); + this->ApplyButtonLayout(); + g_windowMgr.SetFocus(ChatWindow()); RECT rectangle; rectangle.left = 0; rectangle.top = 0; @@ -1322,8 +1322,8 @@ int UISubChatHisWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume new (static_cast(&local)) Concurrency::details::_ReentrantPPLLock(); return 0; } - if (g_chatSuggestions != nullptr) { - reinterpret_cast(g_chatSuggestions)->SendMsg(this, 0, 0, 0, 0, 0); + if (ChatWindow() != nullptr) { + ChatWindow()->SendMsg(this, 0, 0, 0, 0, 0); return 0; } return 0; @@ -1399,8 +1399,8 @@ int UISubChatHisWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume g_windowMgr.SelectWhisperName(reinterpret_cast(argument2)); return 0; case 0x165: - if (g_chatSuggestions != nullptr) { - reinterpret_cast(g_chatSuggestions)->SendMsg(this, 0x76, 0, 0, 0, 0); + if (ChatWindow() != nullptr) { + ChatWindow()->SendMsg(this, 0x76, 0, 0, 0, 0); return 0; } return 0; @@ -1428,7 +1428,7 @@ int UISubChatHisWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume if (width != this->geometry.width || height != this->geometry.height) { this->Resize(width, height); this->m_resizer->Move(this->geometry.width - 0xF, this->geometry.height - 0xF); - reinterpret_cast(this)->Apply(); + this->ApplyButtonLayout(); return 0; } } diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index d500a945..36590c6e 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -2,7 +2,7 @@ #include "Render/Text/FontCache.h" #include "Render/Text/TextContext.h" #include "UI/Window/UIHotKeyWnd.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "Client/Session.h" #include "Client/Mode/ModeTooltip.h" #include "Contents/Hotkeys/UserHotkeyMgr.h" @@ -780,13 +780,13 @@ int UIHotKeyWnd::SendMsg( } g_windowCloseByte = argument2 != 0; - if (g_chatSuggestions) { + if (ChatWindow()) { if (argument2 != 0) { - reinterpret_cast(g_chatSuggestions)->Invalidate(); + ChatWindow()->Invalidate(); return 0; } - reinterpret_cast(g_chatSuggestions)->Toggle(); + ChatWindow()->ToggleInput(); } return 0; case 316: diff --git a/Source/UI/Window/UINewSkillListWnd.cpp b/Source/UI/Window/UINewSkillListWnd.cpp index 219f284d..7210eabb 100644 --- a/Source/UI/Window/UINewSkillListWnd.cpp +++ b/Source/UI/Window/UINewSkillListWnd.cpp @@ -23,7 +23,7 @@ #include "UI/Lists/UIScrollBar.h" #include "UI/Lists/UITabControl.h" #include "UI/Window/WindowMouseHit.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Shortcuts/ShortcutVisibility.h" #include "UI/Window/InputFocus.h" #include "UI/Window/WindowDialogs.h" @@ -1346,8 +1346,8 @@ int UINewSkillListWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s if (reinterpret_cast(&g_windowMgr)->Confirm(LookupMessage(1377), 2, false, false, 0, "Message", 280, 120, 0) == 187) { this->sub_9AE730(); this->SendMsg(nullptr, 23, 0, 0, 0, 0); - if (g_chatSuggestions) { - g_windowMgr.SetFocus(g_chatSuggestions->window); + if (ChatWindow()) { + g_windowMgr.SetFocus(ChatWindow()->m_suggestions); return 0; } } diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 0bf08c7e..966f32c8 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -40,7 +40,7 @@ #include "UI/Buttons/UIButton.h" #include "UI/Buttons/UICheckBox.h" #include "UI/Buttons/UIItemTagButton.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Lists/UIComboBox.h" #include "UI/Lists/UIComboBoxDefWnd.h" @@ -3456,13 +3456,13 @@ void UINavigationV4Wnd::InsertNavigationLink(std::string name, int x, int y) { link += g_windowNaviLinkCloseTag; if (g_windowMgr.GetHoverWindow() && g_windowMgr.GetHoverWindow()->geometry.id != 516) { - if (g_windowMgr.GetHoverWindow() == g_chatSuggestions->window && !g_windowMgr.unknown_0024) { - reinterpret_cast(g_chatSuggestions)->Toggle(); + if (g_windowMgr.GetHoverWindow() == ChatWindow()->m_suggestions && !g_windowMgr.unknown_0024) { + ChatWindow()->ToggleInput(); } } else if (!g_windowMgr.unknown_0024) { - reinterpret_cast(g_chatSuggestions)->Toggle(); + ChatWindow()->ToggleInput(); } else { - g_windowMgr.SetFocus(g_chatSuggestions->window); + g_windowMgr.SetFocus(ChatWindow()->m_suggestions); } g_windowMgr.GetHoverWindow()->SendMsg(nullptr, 153, reinterpret_cast(link.c_str()), 0, 0, 0); diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index bc586a01..218bd76d 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -18,7 +18,8 @@ #include "UI/Dialogs/UIMemorialDunWnd.h" #include "UI/Layout/SnapMgr.h" #include "UI/Lists/UIDropDownBox.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" +#include "UI/Lists/UITabControl.h" #include "UI/Window/MiniPartyWndAreaMgr.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/InputFocus.h" @@ -72,6 +73,7 @@ #include "UI/Text/TextWrapping.h" #include "UI/Chat/UIWhisperWnd.h" #include "UI/Chat/UINewChatWnd.h" +#include "UI/Lists/UITabControl.h" #include "UI/Window/UIChatRoomWnd.h" #include "UI/Shortcuts/ShortcutVisibility.h" #include "Contents/GuildInfo.h" @@ -2018,8 +2020,8 @@ bool UIWindowMgr::sub_A8CA20() { if (window == nullptr) { if (this->hoverWindow != nullptr) { if (this->window_01C8 != nullptr && this->hoverWindow->parent == this->window_01C8) { - if (reinterpret_cast(this->window_01C8)->Visible()) { - UIWindow* child = reinterpret_cast(this->window_01C8)->unknown_013C; + if (static_cast(this->window_01C8)->SuggestionsVisible()) { + UIWindow* child = static_cast(this->window_01C8)->m_suggestions; if (child != nullptr) { child->SendMsg(nullptr, 0xB0, 0xD, 0, 0, 0); return true; @@ -2306,21 +2308,21 @@ bool UIWindowMgr::ProcessHotkeyAction(int action, int pressed) { if ((this->IsHoverOnWindow01C8Button() || (!this->windowHistory.empty() && this->windowHistory.front() == 1)) && this->unknown_0024 != 0 && this->unknown_0026 != 0) { - ChatSuggestions* suggestions = reinterpret_cast(this->window_01C8); - if (suggestions && suggestions->Visible()) { - suggestions->Show(0); + UINewChatWnd* suggestions = static_cast(this->window_01C8); + if (suggestions && suggestions->SuggestionsVisible()) { + suggestions->ShowSuggestions(0); return false; } this->unknown_0024 = 0; - reinterpret_cast(this->window_01C8)->Apply(); + static_cast(this->window_01C8)->ApplyInputLayout(); return false; } if (this->window_01C8 && this->hoverWindow) { UIWindow* parent = this->hoverWindow->parent; if (parent && this->hoverWindow->geometry.x != -100) { - if (parent == reinterpret_cast(this->window_01C8)->unknown_0138) { + if (parent == static_cast(this->window_01C8)->m_tabControl) { parent->SendMsg(this->hoverWindow, 0, 1, 0, 0, 0); return false; } diff --git a/Source/UI/Window/WindowMouseHit.cpp b/Source/UI/Window/WindowMouseHit.cpp index 04b84d6c..8fed0491 100644 --- a/Source/UI/Window/WindowMouseHit.cpp +++ b/Source/UI/Window/WindowMouseHit.cpp @@ -2,7 +2,7 @@ #include "Client/Input/Mouse.h" #include "Client/Replay.h" #include "Contents/Messenger/MessengerMember.h" -#include "UI/Chat/ChatSuggestions.h" +#include "UI/Chat/UINewChatWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Window/InputFocus.h" #include "UI/Lists/UIDropDownBox.h" @@ -324,22 +324,22 @@ int UIWindowMgr::ProcessMouse() { this->unknown_4F248.clear(); if (g_mouse.buttons[0] == 1 && this->window_01C8) { - ChatSuggestions* suggestions = reinterpret_cast(this->window_01C8); - if (suggestions->Visible() == 1) { + UINewChatWnd* suggestions = static_cast(this->window_01C8); + if (suggestions->SuggestionsVisible() == 1) { int left; int top; int right; int bottom; - WindowScreenBounds(suggestions->unknown_013C, left, top, right, bottom); + WindowScreenBounds(suggestions->m_suggestions, left, top, right, bottom); const bool outside = left > x || right < x || top > y || bottom < y; WindowScreenBounds(this->unknown_0384, left, top, right, bottom); const bool outsideCompanion = left > x || right < x || top > y || bottom < y; if (outside && outsideCompanion) { - suggestions->Show(0); - if (suggestions->unknown_00BC) { - static_cast(suggestions->unknown_00BC)->SetText(""); + suggestions->ShowSuggestions(0); + if (suggestions->m_chatEdit) { + static_cast(suggestions->m_chatEdit)->SetText(""); } - reinterpret_cast(suggestions)->Toggle(); + suggestions->ToggleInput(); } } }