Restore translation-unit ownership and publish verified source corrections

Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
This commit is contained in:
ragnarok-clanker 2026-10-25 15:42:21 +00:00
commit e168b4e4a6
326 changed files with 9538 additions and 3481 deletions

View file

@ -14,14 +14,15 @@ namespace {
}
// OFFSET: 0x008C73C0
// FUNCTION: fn_11930
UIChooseSellBuyWnd::UIChooseSellBuyWnd(UIWindowContext& windows, UIFrameContext& frames, UIAcceptanceContext& acceptance)
: UIFrameWnd(windows, frames, 0), identity(0), m_acceptance(&acceptance) {
}
// OFFSET: 0x008CC430
// FUNCTION: fn_12010
UIChooseSellBuyWnd::~UIChooseSellBuyWnd() = default;
// INLINED
void UIChooseSellBuyWnd::AddChoice(const char* name, int id, int x, int y) {
auto* button = new UIBitmapButton(*this->m_context, this->m_acceptance->text.buttons);
const char* suffixes[] = {"", "_a", "_b"};
@ -37,6 +38,7 @@ void UIChooseSellBuyWnd::AddChoice(const char* name, int id, int x, int y) {
this->AddChild(button);
}
// INLINED
void UIChooseSellBuyWnd::CreateViewer(int width, int height) {
auto& text = this->m_acceptance->text;
this->viewer = new UITextViewer(*this->m_context, text);

View file

@ -10,12 +10,13 @@
#include <cstring>
// OFFSET: 0x008C7AA0
// FUNCTION: fn_11941
UIExchangeAcceptWnd::UIExchangeAcceptWnd(UIWindowContext& windows, UIFrameContext& frames, UIAcceptanceContext& acceptance)
: UIChooseSellBuyWnd(windows, frames, acceptance), saved(nullptr) {
}
// OFFSET: 0x008CC9C0
// FUNCTION: fn_12021
// FUNCTION: fn_11996
UIExchangeAcceptWnd::~UIExchangeAcceptWnd() = default;
// OFFSET: 0x008E0380

View file

@ -8,12 +8,12 @@
#include <cstring>
// OFFSET: 0x008C8240
// FUNCTION: fn_11950
UIJoinPartyAcceptWnd::UIJoinPartyAcceptWnd(UIWindowContext& windows, UIFrameContext& frames, UIAcceptanceContext& acceptance)
: UIExchangeAcceptWnd(windows, frames, acceptance) {
}
// OFFSET: 0x008CCEE0
// FUNCTION: fn_12031
UIJoinPartyAcceptWnd::~UIJoinPartyAcceptWnd() = default;
// OFFSET: 0x008FE780

View file

@ -6,12 +6,12 @@
#include <cstring>
// OFFSET: 0x0084EA20
// FUNCTION: fn_10649
UIBasicButton::UIBasicButton(UIWindowContext& windows, UIButtonContext& controls) : UIButton(windows, controls), invalidateParent(0) {
this->geometry.height = 20;
}
// OFFSET: 0x00852170
// FUNCTION: fn_10704
UIBasicButton::~UIBasicButton() = default;
// OFFSET: 0x00854240

View file

@ -3,14 +3,14 @@
#include "UI/Buttons/UIBitmapButton.h"
// OFFSET: 0x0084EAB0
// FUNCTION: fn_10650
UIBitmapButton::UIBitmapButton(UIWindowContext& windowContext, UIButtonContext& buttonContext)
: UIButton(windowContext, buttonContext), m_bitmapWidth(0), m_bitmapHeight(0), m_invalidateParent(0) {
}
// OFFSET: 0x008511B0
// FUNCTION: fn_10689
// OFFSET: 0x00852220
// FUNCTION: fn_10705
// FUNCTION: fn_10689
UIBitmapButton::~UIBitmapButton() = default;
// OFFSET: 0x008657A0

View file

@ -11,9 +11,11 @@ public:
~UIBitmapButton() override;
void Paint() override;
bool SetBitmap(const char* name, int state, unsigned char exactSize);
// INLINED
int BitmapWidth() const {
return this->m_bitmapWidth;
}
// INLINED
int BitmapHeight() const {
return this->m_bitmapHeight;
}

View file

@ -7,11 +7,11 @@
#include <cstring>
// OFFSET: 0x0084ED30
// FUNCTION: fn_10652
UIBmpTextButton::UIBmpTextButton(UIWindowContext& windows, UIButtonContext& controls) : UIBitmapButton(windows, controls) {
}
// OFFSET: 0x00852360
// FUNCTION: fn_10708
UIBmpTextButton::~UIBmpTextButton() = default;
// OFFSET: 0x007C2340

View file

@ -10,13 +10,14 @@
#include <cstring>
// OFFSET: 0x0084EDD0
// FUNCTION: fn_10653
UIButton::UIButton(UIWindowContext& windowContext, UIButtonContext& buttonContext)
: UIWindow(windowContext, 0), m_disabled(0), m_argument(0), m_buttonContext(&buttonContext) {
this->geometry.unknown_0030 = 0;
}
// OFFSET: 0x008523F0
// FUNCTION: fn_10709
// FUNCTION: fn_10690
UIButton::~UIButton() = default;
// OFFSET: 0x0085C450
@ -140,8 +141,8 @@ void UIButton::ResetCursor(int, int) {
}
// OFFSET: 0x0085EED0
// OFFSET: 0x03DE9C61
// FUNCTION: fn_10852
// ORIGINAL_SITE: 0x03DE9C61 in fn_10852 (body)
void UIButton::Slot31(int x, int y) {
FrameFocus& focus = this->m_buttonContext->focus;
if (this->m_disabled != 0) {

View file

@ -53,6 +53,7 @@ public:
void SetTooltip(const char* text);
// INLINED
void SetDisabled(unsigned char value) {
this->m_disabled = value;
}

View file

@ -6,6 +6,7 @@
#include "UI/Buttons/UICheckBox.h"
// OFFSET: 0x0084F010
// FUNCTION: fn_10656
UICheckBox::UICheckBox(UIWindowContext& windowContext, UIButtonContext& controls)
: UIWindow(windowContext, 0), m_disabled(0), m_hidden(0), m_color(0), m_fontHeight(12), m_message(-1), m_notify(0), m_controls(&controls) {
this->geometry.unknown_0030 = 0;
@ -13,7 +14,7 @@ UICheckBox::UICheckBox(UIWindowContext& windowContext, UIButtonContext& controls
}
// OFFSET: 0x008525B0
// FUNCTION: fn_10712
// FUNCTION: fn_10691
UICheckBox::~UICheckBox() = default;
// OFFSET: 0x0085C8C0
@ -48,6 +49,7 @@ void UICheckBox::Paint() {
}
}
// INLINED
void UICheckBox::Notify() {
this->Invalidate();
UIWindow* root = this;

View file

@ -1,11 +1,11 @@
#include "UI/Buttons/UIJobSlotButton.h"
// OFFSET: 0x007BAD70
// FUNCTION: fn_09276
UIJobSlotButton::UIJobSlotButton(UIWindowContext& windows, UIButtonContext& controls) : UIBitmapButton(windows, controls), selected(0) {
}
// OFFSET: 0x007BB6B0
// FUNCTION: fn_09284
UIJobSlotButton::~UIJobSlotButton() = default;
// OFFSET: 0x007BFC70

View file

@ -2,12 +2,12 @@
#include "UI/Buttons/UINaviLinkButton.h"
// OFFSET: 0x0086DF60
// FUNCTION: fn_11062
UINaviLinkButton::UINaviLinkButton(UIWindowContext& windows, UIButtonContext& buttons, NavigationDestination& navigation)
: UITextButton(windows, buttons), m_navigation(&navigation) {
}
// OFFSET: 0x00873A90
// FUNCTION: fn_11163
UINaviLinkButton::~UINaviLinkButton() = default;
// OFFSET: 0x00893050

View file

@ -6,11 +6,12 @@
#include <cstring>
// OFFSET: 0x0086EEB0
// FUNCTION: fn_11085
UITextButton::UITextButton(UIWindowContext& windows, UIButtonContext& buttons) : UIButton(windows, buttons), m_outlineColor(0xFFFFFF), m_value(0) {
}
// OFFSET: 0x00874690
// FUNCTION: fn_11187
// FUNCTION: fn_11110
UITextButton::~UITextButton() = default;
// OFFSET: 0x0087C590

View file

@ -1,45 +0,0 @@
#include "UI/Chat/ChatNotifications.h"
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Text/TextWrapping.h"
#include "UI/Window/UIWindow.h"
#include <cstring>
#include <vector>
// OFFSET: 0x00AA9100
// FUNCTION: fn_17253
void ChatNotifications::Text(const char* text, std::uint32_t color, const char* extra, int value, bool alternate) {
if (this->restricted != 0 && !this->allowsRestricted) {
return;
}
if (color == 0) {
color = 0xFFFFFF;
}
if (this->chat) {
if (std::strcmp(text, "No Msg") != 0 && std::strcmp(text, "NO MSG") != 0) {
this->chat->SendMsg(nullptr, alternate ? 115 : 37, reinterpret_cast<std::intptr_t>(text), color, reinterpret_cast<std::intptr_t>(extra), value);
}
return;
}
std::vector<std::string> lines;
WrapPlainText(text, lines, 94, this->codePage, this->inlineCharset);
for (const auto& line : lines) {
this->queued.push_back({line, color});
}
}
// OFFSET: 0x00AA9100
// FUNCTION: fn_17253
void ChatNotifications::Refresh() {
this->shortcuts.Show(1);
if (this->chat) {
this->chat->SendMsg(nullptr, 16, 0, 0, 0, 0);
}
}

View file

@ -1,6 +1,12 @@
#ifndef RAGNAROK_SOURCE_UI_CHAT_CHATNOTIFICATIONS_H
#define RAGNAROK_SOURCE_UI_CHAT_CHATNOTIFICATIONS_H
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Text/TextWrapping.h"
#include "UI/Window/UIWindow.h"
#include <cstring>
#include <vector>
#include <cstdint>
#include <list>
#include <string>
@ -26,4 +32,38 @@ struct ChatNotifications {
void Refresh();
};
// INLINED
inline void ChatNotifications::Text(const char* text, std::uint32_t color, const char* extra, int value, bool alternate) {
if (this->restricted != 0 && !this->allowsRestricted) {
return;
}
if (color == 0) {
color = 0xFFFFFF;
}
if (this->chat) {
if (std::strcmp(text, "No Msg") != 0 && std::strcmp(text, "NO MSG") != 0) {
this->chat->SendMsg(nullptr, alternate ? 115 : 37, reinterpret_cast<std::intptr_t>(text), color, reinterpret_cast<std::intptr_t>(extra), value);
}
return;
}
std::vector<std::string> lines;
WrapPlainText(text, lines, 94, this->codePage, this->inlineCharset);
for (const auto& line : lines) {
this->queued.push_back({line, color});
}
}
// INLINED
inline void ChatNotifications::Refresh() {
this->shortcuts.Show(1);
if (this->chat) {
this->chat->SendMsg(nullptr, 16, 0, 0, 0, 0);
}
}
#endif

View file

@ -181,9 +181,7 @@ void ChatInputFocus::Toggle() {
}
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
// INLINED
void ChatInputFocus::DismissOutside(ChatSuggestions& suggestions, UIWindow* companion, int button, int x, int y) {
if (button != 1 || !suggestions.Visible()) {
return;

View file

@ -4,6 +4,7 @@
#include "UI/Cooldowns/CooldownDrawing.h"
namespace {
// INLINED
void Submit(std::vector<RenderCommand*>& commands, RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd) {
for (RenderCommand* command : commands) {
queues.Submit(command, 513, depthAlpha, depthStart, depthEnd);

View file

@ -1,7 +1,6 @@
#include "UI/Cooldowns/CooldownOwner.h"
// OFFSET: 0x00CA64C0
// FUNCTION: fn_20960
// INLINED
CooldownOwner::CooldownOwner() : m_initialized(false) {
this->m_drawing.normal.clear();
this->m_drawing.reverse.clear();
@ -9,8 +8,7 @@ CooldownOwner::CooldownOwner() : m_initialized(false) {
this->m_initialized = true;
}
// OFFSET: 0x00CA60D0
// FUNCTION: fn_20956
// INLINED
CooldownOwner::~CooldownOwner() {
this->m_drawing.normal.clear();
this->m_drawing.reverse.clear();

View file

@ -5,6 +5,7 @@
#include <windows.h>
#include <timeapi.h>
// INLINED
std::uint32_t CooldownClock::Now() const {
return this->restricted ? this->serverTick : timeGetTime();
}

View file

@ -1,128 +0,0 @@
#include "Client/Input/InputCharset.h"
#include "Client/Input/TextInputBuffer.h"
#include "Render/DeviceContext/DeviceContext.h"
#include "Render/Text/TextContext.h"
#include "Resource/Bitmap/BitmapImage.h"
#include "UI/Edit/EditPainting.h"
#include "UI/Edit/EditViewport.h"
#include "UI/Window/UIWindow.h"
#include <algorithm>
#include <cstring>
// OFFSET: 0x00856980
// FUNCTION: fn_10755
void EditPainting::Draw() {
TextContext context(this->surface, this->fonts, this->locale);
context.SetFont(0, 12, 0, 0);
const auto measure = [&](const char* text, int bytes) { return context.Measure(text, bytes ? bytes : static_cast<int>(std::strlen(text))).cx; };
int x = 3;
if (this->invalidatesParent == 0 && this->firstVisible != 0) {
x = (3 - measure(this->text.c_str(), this->firstVisible));
}
const auto draw = [&](const std::string& value) {
const bool placeholder = this->alternate && !this->focused && this->placeholderEnabled && this->secondColor == 0xFFFFFFFFu;
context.SetColor(placeholder ? this->placeholderColor : this->color);
const std::string& displayed = placeholder && value.empty() ? *this->placeholder : value;
context.Draw(x, this->y, displayed.c_str(), static_cast<int>(displayed.size()));
if (this->secondColor != 0xFFFFFFFFu) {
context.SetColor(this->secondColor);
context.Draw((x - 1), this->y, value.c_str(), static_cast<int>(value.size()));
}
};
const auto highlight = [&](int left, int extent) {
const int start = std::max(left, 3);
const int adjusted = left < 3 ? (extent + (left - 3)) : extent;
if (start < this->width && adjusted > 0) {
std::uint32_t pixel = 0x00FF0000u;
if (this->colorChip.width > 6 && this->colorChip.height > 2) {
pixel = this->colorChip.pixels[2 * this->colorChip.width + 6];
}
const std::uint32_t color = ((pixel >> 16) & 255) | (pixel & 0xFF00) | ((pixel & 255) << 16);
RECT rectangle{start, 0, std::min((start + adjusted), this->width), this->height};
this->surface.Fill(&rectangle, color);
}
};
const auto moveCandidate = [&](UIWindow* window, int offset) {
if (!window) {
return;
}
int left = (offset + this->absoluteX);
int top = ((this->height + 6) + this->absoluteY);
if ((window->geometry.width + left) > this->screenWidth) {
left = (this->screenWidth - window->geometry.width);
}
if ((window->geometry.height + top) > this->screenHeight) {
top = (((top - 12) - this->height) - window->geometry.height);
}
window->Move(left, top);
};
std::string display;
if (this->focused) {
this->viewport.Synchronize();
unsigned begin = static_cast<unsigned>(std::min(this->anchor, this->cursor));
unsigned end = static_cast<unsigned>(std::max(this->anchor, this->cursor));
if (this->mask != 0) {
display.assign(this->text.size(), static_cast<char>(this->mask));
} else {
const char* prefix = this->alternate ? this->input.candidate.c_str() : this->charset.Prefix(false);
display = prefix;
display += this->text;
const auto prefixBytes = static_cast<unsigned>(std::strlen(prefix));
begin += prefixBytes;
end += prefixBytes + static_cast<unsigned>(this->candidateCursor);
}
const int left = begin == 0 ? 0 : measure(display.c_str(), static_cast<int>(begin));
const int right = end == 0 ? 0 : measure(display.c_str(), static_cast<int>(end));
if (this->input.cursor != this->input.anchor) {
highlight((x + left), (right - left));
draw(display);
} else if (this->candidateCursor != 0) {
moveCandidate(this->candidateWindow, left);
moveCandidate(this->readingWindow, right);
if (((this->tick / 500u) & 1u) == 0) {
highlight((x + left), std::max((right - left), 2));
}
draw(display);
} else {
draw(display);
if (((this->tick / 500u) & 1u) == 0 && (this->alternate ? this->caretEnabled : (!this->chatInputFocused || this->caretEnabled))) {
context.SetColor(this->color);
context.Draw(((x + left) - 2), this->y, "|", 1);
}
}
} else {
if (this->mask != 0) {
display.assign(this->text.size(), static_cast<char>(this->mask));
} else {
display = this->text;
}
draw(display);
if (this->invalidatesParent != 0 && this->parent) {
this->parent->Invalidate();
}
}
if (std::any_of(this->linkWindows.begin(), this->linkWindows.end(), [](const UIWindow* window) { return window->geometry.id == 438; })) {
this->links.Update();
}
}

View file

@ -1,67 +0,0 @@
#ifndef RAGNAROK_SOURCE_UI_EDIT_EDITPAINTING_H
#define RAGNAROK_SOURCE_UI_EDIT_EDITPAINTING_H
#include <cstdint>
#include <list>
#include <string>
class UIWindow;
class CDC;
class FontCache;
struct TextLocale;
struct TextInputBuffer;
struct InputCharset;
struct EditViewport;
struct BitmapImage;
class EditLinkLayout {
public:
virtual void Update() = 0;
protected:
~EditLinkLayout() = default;
};
struct EditPainting {
std::string& text;
const int& anchor;
const int& cursor;
const int& mask;
const int& firstVisible;
const int& y;
const int& invalidatesParent;
const std::uint32_t& color;
const std::uint32_t& secondColor;
const bool& focused;
const bool& chatInputFocused;
const bool& caretEnabled;
const std::uint32_t& tick;
const int& candidateCursor;
const int& width;
const int& height;
const int& screenWidth;
const int& screenHeight;
TextInputBuffer& input;
const InputCharset& charset;
EditViewport& viewport;
CDC& surface;
FontCache& fonts;
const TextLocale& locale;
const BitmapImage& colorChip;
UIWindow* const& parent;
UIWindow* const& candidateWindow;
UIWindow* const& readingWindow;
const int& absoluteX;
const int& absoluteY;
const std::list<UIWindow*>& linkWindows;
EditLinkLayout& links;
bool alternate = false;
const std::string* placeholder = nullptr;
std::uint32_t placeholderColor = 0;
bool placeholderEnabled = false;
void Draw();
};
#endif

View file

@ -3,8 +3,7 @@
#include <cstring>
// OFFSET: 0x008680D0
// FUNCTION: fn_10952
// INLINED
void EditTextState::SetText(const char* value) {
this->text.assign(value, std::strlen(value));
this->Trim();
@ -55,7 +54,6 @@ void EditTextState::SelectAll() {
}
// OFFSET: 0x00858D50
// FUNCTION: fn_10768
int EditTextState::Length() const {
return static_cast<int>(this->focused ? this->input.text.size() : this->text.size());
}

View file

@ -1,20 +1,190 @@
#include "Client/Input/InputCharset.h"
#include "Client/Input/TextInputBuffer.h"
#include "Network/TextEncoding.h"
#include "Render/DeviceContext/DeviceContext.h"
#include "UI/Edit/EditPainting.h"
#include "Render/Text/TextContext.h"
#include "Resource/Bitmap/BitmapImage.h"
#include "UI/Edit/EditTextState.h"
#include "UI/Edit/EditViewport.h"
#include "UI/Window/InputFocus.h"
#include "UI/Buttons/UIButton.h"
#include "UI/Edit/UIEditCtrl.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/UIWindow.h"
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <list>
#include <string>
#include <windows.h>
#include <timeapi.h>
namespace {
class EditLinkLayout {
public:
virtual void Update() = 0;
protected:
~EditLinkLayout() = default;
};
struct EditPainting {
std::string& text;
const int& anchor;
const int& cursor;
const int& mask;
const int& firstVisible;
const int& y;
const int& invalidatesParent;
const std::uint32_t& color;
const std::uint32_t& secondColor;
const bool& focused;
const bool& chatInputFocused;
const bool& caretEnabled;
const std::uint32_t& tick;
const int& candidateCursor;
const int& width;
const int& height;
const int& screenWidth;
const int& screenHeight;
TextInputBuffer& input;
const InputCharset& charset;
EditViewport& viewport;
CDC& surface;
FontCache& fonts;
const TextLocale& locale;
const BitmapImage& colorChip;
UIWindow* const& parent;
UIWindow* const& candidateWindow;
UIWindow* const& readingWindow;
const int& absoluteX;
const int& absoluteY;
const std::list<UIWindow*>& linkWindows;
EditLinkLayout& links;
bool alternate = false;
const std::string* placeholder = nullptr;
std::uint32_t placeholderColor = 0;
bool placeholderEnabled = false;
void Draw();
};
// INLINED
void EditPainting::Draw() {
TextContext context(this->surface, this->fonts, this->locale);
context.SetFont(0, 12, 0, 0);
const auto measure = [&](const char* text, int bytes) { return context.Measure(text, bytes ? bytes : static_cast<int>(std::strlen(text))).cx; };
int x = 3;
if (this->invalidatesParent == 0 && this->firstVisible != 0) {
x = (3 - measure(this->text.c_str(), this->firstVisible));
}
const auto draw = [&](const std::string& value) {
const bool placeholder = this->alternate && !this->focused && this->placeholderEnabled && this->secondColor == 0xFFFFFFFFu;
context.SetColor(placeholder ? this->placeholderColor : this->color);
const std::string& displayed = placeholder && value.empty() ? *this->placeholder : value;
context.Draw(x, this->y, displayed.c_str(), static_cast<int>(displayed.size()));
if (this->secondColor != 0xFFFFFFFFu) {
context.SetColor(this->secondColor);
context.Draw((x - 1), this->y, value.c_str(), static_cast<int>(value.size()));
}
};
const auto highlight = [&](int left, int extent) {
const int start = std::max(left, 3);
const int adjusted = left < 3 ? (extent + (left - 3)) : extent;
if (start < this->width && adjusted > 0) {
std::uint32_t pixel = 0x00FF0000u;
if (this->colorChip.width > 6 && this->colorChip.height > 2) {
pixel = this->colorChip.pixels[2 * this->colorChip.width + 6];
}
const std::uint32_t color = ((pixel >> 16) & 255) | (pixel & 0xFF00) | ((pixel & 255) << 16);
RECT rectangle{start, 0, std::min((start + adjusted), this->width), this->height};
this->surface.Fill(&rectangle, color);
}
};
const auto moveCandidate = [&](UIWindow* window, int offset) {
if (!window) {
return;
}
int left = (offset + this->absoluteX);
int top = ((this->height + 6) + this->absoluteY);
if ((window->geometry.width + left) > this->screenWidth) {
left = (this->screenWidth - window->geometry.width);
}
if ((window->geometry.height + top) > this->screenHeight) {
top = (((top - 12) - this->height) - window->geometry.height);
}
window->Move(left, top);
};
std::string display;
if (this->focused) {
this->viewport.Synchronize();
unsigned begin = static_cast<unsigned>(std::min(this->anchor, this->cursor));
unsigned end = static_cast<unsigned>(std::max(this->anchor, this->cursor));
if (this->mask != 0) {
display.assign(this->text.size(), static_cast<char>(this->mask));
} else {
const char* prefix = this->alternate ? this->input.candidate.c_str() : this->charset.Prefix(false);
display = prefix;
display += this->text;
const auto prefixBytes = static_cast<unsigned>(std::strlen(prefix));
begin += prefixBytes;
end += prefixBytes + static_cast<unsigned>(this->candidateCursor);
}
const int left = begin == 0 ? 0 : measure(display.c_str(), static_cast<int>(begin));
const int right = end == 0 ? 0 : measure(display.c_str(), static_cast<int>(end));
if (this->input.cursor != this->input.anchor) {
highlight((x + left), (right - left));
draw(display);
} else if (this->candidateCursor != 0) {
moveCandidate(this->candidateWindow, left);
moveCandidate(this->readingWindow, right);
if (((this->tick / 500u) & 1u) == 0) {
highlight((x + left), std::max((right - left), 2));
}
draw(display);
} else {
draw(display);
if (((this->tick / 500u) & 1u) == 0 && (this->alternate ? this->caretEnabled : (!this->chatInputFocused || this->caretEnabled))) {
context.SetColor(this->color);
context.Draw(((x + left) - 2), this->y, "|", 1);
}
}
} else {
if (this->mask != 0) {
display.assign(this->text.size(), static_cast<char>(this->mask));
} else {
display = this->text;
}
draw(display);
if (this->invalidatesParent != 0 && this->parent) {
this->parent->Invalidate();
}
}
if (std::any_of(this->linkWindows.begin(), this->linkWindows.end(), [](const UIWindow* window) { return window->geometry.id == 438; })) {
this->links.Update();
}
}
class LinkLayout : public EditLinkLayout {
public:
explicit LinkLayout(UIEditCtrl& control) : m_control(control) {
@ -40,7 +210,7 @@ UIEditCtrl::UIEditCtrl(UIWindowContext& windows, UIEditContext& edit)
// OFFSET: 0x008517E0
// OFFSET: 0x00852980
// FUNCTION: fn_10718
// FUNCTION: fn_10694
UIEditCtrl::~UIEditCtrl() = default;
// OFFSET: 0x005C3210
@ -142,6 +312,7 @@ int UIEditCtrl::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int
}
// OFFSET: 0x005C44E0
// FUNCTION: fn_03561
int UIEditCtrl::Slot46() {
return 2;
}
@ -166,7 +337,6 @@ void UIEditCtrl::SetText(const char* value) {
}
// OFFSET: 0x0085A590
// FUNCTION: fn_10778
void UIEditCtrl::SelectAll() {
const bool focused = this->m_edit->focus.window == this;
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
@ -179,6 +349,7 @@ void UIEditCtrl::PaintText() {
this->PaintTextWithPolicy(false, nullptr, 0, false);
}
// INLINED
void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placeholder, std::uint32_t placeholderColor, bool placeholderEnabled) {
const bool focused = this->m_edit->focus.window == this;
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
@ -249,7 +420,6 @@ void UIEditCtrl::PaintTextWithPolicy(bool alternate, const std::string* placehol
}
// OFFSET: 0x00862FB0
// FUNCTION: fn_10905
void UIEditCtrl::Synchronize() {
const bool focused = this->m_edit->focus.window == this;
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
@ -270,7 +440,6 @@ void UIEditCtrl::Synchronize() {
}
// OFFSET: 0x00868450
// FUNCTION: fn_10959
void UIEditCtrl::Trim() {
const bool focused = this->m_edit->focus.window == this;
EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, this->m_edit->input, g_textCodePage};
@ -310,13 +479,11 @@ void UIEditCtrl::TextColor(std::uint32_t primary, std::uint32_t secondary) {
this->Invalidate();
}
// OFFSET: 0x0097C230
// FUNCTION: fn_13324
// INLINED
UIEditCtrlWheel::UIEditCtrlWheel(UIWindowContext& windows, UIEditContext& edit) : UIEditCtrl(windows, edit) {
}
// OFFSET: 0x009701B0
// FUNCTION: fn_13241
UIEditCtrlWheel::~UIEditCtrlWheel() = default;
// OFFSET: 0x0098A240

View file

@ -140,8 +140,7 @@ void UIEditCtrl::UpdateLinks() {
this->linkedText += remaining;
}
// OFFSET: 0x008641C0
// FUNCTION: fn_10914
// INLINED
void UIEditCtrl::InsertLink(const char* value) {
const std::string name = FormatNavigationLink(value, false);

View file

@ -3,11 +3,11 @@
#include "UI/Edit/UIEditCtrl.h"
// OFFSET: 0x0084F250
// FUNCTION: fn_10657
UIEditCtrl2::UIEditCtrl2(UIWindowContext& windows, UIEditContext& edit) : UIEditCtrl(windows, edit) {
}
// OFFSET: 0x00852700
// FUNCTION: fn_10714
UIEditCtrl2::~UIEditCtrl2() = default;
// OFFSET: 0x00863BF0
@ -24,6 +24,7 @@ int UIEditCtrl2::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::in
}
// OFFSET: 0x0084F7B0
// FUNCTION: fn_10660
UIEditCtrl4::UIEditCtrl4(UIWindowContext& windows, UIEditContext& edit) : UIEditCtrl(windows, edit), placeholderColor(0xFFFFFFFFu), placeholderEnabled(0) {
}
@ -48,11 +49,11 @@ void UIEditCtrl4::PaintText() {
}
// OFFSET: 0x0084F7B0
// FUNCTION: fn_10661
UIEditCtrl5::UIEditCtrl5(UIWindowContext& windows, UIEditContext& edit) : UIEditCtrl4(windows, edit) {
}
// OFFSET: 0x008528F0
// FUNCTION: fn_10717
UIEditCtrl5::~UIEditCtrl5() = default;
// OFFSET: 0x00864140

View file

@ -17,10 +17,12 @@ int g_snapDirection = 1;
SnapObject* g_snapBoundary = nullptr;
namespace {
// INLINED
int Magnitude(int value) {
return value < 0 ? (0 - value) : value;
}
// FUNCTION: fn_09714
bool ContainsUpward(SnapObject* object, SnapObject* target) {
if (object == target) {
return true;
@ -42,13 +44,13 @@ CSnapMgr::CSnapMgr() : root(nullptr) {
}
// OFFSET: 0x007E23D0
// FUNCTION: fn_09697
// OFFSET: 0x007E2520
// FUNCTION: fn_09698
// FUNCTION: fn_09697
CSnapMgr::~CSnapMgr() {
this->Clear();
}
// INLINED
SnapObject* CSnapMgr::Find(const UIWindow* window) const {
for (SnapObject* object : this->objects) {
if (object->window == window) {
@ -59,6 +61,7 @@ SnapObject* CSnapMgr::Find(const UIWindow* window) const {
return nullptr;
}
// INLINED
void CSnapMgr::ResetVisited() {
for (SnapObject* object : this->objects) {
object->visited = 0;

View file

@ -37,11 +37,13 @@ private:
CSnapMgr& operator=(const CSnapMgr&) = delete;
};
// STATIC: 0x01334698 / 0x013346A8
// STATIC: 0x01334698
extern const int g_snapOppositeSide[4];
// STATIC: 0x013346A8
extern bool g_snapEnabled;
// STATIC: 0x013346A4 / 0x013346B0
// STATIC: 0x013346A4
extern int g_snapDirection;
// STATIC: 0x013346B0
extern SnapObject* g_snapBoundary;
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -2,6 +2,7 @@
#include "UI/Window/UIWindow.h"
namespace {
// INLINED
bool Overlaps(int a, int b, int c, int d) {
return (c >= a && c <= b) || (d >= a && d <= b) || (a >= c && a <= d) || (b >= c && b <= d);
}
@ -13,9 +14,7 @@ SnapObject::SnapObject() : window(nullptr), visited(0) {
}
// OFFSET: 0x007E2550
// FUNCTION: fn_09699
// OFFSET: 0x007E2360
// FUNCTION: fn_09696
SnapObject::~SnapObject() = default;
// OFFSET: 0x007E2770

View file

@ -3,10 +3,12 @@
#include <utility>
namespace {
// INLINED
bool Overlaps(int a, int b, int c, int d) {
return (c >= a && c <= b) || (d >= a && d <= b) || (a >= c && a <= d) || (b >= c && b <= d);
}
// INLINED
bool Near(int value, int edge) {
return value >= (edge - 10) && value <= (edge + 10);
}

View file

@ -1,50 +0,0 @@
#include "UI/Layout/WindowGeometry.h"
#include <windows.h>
#include <timeapi.h>
// OFFSET: 0x00A79A90
WindowGeometry::WindowGeometry()
: width(0), height(0), x(0), y(0), surface(nullptr), visible(1), id(600), unknown_0030(0), unknown_0034(0), targetAlpha(255), alphaStart(timeGetTime()),
currentAlpha(255) {
}
// OFFSET: 0x00A81D40
// FUNCTION: fn_16987
void WindowGeometry::Move(int newX, int newY) {
this->x = newX;
this->y = newY;
}
// OFFSET: 0x005C9630
// FUNCTION: fn_03632
void WindowGeometry::Show(int state) {
this->visible = state;
}
// OFFSET: 0x005C8F60
// FUNCTION: fn_03629
void WindowGeometry::SetId(int value) {
this->id = value;
}
// OFFSET: 0x00A7D6F0
// FUNCTION: fn_16954
std::uint32_t WindowGeometry::Color() {
std::uint32_t value = this->currentAlpha;
if (value != this->targetAlpha) {
const std::uint32_t step = (timeGetTime() - this->alphaStart) >> 4;
const std::uint32_t candidate = value < this->targetAlpha ? value + step : value - step;
const bool keepCandidate = value < this->targetAlpha ? candidate < this->targetAlpha : this->targetAlpha < candidate;
value = keepCandidate ? candidate : this->targetAlpha;
this->currentAlpha = value;
}
if (value > 255) {
value = this->targetAlpha;
this->currentAlpha = value;
}
return (value << 24) + 0xFFFFFF;
}

View file

@ -26,6 +26,12 @@ struct WindowGeometry {
std::uint32_t Color();
};
// INLINED
inline void WindowGeometry::Move(int newX, int newY) {
this->x = newX;
this->y = newY;
}
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(WindowGeometry) == 48);
#endif

View file

@ -10,13 +10,13 @@ namespace {
}
// OFFSET: 0x0086CC20
// FUNCTION: fn_11035
UIComboBoxDefWnd::UIComboBoxDefWnd(UIWindowContext& windows, UIComboBoxHeaderContext& controls)
: UIWindow(windows, 0), button(nullptr), list(nullptr), label(nullptr), borderless(0), expanded(0), red(255), green(255), blue(255), borderRed(0),
borderGreen(0), borderBlue(0), dropdownHeight(40), m_controls(&controls) {
}
// OFFSET: 0x00872AE0
// FUNCTION: fn_11134
UIComboBoxDefWnd::~UIComboBoxDefWnd() = default;
// OFFSET: 0x00885920
@ -135,12 +135,12 @@ int UIComboBoxDefWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, st
}
// OFFSET: 0x0086CBA0
// FUNCTION: fn_11034
UIComboBoxDef2Wnd::UIComboBoxDef2Wnd(UIWindowContext& windows, UIComboBoxHeaderContext& controls)
: UIComboBoxDefWnd(windows, controls), skin(0), alignment(0), textOffset(0), previousTextX(0) {
}
// OFFSET: 0x00872A70
// FUNCTION: fn_11133
UIComboBoxDef2Wnd::~UIComboBoxDef2Wnd() = default;
// OFFSET: 0x00885250

View file

@ -28,7 +28,6 @@ UIComboBoxEx::UIComboBoxEx(UIWindowContext& windows, UIComboBoxContext& combo) :
}
// OFFSET: 0x00872C00
// FUNCTION: fn_11136
UIComboBoxEx::~UIComboBoxEx() = default;
// OFFSET: 0x0087B5A0
@ -207,6 +206,7 @@ int UIComboBoxEx::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i
return 0;
}
// INLINED
void UIComboBoxEx::DrawRows(bool centered) {
const unsigned end = std::min(
static_cast<unsigned>(this->lines.size()), static_cast<unsigned>((this->topLine + (this->geometry.height / this->lineHeight - this->bottomMargin)))
@ -263,12 +263,12 @@ void UIComboBoxEx::Paint() {
}
// OFFSET: 0x00885250
// FUNCTION: fn_11318
// FUNCTION: fn_11036
UIComboBoxEx2::UIComboBoxEx2(UIWindowContext& windows, UIComboBoxContext& combo) : UIComboBoxEx(windows, combo), alignment(0) {
}
// OFFSET: 0x00872B50
// FUNCTION: fn_11135
// FUNCTION: fn_11102
UIComboBoxEx2::~UIComboBoxEx2() = default;
// OFFSET: 0x00885EE0

View file

@ -5,15 +5,13 @@
#include <algorithm>
// OFFSET: 0x00AA27B0
// FUNCTION: fn_17217
// INLINED
CUIDropDownBox::CUIDropDownBox(UIWindowContext& context) : CUIControl(context), owner(nullptr) {
}
// OFFSET: 0x009E3300
// FUNCTION: fn_45427
// OFFSET: 0x009E3390
// FUNCTION: fn_14415
// FUNCTION: fn_45427
CUIDropDownBox::~CUIDropDownBox() {
this->Detach();
}

View file

@ -30,7 +30,7 @@ UIListBox::UIListBox(UIWindowContext& windows, UIListBoxContext& list)
}
// OFFSET: 0x00873690
// FUNCTION: fn_11156
// FUNCTION: fn_11105
UIListBox::~UIListBox() = default;
// OFFSET: 0x0087B640

View file

@ -25,7 +25,6 @@ UIListBoxEx::UIListBoxEx(UIWindowContext& windows, UIListBoxContext& list)
}
// OFFSET: 0x00873710
// FUNCTION: fn_11157
UIListBoxEx::~UIListBoxEx() = default;
// OFFSET: 0x0087B690
@ -116,6 +115,7 @@ void UIListBoxEx::Refresh() {
this->verticalBar->Invalidate();
}
// INLINED
int UIListBoxEx::LineAt(int x, int y) const {
if (x < 0 || y < 0 || x >= this->geometry.width || y >= this->geometry.height) {
return -1;

View file

@ -8,13 +8,13 @@
#include <algorithm>
// OFFSET: 0x0086E550
// FUNCTION: fn_11073
UIScrollBar::UIScrollBar(UIWindowContext& windows, FrameFocus& capture, ResourceMgr& resources)
: UIWindow(windows, 0), state(0), maximum(0), position(0), vertical(1), pressX(0), pressY(0), dragAmount(0), total(0), visible(0), arrowLength(13),
thickness(13), minimumThumb(1), horizontalStep(1), verticalStep(1), m_capture(&capture), m_resources(&resources) {
}
// OFFSET: 0x00873FA0
// FUNCTION: fn_11174
UIScrollBar::~UIScrollBar() = default;
// OFFSET: 0x00897830

View file

@ -3,8 +3,7 @@
#include "Resource/ResourceMgr.h"
#include "UI/Lists/UIScrollBarNavi.h"
// OFFSET: 0x00885EE0
// FUNCTION: fn_11320
// INLINED
UIScrollBar_Navi::UIScrollBar_Navi(UIWindowContext& windows, FrameFocus& focus, ResourceMgr& resources)
: UIScrollBar(windows, focus, resources), m_resources(&resources) {
this->arrowLength = 7;
@ -12,7 +11,6 @@ UIScrollBar_Navi::UIScrollBar_Navi(UIWindowContext& windows, FrameFocus& focus,
}
// OFFSET: 0x00874080
// FUNCTION: fn_11176
UIScrollBar_Navi::~UIScrollBar_Navi() = default;
// OFFSET: 0x0088E930

View file

@ -28,13 +28,13 @@ namespace {
}
// OFFSET: 0x007BAC40
// FUNCTION: fn_09274
UIAdvenPartyBoardWnd::UIAdvenPartyBoardWnd(UIWindowContext& windows, UIFrameContext& frames, UIAdvenPartyBoardContext& board)
: UIFrameWnd(windows, frames, 0), unknown_0104(0), unknown_0108(0), page(1), totalPages(1), unknown_0114(1), unknown_0118(0), selectedType(0),
m_board(&board) {
}
// OFFSET: 0x007BB590
// FUNCTION: fn_09282
UIAdvenPartyBoardWnd::~UIAdvenPartyBoardWnd() = default;
// OFFSET: 0x007C23C0
@ -289,6 +289,7 @@ void UIAdvenPartyBoardWnd::SetOwnParty(CAdvenPartyInfo value) {
this->Registration(true);
}
// INLINED
void UIAdvenPartyBoardWnd::RefreshRows() {
for (auto* row : this->rows) {
row->Reset();
@ -316,6 +317,7 @@ void UIAdvenPartyBoardWnd::RefreshRows() {
this->Invalidate();
}
// INLINED
void UIAdvenPartyBoardWnd::UpdatePagination() {
if (this->page <= this->totalPages) {
if (this->page != this->totalPages) {
@ -342,6 +344,7 @@ void UIAdvenPartyBoardWnd::UpdatePagination() {
this->refresh->Invalidate();
}
// INLINED
void UIAdvenPartyBoardWnd::ResetSearch() {
char number[10] = {};
_snprintf_s(number, sizeof(number), _TRUNCATE, "%d", std::max((this->m_board->playerLevel - 5), 1));
@ -361,6 +364,7 @@ void UIAdvenPartyBoardWnd::ResetSearch() {
this->Invalidate();
}
// INLINED
void UIAdvenPartyBoardWnd::Search(int trigger) {
this->searching = 1;
const auto digits = [](const char* text) {

View file

@ -20,12 +20,12 @@ namespace {
}
// OFFSET: 0x007BAD00
// FUNCTION: fn_09275
UIApplyForPartyWnd::UIApplyForPartyWnd(UIWindowContext& windows, UIFrameContext& frames, UIApplyForPartyContext& application)
: UIFrameWnd(windows, frames, 0), m_application(&application) {
}
// OFFSET: 0x007BB610
// FUNCTION: fn_09283
UIApplyForPartyWnd::~UIApplyForPartyWnd() = default;
// OFFSET: 0x007C2400

View file

@ -7,13 +7,13 @@
#include <cstdio>
// OFFSET: 0x007BAE20
// FUNCTION: fn_09277
UIPartyInfoWnd::UIPartyInfoWnd(UIWindowContext& windows, UIButtonContext& buttons, PartyRowContext& row)
: UIBitmapButton(windows, buttons), tanker(0), dealer(0), healer(0), assist(0), m_row(&row) {
this->m_drawLabel = 0;
}
// OFFSET: 0x007BB740
// FUNCTION: fn_09285
UIPartyInfoWnd::~UIPartyInfoWnd() = default;
// OFFSET: 0x007BBF00
@ -44,8 +44,7 @@ void UIPartyInfoWnd::SetInfo(const CAdvenPartyInfo& value) {
this->info = value;
}
// OFFSET: 0x007C0420
// FUNCTION: fn_09312
// INLINED
void UIPartyInfoWnd::Reset() {
this->m_drawLabel = 0;
this->memo.clear();

View file

@ -46,12 +46,12 @@ namespace {
}
// OFFSET: 0x007BAF30
// FUNCTION: fn_09278
UIRegisterPartyWnd::UIRegisterPartyWnd(UIWindowContext& windows, UIFrameContext& frames, UIRegisterPartyContext& registration)
: UIFrameWnd(windows, frames, 0), selectedType(0), m_registration(&registration) {
}
// OFFSET: 0x007BB810
// FUNCTION: fn_09286
UIRegisterPartyWnd::~UIRegisterPartyWnd() = default;
// OFFSET: 0x007C2440

View file

@ -17,6 +17,7 @@ UIRequestJoinPartyMgr::UIRequestJoinPartyMgr(WindowManagerWindows& windows) : m_
// OFFSET: 0x007BB470
// OFFSET: 0x007BB880
// FUNCTION: fn_09281
UIRequestJoinPartyMgr::~UIRequestJoinPartyMgr() = default;
// OFFSET: 0x007BBD50
@ -72,8 +73,7 @@ void UIRequestJoinPartyMgr::Add(std::uint32_t accountId, std::uint32_t character
}
}
// OFFSET: 0x007C1770
// FUNCTION: fn_09315
// INLINED
void UIRequestJoinPartyMgr::Block(std::uint32_t accountId) {
this->m_blocked.push_back(accountId);
}

View file

@ -20,12 +20,12 @@ namespace {
}
// OFFSET: 0x007BB030
// FUNCTION: fn_09280
UIRequestJoinPartyWnd::UIRequestJoinPartyWnd(UIWindowContext& windows, UIFrameContext& frames, UIRequestJoinPartyContext& request)
: UIFrameWnd(windows, frames, 0), m_request(&request) {
}
// OFFSET: 0x007BB960
// FUNCTION: fn_09288
UIRequestJoinPartyWnd::~UIRequestJoinPartyWnd() = default;
// OFFSET: 0x007BEFD0

View file

@ -98,6 +98,7 @@ void MerchantShopRefresh::Refresh() {
this->backup.Clear();
}
// INLINED
void StoreBackupContext::RefreshShop() {
MerchantShopRefresh* window = this->shop ? this->shop : this->otherShop;

View file

@ -23,8 +23,7 @@ int ShortcutBindings::Rotate(int index, int bank) const {
return value < 36 ? value : value - 36;
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
// INLINED
void ShortcutBindings::Refresh(NormalItemSlot** slots, NormalItemSlot** itemSlots) {
for (int index = 0; index < 36; ++index) {
const int source = this->Rotate(index, this->mode);

View file

@ -1,75 +0,0 @@
#include "Client/ClientOptions.h"
#include "UI/Shortcuts/ShortcutControlEvents.h"
#include "UI/Shortcuts/ShortcutCooldowns.h"
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/Buttons/UICheckBox.h"
#include "UI/Window/UIWindow.h"
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutControlEvents::Click(int id) {
switch (id) {
case 201:
this->visibility.Show(0);
return;
case 216:
if (this->window.geometry.visible == 0) {
this->visibility.Show(1);
return;
}
this->grid.rows = this->grid.rows + 1;
if (this->grid.rows > 4) {
this->grid.rows = 1;
this->visibility.Show(0);
}
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
case 217:
if (this->grid.rows > 1) {
--this->grid.rows;
}
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
case 549: {
const bool checked = this->options.Get(10) == 0;
this->options.Set(10, checked ? 1 : 0, 0);
this->controls.bank->geometry.unknown_0030 = checked ? 1 : 0;
this->controls.bank->Invalidate();
for (ShortcutCooldownRecord& record : this->cooldowns.records) {
record.main.clear();
}
this->window.SendMsg(nullptr, 23, 0, 0, 0, 0);
return;
}
case 588:
case 589: {
this->itemSlotActive = id == 588;
const bool active = this->itemSlotActive;
this->controls.showItems->Enable(active ? 0 : 1);
this->controls.showItems->SetDisabled(active ? 1 : 0);
this->controls.showItems->Invalidate();
this->controls.hideItems->Enable(active ? 1 : 0);
this->controls.hideItems->SetDisabled(active ? 0 : 1);
this->controls.hideItems->Invalidate();
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
}
default:
return;
}
}

View file

@ -105,8 +105,7 @@ void ShortcutCooldowns::ApplyStart(
}
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
// INLINED
bool ShortcutCooldowns::RotateRows(int amount, int bank, int& rotation0, int& rotation1, const CooldownClock& clock) {
const int rows = amount < 4 ? amount : amount % 4;
if (rows <= 0) {
@ -144,8 +143,7 @@ bool ShortcutCooldowns::RotateRows(int amount, int bank, int& rotation0, int& ro
return true;
}
// OFFSET: 0x0092F8E0
// FUNCTION: fn_12680
// INLINED
void ShortcutCooldowns::PaintMain(
const std::list<ShortcutCooldownIcon>& icons, int rows, int x, int y, CooldownDrawing& drawing, const CooldownClock& clock, RenderCommandPool& pool,
CRenderSystemBase& system
@ -154,8 +152,7 @@ void ShortcutCooldowns::PaintMain(
this->Paint(icons, &ShortcutCooldownRecord::main, limit, x, y, drawing, clock, pool, system);
}
// OFFSET: 0x0092D660
// FUNCTION: fn_12671
// INLINED
void ShortcutCooldowns::PaintAlternate(
const std::list<ShortcutCooldownIcon>& icons, int x, int y, CooldownDrawing& drawing, const CooldownClock& clock, RenderCommandPool& pool,
CRenderSystemBase& system
@ -163,6 +160,7 @@ void ShortcutCooldowns::PaintAlternate(
this->Paint(icons, &ShortcutCooldownRecord::alternate, 0, x, y, drawing, clock, pool, system);
}
// INLINED
void ShortcutCooldowns::Paint(
const std::list<ShortcutCooldownIcon>& icons, std::list<CooldownState> ShortcutCooldownRecord::* values, int limit, int x, int y, CooldownDrawing& drawing,
const CooldownClock& clock, RenderCommandPool& pool, CRenderSystemBase& system

View file

@ -2,6 +2,8 @@
#include "UI/Shortcuts/SkillDetailClose.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/FrameFocus.h"
#include "UI/Window/WindowRetirement.h"
namespace {
void ToScreen(const UIWindow& window, int& x, int& y) {
@ -16,6 +18,38 @@ namespace {
}
}
// INLINED
inline bool SkillDetailClose::Close() {
if (this->window) {
this->saved[46] = {this->window->geometry.x, this->window->geometry.y, this->window->geometry.width, this->window->geometry.height};
}
if (!this->modalStack.empty() && this->modalStack.back() != 0) {
return false;
}
if (this->window == this->reference_4F1D4) {
this->reference_4F1D4 = nullptr;
}
bool removed = false;
if (this->window) {
this->retirement.Schedule(this->window);
this->window = nullptr;
this->visible = 0;
removed = true;
}
this->windowsById.erase(46);
if (removed) {
this->focus.RemoveOrder(46);
}
return removed;
}
// OFFSET: 0x009332D0
// FUNCTION: fn_12724
void ShortcutDetails::Open(UIWindow& window, ShortcutGrid& grid, int x, int y, const NormalItemSlot* const* slots, const NormalItemSlot* const* itemSlots) {

View file

@ -13,11 +13,13 @@ namespace {
return id - 8000u <= 60 || id - 8200u <= 41 || id - 8400u <= 57;
}
// INLINED
void Refresh(UIWindow& window) {
window.SendMsg(nullptr, 23, 0, 0, 0, 0);
window.Invalidate();
}
// INLINED
void RemoveFirst(ShortcutCooldowns& cooldowns, int slot) {
for (ShortcutCooldownRecord& record : cooldowns.records) {
const auto value = std::find_if(record.main.begin(), record.main.end(), [&](const CooldownState& state) { return state.slot == slot; });

View file

@ -3,7 +3,7 @@
#include <bit>
#include <cstdint>
// OFFSET: 0x009122B0
// INLINED
ShortcutGrid::ShortcutGrid() : hovered(-1), row(-1), rows(1) {
}

View file

@ -1,70 +0,0 @@
#include "UI/Shortcuts/ShortcutLayout.h"
#include "UI/Buttons/UIBitmapButton.h"
void ShortcutLayout::PlaceRowButtons() {
this->decrease.Move(this->window.geometry.width - this->decrease.geometry.width - 2, this->grid.rows * 33 - 28);
this->increase.Move(this->window.geometry.width - this->increase.geometry.width - 2, this->grid.rows * 33 - 13);
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutLayout::ResizeRows() {
const int height = (this->itemSlotActive ? 43 : 10) + this->grid.rows * 33;
if (height == this->window.geometry.height) {
return;
}
this->window.Resize(this->window.geometry.width, height);
this->decrease.Move(this->window.geometry.width - this->decrease.geometry.width - 2, this->grid.rows * 33 - 28);
this->increase.Move(this->window.geometry.width - this->increase.geometry.width - 2, this->grid.rows * 33 - 13);
this->showItems.Move(247, height - 10);
this->hideItems.Move(247, height - 10);
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
this->window.Slot11();
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutLayout::Restore(NormalItemSlotWindow* value) {
this->saved = value;
if (!value->IsValid(this->screenWidth, this->screenHeight, this->itemSlotActive)) {
value->Reset();
}
const int height = value->height;
this->window.Resize(this->window.geometry.width, height);
const int extent = this->itemSlotActive ? height - 43 : height;
this->showItems.Move(247, height - 10);
this->hideItems.Move(247, height - 10);
this->showItems.Enable(this->itemSlotActive ? 0 : 1);
this->showItems.SetDisabled(this->itemSlotActive ? 1 : 0);
this->showItems.Invalidate();
this->hideItems.Enable(this->itemSlotActive ? 1 : 0);
this->hideItems.SetDisabled(this->itemSlotActive ? 0 : 1);
this->hideItems.Invalidate();
this->grid.rows = extent / 33;
this->PlaceRowButtons();
this->window.SendMsg(nullptr, 23, 0, 0, 0, 0);
this->window.Move(value->x, value->y);
}
// OFFSET: 0x00940FE0
// FUNCTION: fn_12787
void ShortcutLayout::Persist() {
if (!this->saved) {
return;
}
this->saved->x = this->window.geometry.x;
this->saved->y = this->window.geometry.y;
this->saved->width = this->window.geometry.width;
this->saved->height = this->window.geometry.height;
}

View file

@ -11,18 +11,19 @@
namespace {
constexpr char prefix[] = "\xC0\xAF\xC0\xFA\xC0\xCE\xC5\xCD\xC6\xE4\xC0\xCC\xBD\xBA";
// INLINED
CBitmapRes* Load(ResourceMgr& resources, const char* tail) {
char path[200];
std::sprintf(path, "%s%s", prefix, tail);
return static_cast<CBitmapRes*>(resources.Load(path));
}
// INLINED
void Bitmap(UIWindow& window, CBitmapRes* image, int x, int y, bool transparent) {
window.DrawBitmap(x, y, image ? &image->image : nullptr, transparent);
}
// OFFSET: 0x00A86200
// FUNCTION: fn_17019
void Count(UIWindow& window, FontCache& fonts, const TextLocale& locale, int right, int y, int value) {
char text[16];
std::sprintf(text, "%d", value);

View file

@ -1,79 +0,0 @@
#include "Client/Mode/ModeEvents.h"
#include "UI/Shortcuts/ShortcutUse.h"
#include "UI/Buttons/UIButton.h"
#include <cstdio>
#include <cstdlib>
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
void ShortcutUse::Use(const NormalItemSlot& slot) {
if (this->options.Get(5) > 0 || slot.itemId == 0) {
return;
}
if (slot.unknown_0000 != 0) {
CSkillInfo skill = this->skills.Lookup(slot.itemId);
if (skill.MatchesShortcut(&slot)) {
int level = slot.unknown_0005;
if ((skill.id == 6579 || skill.id == 6580) && skill.level < level) {
level = skill.level;
}
this->mode->SendModeMessage(113, reinterpret_cast<std::intptr_t>(&skill), level, 0, 0);
}
return;
}
ItemInfo item = LookupClientItem(this->inventory, static_cast<int>(slot.itemId), 1);
if (item.unknown_0000[1] == 0) {
return;
}
ModeEvents* mode = this->mode;
const auto use = [&]() { mode->SendModeMessage(27, item.unknown_0000[1], 0, 0, 0); };
switch (item.unknown_0000[0]) {
case 0:
case 1:
case 2:
if (std::atoi(item.itemId.c_str()) != 12802 || this->dialogs.Confirm(this->naming.Message(2373), 2, 0, 0, "Message", 280, 120) != 188) {
use();
}
break;
case 10:
case 16:
case 17:
case 19:
if (item.unknown_0000[3] == 0x8000) {
mode->SendModeMessage(87, item.unknown_0000[1], item.unknown_0000[2], 0, 0);
}
break;
case 18:
if (this->itemConfirmationState >= 0) {
const std::string name = this->naming.DisplayName(item, 0);
char text[4096];
_snprintf_s(text, sizeof(text), _TRUNCATE, this->naming.Message(1226), name.c_str());
if (this->dialogs.Confirm(text, 2, 0, 0, "Message", 280, 120) == 187) {
use();
}
}
break;
default:
if (item.unknown_0000[2] != 0 && item.unknown_0000[3] == 0 && item.identified != 0) {
mode->SendModeMessage(19, item.unknown_0000[1], item.unknown_0000[2], 0, 0);
}
break;
}
}

View file

@ -1,36 +0,0 @@
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/WindowOrdering.h"
// OFFSET: 0x00AAA310
// FUNCTION: fn_17269
bool ShortcutVisibility::Show(int value) {
if (this->restricted && !this->replayAllowsShortcut) {
return false;
}
this->visible = value;
this->windows.EnsureWindow(36);
this->shortcut->Show(value);
if (value != 0) {
this->ordering.Promote(this->shortcut);
}
if (this->showCompanion) {
this->windows.EnsureWindow(159);
}
UIWindow* companion = this->windows.LookupWindow(159);
if (companion) {
companion->Show(value);
if (value != 0) {
this->ordering.Promote(companion);
}
}
return true;
}

View file

@ -1,9 +1,9 @@
#ifndef RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTVISIBILITY_H
#define RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTVISIBILITY_H
class UIWindow;
class WindowManagerWindows;
struct WindowOrdering;
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include "UI/Window/WindowOrdering.h"
struct ShortcutVisibility {
WindowManagerWindows& windows;
@ -17,4 +17,35 @@ struct ShortcutVisibility {
bool Show(int value);
};
// INLINED
inline bool ShortcutVisibility::Show(int value) {
if (this->restricted && !this->replayAllowsShortcut) {
return false;
}
this->visible = value;
this->windows.EnsureWindow(36);
this->shortcut->Show(value);
if (value != 0) {
this->ordering.Promote(this->shortcut);
}
if (this->showCompanion) {
this->windows.EnsureWindow(159);
}
UIWindow* companion = this->windows.LookupWindow(159);
if (companion) {
companion->Show(value);
if (value != 0) {
this->ordering.Promote(companion);
}
}
return true;
}
#endif

View file

@ -1,36 +0,0 @@
#include "UI/Window/FrameFocus.h"
#include "UI/Shortcuts/SkillDetailClose.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowRetirement.h"
// OFFSET: 0x00A8CF20
bool SkillDetailClose::Close() {
if (this->window) {
this->saved[46] = {this->window->geometry.x, this->window->geometry.y, this->window->geometry.width, this->window->geometry.height};
}
if (!this->modalStack.empty() && this->modalStack.back() != 0) {
return false;
}
if (this->window == this->reference_4F1D4) {
this->reference_4F1D4 = nullptr;
}
bool removed = false;
if (this->window) {
this->retirement.Schedule(this->window);
this->window = nullptr;
this->visible = 0;
removed = true;
}
this->windowsById.erase(46);
if (removed) {
this->focus.RemoveOrder(46);
}
return removed;
}

View file

@ -1,8 +1,10 @@
#include "Client/ClientOptions.h"
#include "Client/Mode/ModeDragState.h"
#include "Client/Mode/ModeEvents.h"
#include "UI/Shortcuts/ShortcutActivation.h"
#include "UI/Shortcuts/ShortcutBindings.h"
#include "UI/Shortcuts/ShortcutControlEvents.h"
#include "UI/Shortcuts/ShortcutCooldowns.h"
#include "UI/Shortcuts/ShortcutDetails.h"
#include "UI/Shortcuts/ShortcutDrop.h"
#include "UI/Shortcuts/ShortcutLayout.h"
@ -10,12 +12,21 @@
#include "UI/Shortcuts/ShortcutPress.h"
#include "UI/Shortcuts/ShortcutTooltip.h"
#include "UI/Shortcuts/ShortcutUse.h"
#include "UI/Shortcuts/ShortcutVisibility.h"
#include "UI/Shortcuts/UIShortCutWnd.h"
#include "UI/Buttons/UIBitmapButton.h"
#include "UI/Buttons/UIButton.h"
#include "UI/Buttons/UICheckBox.h"
#include "UI/Layout/WindowSnapping.h"
#include "UI/Window/UIWindow.h"
#include <cstdio>
#include <cstdlib>
namespace {}
// OFFSET: 0x009122B0
// FUNCTION: fn_12528
UIShortCutWnd::UIShortCutWnd(UIWindowContext& windows, UIFrameContext& frames, ShortcutWindowContext& shortcuts)
: UIFrameWnd(windows, frames, 0), m_shortcuts(&shortcuts) {
this->m_controls.decrease = nullptr;
@ -23,7 +34,6 @@ UIShortCutWnd::UIShortCutWnd(UIWindowContext& windows, UIFrameContext& frames, S
}
// OFFSET: 0x00915D90
// FUNCTION: fn_12577
UIShortCutWnd::~UIShortCutWnd() = default;
// OFFSET: 0x0091E800
@ -45,7 +55,6 @@ void UIShortCutWnd::Move(int x, int y) {
}
// OFFSET: 0x00917640
// FUNCTION: fn_12589
void UIShortCutWnd::Slot10(int x, int y, std::intptr_t value) {
this->m_shortcuts->drop.Drop(*this, this->m_grid, x, y, *reinterpret_cast<const ModeDragState*>(value));
}
@ -80,7 +89,6 @@ void UIShortCutWnd::Show(int visible) {
}
// OFFSET: 0x0092A190
// FUNCTION: fn_12654
void UIShortCutWnd::Slot15(int, int) {
this->m_controls =
ShortcutControls::Create(*this, *this->m_context, this->m_shortcuts->buttons, this->m_shortcuts->options.Get(10), this->m_slots, this->m_itemSlots);
@ -96,19 +104,16 @@ void UIShortCutWnd::Slot19() {
}
// OFFSET: 0x0092F8E0
// FUNCTION: fn_12680
void UIShortCutWnd::Paint() {
this->m_shortcuts->painting.Paint(*this, this->m_grid, this->m_slots, this->m_itemSlots);
}
// OFFSET: 0x009310E0
// FUNCTION: fn_12699
void UIShortCutWnd::Slot25(int x, int y) {
this->m_shortcuts->press.Press(*this, this->m_grid, x, y, this->m_slots, this->m_itemSlots);
}
// OFFSET: 0x00930900
// FUNCTION: fn_12689
void UIShortCutWnd::Slot26(int x, int y) {
ActivateShortcut(
*this, this->m_grid, x, y, this->m_shortcuts->itemSlotActive, this->m_shortcuts->currentRow, this->m_slots, this->m_shortcuts->automatic,
@ -117,7 +122,6 @@ void UIShortCutWnd::Slot26(int x, int y) {
}
// OFFSET: 0x00932050
// FUNCTION: fn_12711
void UIShortCutWnd::Slot28(int x, int y) {
this->m_shortcuts->tooltip.Hover(*this, this->m_grid, x, y, this->m_slots, this->m_itemSlots);
}
@ -130,11 +134,215 @@ void UIShortCutWnd::Slot31(int x, int y) {
}
// OFFSET: 0x009332D0
// FUNCTION: fn_12724
void UIShortCutWnd::Slot32(int x, int y) {
this->m_shortcuts->details.Open(*this, this->m_grid, x, y, this->m_slots, this->m_itemSlots);
}
// INLINED
inline void ShortcutControlEvents::Click(int id) {
switch (id) {
case 201:
this->visibility.Show(0);
return;
case 216:
if (this->window.geometry.visible == 0) {
this->visibility.Show(1);
return;
}
this->grid.rows = this->grid.rows + 1;
if (this->grid.rows > 4) {
this->grid.rows = 1;
this->visibility.Show(0);
}
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
case 217:
if (this->grid.rows > 1) {
--this->grid.rows;
}
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
case 549: {
const bool checked = this->options.Get(10) == 0;
this->options.Set(10, checked ? 1 : 0, 0);
this->controls.bank->geometry.unknown_0030 = checked ? 1 : 0;
this->controls.bank->Invalidate();
for (ShortcutCooldownRecord& record : this->cooldowns.records) {
record.main.clear();
}
this->window.SendMsg(nullptr, 23, 0, 0, 0, 0);
return;
}
case 588:
case 589: {
this->itemSlotActive = id == 588;
const bool active = this->itemSlotActive;
this->controls.showItems->Enable(active ? 0 : 1);
this->controls.showItems->SetDisabled(active ? 1 : 0);
this->controls.showItems->Invalidate();
this->controls.hideItems->Enable(active ? 1 : 0);
this->controls.hideItems->SetDisabled(active ? 0 : 1);
this->controls.hideItems->Invalidate();
this->window.SendMsg(nullptr, 14, 0, 0, 0, 0);
return;
}
default:
return;
}
}
// INLINED
inline void ShortcutLayout::PlaceRowButtons() {
this->decrease.Move(this->window.geometry.width - this->decrease.geometry.width - 2, this->grid.rows * 33 - 28);
this->increase.Move(this->window.geometry.width - this->increase.geometry.width - 2, this->grid.rows * 33 - 13);
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
}
// INLINED
inline void ShortcutLayout::ResizeRows() {
const int height = (this->itemSlotActive ? 43 : 10) + this->grid.rows * 33;
if (height == this->window.geometry.height) {
return;
}
this->window.Resize(this->window.geometry.width, height);
this->decrease.Move(this->window.geometry.width - this->decrease.geometry.width - 2, this->grid.rows * 33 - 28);
this->increase.Move(this->window.geometry.width - this->increase.geometry.width - 2, this->grid.rows * 33 - 13);
this->showItems.Move(247, height - 10);
this->hideItems.Move(247, height - 10);
this->decrease.Enable(this->grid.rows == 1 ? 0 : 1);
this->increase.Enable(1);
this->increase.SetDisabled(this->grid.rows == 4 ? 1 : 0);
this->increase.Invalidate();
this->window.Slot11();
}
// INLINED
inline void ShortcutLayout::Restore(NormalItemSlotWindow* value) {
this->saved = value;
if (!value->IsValid(this->screenWidth, this->screenHeight, this->itemSlotActive)) {
value->Reset();
}
const int height = value->height;
this->window.Resize(this->window.geometry.width, height);
const int extent = this->itemSlotActive ? height - 43 : height;
this->showItems.Move(247, height - 10);
this->hideItems.Move(247, height - 10);
this->showItems.Enable(this->itemSlotActive ? 0 : 1);
this->showItems.SetDisabled(this->itemSlotActive ? 1 : 0);
this->showItems.Invalidate();
this->hideItems.Enable(this->itemSlotActive ? 1 : 0);
this->hideItems.SetDisabled(this->itemSlotActive ? 0 : 1);
this->hideItems.Invalidate();
this->grid.rows = extent / 33;
this->PlaceRowButtons();
this->window.SendMsg(nullptr, 23, 0, 0, 0, 0);
this->window.Move(value->x, value->y);
}
// OFFSET: 0x00940FE0
inline void ShortcutLayout::Persist() {
if (!this->saved) {
return;
}
this->saved->x = this->window.geometry.x;
this->saved->y = this->window.geometry.y;
this->saved->width = this->window.geometry.width;
this->saved->height = this->window.geometry.height;
}
// INLINED
inline void ShortcutUse::Use(const NormalItemSlot& slot) {
if (this->options.Get(5) > 0 || slot.itemId == 0) {
return;
}
if (slot.unknown_0000 != 0) {
CSkillInfo skill = this->skills.Lookup(slot.itemId);
if (skill.MatchesShortcut(&slot)) {
int level = slot.unknown_0005;
if ((skill.id == 6579 || skill.id == 6580) && skill.level < level) {
level = skill.level;
}
this->mode->SendModeMessage(113, reinterpret_cast<std::intptr_t>(&skill), level, 0, 0);
}
return;
}
ItemInfo item = LookupClientItem(this->inventory, static_cast<int>(slot.itemId), 1);
if (item.unknown_0000[1] == 0) {
return;
}
ModeEvents* mode = this->mode;
const auto use = [&]() { mode->SendModeMessage(27, item.unknown_0000[1], 0, 0, 0); };
switch (item.unknown_0000[0]) {
case 0:
case 1:
case 2:
if (std::atoi(item.itemId.c_str()) != 12802 || this->dialogs.Confirm(this->naming.Message(2373), 2, 0, 0, "Message", 280, 120) != 188) {
use();
}
break;
case 10:
case 16:
case 17:
case 19:
if (item.unknown_0000[3] == 0x8000) {
mode->SendModeMessage(87, item.unknown_0000[1], item.unknown_0000[2], 0, 0);
}
break;
case 18:
if (this->itemConfirmationState >= 0) {
const std::string name = this->naming.DisplayName(item, 0);
char text[4096];
_snprintf_s(text, sizeof(text), _TRUNCATE, this->naming.Message(1226), name.c_str());
if (this->dialogs.Confirm(text, 2, 0, 0, "Message", 280, 120) == 187) {
use();
}
}
break;
default:
if (item.unknown_0000[2] != 0 && item.unknown_0000[3] == 0 && item.identified != 0) {
mode->SendModeMessage(19, item.unknown_0000[1], item.unknown_0000[2], 0, 0);
}
break;
}
}
// OFFSET: 0x0093B450
// FUNCTION: fn_12760
int UIShortCutWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {

View file

@ -8,10 +8,12 @@
#include <windows.h>
namespace {
// INLINED
bool Hex(unsigned char value) {
return (value >= '0' && value <= '9') || (value >= 'a' && value <= 'f') || (value >= 'A' && value <= 'F');
}
// INLINED
unsigned Digit(unsigned char value) {
if (value >= '0' && value <= '9') {
return value - '0';

View file

@ -5,6 +5,7 @@
#include <mbstring.h>
namespace {
// INLINED
unsigned Digit(unsigned char value) {
if (value >= '0' && value <= '9') {
return value - '0';

View file

@ -76,6 +76,7 @@ std::string RemoveTextColors(const char* text, unsigned short codePage) {
}
// OFFSET: 0x00A7F660
// FUNCTION: fn_16966
std::string DisplayTextTag(std::string text, const std::string& begin, const std::string& end) {
auto position = text.find(begin);

View file

@ -55,10 +55,12 @@ void WrapPlainText(const char* text, std::vector<std::string>& lines, int width,
}
namespace {
// INLINED
bool Hex(unsigned char value) {
return (value >= '0' && value <= '9') || (value >= 'a' && value <= 'f') || (value >= 'A' && value <= 'F');
}
// INLINED
bool Color(const char* text, std::size_t bytes) {
if (bytes <= 6 || *text != '^') {
return false;

View file

@ -6,6 +6,7 @@
#include <cstring>
namespace {
// INLINED
int Family(unsigned mode) {
switch (mode) {
case 1:
@ -43,13 +44,13 @@ namespace {
}
// OFFSET: 0x0084E970
// FUNCTION: fn_10648
UIBalloonText::UIBalloonText(UIWindowContext& windows, BalloonTextContext& text)
: UIWindow(windows, 0), unknown_007C(0), m_fontHeight(12), m_textColor(0xFFFFFF), m_outlineColor(0), m_richText(0), m_textContext(&text) {
this->geometry.unknown_0034 = 0;
}
// OFFSET: 0x008520F0
// FUNCTION: fn_10703
UIBalloonText::~UIBalloonText() = default;
// OFFSET: 0x00869E20

View file

@ -10,7 +10,6 @@ UIStaticText::UIStaticText(UIWindowContext& windows, UIButtonContext& controls)
}
// OFFSET: 0x00853050
// FUNCTION: fn_10732
UIStaticText::~UIStaticText() = default;
// OFFSET: 0x008681C0

View file

@ -67,7 +67,6 @@ UITextViewer::UITextViewer(UIWindowContext& windows, UITextViewerContext& text)
}
// OFFSET: 0x008747F0
// FUNCTION: fn_11189
UITextViewer::~UITextViewer() = default;
// OFFSET: 0x008872A0

View file

@ -48,15 +48,10 @@ std::pair<int, int> UITextViewer::LinkPosition(unsigned position, unsigned added
}
// OFFSET: 0x008760D0
// FUNCTION: fn_11205
// OFFSET: 0x00878750
// FUNCTION: fn_11212
// OFFSET: 0x00876700
// FUNCTION: fn_11206
// OFFSET: 0x00877B00
// FUNCTION: fn_11211
// OFFSET: 0x00877020
// FUNCTION: fn_11209
void UITextViewer::AddLinks(const char* text, unsigned addedLines, int kind) {
auto& owner = this->m_text->list;
std::string parsed = RemoveTextColors(text, owner.codePage);
@ -165,6 +160,7 @@ void UITextViewer::AddLinks(const char* text, unsigned addedLines, int kind) {
}
}
// INLINED
void UITextViewer::AppendText(char* text, int width, bool carriageReturns, bool pixels) {
auto& owner = this->m_text->list;
std::vector<std::string> wrapped;

View file

@ -8,6 +8,7 @@
#include <cstdlib>
#include <shellapi.h>
// INLINED
void UITextViewer::Activate(UITextButton* button, int id) {
if (!button) {
return;

View file

@ -7,6 +7,7 @@
#include <cstring>
namespace {
// INLINED
int Family(unsigned mode) {
switch (mode) {
case 1:
@ -34,11 +35,11 @@ namespace {
}
// OFFSET: 0x00850810
// FUNCTION: fn_10680
UITransBalloonText::UITransBalloonText(UIWindowContext& windows, BalloonTextContext& text) : UIBalloonText(windows, text), m_borderColor(6052956) {
}
// OFFSET: 0x00853210
// FUNCTION: fn_10735
UITransBalloonText::~UITransBalloonText() = default;
// OFFSET: 0x008632D0
@ -71,6 +72,7 @@ void UITransBalloonText::Slot15(int, int) {
this->m_fontMode = 0;
}
// INLINED
void UITransBalloonText::SetColors(std::uint32_t text, std::uint32_t outline) {
this->m_textColor = text;
this->m_outlineColor = outline;

View file

@ -24,6 +24,7 @@ public:
void Slot15(int width, int height) override;
void Paint() override;
// INLINED
void SetRichText(unsigned char value) {
this->m_richText = value;
}

View file

@ -5,12 +5,12 @@
#include "UI/UIStaticBitmap.h"
// OFFSET: 0x00850430
// FUNCTION: fn_10676
UIStaticBitmap::UIStaticBitmap(UIWindowContext& windows, UIButtonContext& controls)
: UIWindow(windows, 0), tooltipX(0), tooltipY(-20), forwardHover(0), m_controls(&controls) {
}
// OFFSET: 0x00852F20
// FUNCTION: fn_10730
UIStaticBitmap::~UIStaticBitmap() = default;
// OFFSET: 0x00865740

View file

@ -1,6 +1,7 @@
#include "UI/Window/FrameTextCache.h"
namespace {
// INLINED
std::uint32_t HashWord(std::uint32_t value) {
std::uint32_t hash = 0x811C9DC5u;

View file

@ -78,8 +78,7 @@ void InputFocus::Next() {
this->window = nullptr;
}
// OFFSET: 0x00A96F60
// FUNCTION: fn_17197
// INLINED
void InputFocus::Advance() {
if (!this->window) {
this->Next();
@ -103,9 +102,7 @@ void InputFocus::Advance() {
this->First();
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
// INLINED
void InputFocus::Refresh(UIWindow* const& excludedRoot) {
if (this->window) {
this->window->Invalidate();

View file

@ -1,12 +1,10 @@
#include "UI/Window/UIControl.h"
// OFFSET: 0x00AA27B0
// FUNCTION: fn_17217
// INLINED
CUIControl::CUIControl(UIWindowContext& context) : UIWindow(context, 0), hitEnabled(1) {
}
// OFFSET: 0x009C08C0
// FUNCTION: fn_13979
CUIControl::~CUIControl() = default;
// OFFSET: 0x009D5490

View file

@ -10,6 +10,7 @@
#include <timeapi.h>
// OFFSET: 0x008A3700
// FUNCTION: fn_11657
UIFrameWnd::UIFrameWnd(UIWindowContext& windowContext, UIFrameContext& frameContext, unsigned char cached)
: UIWindow(windowContext, cached), m_dragX(0), m_dragY(0), m_message0(600), m_message1(600), m_frameContext(&frameContext) {
this->m_textCache.max_load_factor(1.0f);
@ -18,7 +19,7 @@ UIFrameWnd::UIFrameWnd(UIWindowContext& windowContext, UIFrameContext& frameCont
// OFFSET: 0x008A4E90
// OFFSET: 0x008A60E0
// FUNCTION: fn_11692
// FUNCTION: fn_11678
UIFrameWnd::~UIFrameWnd() = default;
// OFFSET: 0x005C4640

View file

@ -27,14 +27,14 @@ namespace {
}
// OFFSET: 0x008A3FC0
// FUNCTION: fn_11663
UIMessageBox::UIMessageBox(UIWindowContext& windows, UIFrameContext& frames, UIMessageBoxContext& dialog)
: UIFrameWnd(windows, frames, 0), counting(0), protectedMessage(0), m_dialog(&dialog) {
}
// OFFSET: 0x008A5220
// FUNCTION: fn_11680
// OFFSET: 0x008A64E0
// FUNCTION: fn_11698
// FUNCTION: fn_11680
UIMessageBox::~UIMessageBox() = default;
// OFFSET: 0x008B8E60
@ -88,12 +88,14 @@ void UIMessageBox::Paint() {
void UIMessageBox::Slot18() {
}
// INLINED
void UIMessageBox::FormatCountdown() {
char text[512];
std::sprintf(text, this->format.c_str(), this->remaining);
this->messageText = text;
}
// INLINED
void UIMessageBox::AddButton(const char* name, int id, int x, int y) {
auto& controls = this->m_dialog->text.buttons;
auto* button = new UIBitmapButton(*this->m_context, controls);

View file

@ -12,12 +12,50 @@
#include <bit>
#include <cstring>
#include <windows.h>
#include <timeapi.h>
// INLINED
inline WindowGeometry::WindowGeometry()
: width(0), height(0), x(0), y(0), surface(nullptr), visible(1), id(600), unknown_0030(0), unknown_0034(0), targetAlpha(255), alphaStart(timeGetTime()),
currentAlpha(255) {
}
// INLINED
inline void WindowGeometry::Show(int state) {
this->visible = state;
}
// INLINED
inline void WindowGeometry::SetId(int value) {
this->id = value;
}
// INLINED
inline std::uint32_t WindowGeometry::Color() {
std::uint32_t value = this->currentAlpha;
if (value != this->targetAlpha) {
const std::uint32_t step = (timeGetTime() - this->alphaStart) >> 4;
const std::uint32_t candidate = value < this->targetAlpha ? value + step : value - step;
const bool keepCandidate = value < this->targetAlpha ? candidate < this->targetAlpha : this->targetAlpha < candidate;
value = keepCandidate ? candidate : this->targetAlpha;
this->currentAlpha = value;
}
if (value > 255) {
value = this->targetAlpha;
this->currentAlpha = value;
}
return (value << 24) + 0xFFFFFF;
}
// STATIC: 0x0145723C
// GLOBAL: gl_24364
std::uint32_t g_windowUid = 0xFFFFFFFFu;
// ORIGINAL_SITE: 0x00AA4730 in fn_17222 (fragment)
// INLINED
void UIWindowContext::DestroyDeferredChildren() {
for (UIWindow* window : this->deferredDeletion) {
delete window;
@ -27,14 +65,14 @@ void UIWindowContext::DestroyDeferredChildren() {
}
// OFFSET: 0x00A79A90
// FUNCTION: fn_16914
UIWindow::UIWindow(UIWindowContext& context, unsigned char cached)
: unknown_0044(0), unknown_0048(0), unknown_004C(4), m_dirty(1), m_uid(++g_windowUid), m_cached(cached), m_clip(0), m_context(&context) {
}
// OFFSET: 0x00A79E90
// FUNCTION: fn_16917
// OFFSET: 0x00A7A050
// FUNCTION: fn_16919
// FUNCTION: fn_16917
UIWindow::~UIWindow() {
delete this->geometry.surface;
this->geometry.surface = nullptr;
@ -46,6 +84,7 @@ UIWindow::~UIWindow() {
);
}
// INLINED
UIWindow* UIWindow::Parent() const {
return static_cast<UIWindow*>(this->parent);
}
@ -72,7 +111,8 @@ bool UIWindow::Slot03() {
return false;
}
// ORIGINAL_SITE: 0x00A81D40 in fn_16987 (body)
// OFFSET: 0x00A81D40
// FUNCTION: fn_16987
void UIWindow::Move(int x, int y) {
this->geometry.Move(x, y);
}
@ -128,7 +168,8 @@ void UIWindow::Slot12() {
void UIWindow::Slot13(int, int) {
}
// ORIGINAL_SITE: 0x005C9630 in fn_03632 (body)
// OFFSET: 0x005C9630
// FUNCTION: fn_03632
void UIWindow::Show(int visible) {
this->geometry.Show(visible);
}
@ -282,7 +323,8 @@ void UIWindow::InvalidateChildren() {
void UIWindow::Slot39() {
}
// ORIGINAL_SITE: 0x00A7D6F0 in fn_16954 (body)
// OFFSET: 0x00A7D6F0
// FUNCTION: fn_16954
std::uint32_t UIWindow::Color() {
return this->geometry.Color();
}
@ -375,7 +417,8 @@ std::vector<std::uint32_t> UIWindow::Slot44() {
return {};
}
// ORIGINAL_SITE: 0x005C8F60 in fn_03629 (body)
// OFFSET: 0x005C8F60
// FUNCTION: fn_03629
void UIWindow::SetId(int value) {
this->geometry.SetId(value);
}

View file

@ -108,6 +108,7 @@ public:
void InvalidateChildren();
bool Contains(const UIWindow* window) const;
UIWindow* FindUid(std::uint32_t uid);
// INLINED
std::uint32_t Uid() const {
return this->m_uid;
}
@ -123,9 +124,11 @@ public:
);
void FlushPrimitives(RenderQueues& queues, bool depthAlpha, float depthStart, float depthEnd);
// INLINED
bool HasTextBackground() const {
return this->unknown_0044 != 0;
}
// INLINED
std::uint32_t TextBackground() const {
return this->unknown_0048;
}

View file

@ -1,6 +1,6 @@
#include "UI/Window/WindowAncestry.h"
// OFFSET: 0x00A79A90
// INLINED
WindowAncestry::WindowAncestry() : parent(nullptr) {
}

View file

@ -58,8 +58,7 @@ UIWindow* WindowMouseHit::HitTest(int x, int y) {
return nullptr;
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
// INLINED
bool WindowMouseCapture::Dispatch() {
if (!this->capture) {
return false;
@ -107,9 +106,7 @@ bool WindowMouseCapture::Dispatch() {
return true;
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
// INLINED
int WindowMouseUncaptured::Dispatch() {
const int x = this->mouse.x;
const int y = this->mouse.y;

View file

@ -77,8 +77,7 @@ void WindowRetirement::DismissTransient(UIWindow*& transient) {
}
}
// OFFSET: 0x00AA4730
// FUNCTION: fn_17222
// INLINED
void WindowRetirement::DrainPending(
const std::deque<UIWindow*>& modal, UIWindow*& reference_4F16C, WindowAncestry*& capture, WindowAncestry*& input, WindowAncestry*& hover
) {