Decompile 4 functions in Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp, Source/UI/SkillDelayInfo/SkillDelayInfo.h
Batch #8565 by eAthena: 0 byte-identical, 4 confirmed by peer review. - fn_16814 CUIListBoxEx<SkillDelayInfo::CUIDelayItem,SkillDelayInfo::CDelayItemData>::AddNewItem: logic confirmed by peer review - fn_16815 CUIListBoxEx<SkillDelayInfo::CUIDelayItem,SkillDelayInfo::CDelayItemData>::Slot53: logic confirmed by peer review - fn_16816 CUIListBoxEx<SkillDelayInfo::CUIDelayItem,SkillDelayInfo::CDelayItemData>::Resize: logic confirmed by peer review - fn_16871 SkillDelayInfo::CUIDelayItem::CUIDelayItem: logic confirmed by peer review Peer-reviewed-by: gordaoprogramas, KWDev, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
5f30c9682c
commit
71a4c3db20
2 changed files with 108 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ public:
|
|||
|
||||
class CUIDelayItem : public CUIListItem {
|
||||
public:
|
||||
CUIDelayItem();
|
||||
void Slot15(int width, int height) override;
|
||||
void Slot16() override;
|
||||
void Paint() override;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@ template <>
|
|||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::Slot35(int value);
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::OnScroll(int position);
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::AddNewItem();
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::Slot53(int resolveSkin);
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::Resize(int width, int height);
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -198,6 +204,100 @@ void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>:
|
|||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A75D20
|
||||
// FUNCTION: fn_16814
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::AddNewItem() {
|
||||
if (this->itemWidth <= 0 || this->rowHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (SkillDelayInfo::CUIDelayItem* item : this->items) {
|
||||
this->RemoveChild(item, 1);
|
||||
}
|
||||
this->items.clear();
|
||||
this->selected = static_cast<unsigned int>(-1);
|
||||
|
||||
if (this->rowHeight <= this->geometry.height) {
|
||||
unsigned int count = static_cast<unsigned int>(this->geometry.height / this->rowHeight) + 1;
|
||||
if (this->geometry.height % this->rowHeight > 1) {
|
||||
++count;
|
||||
}
|
||||
this->items.resize(count, nullptr);
|
||||
for (SkillDelayInfo::CUIDelayItem*& slot : this->items) {
|
||||
SkillDelayInfo::CUIDelayItem* item = new SkillDelayInfo::CUIDelayItem();
|
||||
item->SetSize(this->itemWidth, this->rowHeight);
|
||||
item->Show(0);
|
||||
CResPtr<CBitmapRes>* images = reinterpret_cast<CResPtr<CBitmapRes>*>(reinterpret_cast<std::uint8_t*>(this) + 0x80);
|
||||
item->SetImageResources(images[0], images[1], images[2], images[3]);
|
||||
item->onHover = [this](CUIListItem* listItem) {
|
||||
for (SkillDelayInfo::CUIDelayItem* row : this->items) {
|
||||
row->SetHighlighted(listItem == row);
|
||||
}
|
||||
};
|
||||
item->onPress = [this](CUIListItem* listItem) {
|
||||
if (this->unknown_00C4) {
|
||||
return;
|
||||
}
|
||||
for (SkillDelayInfo::CUIDelayItem* row : this->items) {
|
||||
if (listItem != row) {
|
||||
row->SetSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
listItem->SetSelected(true);
|
||||
if (listItem->index == static_cast<int>(this->selected) && this->unknown_00E0) {
|
||||
return;
|
||||
}
|
||||
SkillDelayInfo::CUIDelayItem* delayItem = dynamic_cast<SkillDelayInfo::CUIDelayItem*>(listItem);
|
||||
if (!delayItem) {
|
||||
return;
|
||||
}
|
||||
this->selected = delayItem->index;
|
||||
if (this->onSelect && delayItem->index >= 0 && static_cast<unsigned int>(delayItem->index) < this->data.size()) {
|
||||
auto node = this->data.begin();
|
||||
for (int index = delayItem->index; index > 0; --index) {
|
||||
++node;
|
||||
}
|
||||
this->onSelect(delayItem, *node);
|
||||
}
|
||||
};
|
||||
this->AddChild(item);
|
||||
slot = item;
|
||||
}
|
||||
}
|
||||
|
||||
this->scrollBar->SetTotal(this->geometry.height);
|
||||
this->scrollBar->SetVisible(this->geometry.height);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A75F80
|
||||
// FUNCTION: fn_16815
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::Slot53(int resolveSkin) {
|
||||
CResPtr<CBitmapRes>* images = reinterpret_cast<CResPtr<CBitmapRes>*>(reinterpret_cast<std::uint8_t*>(this) + 0x80);
|
||||
images[0] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[0], resolveSkin));
|
||||
images[1] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[1], resolveSkin));
|
||||
images[2] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[2], resolveSkin));
|
||||
images[3] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->disabledName, resolveSkin));
|
||||
for (SkillDelayInfo::CUIDelayItem* item : this->items) {
|
||||
item->SetImageResources(images[0], images[1], images[2], images[3]);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A76190
|
||||
// FUNCTION: fn_16816
|
||||
template <>
|
||||
void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>::Resize(int width, int height) {
|
||||
UIWindow::Resize(width, height);
|
||||
this->AddNewItem();
|
||||
this->scrollBar->Resize(this->scrollBar->geometry.width, height);
|
||||
this->scrollBar->SetTotal(this->rowHeight * static_cast<int>(this->data.size()) + this->itemY);
|
||||
this->scrollBar->SetVisible(this->geometry.height);
|
||||
this->scrollBar->SetPosition(this->scrollBar->position);
|
||||
this->rebind = 1;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A76210
|
||||
// FUNCTION: fn_16817
|
||||
template <>
|
||||
|
|
@ -302,6 +402,13 @@ CUISkillDelayInfo::CUISkillDelayInfo()
|
|||
: titleBar(nullptr), unknown_00DC(nullptr), labels{}, columns{}, delayList(nullptr), description(nullptr), backgroundColor(0), borderColor(0), skillId(7999) {
|
||||
}
|
||||
|
||||
namespace SkillDelayInfo {
|
||||
// OFFSET: 0x00A77160
|
||||
// FUNCTION: fn_16871
|
||||
CUIDelayItem::CUIDelayItem() : CUIListItem(), level(nullptr), times(), backgroundColor(0), borderColor(0) {
|
||||
}
|
||||
}
|
||||
|
||||
namespace SkillDelayInfo {
|
||||
// OFFSET: 0x00A77350
|
||||
// FUNCTION: fn_16873
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue