diff --git a/Source/Contents/Effects/Particle.cpp b/Source/Contents/Effects/Particle.cpp index 436b8fcc7..b16a97f64 100644 --- a/Source/Contents/Effects/Particle.cpp +++ b/Source/Contents/Effects/Particle.cpp @@ -142,7 +142,7 @@ CEZ2STRParticle::~CEZ2STRParticle() { // OFFSET: 0x00B3CFC0 // FUNCTION: fn_18815 void CEZ2STRParticle::ReleaseResource() { - this->m_res = CResPtr(); + this->m_res = nullptr; } // OFFSET: 0x00B3D030 @@ -164,7 +164,7 @@ std::string CEZ2STRParticle::ResolvePath(const std::string& name) { // FUNCTION: fn_18817 void CEZ2STRParticle::Clear() { this->Reset(); - this->m_res = CResPtr(); + this->m_res = nullptr; this->m_data = nullptr; this->m_finishedClips = 0; this->m_frame = 0; diff --git a/Source/UI/Enchant/UIEnchantUI.cpp b/Source/UI/Enchant/UIEnchantUI.cpp index 2512dbb94..b8e95e78b 100644 --- a/Source/UI/Enchant/UIEnchantUI.cpp +++ b/Source/UI/Enchant/UIEnchantUI.cpp @@ -182,7 +182,7 @@ void CUIListBoxEx::AddNe // OFFSET: 0x00A022A0 // FUNCTION: fn_14839 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -280,7 +280,7 @@ void CUIListBoxEx::AddNewItem() { // OFFSET: 0x00A024B0 // FUNCTION: fn_14840 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); diff --git a/Source/UI/Exchange/UIExchangeUI.cpp b/Source/UI/Exchange/UIExchangeUI.cpp index 86635c03d..8be8122d6 100644 --- a/Source/UI/Exchange/UIExchangeUI.cpp +++ b/Source/UI/Exchange/UIExchangeUI.cpp @@ -50,7 +50,7 @@ void CUIListBoxEx::OnScroll(int posi template <> void CUIListBoxEx::AddNewItem(); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); @@ -154,8 +154,9 @@ void CUIListBoxEx::OnScroll(int posi } if (this->data.size() == 0) { for (; it != this->items.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + ExchangeUI::CUIItem* item = *it; + item->index = -1; + item->Show(0); } return; } @@ -196,8 +197,9 @@ void CUIListBoxEx::OnScroll(int posi } for (; it != this->items.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + ExchangeUI::CUIItem* item = *it; + item->index = -1; + item->Show(0); } } @@ -1382,7 +1384,7 @@ void CUIListBoxEx::AddNewItem() { // OFFSET: 0x00A15530 // FUNCTION: fn_15198 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); diff --git a/Source/UI/GameSettings/GameSettingsUI.cpp b/Source/UI/GameSettings/GameSettingsUI.cpp index bfcbc5b86..ad3435e05 100644 --- a/Source/UI/GameSettings/GameSettingsUI.cpp +++ b/Source/UI/GameSettings/GameSettingsUI.cpp @@ -139,15 +139,15 @@ void CUIListBoxEx::AddNewItem(); template <> void CUIListBoxEx::AddNewItem(); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); template <> @@ -521,7 +521,7 @@ void CUICheckBox::SetOnCheck(std::function callback) { // OFFSET: 0x00A354A0 // FUNCTION: fn_15427 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -535,7 +535,7 @@ void CUIListBoxEx::LoadSkin(int res // OFFSET: 0x00A356B0 // FUNCTION: fn_15428 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -549,7 +549,7 @@ void CUIListBoxEx::LoadSkin(int resol // OFFSET: 0x00A358C0 // FUNCTION: fn_15429 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -563,7 +563,7 @@ void CUIListBoxEx::LoadSkin(int res // OFFSET: 0x00A35AD0 // FUNCTION: fn_15430 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -577,7 +577,7 @@ void CUIListBoxEx::LoadSkin(int resol // OFFSET: 0x00A35CE0 // FUNCTION: fn_15431 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp index 0549cf010..aceb4bb8f 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp @@ -101,7 +101,7 @@ void CUIListBoxExgeometry.height % this->rowHeight >= 2) { ++count; } - this->items.resize(count, nullptr); + this->items.resize(count); for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine*& slot : this->items) { EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* item = new EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine(); @@ -129,7 +129,7 @@ void CUIListBoxEx -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -204,9 +204,10 @@ void CUIListBoxExitems.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + for (auto end = this->items.end(); it != end; ++it) { + EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* item = *it; + item->index = -1; + item->Show(0); } } @@ -246,9 +247,9 @@ CUIListBoxExResize(300, 308); this->ownedSkinColors = 0x101; this->m_resolveSkin = true; + this->Resize(300, 308); this->Move(0, 0); this->OnCreate(this->geometry.width, this->geometry.height); this->OnInit(); @@ -316,7 +317,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { { CUITitleBar* titleBar = this->titleBar; const std::string right([] { - const char source[] = { + const std::array source = { '\x47', '\xBC', '\xAB', '\x85', '\xF9', '\xC7', '\xB4', '\xC6', '\x41', '\xF7', '\xAB', '\xB3', '\x84', '\xB3', '\x2D', '\x69', '\xE6', '\x60', '\x02', '\x1C', '\x66', '\x60', '\x1F', '\x7F', '\xE2', '\x61', '\x0D', '\x1E', '\x5A', '\x6C', '\x2D', '\x7F', '\xEE', '\x67', '\x07', '\x1A', '\x5B', '\x68', '\x03', '\x54', '\xF5', '\x7A', '\x0C', '\x17', '\x4D', '\x27', '\x13', '\x66', @@ -327,7 +328,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string middle([] { - const char source[] = { + const std::array source = { '\x65', '\x32', '\xAD', '\x03', '\xA3', '\xE9', '\xB2', '\xCE', '\x63', '\x79', '\xAD', '\x35', '\xDE', '\x9D', '\x2B', '\x61', '\xC4', '\xEE', '\x04', '\x9A', '\x3C', '\x4E', '\x19', '\x77', '\xC0', '\xEF', '\x0B', '\x98', '\x00', '\x42', '\x2B', '\x77', '\xCC', '\xE9', '\x01', '\x9C', '\x01', '\x46', '\x05', '\x5C', '\xC8', '\xF4', '\x09', '\xD7', '\x01', '\x4A', '\x07', '\x03' @@ -337,7 +338,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string left([] { - const char source[] = { + const std::array source = { '\xAD', '\x14', '\x55', '\xD7', '\x53', '\x35', '\xD2', '\x08', '\xAB', '\x5F', '\x55', '\xE1', '\x2E', '\x41', '\x4B', '\xA7', '\x0C', '\xC8', '\xFC', '\x4E', '\xCC', '\x92', '\x79', '\xB1', '\x08', '\xC9', '\xF3', '\x4C', '\xF0', '\x9E', '\x4B', '\xB1', '\x04', '\xCF', '\xF9', '\x48', '\xF1', '\x9A', '\x65', '\x9A', '\x01', '\xDE', '\xF3', '\x59', '\xBD', '\x99', '\x7A', '\xB5', @@ -359,7 +360,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { title->SetAlign(0, 6); { title->SetFont(std::string([] { - const char source[] = {'\x20', '\xDE', '\xFD', '\xCC', '\xCC', '\x3F'}; + const std::array source = {'\x20', '\xDE', '\xFD', '\xCC', '\xCC', '\x3F'}; // GLOBAL: gl_25324 thread_local EncryptedName name(source); return name.Text(); @@ -382,7 +383,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { baseButton->Invalidate(); { const std::string inactive([] { - const char source[] = { + const std::array source = { '\xC9', '\x88', '\xEF', '\x41', '\x7D', '\x93', '\xB8', '\x14', '\xCF', '\xC3', '\xEF', '\x77', '\x00', '\xE7', '\x21', '\xBB', '\x68', '\x54', '\x46', '\xD8', '\xE2', '\x34', '\x13', '\xAD', '\x6C', '\x55', '\x49', '\xDA', '\xDE', '\x38', '\x21', '\xAA', '\x70', '\x54', '\x70', '\xD9', '\xDC', '\x2E', '\x18', '\x86', '\x66', '\x41', '\x49', '\x95', '\xDF', '\x30', '\x0D', '\xD9' @@ -392,7 +393,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string pressed([] { - const char source[] = { + const std::array source = { '\xAF', '\xD2', '\x3B', '\xD9', '\xB1', '\xC9', '\x4A', '\x00', '\xA9', '\x99', '\x3B', '\xEF', '\xCC', '\xBD', '\xD3', '\xAF', '\x0E', '\x0E', '\x92', '\x40', '\x2E', '\x6E', '\xE1', '\xB9', '\x0A', '\x0F', '\x9D', '\x42', '\x12', '\x62', '\xD3', '\xBE', '\x16', '\x0E', '\xA4', '\x41', '\x10', '\x74', '\xEA', '\x92', '\x00', '\x13', '\xD5', '\x41', '\x1C', '\x77', '\x8F' @@ -402,7 +403,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string hover([] { - const char source[] = { + const std::array source = { '\x83', '\x86', '\x93', '\xDD', '\x15', '\x71', '\x8C', '\x54', '\x85', '\xCD', '\x93', '\xEB', '\x68', '\x05', '\x15', '\xFB', '\x22', '\x5A', '\x3A', '\x44', '\x8A', '\xD6', '\x27', '\xED', '\x26', '\x5B', '\x35', '\x46', '\xB6', '\xDA', '\x15', '\xEA', '\x3A', '\x5A', '\x0C', '\x45', '\xB4', '\xCC', '\x2C', '\xC6', '\x2C', '\x47', '\x7D', '\x45', '\xB8', '\xCF', '\x49' @@ -412,7 +413,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string normal([] { - const char source[] = { + const std::array source = { '\xF7', '\xE8', '\x6D', '\xC3', '\x7F', '\x2B', '\x6C', '\xDA', '\xF1', '\xA3', '\x6D', '\xF5', '\x02', '\x5F', '\xF5', '\x75', '\x56', '\x34', '\xC4', '\x5A', '\xE0', '\x8C', '\xC7', '\x63', '\x52', '\x35', '\xCB', '\x58', '\xDC', '\x80', '\xF5', '\x64', '\x4E', '\x34', '\xF2', '\x5B', '\xDE', '\x96', '\xCC', '\x48', '\x58', '\x21', '\xCB', '\x17', '\xDD', '\x88', '\xD9', '\x17' @@ -433,7 +434,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { closeButton->Invalidate(); { const std::string inactive([] { - const char source[] = { + const std::array source = { '\x21', '\xD4', '\x39', '\x2D', '\x15', '\xDD', '\xFC', '\x10', '\x27', '\x9F', '\x39', '\x1B', '\x68', '\xA9', '\x65', '\xBF', '\x80', '\x08', '\x90', '\xB4', '\x8A', '\x7A', '\x57', '\xA9', '\x84', '\x09', '\x9F', '\xB6', '\xB6', '\x76', '\x65', '\xAE', '\x98', '\x08', '\xA6', '\xB4', '\xB9', '\x7C', '\x4A', '\xB8', '\xBE', '\x14', '\x9F', '\xB1', '\xFB', '\x71', '\x54', '\xAD', @@ -444,7 +445,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string pressed([] { - const char source[] = { + const std::array source = { '\x5F', '\x6A', '\xAD', '\x51', '\x17', '\xE7', '\x38', '\x68', '\x59', '\x21', '\xAD', '\x67', '\x6A', '\x93', '\xA1', '\xC7', '\xFE', '\xB6', '\x04', '\xC8', '\x88', '\x40', '\x93', '\xD1', '\xFA', '\xB7', '\x0B', '\xCA', '\xB4', '\x4C', '\xA1', '\xD6', '\xE6', '\xB6', '\x32', '\xC8', '\xBB', '\x46', '\x8E', '\xC0', '\xC0', '\xAA', '\x03', '\x85', '\xB5', '\x44', '\x8D', '\xA5' @@ -454,7 +455,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string hover([] { - const char source[] = { + const std::array source = { '\x31', '\x68', '\xF9', '\xF3', '\xD7', '\xB7', '\x8A', '\x3C', '\x37', '\x23', '\xF9', '\xC5', '\xAA', '\xC3', '\x13', '\x93', '\x90', '\xB4', '\x50', '\x6A', '\x48', '\x10', '\x21', '\x85', '\x94', '\xB5', '\x5F', '\x68', '\x74', '\x1C', '\x13', '\x82', '\x88', '\xB4', '\x66', '\x6A', '\x7B', '\x16', '\x3C', '\x94', '\xAE', '\xA8', '\x57', '\x27', '\x75', '\x14', '\x3F', '\xF1' @@ -464,7 +465,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string normal([] { - const char source[] = { + const std::array source = { '\xBF', '\xBC', '\x1F', '\x2B', '\x45', '\xA9', '\xBC', '\x20', '\xB9', '\xF7', '\x1F', '\x1D', '\x38', '\xDD', '\x25', '\x8F', '\x1E', '\x60', '\xB6', '\xB2', '\xDA', '\x0E', '\x17', '\x99', '\x1A', '\x61', '\xB9', '\xB0', '\xE6', '\x02', '\x25', '\x9E', '\x06', '\x60', '\x80', '\xB2', '\xE9', '\x08', '\x0A', '\x88', '\x20', '\x7C', '\xB9', '\xB7', '\xAB', '\x05', '\x14', '\x9D', @@ -495,7 +496,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { { auto* list = this->list; const std::string down([] { - const char source[] = { + const std::array source = { '\x7D', '\x12', '\x2D', '\xCD', '\x7B', '\x71', '\x2A', '\x4E', '\x7B', '\x59', '\x2D', '\xFB', '\x06', '\x05', '\xB3', '\xF0', '\xDE', '\xCF', '\x82', '\x5B', '\xD7', '\x8F', '\x8B', '\xEC', '\xCA', '\xD3', '\xC3', '\x55', '\xD6', '\xCF', '\xEF' }; @@ -504,7 +505,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string up([] { - const char source[] = { + const std::array source = { '\x5B', '\xF8', '\xC3', '\x63', '\xA7', '\xCB', '\xC0', '\xC8', '\x5D', '\xB3', '\xC3', '\x55', '\xDA', '\xBF', '\x59', '\x76', '\xF8', '\x25', '\x6C', '\xF5', '\x0B', '\x35', '\x70', '\x75', '\xB5', '\x35', '\x6E', '\xE9', '\x67' }; @@ -517,7 +518,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { { auto* list = this->list; const std::string background([] { - const char source[] = { + const std::array source = { '\x67', '\x5A', '\xBF', '\xC3', '\xF1', '\x85', '\xEE', '\x72', '\x61', '\x11', '\xBF', '\xF5', '\x8C', '\xF1', '\x77', '\xCC', '\xC4', '\x87', '\x10', '\x55', '\x5D', '\x7B', '\x46', '\xD6', '\xC3', '\xDB', '\x1D', '\x54', '\x41', '\x4B' }; @@ -530,7 +531,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { { auto* list = this->list; const std::string bottom([] { - const char source[] = { + const std::array source = { '\xBF', '\xBA', '\x4D', '\xEB', '\xF7', '\xC1', '\x4E', '\xE2', '\xB9', '\xF1', '\x4D', '\xDD', '\x8A', '\xB5', '\xD7', '\x5C', '\x1C', '\x67', '\xE2', '\x7D', '\x5B', '\x3F', '\xE9', '\x4E', '\x0D', '\x4A', '\xE9', '\x7E', '\x40', '\x61', '\xA5', '\x4D', '\x12', '\x65', '\x8D' @@ -540,7 +541,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string middle([] { - const char source[] = { + const std::array source = { '\x4F', '\x36', '\x2B', '\xF7', '\x75', '\xB1', '\x3A', '\xF4', '\x49', '\x7D', '\x2B', '\xC1', '\x08', '\xC5', '\xA3', '\x4A', '\xEC', '\xEB', '\x84', '\x61', '\xD9', '\x4F', '\x9D', '\x58', '\xFD', '\xC6', '\x86', '\x64', '\xD1', '\x51', '\x9D', '\x54', '\xFF', '\x99' @@ -550,7 +551,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { return name.Text(); }()); const std::string top([] { - const char source[] = { + const std::array source = { '\x57', '\x5E', '\x21', '\x27', '\x11', '\x5D', '\x2C', '\xE2', '\x51', '\x15', '\x21', '\x11', '\x6C', '\x29', '\xB5', '\x5C', '\xF4', '\x83', '\x8E', '\xB1', '\xBD', '\xA3', '\x8B', '\x4E', '\xE5', '\xAE', '\x94', '\xAD', '\xFF', '\xF1', '\x84', '\x5F', '\x97' @@ -583,7 +584,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { allButton->SetId(0); { const std::string label([] { - const char source[] = {'\x0D', '\x0D', '\x5A', '\x09', '\x8D'}; + const std::array source = {'\x0D', '\x0D', '\x5A', '\x09', '\x8D'}; // GLOBAL: gl_25342 thread_local EncryptedName name(source); return name.Text(); @@ -594,7 +595,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { allButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\xBA', '\xCC', '\xD7', '\x48', '\xF2', '\xFD'}; + const std::array source = {'\xBA', '\xCC', '\xD7', '\x48', '\xF2', '\xFD'}; // GLOBAL: gl_25343 thread_local EncryptedName name(source); return name.Text(); @@ -619,7 +620,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { statButton->SetId(1); { const std::string label([] { - const char source[] = {'\xC8', '\x77', '\x28', '\x95', '\x6B'}; + const std::array source = {'\xC8', '\x77', '\x28', '\x95', '\x6B'}; // GLOBAL: gl_25344 thread_local EncryptedName name(source); return name.Text(); @@ -630,7 +631,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { statButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x2C', '\xCC', '\xAB', '\x66', '\x0A', '\x8F'}; + const std::array source = {'\x2C', '\xCC', '\xAB', '\x66', '\x0A', '\x8F'}; // GLOBAL: gl_25345 thread_local EncryptedName name(source); return name.Text(); @@ -655,7 +656,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { abilityButton->SetId(2); { const std::string label([] { - const char source[] = {'\x43', '\x39', '\xF7', '\x5D', '\xB5'}; + const std::array source = {'\x43', '\x39', '\xF7', '\x5D', '\xB5'}; // GLOBAL: gl_25346 thread_local EncryptedName name(source); return name.Text(); @@ -666,7 +667,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { abilityButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x8E', '\x66', '\x95', '\x1A', '\x94', '\xD9'}; + const std::array source = {'\x8E', '\x66', '\x95', '\x1A', '\x94', '\xD9'}; // GLOBAL: gl_25347 thread_local EncryptedName name(source); return name.Text(); @@ -691,7 +692,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { battleButton->SetId(3); { const std::string label([] { - const char source[] = {'\xA3', '\x09', '\x24', '\x8A', '\x3B'}; + const std::array source = {'\xA3', '\x09', '\x24', '\x8A', '\x3B'}; // GLOBAL: gl_25348 thread_local EncryptedName name(source); return name.Text(); @@ -702,7 +703,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { battleButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x08', '\x12', '\x81', '\xEC', '\x64', '\x37'}; + const std::array source = {'\x08', '\x12', '\x81', '\xEC', '\x64', '\x37'}; // GLOBAL: gl_25349 thread_local EncryptedName name(source); return name.Text(); @@ -727,7 +728,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { elementButton->SetId(4); { const std::string label([] { - const char source[] = {'\xA1', '\xD6', '\x2F', '\x93', '\x71'}; + const std::array source = {'\xA1', '\xD6', '\x2F', '\x93', '\x71'}; // GLOBAL: gl_25350 thread_local EncryptedName name(source); return name.Text(); @@ -738,7 +739,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { elementButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x64', '\x84', '\xBB', '\x7E', '\xBA', '\x49'}; + const std::array source = {'\x64', '\x84', '\xBB', '\x7E', '\xBA', '\x49'}; // GLOBAL: gl_25351 thread_local EncryptedName name(source); return name.Text(); @@ -763,7 +764,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { raceButton->SetId(5); { const std::string label([] { - const char source[] = {'\xBE', '\x6B', '\x6E', '\xEC', '\x6B'}; + const std::array source = {'\xBE', '\x6B', '\x6E', '\xEC', '\x6B'}; // GLOBAL: gl_25352 thread_local EncryptedName name(source); return name.Text(); @@ -774,7 +775,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { raceButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x08', '\xD4', '\xA3', '\x5C', '\x0E', '\xD7'}; + const std::array source = {'\x08', '\xD4', '\xA3', '\x5C', '\x0E', '\xD7'}; // GLOBAL: gl_25353 thread_local EncryptedName name(source); return name.Text(); @@ -799,7 +800,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { skillButton->SetId(6); { const std::string label([] { - const char source[] = {'\x5C', '\x23', '\x42', '\xFC', '\x81'}; + const std::array source = {'\x5C', '\x23', '\x42', '\xFC', '\x81'}; // GLOBAL: gl_25354 thread_local EncryptedName name(source); return name.Text(); @@ -810,7 +811,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { skillButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\xF4', '\x12', '\x35', '\xE6', '\xB2', '\x27'}; + const std::array source = {'\xF4', '\x12', '\x35', '\xE6', '\xB2', '\x27'}; // GLOBAL: gl_25355 thread_local EncryptedName name(source); return name.Text(); @@ -835,7 +836,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { specialButton->SetId(7); { const std::string label([] { - const char source[] = {'\xAB', '\xB4', '\x1B', '\xE7', '\x77'}; + const std::array source = {'\xAB', '\xB4', '\x1B', '\xE7', '\x77'}; // GLOBAL: gl_25356 thread_local EncryptedName name(source); return name.Text(); @@ -846,7 +847,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { specialButton->SetAlign(6, 6); { const std::string font([] { - const char source[] = {'\x22', '\x20', '\xA5', '\x16', '\x60', '\xEF'}; + const std::array source = {'\x22', '\x20', '\xA5', '\x16', '\x60', '\xEF'}; // GLOBAL: gl_25357 thread_local EncryptedName name(source); return name.Text(); @@ -868,7 +869,7 @@ void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) { { CUIResizer* resizer = this->resizer; const std::string image([] { - const char source[] = { + const std::array source = { '\x9D', '\xA2', '\x89', '\x73', '\x61', '\xB3', '\x28', '\x52', '\x9B', '\xE9', '\x89', '\x45', '\x1C', '\xC7', '\xB1', '\xFD', '\x29', '\x63', '\x16', '\xFB', '\xC4', '\x0E', '\x84', '\xE5', '\x38', '\x23', '\x2B', '\xE4', '\xD1', '\x7D' }; @@ -1052,7 +1053,7 @@ void CUIEquipmentPropertiesWnd::Grow(int width, int height) { // OFFSET: 0x00A0F2F0 // FUNCTION: fn_15170 -void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::LoadSkin(int resolveSkin) { +void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::LoadSkin(bool resolveSkin) { unsigned red, green, blue; SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue); this->evenRowColor = RGB(red, green, blue); @@ -1065,8 +1066,7 @@ void EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::LoadSkin(int resolv void CUIEquipmentPropertiesWnd::SetTab(const int& tab) { this->currentTab = tab; std::list lines; - const int group = this->currentTab; - EquipmentProperties::EquipmentPropertiesMgr()->GetDescriptions(group, lines); + EquipmentProperties::EquipmentPropertiesMgr()->GetDescriptions(static_cast(this->currentTab), lines); auto* listBox = this->list; if (listBox->data != lines) { diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.h b/Source/UI/Item/UIEquipmentPropertiesWnd.h index 404a92eb6..4ae22c0de 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.h +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.h @@ -21,7 +21,7 @@ public: void OnCreate(int width, int height) override; void OnInit() override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; }; } @@ -71,7 +71,7 @@ void CUIListBoxEx void CUIListBoxEx::Resize(int width, int height); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine) == 0xF8); diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 18dd70084..72fa49740 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -244,7 +244,7 @@ public: this->scrollBar->SetPosition(this->scrollBar->position); } - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SelectItem(CUIListItem* item); T* CreateItem(); @@ -341,9 +341,7 @@ public: void Resize(int width, int height) override { UIWindow::Resize(width, height); } - void LoadSkin(int resolveSkin) override { - (void)resolveSkin; - } + void LoadSkin(bool resolveSkin) override; // OFFSET: 0x00A04B30 // FUNCTION: fn_14963 diff --git a/Source/UI/Lists/UIThumb.h b/Source/UI/Lists/UIThumb.h index 12e858ba2..68377196e 100644 --- a/Source/UI/Lists/UIThumb.h +++ b/Source/UI/Lists/UIThumb.h @@ -13,7 +13,7 @@ public: ~CUIThumb() override; void ResetCursor(int x, int y) override; void OnMouseHover(int x, int y) override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; __declspec(noinline) void SetImages(const std::string& top, const std::string& middle, const std::string& bottom); void SetImage(const std::string& name); diff --git a/Source/UI/Lists/UIVScrollBar.h b/Source/UI/Lists/UIVScrollBar.h index fe56386d5..893d01ec5 100644 --- a/Source/UI/Lists/UIVScrollBar.h +++ b/Source/UI/Lists/UIVScrollBar.h @@ -18,7 +18,7 @@ public: void Paint() override; void OnLBtnDown(int x, int y) override; void OnWheel(int value) override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; virtual void UpdateThumb(); virtual void ScrollBy(int value); diff --git a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp index 3a7676a86..9ad3422dc 100644 --- a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp +++ b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp @@ -137,7 +137,7 @@ template <> void CUIListBoxEx::AddNewItem(); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); @@ -279,18 +279,14 @@ void CUIListBoxEx::AddNe return; } - for (ProbabilityTable::CUIItem* item : this->items) { - this->RemoveChild(item, 1); - } - this->items.clear(); - this->selected = static_cast(-1); + this->ClearItems(); if (this->geometry.height >= this->rowHeight) { unsigned int count = static_cast(this->geometry.height / this->rowHeight) + 1; if (this->geometry.height % this->rowHeight >= 2) { ++count; } - this->items.resize(count, nullptr); + this->items.resize(count); for (ProbabilityTable::CUIItem*& slot : this->items) { ProbabilityTable::CUIItem* item = new ProbabilityTable::CUIItem(); item->SetSize(this->itemWidth, this->rowHeight); @@ -317,7 +313,7 @@ void CUIListBoxEx::AddNe // OFFSET: 0x00A4C2F0 // FUNCTION: fn_16123 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); diff --git a/Source/UI/Quest/UIOngoingQuestInfo.cpp b/Source/UI/Quest/UIOngoingQuestInfo.cpp index 663f44b11..277fbe07e 100644 --- a/Source/UI/Quest/UIOngoingQuestInfo.cpp +++ b/Source/UI/Quest/UIOngoingQuestInfo.cpp @@ -27,7 +27,7 @@ template <> void CUIListBoxEx::OnScroll(int position); -template <> void CUIListBoxEx::AddNewItem(); template <> void CUIListBoxEx::LoadSkin(int resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); +template <> void CUIListBoxEx::AddNewItem(); template <> void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); // OFFSET: 0x00A4F580 // FUNCTION: fn_16213 bool UnusedTrueA4F580() { @@ -382,10 +382,8 @@ void CUIOngoingQuestInfo::SetQuest(unsigned int id) { const auto found = g_renewQuestMgr->m_ongoingQuests.find(id); if (found != g_renewQuestMgr->m_ongoingQuests.end()) { const RenewQuestOngoingInfo& quest = found->second; - this->titleText->SetText(quest.m_title.c_str(), quest.m_title.size()); - CUIStaticText* date = this->dateText; - const std::string text = quest.GetDateString(); - date->SetText(text.c_str(), text.size()); + this->titleText->SetText(quest.m_title); + this->dateText->SetText(quest.GetDateString()); this->scrollWindow->SetQuest(id); this->questId = id; } @@ -749,9 +747,9 @@ void CUIListBoxExitems.clear(); this->selected = static_cast(-1); - if (this->rowHeight <= this->geometry.height) { + if (this->geometry.height >= this->rowHeight) { unsigned count = static_cast(this->geometry.height / this->rowHeight) + 1; - if (this->geometry.height % this->rowHeight > 1) { + if (this->geometry.height % this->rowHeight >= 2) { ++count; } this->items.resize(count); @@ -759,8 +757,7 @@ void CUIListBoxExSetSize(this->itemWidth, this->rowHeight); item->Show(0); - CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); - item->SetImageResources(images[0], images[1], images[2], images[3]); + item->SetImageResources(this->normalImage, this->hoverImage, this->pressedImage, this->disabledImage); item->onHover = [this](CUIListItem* listItem) { for (OngoingQuestInfo::CUIRewardItem* other : this->items) { other->SetHighlighted(other == listItem); @@ -781,7 +778,7 @@ void CUIListBoxEx -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -906,10 +903,11 @@ void CUIRewards::OnCreate(int width, int height) { this->thirdLabel->SetOutline(0, 0xFFFFFF); this->AddChild(this->thirdLabel); - this->rewardList = new CUIListBoxEx(); - this->rewardList->itemWidth = 225; - this->rewardList->rowHeight = 41; - this->rewardList->SetSize(225, 41); + CUIListBoxEx* rewardList = new CUIListBoxEx(); + this->rewardList = rewardList; + rewardList->itemWidth = 225; + rewardList->rowHeight = 41; + rewardList->SetSize(225, 41); this->rewardList->Move(110, 72); this->rewardList->onSelect = [this](CUIRewardItem* item, const CRewardItemData& data) { this->OnPrepareItem(item, data); }; this->rewardList->binder = [this](CUIRewardItem* item, const CRewardItemData& data) { this->OnBindItem(item, data); }; diff --git a/Source/UI/Quest/UIRenewQuestUI.cpp b/Source/UI/Quest/UIRenewQuestUI.cpp index b4a24e259..71e13c5f3 100644 --- a/Source/UI/Quest/UIRenewQuestUI.cpp +++ b/Source/UI/Quest/UIRenewQuestUI.cpp @@ -697,21 +697,22 @@ void CUIListBoxEx::OnScroll(int posit } if (this->data.size() == 0) { for (; it != this->items.end(); ++it) { - (*it)->index = -1; - (*it)->Show(0); + RenewQuestUI::CUIQuestItem* item = *it; + item->index = -1; + item->Show(0); } return; } const int first = (*it)->index; - unsigned int row = position / this->rowHeight; + int row = position / this->rowHeight; if (first != -1) { - if (first < static_cast(row)) { - if (row - first < static_cast(this->items.size())) { + if (first < row) { + if (static_cast(row - first) < this->items.size()) { std::rotate(this->items.begin(), this->items.begin() + (row - first), this->items.end()); } - } else if (first > static_cast(row)) { - if (first - row < static_cast(this->items.size())) { + } else if (first > row) { + if (static_cast(first - row) < this->items.size()) { std::rotate(this->items.begin(), this->items.end() - (first - row), this->items.end()); } } @@ -719,19 +720,15 @@ void CUIListBoxEx::OnScroll(int posit it = this->items.begin(); for (int y = this->itemY - position % this->rowHeight; y < this->geometry.height; y += this->rowHeight, ++it, ++row) { - if (it == this->items.end() || row >= this->data.size()) { + if (it == this->items.end() || static_cast(row) >= this->data.size()) { break; } RenewQuestUI::CUIQuestItem* item = *it; if (item) { - if (this->rebind || row != static_cast(item->index)) { + if (this->rebind || row != item->index) { item->index = row; if (this->binder) { - auto node = this->data.begin(); - for (int count = static_cast(row); count > 0; --count) { - ++node; - } - this->binder(item, *node); + this->binder(item, *std::next(this->data.begin(), row)); } } item->SetSelected(row == this->selected); @@ -1366,8 +1363,9 @@ void RenewQuestUI::CUIQuestItem::OnCreate(int width, int height) { this->simpleViewCheckBox->SetSize(14, 14); this->simpleViewCheckBox->Move(312, 3); this->simpleViewCheckBox->SetOnCheck([this](bool checked) { this->OnSimpleView(checked); }); - this->simpleViewCheckBox->disabled = 0; - this->simpleViewCheckBox->Invalidate(); + CUICheckBox* simpleViewCheckBox = this->simpleViewCheckBox; + simpleViewCheckBox->disabled = 0; + simpleViewCheckBox->Invalidate(); this->simpleViewCheckBox->SetImages( std::string(DecryptName<0x050505679903579BULL>({ '\x5B', '\xF8', '\xC3', '\x63', '\xA7', '\xCB', '\xC0', '\xC8', '\x5D', '\xB3', '\xC3', '\x55', '\xDA', '\xBF', '\x59', '\x57', @@ -1398,8 +1396,9 @@ void RenewQuestUI::CUIQuestItem::OnCreate(int width, int height) { this->activeCheckBox->SetSize(20, 17); this->activeCheckBox->Move(306, 22); this->activeCheckBox->SetOnCheck([this](bool checked) { this->OnActiveStateChanged(checked); }); - this->activeCheckBox->disabled = 0; - this->activeCheckBox->Invalidate(); + CUICheckBox* activeCheckBox = this->activeCheckBox; + activeCheckBox->disabled = 0; + activeCheckBox->Invalidate(); this->activeCheckBox->SetImages( std::string(DecryptName<0xED796785D1DF137FULL>({ '\xBF', '\xBC', '\x1F', '\x2B', '\x45', '\xA9', '\xBC', '\x20', '\xB9', '\xF7', '\x1F', '\x1D', '\x38', '\xDD', '\x25', '\xBF', @@ -1776,8 +1775,9 @@ void CUIRenewQuestUI::OnCreate(int width, int height) { this->checkBox->SetSize(10, 10); this->checkBox->Move(38, 448); this->checkBox->SetOnCheck([this](bool checked) { this->RecordWindowFlag(checked); }); - this->checkBox->disabled = 0; - this->checkBox->Invalidate(); + CUICheckBox* checkBox = this->checkBox; + checkBox->disabled = 0; + checkBox->Invalidate(); this->checkBox->SetImages( std::string(DecryptName<0x7DE349D717D7F123ULL>({ '\xE3', '\x5E', '\x17', '\xED', '\x17', '\x87', '\x26', '\xB0', '\xE5', '\x15', '\x17', '\xDB', '\x6A', '\xF3', '\xBF', '\x2F', @@ -1822,8 +1822,9 @@ void CUIRenewQuestUI::OnCreate(int width, int height) { this->closeButton->SetSize(42, 20); this->closeButton->Move(327, 442); this->closeButton->SetOnClick([this]() { g_windowMgr.CloseWindow(WID_RENEWQUESTUI); }); - this->closeButton->disabled = 0; - this->closeButton->Invalidate(); + CUIImageButton* closeButton = this->closeButton; + closeButton->disabled = 0; + closeButton->Invalidate(); this->closeButton->SetImages( std::string(DecryptName<0xCB1D253B7FE1F563ULL>({ '\xA3', '\x5A', '\x21', '\x85', '\xFB', '\xEB', '\xD8', '\x06', '\xA5', '\x11', '\x21', '\xB3', '\x86', '\x9F', '\x41', '\xA9', @@ -2050,8 +2051,9 @@ void CUIRenewQuestUI::OnCreate(int width, int height) { this->searchText = this->searchEdit->edit->Text(); this->UpdateQuestLists(0xF); }); - this->searchButton->disabled = 0; - this->searchButton->Invalidate(); + CUIImageButton* searchButton = this->searchButton; + searchButton->disabled = 0; + searchButton->Invalidate(); this->searchButton->SetImages( std::string(SearchNormalButtonName().Text()), std::string(SearchPressButtonName().Text()), std::string(SearchOverButtonName().Text()), std::string(SearchDisableButtonName().Text()) @@ -2085,13 +2087,12 @@ void CUIListBoxEx::AddNewItem() { if (this->geometry.height % this->rowHeight >= 2) { ++count; } - this->items.resize(count, nullptr); + this->items.resize(count); for (RenewQuestUI::CUIQuestItem*& slot : this->items) { RenewQuestUI::CUIQuestItem* item = new RenewQuestUI::CUIQuestItem(); item->SetSize(this->itemWidth, this->rowHeight); item->Show(0); - CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); - item->SetImageResources(images[0], images[1], images[2], images[3]); + item->SetImageResources(this->normalImage, this->hoverImage, this->pressedImage, this->disabledImage); item->onHover = [this](CUIListItem* listItem) { for (RenewQuestUI::CUIQuestItem* other : this->items) { other->SetHighlighted(other == listItem); @@ -2112,7 +2113,7 @@ void CUIListBoxEx::AddNewItem() { // OFFSET: 0x00A63CD0 // FUNCTION: fn_16442 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -2249,8 +2250,9 @@ void CUIRenewQuestUI::OnInit() { if (UIWindow* window = g_windowMgr.LookupWindow(WID_QUESTDISPLAY)) { visible = window->geometry.visible != 0; } - this->checkBox->checked = visible; - this->checkBox->Invalidate(); + CUICheckBox* checkBox = this->checkBox; + checkBox->checked = visible; + checkBox->Invalidate(); for (unsigned int index = 0; index < this->questLists.size(); ++index) { this->questLists[index]->type = 1 << index; diff --git a/Source/UI/Quest/UIRenewQuestUI.h b/Source/UI/Quest/UIRenewQuestUI.h index 0cc96846d..f6e4ee214 100644 --- a/Source/UI/Quest/UIRenewQuestUI.h +++ b/Source/UI/Quest/UIRenewQuestUI.h @@ -110,7 +110,7 @@ void CUIListBoxEx::AddNewItem(); template <> void CUIListBoxEx::Resize(int width, int height); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(RenewQuestUI::CUIQuestItem) == 0x110); diff --git a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp index 186704952..dca4a8a3e 100644 --- a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp +++ b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp @@ -30,9 +30,9 @@ void CUIListBoxEx::AddNewItem(); template <> void CUIListBoxEx::AddNewItem(); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); template <> @@ -308,7 +308,7 @@ void CUIListBoxEx -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); @@ -322,7 +322,7 @@ void CUIListBoxEx::LoadSkin(int re // OFFSET: 0x00A6D870 // FUNCTION: fn_16673 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); diff --git a/Source/UI/SkillDelayInfo/SkillDelayInfo.h b/Source/UI/SkillDelayInfo/SkillDelayInfo.h index c0131aefa..3da6fc7f5 100644 --- a/Source/UI/SkillDelayInfo/SkillDelayInfo.h +++ b/Source/UI/SkillDelayInfo/SkillDelayInfo.h @@ -24,7 +24,7 @@ public: class CUIDelayItem : public CUIListItem { public: - CUIDelayItem(); + __declspec(noinline) CUIDelayItem(); void OnCreate(int width, int height) override; void OnInit() override; void Paint() override; diff --git a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp index 9a37559a0..d5fbdd74d 100644 --- a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp +++ b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp @@ -30,7 +30,7 @@ void CUIListBoxEx: template <> void CUIListBoxEx::AddNewItem(); template <> -void CUIListBoxEx::LoadSkin(int resolveSkin); +void CUIListBoxEx::LoadSkin(bool resolveSkin); template <> void CUIListBoxEx::Resize(int width, int height); @@ -249,13 +249,12 @@ void CUIListBoxEx: if (this->geometry.height % this->rowHeight >= 2) { ++count; } - this->items.resize(count, nullptr); + this->items.resize(count); for (SkillDelayInfo::CUIDelayItem*& slot : this->items) { SkillDelayInfo::CUIDelayItem* item = new SkillDelayInfo::CUIDelayItem(); item->SetSize(this->itemWidth, this->rowHeight); item->Show(0); - CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); - item->SetImageResources(images[0], images[1], images[2], images[3]); + item->SetImageResources(this->normalImage, this->hoverImage, this->pressedImage, this->disabledImage); item->onHover = [this](CUIListItem* listItem) { for (SkillDelayInfo::CUIDelayItem* row : this->items) { row->SetHighlighted(listItem == row); @@ -300,14 +299,13 @@ void CUIListBoxEx: // OFFSET: 0x00A75F80 // FUNCTION: fn_16815 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { - CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); - images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); - images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); - images[2] = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); - images[3] = CResPtr(this->LoadBitmapResource(this->disabledName, resolveSkin)); +void CUIListBoxEx::LoadSkin(bool resolveSkin) { + this->normalImage = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); + this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); + this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); + this->disabledImage = CResPtr(this->LoadBitmapResource(this->disabledName, resolveSkin)); for (SkillDelayInfo::CUIDelayItem* item : this->items) { - item->SetImageResources(images[0], images[1], images[2], images[3]); + item->SetImageResources(this->normalImage, this->hoverImage, this->pressedImage, this->disabledImage); } } @@ -426,7 +424,7 @@ void SkillDelayInfoSelectCallback::operator()(CUIListItem* const& item) { // OFFSET: 0x00A77200 // FUNCTION: fn_16872 CUISkillDelayInfo::CUISkillDelayInfo() - : titleBar(nullptr), skillNameText(nullptr), labels{}, columns{}, delayList(nullptr), description(nullptr), backgroundColor(0), borderColor(0), skillId(7999) { + : titleBar(nullptr), skillNameText(nullptr), labels{nullptr, nullptr, nullptr}, columns{nullptr, nullptr, nullptr, nullptr}, delayList(nullptr), description(nullptr), backgroundColor(0), borderColor(0), skillId(7999) { } namespace SkillDelayInfo { diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index f76dc3957..a145868f6 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -354,7 +354,7 @@ void CUIControl::Invalidate() { // OFFSET: 0x009EF820 // FUNCTION: fn_14648 -void CUIControl::ApplySkin(int value) { +void CUIControl::ApplySkin(bool value) { this->LoadSkin(value); for (UIWindow* child : this->m_children) { @@ -364,7 +364,7 @@ void CUIControl::ApplySkin(int value) { // OFFSET: 0x009D3FC0 // FUNCTION: fn_14036 -void CUIControl::LoadSkin(int) { +void CUIControl::LoadSkin(bool) { } // OFFSET: 0x009C0220 @@ -623,7 +623,7 @@ void CUIVScrollBar::Paint() { // OFFSET: 0x009F2800 // FUNCTION: fn_14719 -void CUIVScrollBar::LoadSkin(int resolveSkin) { +void CUIVScrollBar::LoadSkin(bool resolveSkin) { this->background = CResPtr(this->LoadBitmapResource(this->backgroundName, resolveSkin)); } @@ -999,7 +999,7 @@ void CUIBasicButton::Paint() { // OFFSET: 0x009E20B0 // FUNCTION: fn_14406 -void CUIBasicButton::LoadSkin(int resolveSkin) { +void CUIBasicButton::LoadSkin(bool resolveSkin) { this->leftImages[0] = CResPtr(this->LoadBitmapResource("유저인터페이스\\basic_interface\\btn_out_left.bmp", resolveSkin)); this->leftImages[1] = CResPtr(this->LoadBitmapResource("유저인터페이스\\basic_interface\\btn_press_left.bmp", resolveSkin)); this->leftImages[2] = CResPtr(this->LoadBitmapResource("유저인터페이스\\basic_interface\\btn_over_left.bmp", resolveSkin)); @@ -1016,7 +1016,7 @@ void CUIBasicButton::LoadSkin(int resolveSkin) { // OFFSET: 0x009F26B0 // FUNCTION: fn_14718 -void CUIThumb::LoadSkin(int resolveSkin) { +void CUIThumb::LoadSkin(bool resolveSkin) { this->middle = CResPtr(this->LoadBitmapResource(this->middleName, resolveSkin)); if (this->resizable) { this->top = CResPtr(this->LoadBitmapResource(this->topName, resolveSkin)); @@ -1194,7 +1194,7 @@ void CUITabButton::OnLBtnUp(int, int) { // OFFSET: 0x009F1690 // FUNCTION: fn_14694 -void CUITabButton::LoadSkin(int resolveSkin) { +void CUITabButton::LoadSkin(bool resolveSkin) { this->normalColor = SkinPaletteColor(ResourceMgr::Instance(), this->normalCell, resolveSkin); this->selectedColor = SkinPaletteColor(ResourceMgr::Instance(), this->selectedCell, resolveSkin); this->borderColor = SkinPaletteColor(ResourceMgr::Instance(), this->borderCell, resolveSkin); @@ -1257,7 +1257,7 @@ void CUIStaticImage::OnMouseHover(int, int) { // OFFSET: 0x009F08A0 // FUNCTION: fn_14667 -void CUIStaticImage::LoadSkin(int resolveSkin) { +void CUIStaticImage::LoadSkin(bool resolveSkin) { this->image = CResPtr(this->LoadBitmapResource(this->imageName, resolveSkin)); } @@ -1342,7 +1342,7 @@ void CUITitleBar::Paint() { // OFFSET: 0x009F1AA0 // FUNCTION: fn_14699 -void CUITitleBar::LoadSkin(int resolveSkin) { +void CUITitleBar::LoadSkin(bool resolveSkin) { this->middle = CResPtr(this->LoadBitmapResource(this->middleName, resolveSkin)); if (this->resizable) { this->left = CResPtr(this->LoadBitmapResource(this->leftName, resolveSkin)); @@ -1469,7 +1469,7 @@ void CUIImageButton::Paint() { // OFFSET: 0x009EF900 // FUNCTION: fn_14650 -void CUIImageButton::LoadSkin(int resolveSkin) { +void CUIImageButton::LoadSkin(bool resolveSkin) { this->images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->images[2] = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -1555,7 +1555,7 @@ CUIImageTextButton::~CUIImageTextButton() = default; // OFFSET: 0x009E8150 // FUNCTION: fn_14490 -void CUIImageTextButton::LoadSkin(int resolveSkin) { +void CUIImageTextButton::LoadSkin(bool resolveSkin) { this->images[0] = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->images[1] = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->images[2] = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -1979,7 +1979,7 @@ void CUIListBoxEx::AddNewItem // OFFSET: 0x009D3360 // FUNCTION: fn_14030 template <> -void CUIListBox::LoadSkin(int resolveSkin) { +void CUIListBox::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -1992,7 +1992,7 @@ void CUIListBox::LoadSkin(int resolveSkin) { // OFFSET: 0x009D3570 // FUNCTION: fn_14031 template <> -void CUIListBox::LoadSkin(int resolveSkin) { +void CUIListBox::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -2005,7 +2005,7 @@ void CUIListBox::LoadSkin(int resolveSkin) { // OFFSET: 0x009D3780 // FUNCTION: fn_14032 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -2018,7 +2018,7 @@ void CUIListBoxEx::LoadS // OFFSET: 0x009D3990 // FUNCTION: fn_14033 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -2031,7 +2031,7 @@ void CUIListBoxEx: // OFFSET: 0x009D3BA0 // FUNCTION: fn_14034 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -2044,7 +2044,7 @@ void CUIListBoxEx::Loa // OFFSET: 0x009D3DB0 // FUNCTION: fn_14035 template <> -void CUIListBoxEx::LoadSkin(int resolveSkin) { +void CUIListBoxEx::LoadSkin(bool resolveSkin) { this->NormalImage() = CResPtr(this->LoadBitmapResource(this->imageNames[0], resolveSkin)); this->hoverImage = CResPtr(this->LoadBitmapResource(this->imageNames[1], resolveSkin)); this->pressedImage = CResPtr(this->LoadBitmapResource(this->imageNames[2], resolveSkin)); @@ -2587,7 +2587,7 @@ void CUIResizer::ResetCursor(int, int) { // OFFSET: 0x009E96C0 // FUNCTION: fn_14508 -void CUIResizer::LoadSkin(int resolveSkin) { +void CUIResizer::LoadSkin(bool resolveSkin) { this->image = CResPtr(this->LoadBitmapResource(this->imageName, resolveSkin)); if (this->image) { this->Resize(this->image->image.width, this->image->image.height); diff --git a/Source/UI/Window/UIControl.h b/Source/UI/Window/UIControl.h index 531822469..e5714aba7 100644 --- a/Source/UI/Window/UIControl.h +++ b/Source/UI/Window/UIControl.h @@ -10,6 +10,7 @@ #include #include #include +#include template class CResPtr { public: @@ -28,17 +29,28 @@ public: } } - CResPtr& operator=(CResPtr&& other) { - T* res = other.m_res; + // INLINED + CResPtr(CResPtr&& other) : m_res(other.m_res) { other.m_res = nullptr; - T* old = this->m_res; - this->m_res = res; - if (old) { - old->Unlock(); - } + } + + // INLINED + CResPtr& operator=(CResPtr&& other) { + CResPtr(std::move(other)).Swap(*this); return *this; } + // INLINED + CResPtr& operator=(T* res) { + CResPtr(res).Swap(*this); + return *this; + } + + // INLINED + void Swap(CResPtr& other) { + std::swap(this->m_res, other.m_res); + } + operator T*() const { return this->m_res; } @@ -75,8 +87,8 @@ public: void OnRBtnDblClk(int x, int y) override; void OnWheel(int value) override; void Invalidate() override; - void ApplySkin(int value) override; - virtual void LoadSkin(int value); + void ApplySkin(bool value) override; + virtual void LoadSkin(bool value); bool IsPointInside(int x, int y); UIWindow* FindChildById(int id); @@ -178,7 +190,7 @@ public: CUIImageTextButton(); ~CUIImageTextButton() override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SetImages(const std::string& normal, const std::string& hover, const std::string& pressed, const std::string& inactive); @@ -195,7 +207,7 @@ public: ~CUIBasicButton() override; void Resize(int width, int height) override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void DrawLabel() override; void Create(int width, int height); @@ -219,7 +231,7 @@ public: void OnMouseEnter() override; void OnMouseLeave() override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void ResizeToText(int padding) override; __declspec(noinline) void SetSelected(bool selected); @@ -241,7 +253,7 @@ public: CUIImageButton(); ~CUIImageButton() override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SetImages(const std::string& normal, const std::string& hover, const std::string& pressed, const std::string& inactive); @@ -261,7 +273,7 @@ public: void Paint() override; void OnMouseHover(int x, int y) override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SetImage(const std::string& name); @@ -282,7 +294,7 @@ public: void Resize(int width, int height) override; void Paint() override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SetImages(const std::string& left, const std::string& middle, const std::string& right); void SetSecondButton(CUIButton* button); @@ -351,7 +363,7 @@ public: void OnMouseMove(int x, int y) override; void ResetCursor(int x, int y) override; void OnLBtnUp(int x, int y) override; - void LoadSkin(int resolveSkin) override; + void LoadSkin(bool resolveSkin) override; void SetImage(const std::string& name); diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 5f5521003..09853975f 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -624,7 +624,7 @@ void UIWindow::VisitChildren() { // OFFSET: 0x005C7AC0 // FUNCTION: fn_03621 -void UIWindow::ApplySkin(int) { +void UIWindow::ApplySkin(bool) { } // OFFSET: 0x00A7A080 diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index a9e7f0dc9..7c0de5c7a 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -92,7 +92,7 @@ public: virtual RenderPrimitive* DrawPrimitive(); virtual UIWindow* HitTest(int x, int y); virtual void VisitChildren(); - virtual void ApplySkin(int argument); + virtual void ApplySkin(bool argument); void AddChild(UIWindow* child); void AddChildFront(UIWindow* child);