Decompile 47 functions in Source/Client/ClientOptions.cpp, Source/Client/Session.h, ...
Batch #1675 by ragnarok-clanker: 2 byte-identical, 45 confirmed by peer review. - fn_10839 UIButton::Slot25: logic confirmed by peer review - fn_10852 UIButton::Slot31: logic confirmed by peer review - fn_10868 UIButton::Slot27: logic confirmed by peer review - fn_10930 UIStaticBitmap::SetBitmap: logic confirmed by peer review - fn_10931 UIBitmapButton::SetBitmap: logic confirmed by peer review - fn_11320 UIComboBoxEx2::Slot15: logic confirmed by peer review - fn_11326 UIListBox::Slot15: logic confirmed by peer review - fn_11327 UIListBoxEx::Slot15: logic confirmed by peer review - fn_11381 UIScrollBar::Paint: logic confirmed by peer review - fn_11383 UIScrollBar_Navi::Paint: logic confirmed by peer review - fn_11425 UIScrollBar::Slot25: logic confirmed by peer review - fn_11440 UIScrollBar::Slot31: logic confirmed by peer review - fn_11445 UITextButton::Slot31: logic confirmed by peer review - fn_11468 UIScrollBar::Slot27: logic confirmed by peer review - fn_11471 UITextButton::Slot27: logic confirmed by peer review - fn_11494 UITextButton::Slot33: logic confirmed by peer review - fn_11779 UIFrameWnd::Slot25: logic confirmed by peer review - fn_11781 UIFrameWnd::Slot31: logic confirmed by peer review - fn_11786 UIFrameWnd::Slot27: logic confirmed by peer review - fn_12610 CSession::GetOption: logic confirmed by peer review - fn_12689 ActivateShortcut: logic confirmed by peer review - fn_12711 ShortcutTooltip::Hover: logic confirmed by peer review - fn_12724 ShortcutDetails::Open: logic confirmed by peer review (already on main) - fn_12760 UIShortCutWnd::SendMsg: logic confirmed by peer review - fn_17144 UIWindowMgr::RemoveOrder: logic confirmed by peer review - fn_17158 UIWindowMgr::Capture: byte-identical - fn_17180 UIWindowMgr::BringToFront: logic confirmed by peer review - fn_17192 UIWindowMgr::IsOrderFixed: logic confirmed by peer review - fn_17232 UIWindowMgr::ReleaseCapture: byte-identical - fn_17255 UIWindowMgr::SetCapture: logic confirmed by peer review - fn_20382 CConnection::CConnection: logic confirmed by peer review - fn_20383 CRagConnection::CRagConnection: logic confirmed by peer review - fn_20384 CConnection::~CConnection: logic confirmed by peer review (already on main) - fn_20389 CConnection::Connect: logic confirmed by peer review - fn_20390 CConnection::Close: logic confirmed by peer review - fn_20409 GetRagConnection: logic confirmed by peer review - fn_21406 AutomaticSkills::Complete: logic confirmed by peer review - fn_03927 CCharacterLinkedUserDataMgr::CompleteLoad: logic confirmed by peer review - fn_03933 CCharacterLinkedUserDataMgr::Save: logic confirmed by peer review - fn_03937 CSession::SetOption: logic confirmed by peer review - fn_11073 UIScrollBar::UIScrollBar: logic confirmed by peer review - fn_11102 UIComboBoxEx2::~UIComboBoxEx2: logic confirmed by peer review (already on main) - fn_09150 AutomaticSkills::DisableAll: logic confirmed by peer review - fn_09153 AutomaticSkills::Use: logic confirmed by peer review - fn_10689 UIBitmapButton::~UIBitmapButton: logic confirmed by peer review (already on main) - fn_10795 UIBitmapButton::Paint: logic confirmed by peer review - fn_10817 UIStaticBitmap::Paint: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
8386270904
commit
9aea62bd9b
36 changed files with 122 additions and 165 deletions
|
|
@ -1,14 +1,14 @@
|
|||
#include "Client/ClientOptions.h"
|
||||
#include "Client/Session.h"
|
||||
|
||||
// OFFSET: 0x0091BE20
|
||||
// FUNCTION: fn_12610
|
||||
int ClientOptions::Get(int id) const {
|
||||
return static_cast<int>(this->values.Get(id));
|
||||
int CSession::GetOption(int id) const {
|
||||
return static_cast<int>(this->m_options.Get(id));
|
||||
}
|
||||
|
||||
// OFFSET: 0x005E7970
|
||||
// FUNCTION: fn_03937
|
||||
void ClientOptions::Set(int id, int value, int extra) {
|
||||
void CSession::SetOption(int id, int value, int extra) {
|
||||
const std::uint64_t bits = static_cast<std::uint32_t>(value) | (static_cast<std::uint64_t>(extra) << 32);
|
||||
this->values.Set(id, static_cast<std::int64_t>(bits));
|
||||
this->m_options.Set(id, static_cast<std::int64_t>(bits));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef RAGNAROK_SOURCE_CLIENT_SESSION_H
|
||||
#define RAGNAROK_SOURCE_CLIENT_SESSION_H
|
||||
|
||||
#include "Contents/InstantVar.h"
|
||||
#include "Contents/Items/ItemInfo.h"
|
||||
#include "Contents/Skills/PlayerSkillBundle.h"
|
||||
#include "Contents/UserData/NormalItemSlots.h"
|
||||
|
|
@ -129,7 +130,9 @@ public:
|
|||
/* 616C */ std::vector<int> unknown_616C;
|
||||
/* 6178 */ unsigned char unknown_6178[0x1D68];
|
||||
/* 7EE0 */ std::map<int, RobeAlpha> m_robeAlpha;
|
||||
/* 7EE8 */ unsigned char unknown_7EE8[0x1CC];
|
||||
/* 7EE8 */ unsigned char unknown_7EE8[0xC0];
|
||||
/* 7FA8 */ CInstantVar m_options;
|
||||
/* 7FB4 */ unsigned char unknown_7FB4[0x100];
|
||||
/* 80B4 */ std::map<std::string, int> m_nameToId;
|
||||
/* 80BC */ std::map<int, SessionShop> m_shops;
|
||||
/* 80C4 */ unsigned char unknown_80C4[0x58];
|
||||
|
|
@ -140,6 +143,8 @@ public:
|
|||
/* 8140 */ std::int64_t m_loginTimeTicks;
|
||||
/* 8148 */ int unknown_8148;
|
||||
|
||||
int GetOption(int id) const;
|
||||
void SetOption(int id, int value, int extra);
|
||||
std::uint32_t GetServerTime();
|
||||
std::uint32_t AddPingSample(std::uint32_t sample);
|
||||
std::uint32_t SetServerTime(std::uint32_t serverTime);
|
||||
|
|
@ -223,6 +228,8 @@ static_assert(sizeof(SessionRecord6144) == 0x38);
|
|||
static_assert(offsetof(SessionRecord6144, unknown_002C) == 0x2C);
|
||||
static_assert(offsetof(SessionRecord6144, unknown_0030) == 0x30);
|
||||
static_assert(offsetof(CSession, m_additionalSkills) == 0x4);
|
||||
static_assert(offsetof(CSession, m_options) == 0x7FA8);
|
||||
static_assert(offsetof(CSession, m_nameToId) == 0x80B4);
|
||||
static_assert(offsetof(CSession, m_level) == 0x1650);
|
||||
static_assert(offsetof(CSession, m_hotkeyPage) == 0xBC);
|
||||
static_assert(offsetof(CSession, m_pairValues) == 0x5BF4);
|
||||
|
|
@ -239,7 +246,6 @@ static_assert(offsetof(CSession, m_navigationPlayerMap) == 0x160C);
|
|||
static_assert(offsetof(CSession, unknown_1738) == 0x1738);
|
||||
static_assert(offsetof(CSession, unknown_1740) == 0x1740);
|
||||
static_assert(offsetof(CSession, m_itemSlots) == 0x4860);
|
||||
static_assert(offsetof(CSession, m_nameToId) == 0x80B4);
|
||||
static_assert(offsetof(CSession, m_shops) == 0x80BC);
|
||||
static_assert(offsetof(CSession, unknown_8134) == 0x8134);
|
||||
static_assert(offsetof(CSession, m_skillBundle) == 0xC);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "Contents/Skills/AutomaticSkills.h"
|
||||
#include "Client/Session.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -64,9 +65,9 @@ void AutomaticSkills::DisableAll() {
|
|||
for (int id : this->m_ids) {
|
||||
const auto skill = static_cast<std::int16_t>(id);
|
||||
const int option = ActiveOption(skill);
|
||||
if (this->m_context->options.Get(option) != 0) {
|
||||
if (g_session.GetOption(option) != 0) {
|
||||
Cancel(this->m_context->connection, skill);
|
||||
this->m_context->options.Set(option, 0, 0);
|
||||
g_session.SetOption(option, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -83,12 +84,12 @@ void AutomaticSkills::Use(std::int16_t id, std::int16_t level, std::uint32_t tar
|
|||
this->m_context->connection.Send(sizeof(packet), packet);
|
||||
const int cancel = AutomaticSkills::CancelOption(id);
|
||||
|
||||
if (this->m_context->options.Get(cancel) != 0) {
|
||||
if (g_session.GetOption(cancel) != 0) {
|
||||
Cancel(this->m_context->connection, id);
|
||||
this->m_context->options.Set(cancel, 0, 0);
|
||||
g_session.SetOption(cancel, 0, 0);
|
||||
} else {
|
||||
this->m_context->activeKey = this->m_context->currentKey;
|
||||
this->m_context->options.Set(ActiveOption(id), 1, 0);
|
||||
g_session.SetOption(ActiveOption(id), 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +97,6 @@ void AutomaticSkills::Use(std::int16_t id, std::int16_t level, std::uint32_t tar
|
|||
// FUNCTION: fn_21406
|
||||
void AutomaticSkills::Complete(int id) {
|
||||
if (this->Contains(id)) {
|
||||
this->m_context->options.Set(AutomaticSkills::CancelOption(static_cast<std::int16_t>(id)), 0, 0);
|
||||
g_session.m_options.Set(AutomaticSkills::CancelOption(static_cast<std::int16_t>(id)), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <set>
|
||||
|
||||
struct AutomaticSkillContext {
|
||||
ClientOptions& options;
|
||||
CConnection& connection;
|
||||
int& activeKey;
|
||||
const int& currentKey;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "Client/ClientOptions.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Contents/Async/AsyncWorkMgr.h"
|
||||
#include "Contents/UserData/CharacterConfigLoad.h"
|
||||
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
|
||||
|
|
@ -32,8 +32,8 @@ void CCharacterLinkedUserDataMgr::CompleteLoad(
|
|||
|
||||
if (type == 4) {
|
||||
context.registry.Load();
|
||||
context.options.Set(7, 1, 0);
|
||||
context.options.Set(8, 1, 0);
|
||||
g_session.SetOption(7, 1, 0);
|
||||
g_session.SetOption(8, 1, 0);
|
||||
this->m_loaded = true;
|
||||
} else if (type == 1) {
|
||||
Json::Value& data = root["data"];
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ struct NormalItemSlot;
|
|||
struct NormalItemSlotWindow;
|
||||
struct ShortcutVisibility;
|
||||
struct ServiceOptions;
|
||||
struct ClientOptions;
|
||||
struct SkillLevelRegistry;
|
||||
class WindowManagerWindows;
|
||||
|
||||
|
|
@ -13,7 +12,6 @@ struct CharacterConfigLoad {
|
|||
int* useLevels;
|
||||
int* homunculusLevels;
|
||||
ServiceOptions& serviceOptions;
|
||||
ClientOptions& options;
|
||||
SkillLevelRegistry& registry;
|
||||
bool& sortPrivate;
|
||||
NormalItemSlot* items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Client/Session.h"
|
||||
#include "Client/ClientOptions.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Contents/Async/AsyncWorkMgr.h"
|
||||
#include "Contents/UserData/CharacterConfigSave.h"
|
||||
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
|
||||
|
|
@ -40,7 +40,7 @@ void CCharacterLinkedUserDataMgr::Save(CharacterConfigSave& context, const char*
|
|||
Json::Value root;
|
||||
Json::Value data;
|
||||
|
||||
if (context.options.Get(7) != 0) {
|
||||
if (g_session.GetOption(7) != 0) {
|
||||
Json::Value values;
|
||||
|
||||
context.skills.ForEachGrouped([&](CSkillInfo* skill) {
|
||||
|
|
@ -59,7 +59,7 @@ void CCharacterLinkedUserDataMgr::Save(CharacterConfigSave& context, const char*
|
|||
data["UseSkillInfo"] = values;
|
||||
}
|
||||
|
||||
if (context.options.Get(8) != 0) {
|
||||
if (g_session.GetOption(8) != 0) {
|
||||
Json::Value values;
|
||||
|
||||
for (const CSkillInfo& skill : context.homunculusSkills) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <list>
|
||||
|
||||
class CPlayerSkillBundle;
|
||||
struct ClientOptions;
|
||||
struct ServiceOptions;
|
||||
struct NormalItemSlot;
|
||||
struct NormalItemSlotWindow;
|
||||
|
|
@ -17,7 +16,6 @@ struct CharacterConfigSave {
|
|||
const int* useLevels;
|
||||
const int* additionalLevels;
|
||||
const int* homunculusLevels;
|
||||
const ClientOptions& options;
|
||||
const ServiceOptions& serviceOptions;
|
||||
const bool& sortPrivate;
|
||||
const NormalItemSlot* items;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#include "Client/Application/ErrorDialog.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Network/Connection/Connection.h"
|
||||
#include "Network/Connection/ConnectionRuntime.h"
|
||||
#include "Network/Packets/PacketLengths.h"
|
||||
#include "Render/DeviceContext/DCSurface.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
|
|
@ -12,7 +14,7 @@
|
|||
|
||||
// OFFSET: 0x00C7C110
|
||||
// FUNCTION: fn_20382
|
||||
CConnection::CConnection(ConnectionContext& context) : m_socket(INVALID_SOCKET), m_deferred(0), m_sendDeadline(0), m_context(&context) {
|
||||
CConnection::CConnection() : m_socket(INVALID_SOCKET), m_deferred(0), m_sendDeadline(0) {
|
||||
this->m_input.Reset(0xA000);
|
||||
this->m_output.Reset(0xA000);
|
||||
this->m_pending.Reset(0xA000);
|
||||
|
|
@ -25,7 +27,7 @@ CConnection::~CConnection() = default;
|
|||
|
||||
// OFFSET: 0x00C7C1C0
|
||||
// FUNCTION: fn_20383
|
||||
CRagConnection::CRagConnection(ConnectionContext& context) : CConnection(context), unknown_006C(0) {
|
||||
CRagConnection::CRagConnection() : unknown_006C(0) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x00C7C370
|
||||
|
|
@ -56,7 +58,7 @@ bool CConnection::Connect(const ConnectionEndpoint& endpoint) {
|
|||
u_long nonblocking = 1;
|
||||
|
||||
if (ioctlsocket(this->m_socket, FIONBIO, &nonblocking) == SOCKET_ERROR) {
|
||||
ShowErrorDialog(this->m_context->renderSystem, "Failed to setup select mode", 0);
|
||||
ShowErrorDialog(GetRenderSystemHolder()->system, "Failed to setup select mode", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -83,13 +85,6 @@ bool CConnection::Connect(const ConnectionEndpoint& endpoint) {
|
|||
}
|
||||
|
||||
this->m_address.sin_port = htons(static_cast<u_short>(port));
|
||||
ConnectionAddressCache& cache = this->m_context->addressCache;
|
||||
if (cache.session != this->m_context->session || cache.address == 0) {
|
||||
cache.address = this->m_address.sin_addr.s_addr;
|
||||
cache.session = this->m_context->session;
|
||||
}
|
||||
|
||||
this->m_address.sin_addr.s_addr = cache.address;
|
||||
if (connect(this->m_socket, reinterpret_cast<const sockaddr*>(&this->m_address), sizeof(this->m_address)) != SOCKET_ERROR ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
this->m_status = 0;
|
||||
|
|
@ -111,7 +106,7 @@ void CConnection::Close() {
|
|||
}
|
||||
|
||||
this->m_status = 0;
|
||||
this->m_context->options.Set(5, 0, 0);
|
||||
g_session.m_options.Set(5, 0);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00C7CA40
|
||||
|
|
@ -302,9 +297,9 @@ void CConnection::SetDeferred(unsigned char value) {
|
|||
|
||||
// OFFSET: 0x00C7D7D0
|
||||
// FUNCTION: fn_20409
|
||||
CRagConnection& GetRagConnection(ConnectionContext& context) {
|
||||
CRagConnection& GetRagConnection() {
|
||||
// STATIC: 0x016FDC98
|
||||
// GLOBAL: gl_24490
|
||||
static CRagConnection connection(context);
|
||||
static CRagConnection connection;
|
||||
return connection;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
#ifndef RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
|
||||
#define RAGNAROK_SOURCE_NETWORK_CONNECTION_CONNECTION_H
|
||||
|
||||
#include "Client/ClientOptions.h"
|
||||
#include "Network/Connection/ConnectionBuffer.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
class CRenderSystemBase;
|
||||
class PacketLengths;
|
||||
|
||||
struct ConnectionEndpoint {
|
||||
|
|
@ -15,21 +13,9 @@ struct ConnectionEndpoint {
|
|||
const char* overrideAddress;
|
||||
};
|
||||
|
||||
struct ConnectionAddressCache {
|
||||
unsigned address = 0;
|
||||
unsigned session = 0xFFFFFFFFu;
|
||||
};
|
||||
|
||||
struct ConnectionContext {
|
||||
ClientOptions& options;
|
||||
const unsigned& session;
|
||||
ConnectionAddressCache& addressCache;
|
||||
CRenderSystemBase* renderSystem;
|
||||
};
|
||||
|
||||
class CConnection {
|
||||
public:
|
||||
explicit CConnection(ConnectionContext& context);
|
||||
CConnection();
|
||||
virtual ~CConnection();
|
||||
virtual bool Connect(const ConnectionEndpoint& endpoint);
|
||||
void Close();
|
||||
|
|
@ -68,23 +54,22 @@ protected:
|
|||
/* 0024 */ ConnectionBuffer m_output;
|
||||
/* 003C */ ConnectionBuffer m_input;
|
||||
/* 0054 */ ConnectionBuffer m_pending;
|
||||
ConnectionContext* m_context;
|
||||
};
|
||||
|
||||
class CRagConnection : public CConnection {
|
||||
public:
|
||||
explicit CRagConnection(ConnectionContext& context);
|
||||
CRagConnection();
|
||||
~CRagConnection() override;
|
||||
|
||||
private:
|
||||
/* 006C */ unsigned char unknown_006C;
|
||||
};
|
||||
|
||||
CRagConnection& GetRagConnection(ConnectionContext& context);
|
||||
CRagConnection& GetRagConnection();
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(CConnection) == 112);
|
||||
static_assert(sizeof(CRagConnection) == 116);
|
||||
static_assert(sizeof(CConnection) == 0x6C);
|
||||
static_assert(sizeof(CRagConnection) == 0x70);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ UIBitmapButton::~UIBitmapButton() = default;
|
|||
// OFFSET: 0x008657A0
|
||||
// FUNCTION: fn_10931
|
||||
bool UIBitmapButton::SetBitmap(const char* name, int state, unsigned char exactSize) {
|
||||
CBitmapRes* bitmap = static_cast<CBitmapRes*>(this->m_buttonContext->resources.Load(name));
|
||||
CBitmapRes* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(name));
|
||||
if (!bitmap) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -48,18 +48,18 @@ void UIBitmapButton::Paint() {
|
|||
|
||||
switch (this->geometry.unknown_0030) {
|
||||
case 0:
|
||||
bitmap = static_cast<CBitmapRes*>(this->m_buttonContext->resources.Load(this->m_names[0].c_str()));
|
||||
bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[0].c_str()));
|
||||
break;
|
||||
case 1:
|
||||
bitmap = static_cast<CBitmapRes*>(this->m_buttonContext->resources.Load(this->m_names[1].c_str()));
|
||||
bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[1].c_str()));
|
||||
break;
|
||||
case 2:
|
||||
bitmap = static_cast<CBitmapRes*>(this->m_buttonContext->resources.Load(this->m_names[2].c_str()));
|
||||
bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[2].c_str()));
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->m_disabled != 0 && !this->m_names[3].empty()) {
|
||||
bitmap = static_cast<CBitmapRes*>(this->m_buttonContext->resources.Load(this->m_names[3].c_str()));
|
||||
bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->m_names[3].c_str()));
|
||||
}
|
||||
|
||||
this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "Resource/Bitmap/BitmapResource.h"
|
||||
#include "Resource/ResourceMgr.h"
|
||||
#include "Script/LuaScript.h"
|
||||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
#include "UI/Buttons/UIButton.h"
|
||||
#include "UI/Window/WindowPolicy.h"
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ void UIButton::Slot25(int, int) {
|
|||
return;
|
||||
}
|
||||
|
||||
this->m_buttonContext->focus.Set(this);
|
||||
g_windowMgr.SetCapture(this);
|
||||
this->geometry.unknown_0030 = 2;
|
||||
this->Invalidate();
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ void UIButton::Slot27(int x, int y) {
|
|||
|
||||
unsigned state = 0;
|
||||
if (x >= 0 && x < this->geometry.width && y >= 0 && y < this->geometry.height) {
|
||||
state = this->m_buttonContext->focus.Get() == this ? 2 : 1;
|
||||
state = g_windowMgr.Capture() == this ? 2 : 1;
|
||||
}
|
||||
|
||||
if (this->geometry.unknown_0030 != state) {
|
||||
|
|
@ -144,16 +144,15 @@ void UIButton::ResetCursor(int, int) {
|
|||
// OFFSET: 0x03DE9C61
|
||||
// FUNCTION: fn_10852
|
||||
void UIButton::Slot31(int x, int y) {
|
||||
FrameFocus& focus = this->m_buttonContext->focus;
|
||||
if (this->m_disabled != 0) {
|
||||
if (focus.Get() == this) {
|
||||
focus.Clear();
|
||||
if (g_windowMgr.Capture() == this) {
|
||||
g_windowMgr.ReleaseCapture();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (focus.Get() != this) {
|
||||
if (g_windowMgr.Capture() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +185,7 @@ void UIButton::Slot31(int x, int y) {
|
|||
}
|
||||
|
||||
this->Invalidate();
|
||||
focus.Clear();
|
||||
g_windowMgr.ReleaseCapture();
|
||||
}
|
||||
|
||||
// OFFSET: 0x005FEAF0
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class FrameFocus;
|
||||
class ResourceMgr;
|
||||
class LuaScript;
|
||||
class FontCache;
|
||||
|
|
@ -23,7 +22,6 @@ protected:
|
|||
};
|
||||
|
||||
struct UIButtonContext {
|
||||
FrameFocus& focus;
|
||||
ResourceMgr& resources;
|
||||
LuaScript& behavior;
|
||||
FontCache& fonts;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Render/DeviceContext/DeviceContext.h"
|
||||
#include "Render/Text/TextContext.h"
|
||||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
#include "UI/Buttons/UIItemTagButton.h"
|
||||
#include "UI/Buttons/UITextButton.h"
|
||||
#include "UI/Lists/UITreeView.h"
|
||||
|
|
@ -82,7 +82,7 @@ void UITextButton::Slot27(int x, int y) {
|
|||
}
|
||||
|
||||
const bool inside = x >= 0 && x < this->geometry.width && y >= 0 && y < this->geometry.height;
|
||||
const unsigned state = inside ? (this->m_buttonContext->focus.Get() == this ? 2 : 1) : 0;
|
||||
const unsigned state = inside ? (g_windowMgr.Capture() == this ? 2 : 1) : 0;
|
||||
this->m_color = inside ? this->m_hoverColor : this->m_normalColor;
|
||||
|
||||
if (this->geometry.unknown_0030 != state) {
|
||||
|
|
@ -104,9 +104,8 @@ void UITextButton::Slot28(int x, int y) {
|
|||
// OFFSET: 0x00891140
|
||||
// FUNCTION: fn_11445
|
||||
void UITextButton::Slot31(int x, int y) {
|
||||
FrameFocus& focus = this->m_buttonContext->focus;
|
||||
|
||||
if (this->m_disabled != 0 || focus.Get() != this) {
|
||||
if (this->m_disabled != 0 || g_windowMgr.Capture() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -117,13 +116,13 @@ void UITextButton::Slot31(int x, int y) {
|
|||
|
||||
if (this->parent) {
|
||||
this->parent->SendMsg(this, 98, this->geometry.id, this->m_value, 0, 0);
|
||||
focus.Clear();
|
||||
g_windowMgr.ReleaseCapture();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->Invalidate();
|
||||
focus.Clear();
|
||||
g_windowMgr.ReleaseCapture();
|
||||
}
|
||||
|
||||
// OFFSET: 0x00892B60
|
||||
|
|
@ -141,9 +140,8 @@ void UITextButton::Slot32(int, int) {
|
|||
// OFFSET: 0x00892D60
|
||||
// FUNCTION: fn_11494
|
||||
void UITextButton::Slot33(int x, int y) {
|
||||
FrameFocus& focus = this->m_buttonContext->focus;
|
||||
|
||||
if (this->m_disabled != 0 || focus.Get() != this) {
|
||||
if (this->m_disabled != 0 || g_windowMgr.Capture() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +156,7 @@ void UITextButton::Slot33(int x, int y) {
|
|||
}
|
||||
|
||||
this->Invalidate();
|
||||
focus.Clear();
|
||||
g_windowMgr.ReleaseCapture();
|
||||
}
|
||||
|
||||
// OFFSET: 0x00892F30
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ UIComboBoxEx2::~UIComboBoxEx2() = default;
|
|||
// FUNCTION: fn_11320
|
||||
void UIComboBoxEx2::Slot15(int width, int height) {
|
||||
auto& list = *this->m_listContext;
|
||||
auto* vertical = new UIScrollBar_Navi(*this->m_context, list.capture, list.resources);
|
||||
auto* vertical = new UIScrollBar_Navi(*this->m_context);
|
||||
this->verticalBar = vertical;
|
||||
vertical->vertical = 1;
|
||||
vertical->UIWindow::Resize(vertical->thickness, height);
|
||||
|
|
@ -286,7 +286,7 @@ void UIComboBoxEx2::Slot15(int width, int height) {
|
|||
vertical->Slot22(vertical->thickness, height);
|
||||
this->AddChild(vertical);
|
||||
|
||||
auto* horizontal = new UIScrollBar(*this->m_context, list.capture, list.resources);
|
||||
auto* horizontal = new UIScrollBar(*this->m_context);
|
||||
this->horizontalBar = horizontal;
|
||||
horizontal->vertical = 0;
|
||||
horizontal->UIWindow::Resize((width - 7), horizontal->thickness);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ void UIListBox::Configure(int x, int y, int width, int height, unsigned char val
|
|||
// OFFSET: 0x00886840
|
||||
// FUNCTION: fn_11326
|
||||
void UIListBox::Slot15(int width, int height) {
|
||||
auto& owner = *this->m_listContext;
|
||||
auto* vertical = new UIScrollBar(*this->m_context, owner.capture, owner.resources);
|
||||
auto* vertical = new UIScrollBar(*this->m_context);
|
||||
this->verticalBar = vertical;
|
||||
const int verticalWidth = vertical->thickness;
|
||||
vertical->vertical = 1;
|
||||
|
|
@ -57,7 +56,7 @@ void UIListBox::Slot15(int width, int height) {
|
|||
vertical->Slot22(verticalWidth, height);
|
||||
this->AddChild(vertical);
|
||||
|
||||
auto* horizontal = new UIScrollBar(*this->m_context, owner.capture, owner.resources);
|
||||
auto* horizontal = new UIScrollBar(*this->m_context);
|
||||
this->horizontalBar = horizontal;
|
||||
const int horizontalHeight = horizontal->thickness;
|
||||
horizontal->vertical = 0;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void UIListBoxEx::Configure(int x, int y, int width, int height, unsigned char v
|
|||
// FUNCTION: fn_11327
|
||||
void UIListBoxEx::Slot15(int width, int height) {
|
||||
auto& owner = *this->m_listContext;
|
||||
auto* vertical = new UIScrollBar(*this->m_context, owner.capture, owner.resources);
|
||||
auto* vertical = new UIScrollBar(*this->m_context);
|
||||
this->verticalBar = vertical;
|
||||
const int thickness = vertical->thickness;
|
||||
vertical->vertical = 1;
|
||||
|
|
@ -52,7 +52,7 @@ void UIListBoxEx::Slot15(int width, int height) {
|
|||
vertical->Slot22(thickness, height);
|
||||
this->AddChild(vertical);
|
||||
|
||||
auto* horizontal = new UIScrollBar(*this->m_context, owner.capture, owner.resources);
|
||||
auto* horizontal = new UIScrollBar(*this->m_context);
|
||||
this->horizontalBar = horizontal;
|
||||
const int horizontalHeight = horizontal->thickness;
|
||||
horizontal->vertical = 0;
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
#include "Render/DeviceContext/DeviceContext.h"
|
||||
#include "Resource/Bitmap/BitmapResource.h"
|
||||
#include "Resource/ResourceMgr.h"
|
||||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
#include "UI/Lists/UIScrollBar.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// OFFSET: 0x0086E550
|
||||
// FUNCTION: fn_11073
|
||||
UIScrollBar::UIScrollBar(UIWindowContext& windows, FrameFocus& capture, ResourceMgr& resources)
|
||||
UIScrollBar::UIScrollBar(UIWindowContext& windows)
|
||||
: 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) {
|
||||
thickness(13), minimumThumb(1), horizontalStep(1), verticalStep(1) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x00873FA0
|
||||
|
|
@ -131,7 +131,7 @@ void UIScrollBar::Slot25(int x, int y) {
|
|||
owner->SendMsg(this, vertical ? 9 : 11, 0, 0, 0, 0);
|
||||
break;
|
||||
case 2:
|
||||
this->m_capture->Set(this);
|
||||
g_windowMgr.SetCapture(this);
|
||||
this->state = 6;
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -199,7 +199,7 @@ void UIScrollBar::Slot27(int x, int y) {
|
|||
this->Invalidate();
|
||||
}
|
||||
|
||||
if (this->m_capture->Get() == this && owner && (this->vertical == 0 || this->vertical == 1)) {
|
||||
if (g_windowMgr.Capture() == this && owner && (this->vertical == 0 || this->vertical == 1)) {
|
||||
const int distance = this->vertical == 0 ? (x - this->pressX) : (y - this->pressY);
|
||||
const int delta = ((distance * (this->maximum + 1)) / this->Travel() - this->dragAmount);
|
||||
|
||||
|
|
@ -221,8 +221,8 @@ void UIScrollBar::ResetCursor(int, int) {
|
|||
// FUNCTION: fn_11440
|
||||
void UIScrollBar::Slot31(int x, int y) {
|
||||
if (this->maximum != 0) {
|
||||
if (this->m_capture->Get() == this) {
|
||||
this->m_capture->Clear();
|
||||
if (g_windowMgr.Capture() == this) {
|
||||
g_windowMgr.ReleaseCapture();
|
||||
}
|
||||
} else {
|
||||
this->parent->Slot31((x + this->geometry.x), (y + this->geometry.y));
|
||||
|
|
@ -259,7 +259,7 @@ void UIScrollBar::Paint() {
|
|||
const int length = vertical ? this->geometry.height : this->geometry.width;
|
||||
const auto draw = [&](const char* name, int coordinate, bool transparent) {
|
||||
const std::string path = std::string(prefix) + name;
|
||||
auto* bitmap = static_cast<CBitmapRes*>(this->m_resources->Load(path.c_str()));
|
||||
auto* bitmap = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(path.c_str()));
|
||||
this->DrawBitmap(vertical ? 0 : coordinate, vertical ? coordinate : 0, bitmap ? &bitmap->image : nullptr, transparent);
|
||||
};
|
||||
draw(vertical ? "scroll0up.bmp" : "scroll1left.bmp", 1, false);
|
||||
|
|
|
|||
|
|
@ -3,12 +3,9 @@
|
|||
|
||||
#include "UI/Window/UIWindow.h"
|
||||
|
||||
struct FrameFocus;
|
||||
class ResourceMgr;
|
||||
|
||||
class UIScrollBar : public UIWindow {
|
||||
public:
|
||||
UIScrollBar(UIWindowContext& windows, FrameFocus& capture, ResourceMgr& resources);
|
||||
explicit UIScrollBar(UIWindowContext& windows);
|
||||
~UIScrollBar() override;
|
||||
void Resize(int width, int height) override;
|
||||
bool Slot08() override;
|
||||
|
|
@ -41,14 +38,10 @@ public:
|
|||
/* 00A8 */ int minimumThumb;
|
||||
/* 00AC */ int horizontalStep;
|
||||
/* 00B0 */ int verticalStep;
|
||||
|
||||
private:
|
||||
FrameFocus* m_capture;
|
||||
ResourceMgr* m_resources;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(UIScrollBar) == 192);
|
||||
static_assert(sizeof(UIScrollBar) == sizeof(UIWindow) + 0x38);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
#include "UI/Lists/UIScrollBarNavi.h"
|
||||
|
||||
// INLINED
|
||||
UIScrollBar_Navi::UIScrollBar_Navi(UIWindowContext& windows, FrameFocus& focus, ResourceMgr& resources)
|
||||
: UIScrollBar(windows, focus, resources), m_resources(&resources) {
|
||||
UIScrollBar_Navi::UIScrollBar_Navi(UIWindowContext& windows) : UIScrollBar(windows) {
|
||||
this->arrowLength = 7;
|
||||
this->thickness = 7;
|
||||
}
|
||||
|
|
@ -24,7 +23,7 @@ void UIScrollBar_Navi::Paint() {
|
|||
|
||||
if (this->vertical == 1) {
|
||||
constexpr char prefix[] = "유저인터페이스\\navigation_interface3\\";
|
||||
const auto load = [&](const char* name) { return static_cast<CBitmapRes*>(this->m_resources->Load((std::string(prefix) + name).c_str())); };
|
||||
const auto load = [&](const char* name) { return static_cast<CBitmapRes*>(ResourceMgr::Instance().Load((std::string(prefix) + name).c_str())); };
|
||||
const auto draw = [&](CBitmapRes* image, int y, bool transparent) { this->DrawBitmap(0, y, image ? &image->image : nullptr, transparent); };
|
||||
auto* up = load("Navi_scroll_up.bmp");
|
||||
auto* middle = load("Navi_scroll_mid.bmp");
|
||||
|
|
|
|||
|
|
@ -5,16 +5,13 @@
|
|||
|
||||
class UIScrollBar_Navi : public UIScrollBar {
|
||||
public:
|
||||
UIScrollBar_Navi(UIWindowContext& windows, FrameFocus& focus, ResourceMgr& resources);
|
||||
explicit UIScrollBar_Navi(UIWindowContext& windows);
|
||||
~UIScrollBar_Navi() override;
|
||||
void Paint() override;
|
||||
|
||||
private:
|
||||
ResourceMgr* m_resources;
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(UIScrollBar_Navi) == 196);
|
||||
static_assert(sizeof(UIScrollBar_Navi) == sizeof(UIScrollBar));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "Client/ClientOptions.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Contents/Skills/AutomaticSkills.h"
|
||||
#include "UI/Shortcuts/ShortcutActivation.h"
|
||||
#include "UI/Window/UIWindow.h"
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
// FUNCTION: fn_12689
|
||||
void ActivateShortcut(
|
||||
UIWindow& window, ShortcutGrid& grid, int x, int y, bool itemSlotActive, unsigned char& currentRow, const NormalItemSlot* const* slots,
|
||||
AutomaticSkills& automatic, ClientOptions& options
|
||||
AutomaticSkills& automatic
|
||||
) {
|
||||
const int column = grid.HitTest(x, y, itemSlotActive, currentRow);
|
||||
if (column == -1) {
|
||||
|
|
@ -22,7 +22,7 @@ void ActivateShortcut(
|
|||
|
||||
const NormalItemSlot& slot = *slots[index];
|
||||
if (slot.unknown_0000 != 0 && automatic.Contains(static_cast<std::uint16_t>(slot.itemId))) {
|
||||
options.Set(AutomaticSkills::CancelOption(static_cast<std::int16_t>(slot.itemId)), 1, 0);
|
||||
g_session.SetOption(AutomaticSkills::CancelOption(static_cast<std::int16_t>(slot.itemId)), 1, 0);
|
||||
} else {
|
||||
automatic.DisableAll();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
#include "UI/Shortcuts/ShortcutGrid.h"
|
||||
|
||||
class AutomaticSkills;
|
||||
struct ClientOptions;
|
||||
class UIWindow;
|
||||
|
||||
void ActivateShortcut(
|
||||
UIWindow& window, ShortcutGrid& grid, int x, int y, bool itemSlotActive, unsigned char& currentRow, const NormalItemSlot* const* slots,
|
||||
AutomaticSkills& automatic, ClientOptions& options
|
||||
AutomaticSkills& automatic
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
class UIWindow;
|
||||
struct ShortcutVisibility;
|
||||
struct ClientOptions;
|
||||
struct ShortcutCooldowns;
|
||||
|
||||
struct ShortcutControlEvents {
|
||||
|
|
@ -14,7 +13,6 @@ struct ShortcutControlEvents {
|
|||
ShortcutGrid& grid;
|
||||
ShortcutControls& controls;
|
||||
ShortcutVisibility& visibility;
|
||||
ClientOptions& options;
|
||||
ShortcutCooldowns& cooldowns;
|
||||
bool& itemSlotActive;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "UI/Shortcuts/SkillDetailClose.h"
|
||||
#include "UI/Window/UIWindow.h"
|
||||
#include "UI/Window/WindowManagerWindows.h"
|
||||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
|
||||
namespace {
|
||||
|
|
@ -44,7 +43,7 @@ inline bool SkillDetailClose::Close() {
|
|||
this->windowsById.erase(46);
|
||||
|
||||
if (removed) {
|
||||
this->focus.RemoveOrder(46);
|
||||
g_windowMgr.RemoveOrder(46);
|
||||
}
|
||||
|
||||
return removed;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "Client/Session.h"
|
||||
#include "Contents/Hotkeys/HotkeyInfo.h"
|
||||
#include "UI/Shortcuts/ShortcutTooltip.h"
|
||||
#include "UI/Buttons/UIButton.h"
|
||||
|
|
@ -63,7 +64,7 @@ void ShortcutTooltip::Hover(UIWindow& window, ShortcutGrid& grid, int x, int y,
|
|||
}
|
||||
|
||||
HotkeyInfo hotkey;
|
||||
const int bank = this->options.Get(10);
|
||||
const int bank = g_session.GetOption(10);
|
||||
if (bank == 0) {
|
||||
hotkey = GetHotkeyInfo(this->script, 0, index);
|
||||
} else if (bank == 1) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTTOOLTIP_H
|
||||
#define RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTTOOLTIP_H
|
||||
|
||||
#include "Client/ClientOptions.h"
|
||||
#include "Contents/Skills/ClientSkills.h"
|
||||
#include "Contents/Items/ItemInfo.h"
|
||||
#include "Contents/Items/ItemNaming.h"
|
||||
|
|
@ -16,7 +15,6 @@ struct ShortcutTooltip {
|
|||
ClientSkills& skills;
|
||||
const std::list<ItemInfo>& inventory;
|
||||
ItemNaming& naming;
|
||||
ClientOptions& options;
|
||||
LuaScript& script;
|
||||
ButtonServices* services;
|
||||
const bool& itemSlotActive;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTUSE_H
|
||||
#define RAGNAROK_SOURCE_UI_SHORTCUTS_SHORTCUTUSE_H
|
||||
|
||||
#include "Client/ClientOptions.h"
|
||||
#include "Contents/Skills/ClientSkills.h"
|
||||
#include "Contents/Items/ItemInfo.h"
|
||||
#include "Contents/Items/ItemNaming.h"
|
||||
|
|
@ -14,7 +13,6 @@ struct ShortcutUse {
|
|||
ClientSkills& skills;
|
||||
const std::list<ItemInfo>& inventory;
|
||||
ItemNaming& naming;
|
||||
ClientOptions& options;
|
||||
ModeEvents*& mode;
|
||||
ButtonServices& dialogs;
|
||||
const int& itemConfirmationState;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <map>
|
||||
|
||||
class UIWindow;
|
||||
struct FrameFocus;
|
||||
|
||||
struct SkillDetailClose {
|
||||
UIWindow*& window;
|
||||
|
|
@ -17,7 +16,6 @@ struct SkillDetailClose {
|
|||
UIWindow*& reference_4F1D4;
|
||||
std::map<int, UIWindow*>& windowsById;
|
||||
UIWindowMgr& retirement;
|
||||
FrameFocus& focus;
|
||||
|
||||
bool Close();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "Client/ClientOptions.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Client/Mode/ModeDragState.h"
|
||||
#include "Client/Mode/ModeEvents.h"
|
||||
#include "UI/Shortcuts/ShortcutActivation.h"
|
||||
|
|
@ -95,7 +95,7 @@ void UIShortCutWnd::Show(int visible) {
|
|||
// OFFSET: 0x0092A190
|
||||
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);
|
||||
ShortcutControls::Create(*this, *this->m_context, this->m_shortcuts->buttons, g_session.GetOption(10), this->m_slots, this->m_itemSlots);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00932F30
|
||||
|
|
@ -120,8 +120,7 @@ void UIShortCutWnd::Slot25(int x, int y) {
|
|||
// OFFSET: 0x00930900
|
||||
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,
|
||||
this->m_shortcuts->options
|
||||
*this, this->m_grid, x, y, this->m_shortcuts->itemSlotActive, this->m_shortcuts->currentRow, this->m_slots, this->m_shortcuts->automatic
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -174,8 +173,8 @@ inline void ShortcutControlEvents::Click(int id) {
|
|||
return;
|
||||
|
||||
case 549: {
|
||||
const bool checked = this->options.Get(10) == 0;
|
||||
this->options.Set(10, checked ? 1 : 0, 0);
|
||||
const bool checked = g_session.GetOption(10) == 0;
|
||||
g_session.SetOption(10, checked ? 1 : 0, 0);
|
||||
this->controls.bank->geometry.unknown_0030 = checked ? 1 : 0;
|
||||
this->controls.bank->Invalidate();
|
||||
|
||||
|
|
@ -277,7 +276,7 @@ inline void ShortcutLayout::Persist() {
|
|||
|
||||
// INLINED
|
||||
inline void ShortcutUse::Use(const NormalItemSlot& slot) {
|
||||
if (this->options.Get(5) > 0 || slot.itemId == 0) {
|
||||
if (g_session.GetOption(5) > 0 || slot.itemId == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -354,7 +353,7 @@ int UIShortCutWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::
|
|||
|
||||
switch (message) {
|
||||
case 6: {
|
||||
ShortcutControlEvents events{*this, this->m_grid, this->m_controls, owner.visibility, owner.options, owner.bindings.cooldowns, owner.itemSlotActive};
|
||||
ShortcutControlEvents events{*this, this->m_grid, this->m_controls, owner.visibility, owner.bindings.cooldowns, owner.itemSlotActive};
|
||||
events.Click(static_cast<int>(a));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ struct ShortcutDetails;
|
|||
struct ShortcutUse;
|
||||
struct ShortcutVisibility;
|
||||
struct UIButtonContext;
|
||||
struct ClientOptions;
|
||||
struct CooldownClock;
|
||||
struct ModeDragState;
|
||||
struct NormalItemSlot;
|
||||
|
|
@ -23,7 +22,6 @@ class AutomaticSkills;
|
|||
|
||||
struct ShortcutWindowContext {
|
||||
UIButtonContext& buttons;
|
||||
ClientOptions& options;
|
||||
ShortcutBindings& bindings;
|
||||
ShortcutPainting& painting;
|
||||
ShortcutPress& press;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ UIStaticBitmap::~UIStaticBitmap() = default;
|
|||
// FUNCTION: fn_10930
|
||||
void UIStaticBitmap::SetBitmap(const char* name) {
|
||||
this->bitmap = name;
|
||||
const auto* resource = static_cast<CBitmapRes*>(this->m_controls->resources.Load(this->bitmap.c_str()));
|
||||
const auto* resource = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->bitmap.c_str()));
|
||||
this->geometry.width = resource->image.width;
|
||||
this->geometry.height = resource->image.height;
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ void UIStaticBitmap::Paint() {
|
|||
}
|
||||
|
||||
if (this->geometry.unknown_0030 == 0) {
|
||||
const auto* resource = static_cast<CBitmapRes*>(this->m_controls->resources.Load(this->bitmap.c_str()));
|
||||
const auto* resource = static_cast<CBitmapRes*>(ResourceMgr::Instance().Load(this->bitmap.c_str()));
|
||||
this->DrawBitmap(0, 0, resource ? &resource->image : nullptr, false);
|
||||
} else if (this->geometry.unknown_0030 == 1 && this->geometry.surface) {
|
||||
this->geometry.surface->Fill(nullptr, 0xFFFF00FFu);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindow.h"
|
||||
#include "UI/Window/WindowManagerWindows.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ int g_dragWindowId = -1;
|
|||
|
||||
// OFFSET: 0x00A96A60
|
||||
// FUNCTION: fn_17192
|
||||
bool FrameFocus::IsOrderFixed(int id) {
|
||||
bool UIWindowMgr::IsOrderFixed(int id) {
|
||||
static constexpr int fixed[] = {0, 1, 2, 3, 4, 6, 7, 9, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 26, 28, 29, 31, 32,
|
||||
33, 34, 35, 36, 39, 42, 45, 49, 50, 56, 58, 60, 61, 62, 63, 64, 65, 66, 67, 70, 73, 74, 78,
|
||||
79, 80, 81, 90, 91, 94, 95, 99, 100, 101, 104, 105, 107, 109, 111, 115, 116, 123, 124, 127, 128, 130, 131,
|
||||
|
|
@ -18,7 +17,7 @@ bool FrameFocus::IsOrderFixed(int id) {
|
|||
198, 199, 200, 204, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 253, 257, 258, 262, 267, 268, 269,
|
||||
271, 277, 278, 284, 285, 286, 289, 295, 301, 307, 325, 332, 343, 358, 359, 600, 10011, 10032};
|
||||
if (id == 145) {
|
||||
UIWindow* window = this->windows.LookupWindow(145);
|
||||
UIWindow* window = g_windowMgr.LookupWindow(145);
|
||||
return !window || window->geometry.visible == 0;
|
||||
}
|
||||
|
||||
|
|
@ -27,14 +26,14 @@ bool FrameFocus::IsOrderFixed(int id) {
|
|||
|
||||
// OFFSET: 0x00A8F720
|
||||
// FUNCTION: fn_17144
|
||||
void FrameFocus::RemoveOrder(int id) {
|
||||
void UIWindowMgr::RemoveOrder(int id) {
|
||||
if (this->IsOrderFixed(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto entry = this->order.begin(); entry != this->order.end(); ++entry) {
|
||||
for (auto entry = this->windowHistory.begin(); entry != this->windowHistory.end(); ++entry) {
|
||||
if (*entry == id) {
|
||||
this->order.erase(entry);
|
||||
this->windowHistory.erase(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,33 +41,33 @@ void FrameFocus::RemoveOrder(int id) {
|
|||
|
||||
// OFFSET: 0x00A95540
|
||||
// FUNCTION: fn_17180
|
||||
void FrameFocus::BringToFront(int id) {
|
||||
void UIWindowMgr::BringToFront(int id) {
|
||||
if (this->IsOrderFixed(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->RemoveOrder(id);
|
||||
if (id == 203) {
|
||||
this->order.push_back(id);
|
||||
this->windowHistory.push_back(id);
|
||||
} else {
|
||||
this->order.push_front(id);
|
||||
this->windowHistory.push_front(id);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AA9B30
|
||||
// FUNCTION: fn_17255
|
||||
void FrameFocus::Set(UIWindow* window) {
|
||||
this->focused = window;
|
||||
void UIWindowMgr::SetCapture(UIWindow* window) {
|
||||
this->inputWindow = window;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AA66C0
|
||||
// FUNCTION: fn_17232
|
||||
void FrameFocus::Clear() {
|
||||
this->focused = nullptr;
|
||||
void UIWindowMgr::ReleaseCapture() {
|
||||
this->inputWindow = nullptr;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A913F0
|
||||
// FUNCTION: fn_17158
|
||||
UIWindow* FrameFocus::Get() const {
|
||||
return this->focused;
|
||||
UIWindow* UIWindowMgr::Capture() const {
|
||||
return this->inputWindow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "UI/Window/FrameFocus.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
#include "UI/Layout/SnapMgr.h"
|
||||
#include "UI/Buttons/UIBitmapButton.h"
|
||||
#include "UI/Lists/UIReplayListBox.h"
|
||||
|
|
@ -67,11 +67,11 @@ void UIFrameWnd::ToScreen(int& x, int& y) const {
|
|||
// FUNCTION: fn_11779
|
||||
void UIFrameWnd::Slot25(int x, int y) {
|
||||
if (g_dragWindowId != this->geometry.id) {
|
||||
this->m_frameContext->focus.BringToFront(this->geometry.id);
|
||||
g_windowMgr.BringToFront(this->geometry.id);
|
||||
g_dragWindowId = this->geometry.id;
|
||||
}
|
||||
|
||||
this->m_frameContext->focus.Set(this);
|
||||
g_windowMgr.SetCapture(this);
|
||||
this->ToScreen(x, y);
|
||||
this->m_dragX = x;
|
||||
this->m_dragY = y;
|
||||
|
|
@ -85,7 +85,7 @@ void UIFrameWnd::Slot25(int x, int y) {
|
|||
// OFFSET: 0x008BA510
|
||||
// FUNCTION: fn_11786
|
||||
void UIFrameWnd::Slot27(int x, int y) {
|
||||
if (this->m_frameContext->focus.Get() != this || x <= -this->m_frameContext->dragLimitX || y <= -this->m_frameContext->dragLimitY) {
|
||||
if (g_windowMgr.Capture() != this || x <= -this->m_frameContext->dragLimitX || y <= -this->m_frameContext->dragLimitY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -126,14 +126,14 @@ void UIFrameWnd::Slot28(int, int) {
|
|||
// OFFSET: 0x008BA2C0
|
||||
// FUNCTION: fn_11781
|
||||
void UIFrameWnd::Slot31(int, int) {
|
||||
if (this->m_frameContext->focus.Get() != this) {
|
||||
if (g_windowMgr.Capture() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_dragWindowId = -1;
|
||||
this->geometry.targetAlpha = 255;
|
||||
this->geometry.alphaStart = timeGetTime();
|
||||
this->m_frameContext->focus.Clear();
|
||||
g_windowMgr.ReleaseCapture();
|
||||
this->m_frameContext->snapping.graph.Refresh(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@
|
|||
#include "UI/Window/FrameTextCache.h"
|
||||
#include "UI/Window/UIWindow.h"
|
||||
|
||||
struct FrameFocus;
|
||||
struct WindowSnapping;
|
||||
class WindowManagerWindows;
|
||||
class UIBitmapButton;
|
||||
struct UIButtonContext;
|
||||
|
||||
struct UIFrameContext {
|
||||
FrameFocus& focus;
|
||||
WindowSnapping& snapping;
|
||||
WindowManagerWindows& windows;
|
||||
const int& dragLimitX;
|
||||
|
|
|
|||
|
|
@ -437,9 +437,16 @@ public:
|
|||
bool ProcessDialogKey(int unused, int key);
|
||||
void NotifyMode();
|
||||
int SendMsg(int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4, std::intptr_t argument5);
|
||||
bool IsOrderFixed(int id);
|
||||
void RemoveOrder(int id);
|
||||
void BringToFront(int id);
|
||||
void SetCapture(UIWindow* window);
|
||||
void ReleaseCapture();
|
||||
UIWindow* Capture() const;
|
||||
};
|
||||
|
||||
extern UIWindowMgr g_windowMgr;
|
||||
extern int g_dragWindowId;
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(WindowTextEntry) == 0x1C);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue