diff --git a/Source/Client/Input/InputCharset.cpp b/Source/Client/Input/InputCharset.cpp index 50822d1..9653174 100644 --- a/Source/Client/Input/InputCharset.cpp +++ b/Source/Client/Input/InputCharset.cpp @@ -1,5 +1,6 @@ #include "Client/Input/InputCharset.h" #include "Utility/Text/LanguageCharset.h" +#include "Utility/Text/TextTokens.h" #include @@ -10,7 +11,7 @@ const char* InputCharset::Prefix(bool alternate) const { // GLOBAL: gl_24373 static char prefix[8]; - if (this->enabled) { + if (g_inlineCharset) { std::sprintf(prefix, "|%02x", LanguageCharset(alternate ? this->alternateLanguage : this->language)); } else { prefix[0] = '\0'; @@ -21,5 +22,5 @@ const char* InputCharset::Prefix(bool alternate) const { // INLINED unsigned InputCharset::CodePage(unsigned fallback) const { - return this->enabled ? LanguageCodePage(this->language) : fallback; + return g_inlineCharset ? LanguageCodePage(this->language) : fallback; } diff --git a/Source/Client/Input/InputCharset.h b/Source/Client/Input/InputCharset.h index 1539477..7863268 100644 --- a/Source/Client/Input/InputCharset.h +++ b/Source/Client/Input/InputCharset.h @@ -1,18 +1,30 @@ #ifndef RAGNAROK_SOURCE_CLIENT_INPUT_INPUTCHARSET_H #define RAGNAROK_SOURCE_CLIENT_INPUT_INPUTCHARSET_H +#include #include +#include struct InputCharset { - const bool& enabled; - const std::uint16_t& language; - const std::uint16_t& alternateLanguage; + /* 0000 */ unsigned char unknown_0000[0x8E]; + /* 008E */ std::uint16_t language; + /* 0090 */ unsigned char unknown_0090[0xC]; + /* 009C */ std::string servicePrefix; + /* 00B4 */ std::uint16_t alternateLanguage; const char* Prefix(bool alternate) const; + const char* ServiceName(const char* name); + unsigned CodePage(unsigned fallback) const; }; +#if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(InputCharset, language) == 0x8E); +static_assert(offsetof(InputCharset, servicePrefix) == 0x9C); +static_assert(offsetof(InputCharset, alternateLanguage) == 0xB4); +#endif + extern InputCharset* g_serverLanguage; #endif diff --git a/Source/Client/ModeFadeOut.cpp b/Source/Client/ModeFadeOut.cpp index 5156922..86cb4e1 100644 --- a/Source/Client/ModeFadeOut.cpp +++ b/Source/Client/ModeFadeOut.cpp @@ -12,7 +12,7 @@ // OFFSET: 0x00AD6960 // FUNCTION: fn_17847 -std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, TextureCache& textures, ResourceMgr& resources, TextureNames& names, +std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, TextureCache& textures, ResourceMgr& resources, int showLogo, bool depthAlpha, float depthStart, float depthEnd) { g_soundMgr->FadeOut(); g_modeFadeTick = timeGetTime(); @@ -22,7 +22,7 @@ std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, Textur DrawAlphaRectangle(renderer.primitives, textures, renderer.queues, 0, 0, renderer.viewport.width, renderer.viewport.height, elapsed << 24, depthAlpha, depthStart, depthEnd); if (showLogo != 0) { - auto* logo = static_cast(resources.Load(names.Resolve("rag_logo.bmp"))); + auto* logo = static_cast(resources.Load(Resolve("rag_logo.bmp"))); DrawBitmapResource(system, renderer.viewport.width - 192, renderer.viewport.height - 122, logo); } if (renderer.Draw()) { diff --git a/Source/Client/ModeFadeOut.h b/Source/Client/ModeFadeOut.h index 68a2a0c..0854e16 100644 --- a/Source/Client/ModeFadeOut.h +++ b/Source/Client/ModeFadeOut.h @@ -7,9 +7,8 @@ class CRenderer; class CRenderSystemBase; class TextureCache; class ResourceMgr; -struct TextureNames; -std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, TextureCache& textures, ResourceMgr& resources, TextureNames& names, +std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, TextureCache& textures, ResourceMgr& resources, int showLogo, bool depthAlpha, float depthStart, float depthEnd); #endif diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 9e50a01..3898881 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -663,7 +663,7 @@ void UICashEmotionPack::Paint() { if (this->m_limited) { auto* bitmap = - static_cast(ResourceMgr::Instance().Load(this->m_controls->textureNames.Resolve("유저인터페이스\\cashemotion\\icon_limitemotion.bmp"))); + static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashemotion\\icon_limitemotion.bmp"))); if (bitmap) { this->DrawBitmap(0, 0, &bitmap->image, true); } @@ -729,9 +729,9 @@ int UICashEmotionPack::SendMsg( // FUNCTION: fn_09453 void UICashEmotionPack::SetSaleBadge(char type) { if (type == 1) { - this->m_saleBadge = this->m_controls->textureNames.Resolve("유저인터페이스\\cashemotion\\sale_account.bmp"); + this->m_saleBadge = Resolve("유저인터페이스\\cashemotion\\sale_account.bmp"); } else if (type == 2) { - this->m_saleBadge = this->m_controls->textureNames.Resolve("유저인터페이스\\cashemotion\\sale_char.bmp"); + this->m_saleBadge = Resolve("유저인터페이스\\cashemotion\\sale_char.bmp"); } else { this->m_saleBadge = ""; } @@ -811,7 +811,7 @@ void UICashEmotionPiece::Paint() { unsigned red; unsigned green; unsigned blue; - SkinPaletteChannels(ResourceMgr::Instance(), this->m_controls->textureNames, 14, 6, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 14, 6, red, green, blue); DrawRoundedBorder(*this, 0, 0, this->geometry.width, this->geometry.height, RGB(red, green, blue)); } } diff --git a/Source/Contents/SkinInfo.cpp b/Source/Contents/SkinInfo.cpp index ddeb635..711a42b 100644 --- a/Source/Contents/SkinInfo.cpp +++ b/Source/Contents/SkinInfo.cpp @@ -1,4 +1,4 @@ -#include "Contents/SkinInfo.h" +#include "Contents/SkinMgr.h" #include #include @@ -7,15 +7,15 @@ // OFFSET: 0x007E2130 // FUNCTION: fn_09690 -bool SkinInfo::Selected() const { +bool CSkinMgr::Selected() const { return this->selected > -1; } // OFFSET: 0x007E1020 // FUNCTION: fn_09686 -const char* SkinInfo::Name() const { +const char* CSkinMgr::Name() const { if (this->selected == -1) { - return ""; + return g_defaultSkinPrefix.c_str(); } return this->names[this->selected].c_str(); @@ -23,9 +23,9 @@ const char* SkinInfo::Name() const { // OFFSET: 0x007E1060 // FUNCTION: fn_09687 -const char* SkinInfo::Prefix() const { +const char* CSkinMgr::Prefix() const { if (this->selected == -1) { - return ""; + return g_defaultSkinPrefix.c_str(); } return this->prefixes[this->selected].c_str(); @@ -33,9 +33,9 @@ const char* SkinInfo::Prefix() const { // OFFSET: 0x007E10E0 // FUNCTION: fn_09688 -const char* SkinInfo::Name(int index) const { +const char* CSkinMgr::Name(int index) const { if (index == -1) { - return ""; + return g_defaultSkinPrefix.c_str(); } return this->names[index].c_str(); @@ -43,13 +43,13 @@ const char* SkinInfo::Name(int index) const { // OFFSET: 0x007E0C40 // FUNCTION: fn_09683 -void SkinInfo::Prepare() { +void CSkinMgr::Prepare() { if (this->selected == -1 || this->archives[this->selected] == 0 || this->prepared[this->selected] != 0) { return; } char directory[2048]; - std::sprintf(directory, "%s\\_tmpskin_", this->applicationDirectory); + std::sprintf(directory, "%s\\_tmpskin_", g_applicationDirectory); const std::string target = std::string(directory) + "\\" + this->names[this->selected]; if (_access(target.c_str(), 0) == 0) { diff --git a/Source/Contents/SkinMgr.cpp b/Source/Contents/SkinMgr.cpp new file mode 100644 index 0000000..edf0e3f --- /dev/null +++ b/Source/Contents/SkinMgr.cpp @@ -0,0 +1,28 @@ +#include "Contents/SkinMgr.h" +#include "File/DirectoryRemoval.h" + +#include +#include + +// GLOBAL: gl_24634 +CSkinMgr g_skinInfo; + +// GLOBAL: gl_24583 +std::string g_defaultSkinPrefix = ""; + +// OFFSET: 0x007E09D0 +// FUNCTION: fn_45445 +CSkinMgr::CSkinMgr() { + this->m_name = g_defaultSkinPrefix; +} + +// OFFSET: 0x007E0AD0 +// FUNCTION: fn_09681 +CSkinMgr::~CSkinMgr() { + char directory[2048]; + std::sprintf(directory, "%s\\_tmpskin_", g_applicationDirectory); + + if (_access(directory, 0) == 0) { + RemoveDirectoryTree(directory); + } +} diff --git a/Source/Contents/SkinMgr.h b/Source/Contents/SkinMgr.h new file mode 100644 index 0000000..cc1848f --- /dev/null +++ b/Source/Contents/SkinMgr.h @@ -0,0 +1,37 @@ +#ifndef RAGNAROK_SOURCE_CONTENTS_SKINMGR_H +#define RAGNAROK_SOURCE_CONTENTS_SKINMGR_H + +#include "Client/Application/Launcher.h" + +#include +#include + +// VTABLE: vt_00808 +class CSkinMgr { +public: + /* 0004 */ std::string m_name; + /* 001C */ int selected; + /* 0020 */ std::vector names; + /* 002C */ std::vector prefixes; + /* 0038 */ std::vector prepared; + /* 0044 */ std::vector archives; + + virtual ~CSkinMgr(); + + CSkinMgr(); + + bool Selected() const; + const char* Prefix() const; + const char* Name() const; + const char* Name(int index) const; + void Prepare(); +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(CSkinMgr) == 0x50); +#endif + +extern std::string g_defaultSkinPrefix; +extern CSkinMgr g_skinInfo; + +#endif diff --git a/Source/Render/DX7/RendererDX7Operations.h b/Source/Render/DX7/RendererDX7Operations.h index b96a1e9..fa06b4e 100644 --- a/Source/Render/DX7/RendererDX7Operations.h +++ b/Source/Render/DX7/RendererDX7Operations.h @@ -17,7 +17,6 @@ struct RendererBackBuffer; struct BitmapImage; class IJL15Runtime; class ResourceMgr; -struct TextureNames; struct RendererDX7Operations { DeviceOwnerDX7& owner; @@ -34,7 +33,7 @@ struct RendererDX7Operations { ); bool SaveBitmap(const char* filename, const BitmapImage& overlay, int width, int height, RendererBackBuffer& backBuffer); bool SaveJpeg(const char* filename, const BitmapImage& overlay, int width, int height, RendererBackBuffer& backBuffer, IJL15Runtime& runtime); - bool SaveLogo(std::string filename, ResourceMgr& resources, TextureNames& names, IJL15Runtime& runtime); + bool SaveLogo(std::string filename, ResourceMgr& resources, IJL15Runtime& runtime); }; #endif diff --git a/Source/Render/DX7/ScreenshotDX7.cpp b/Source/Render/DX7/ScreenshotDX7.cpp index 043cf0e..ae51ae5 100644 --- a/Source/Render/DX7/ScreenshotDX7.cpp +++ b/Source/Render/DX7/ScreenshotDX7.cpp @@ -176,8 +176,8 @@ bool RendererDX7Operations::SaveJpeg( // OFFSET: 0x0055E340 // FUNCTION: fn_02111 -bool RendererDX7Operations::SaveLogo(std::string filename, ResourceMgr& resources, TextureNames& names, IJL15Runtime& runtime) { - auto* logo = static_cast(resources.Load(names.Resolve("scr_logo.bmp"))); +bool RendererDX7Operations::SaveLogo(std::string filename, ResourceMgr& resources, IJL15Runtime& runtime) { + auto* logo = static_cast(resources.Load(Resolve("scr_logo.bmp"))); if (!logo) { return false; diff --git a/Source/Render/Textures/ClientTextureSources.h b/Source/Render/Textures/ClientTextureSources.h index aa52761..b3c3c3d 100644 --- a/Source/Render/Textures/ClientTextureSources.h +++ b/Source/Render/Textures/ClientTextureSources.h @@ -8,18 +8,16 @@ #include -struct TextureNames; class BinkMovies; class ClientTextureSources : public TextureSources { public: - ClientTextureSources(TextureNames& names, const int& modeType, BinkMovies* const& movies, CRenderSystemBase*& system, IDirectDraw7* const& directDraw); + ClientTextureSources(const int& modeType, BinkMovies* const& movies, CRenderSystemBase*& system, IDirectDraw7* const& directDraw); const char* Resolve(const char* name) override; bool MovieSize(const char* name, int& width, int& height) override; void CleanupTextures() override; private: - TextureNames& m_names; const int& m_modeType; BinkMovies* const& m_movies; CRenderSystemBase*& m_system; @@ -28,14 +26,14 @@ private: // INLINED inline ClientTextureSources::ClientTextureSources( - TextureNames& names, const int& modeType, BinkMovies* const& movies, CRenderSystemBase*& system, IDirectDraw7* const& directDraw + const int& modeType, BinkMovies* const& movies, CRenderSystemBase*& system, IDirectDraw7* const& directDraw ) - : m_names(names), m_modeType(modeType), m_movies(movies), m_system(system), m_directDraw(directDraw) { + : m_modeType(modeType), m_movies(movies), m_system(system), m_directDraw(directDraw) { } // INLINED inline const char* ClientTextureSources::Resolve(const char* name) { - return this->m_names.Resolve(name); + return ::Resolve(name); } // INLINED diff --git a/Source/Resource/SkinPalette.cpp b/Source/Resource/SkinPalette.cpp index 69eadfd..0f7191b 100644 --- a/Source/Resource/SkinPalette.cpp +++ b/Source/Resource/SkinPalette.cpp @@ -5,10 +5,10 @@ // OFFSET: 0x007E0F40 // FUNCTION: fn_09684 -std::uint32_t SkinPaletteColor(ResourceMgr& resources, TextureNames& names, const SkinPaletteCell& cell, bool resolveSkin) { +std::uint32_t SkinPaletteColor(ResourceMgr& resources, const SkinPaletteCell& cell, bool resolveSkin) { const char* filename = "유저인터페이스\\colorchip.bmp"; if (resolveSkin) { - filename = names.Resolve(filename); + filename = Resolve(filename); } auto* bitmap = static_cast(resources.Load(filename)); if (!bitmap) { @@ -20,8 +20,8 @@ std::uint32_t SkinPaletteColor(ResourceMgr& resources, TextureNames& names, cons // OFFSET: 0x007E0FC0 // FUNCTION: fn_09685 -void SkinPaletteChannels(ResourceMgr& resources, TextureNames& names, int x, int y, unsigned& red, unsigned& green, unsigned& blue) { - auto* bitmap = static_cast(resources.Load(names.Resolve("유저인터페이스\\colorchip.bmp"))); +void SkinPaletteChannels(ResourceMgr& resources, int x, int y, unsigned& red, unsigned& green, unsigned& blue) { + auto* bitmap = static_cast(resources.Load(Resolve("유저인터페이스\\colorchip.bmp"))); const std::uint32_t color = bitmap->image.Pixel(x, y); red = (color >> 16) & 255; green = (color >> 8) & 255; diff --git a/Source/Resource/SkinPalette.h b/Source/Resource/SkinPalette.h index 6fecc1a..7f78f06 100644 --- a/Source/Resource/SkinPalette.h +++ b/Source/Resource/SkinPalette.h @@ -4,14 +4,13 @@ #include class ResourceMgr; -struct TextureNames; struct SkinPaletteCell { /* 0000 */ int column; /* 0004 */ int row; }; -std::uint32_t SkinPaletteColor(ResourceMgr& resources, TextureNames& names, const SkinPaletteCell& cell, bool resolveSkin); -void SkinPaletteChannels(ResourceMgr& resources, TextureNames& names, int x, int y, unsigned& red, unsigned& green, unsigned& blue); +std::uint32_t SkinPaletteColor(ResourceMgr& resources, const SkinPaletteCell& cell, bool resolveSkin); +void SkinPaletteChannels(ResourceMgr& resources, int x, int y, unsigned& red, unsigned& green, unsigned& blue); #endif diff --git a/Source/Resource/TextureNames.cpp b/Source/Resource/TextureNames.cpp index e560b4b..c386d7d 100644 --- a/Source/Resource/TextureNames.cpp +++ b/Source/Resource/TextureNames.cpp @@ -1,14 +1,18 @@ -#include "Contents/SkinInfo.h" -#include "File/ResourcePath.h" +#include "Client/Input/InputCharset.h" +#include "Client/Mode/ActiveGameMode.h" +#include "Contents/Configuration/ServiceConfiguration.h" +#include "Contents/SkinMgr.h" #include "Resource/ResourceMgr.h" +#include "File/ResourcePath.h" #include "Resource/TextureNames.h" #include +#include // OFFSET: 0x00ACE510 // FUNCTION: fn_17788 -const char* TextureNames::ServiceName(const char* name) { - if (this->service == 0 || this->service == 2 || this->service == 20) { +const char* InputCharset::ServiceName(const char* name) { + if (g_serviceType == 0 || g_serviceType == 2 || g_serviceType == 20) { return name; } @@ -17,14 +21,14 @@ const char* TextureNames::ServiceName(const char* name) { static char path[260]; std::strcpy(path, this->servicePrefix.c_str()); std::strcat(path, name); - const bool exists = std::strstr(name, ".txt") || std::strstr(name, ".xml") ? ResourceExists(path, 0) : this->resources.Exists(path); + const bool exists = std::strstr(name, ".txt") || std::strstr(name, ".xml") ? ResourceExists(path, 0) : ResourceMgr::Instance().Exists(path); return exists ? path : name; } // OFFSET: 0x00B01200 // FUNCTION: fn_18378 -const char* TextureNames::Resolve(const char* name) { +const char* Resolve(const char* name) { if (*name == '\0') { return name; } @@ -36,8 +40,8 @@ const char* TextureNames::Resolve(const char* name) { return name; } - if (this->activeMode && this->skin.Selected()) { - const std::string prefix(this->skin.Prefix()); + if (g_world.gameMode && g_skinInfo.Selected()) { + const std::string prefix(g_skinInfo.Prefix()); // STATIC: 0x016D58CC // GLOBAL: gl_24385 static std::string selectedPath; @@ -47,18 +51,16 @@ const char* TextureNames::Resolve(const char* name) { selectedPath.append(original.data() + 15, original.size() - 15); } - this->skin.Prepare(); + g_skinInfo.Prepare(); - if (this->resources.Exists(selectedPath.c_str())) { + if (ResourceMgr::Instance().Exists(selectedPath.c_str())) { return selectedPath.c_str(); } } - if (this->service != 0) { - const char* serviceName = this->ServiceName(name); - - if (this->resources.Exists(serviceName)) { - return this->ServiceName(name); + if (g_serviceType != 0) { + if (ResourceMgr::Instance().Exists(g_serverLanguage->ServiceName(name))) { + return g_serverLanguage->ServiceName(name); } // STATIC: 0x016D58E8 @@ -69,7 +71,7 @@ const char* TextureNames::Resolve(const char* name) { uiPath.append(original.data() + 15, original.size() - 15); } - if (this->resources.Exists(uiPath.c_str())) { + if (ResourceMgr::Instance().Exists(uiPath.c_str())) { return uiPath.c_str(); } } diff --git a/Source/Resource/TextureNames.h b/Source/Resource/TextureNames.h index e902d71..40d60cc 100644 --- a/Source/Resource/TextureNames.h +++ b/Source/Resource/TextureNames.h @@ -1,20 +1,6 @@ #ifndef RAGNAROK_SOURCE_RESOURCE_TEXTURENAMES_H #define RAGNAROK_SOURCE_RESOURCE_TEXTURENAMES_H -#include - -class ResourceMgr; -struct SkinInfo; - -struct TextureNames { - ResourceMgr& resources; - SkinInfo& skin; - const bool& activeMode; - const int& service; - const std::string& servicePrefix; - - const char* Resolve(const char* name); - const char* ServiceName(const char* name); -}; +const char* Resolve(const char* name); #endif diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index 196813e..fdd7821 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -115,7 +115,7 @@ void UIComboBoxWnd::Paint() { // OFFSET: 0x008ED1B0 // FUNCTION: fn_12219 void UIDisconnectedServerMsgWnd::Paint() { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(this->m_textureNames->Resolve("유저인터페이스\\win_msgbox.bmp"))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp"))); this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); } @@ -127,7 +127,7 @@ void UILoadingWnd::Paint() { // OFFSET: 0x008EF590 // FUNCTION: fn_12233 void UINoticeConfirmWnd::Paint() { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(this->m_textureNames->Resolve("유저인터페이스\\win_msgbox.bmp"))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp"))); this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); } @@ -144,21 +144,21 @@ void UINotifyQuestWnd::Paint() { // OFFSET: 0x008EFF60 // FUNCTION: fn_12245 void UIQuitWnd::Paint() { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(this->m_textureNames->Resolve("유저인터페이스\\win_msgbox.bmp"))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp"))); this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); } // OFFSET: 0x008EFFA0 // FUNCTION: fn_12246 void UIRestartWnd::Paint() { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(this->m_textureNames->Resolve("유저인터페이스\\win_msgbox.bmp"))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp"))); this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); } // OFFSET: 0x008F2A90 // FUNCTION: fn_12258 void UIWaitWnd::Paint() { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(this->m_textureNames->Resolve("유저인터페이스\\win_msgbox.bmp"))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\win_msgbox.bmp"))); this->DrawBitmap(0, 0, bitmap ? &bitmap->image : nullptr, false); } diff --git a/Source/UI/CashEmotion/UICashEmotionPiece.h b/Source/UI/CashEmotion/UICashEmotionPiece.h index d44c237..a3fb379 100644 --- a/Source/UI/CashEmotion/UICashEmotionPiece.h +++ b/Source/UI/CashEmotion/UICashEmotionPiece.h @@ -6,12 +6,10 @@ #include struct UIButtonContext; -struct TextureNames; class UICashEmotionSprBtn; struct UICashEmotionPieceContext { UIButtonContext& buttons; - TextureNames& textureNames; }; class UICashEmotionPiece : public UIWindow { diff --git a/Source/UI/Dialogs/UIDisconnectedServerMsgWnd.h b/Source/UI/Dialogs/UIDisconnectedServerMsgWnd.h index ececc42..19359d2 100644 --- a/Source/UI/Dialogs/UIDisconnectedServerMsgWnd.h +++ b/Source/UI/Dialogs/UIDisconnectedServerMsgWnd.h @@ -3,14 +3,9 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; - class UIDisconnectedServerMsgWnd : public UIFrameWnd { public: void Paint() override; - -protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Dialogs/UINoticeConfirmWnd.h b/Source/UI/Dialogs/UINoticeConfirmWnd.h index 9674c8e..0ee1a10 100644 --- a/Source/UI/Dialogs/UINoticeConfirmWnd.h +++ b/Source/UI/Dialogs/UINoticeConfirmWnd.h @@ -3,14 +3,9 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; - class UINoticeConfirmWnd : public UIFrameWnd { public: void Paint() override; - -protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Dialogs/UIQuitWnd.h b/Source/UI/Dialogs/UIQuitWnd.h index d4933a9..1739dfc 100644 --- a/Source/UI/Dialogs/UIQuitWnd.h +++ b/Source/UI/Dialogs/UIQuitWnd.h @@ -3,14 +3,9 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; - class UIQuitWnd : public UIFrameWnd { public: void Paint() override; - -protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Dialogs/UIRestartWnd.h b/Source/UI/Dialogs/UIRestartWnd.h index 218283f..f228946 100644 --- a/Source/UI/Dialogs/UIRestartWnd.h +++ b/Source/UI/Dialogs/UIRestartWnd.h @@ -3,14 +3,9 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; - class UIRestartWnd : public UIFrameWnd { public: void Paint() override; - -protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Dialogs/UIWaitWnd.h b/Source/UI/Dialogs/UIWaitWnd.h index ce0c450..d83257a 100644 --- a/Source/UI/Dialogs/UIWaitWnd.h +++ b/Source/UI/Dialogs/UIWaitWnd.h @@ -3,14 +3,9 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; - class UIWaitWnd : public UIFrameWnd { public: void Paint() override; - -protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index d0eb129..618fdf4 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -153,7 +153,7 @@ void EditPainting::Draw() { if (this->mask != 0) { display.assign(this->text.size(), static_cast(this->mask)); } else { - const char* prefix = this->alternate ? this->input.candidate.c_str() : this->charset.Prefix(false); + const char* prefix = this->alternate ? this->input.candidate.c_str() : g_serverLanguage->Prefix(false); display = prefix; display += this->text; const auto prefixBytes = static_cast(std::strlen(prefix)); @@ -507,7 +507,7 @@ void UIEditCtrl::DrawSelectionAt(int x, int y, int width) { if (left < right && extent > 0) { unsigned red, green, blue; - SkinPaletteChannels(this->m_edit->buttons.resources, this->m_edit->textureNames, 6, 2, red, green, blue); + SkinPaletteChannels(this->m_edit->buttons.resources, 6, 2, red, green, blue); this->FillRegion(left, y, left + extent > right ? right - left : extent, 14, RGB(red, green, blue)); } } @@ -521,7 +521,7 @@ void UIEditCtrl::DrawSelection(int x, int width) { if (left < right && extent > 0) { unsigned red, green, blue; - SkinPaletteChannels(this->m_edit->buttons.resources, this->m_edit->textureNames, 6, 2, red, green, blue); + SkinPaletteChannels(this->m_edit->buttons.resources, 6, 2, red, green, blue); this->FillRegion(left, 0, left + extent > right ? right - left : extent, this->geometry.height, RGB(red, green, blue)); } } diff --git a/Source/UI/Edit/UIEditCtrl.h b/Source/UI/Edit/UIEditCtrl.h index 2771911..8dfb8cf 100644 --- a/Source/UI/Edit/UIEditCtrl.h +++ b/Source/UI/Edit/UIEditCtrl.h @@ -10,7 +10,6 @@ struct TextInputBuffer; struct InputCharset; struct UIButtonContext; struct BitmapImage; -struct TextureNames; class WindowManagerWindows; class NavigationDestination; class UINaviLinkButton; @@ -32,7 +31,6 @@ struct UIEditContext { UIWindow* const& permittedLinkInput; const int& screenWidth; const int& screenHeight; - TextureNames& textureNames; }; class UIEditCtrl : public UIWindow { diff --git a/Source/UI/FrameSkin.cpp b/Source/UI/FrameSkin.cpp index 8d08e59..17ae6d1 100644 --- a/Source/UI/FrameSkin.cpp +++ b/Source/UI/FrameSkin.cpp @@ -11,8 +11,8 @@ void CUIFrameWnd::RefreshSkinColors() { } if (this->m_hasSkinColors) { - this->m_backgroundColor = SkinPaletteColor(ResourceMgr::Instance(), *this->m_textureNames, this->m_backgroundCell, this->m_resolveSkin); - this->m_borderColor = SkinPaletteColor(ResourceMgr::Instance(), *this->m_textureNames, this->m_borderCell, this->m_resolveSkin); + this->m_backgroundColor = SkinPaletteColor(ResourceMgr::Instance(), this->m_backgroundCell, this->m_resolveSkin); + this->m_borderColor = SkinPaletteColor(ResourceMgr::Instance(), this->m_borderCell, this->m_resolveSkin); } for (UIWindow* child : this->m_children) { @@ -30,7 +30,7 @@ void CUIFrameWnd::Paint() { } if (this->m_buttonBarStyle > 0) { - this->DrawButtonBar(*this->m_textureNames, this->m_buttonBarStyle - 1, 0, 1); + this->DrawButtonBar(this->m_buttonBarStyle - 1, 0, 1); } } @@ -43,6 +43,6 @@ void CUIFrameWnd::SetSkinColors(int backgroundColumn, int backgroundRow, int bor this->m_borderCell.row = borderRow; this->m_hasSkinColors = true; - this->m_backgroundColor = SkinPaletteColor(ResourceMgr::Instance(), *this->m_textureNames, this->m_backgroundCell, this->m_resolveSkin); - this->m_borderColor = SkinPaletteColor(ResourceMgr::Instance(), *this->m_textureNames, this->m_borderCell, this->m_resolveSkin); + this->m_backgroundColor = SkinPaletteColor(ResourceMgr::Instance(), this->m_backgroundCell, this->m_resolveSkin); + this->m_borderColor = SkinPaletteColor(ResourceMgr::Instance(), this->m_borderCell, this->m_resolveSkin); } diff --git a/Source/UI/FrameSkin.h b/Source/UI/FrameSkin.h index 9d7500a..1521a72 100644 --- a/Source/UI/FrameSkin.h +++ b/Source/UI/FrameSkin.h @@ -6,8 +6,6 @@ #include -struct TextureNames; - class CUIFrameWnd : public UIFrameWnd { public: void Paint() override; @@ -23,7 +21,6 @@ protected: /* 00C8 */ SkinPaletteCell m_borderCell; /* 00D0 */ int m_buttonBarStyle; /* 00D4 */ bool m_resolveSkin; - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Shop/ItemDrawing.cpp b/Source/UI/Shop/ItemDrawing.cpp index dbd7756..b13711a 100644 --- a/Source/UI/Shop/ItemDrawing.cpp +++ b/Source/UI/Shop/ItemDrawing.cpp @@ -22,10 +22,10 @@ void DrawItemIcon(UIWindow& window, ResourceMgr& resources, ItemDescriptions& de // OFFSET: 0x008A8F80 // FUNCTION: fn_11718 -void DrawItemIconById(UIWindow& window, TextureNames& names, ItemDescriptions& descriptions, int x, int y, const char* id, unsigned char identified) { +void DrawItemIconById(UIWindow& window, ItemDescriptions& descriptions, int x, int y, const char* id, unsigned char identified) { char path[128]; descriptions.IconPath(path, id, identified); - CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(names.Resolve(path))); + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve(path))); if (bitmap) { window.DrawBitmap(x, y, &bitmap->image, true); @@ -34,8 +34,8 @@ void DrawItemIconById(UIWindow& window, TextureNames& names, ItemDescriptions& d // OFFSET: 0x008A9000 // FUNCTION: fn_11719 -void DrawItemSlotBackground(UIWindow& window, TextureNames& names, int x, int y) { - CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\itemwin_mid.bmp"))); +void DrawItemSlotBackground(UIWindow& window, int x, int y) { + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\itemwin_mid.bmp"))); window.DrawBitmap(x, y, bitmap ? &bitmap->image : nullptr, false); } diff --git a/Source/UI/Shop/ItemDrawing.h b/Source/UI/Shop/ItemDrawing.h index 82b6500..055b447 100644 --- a/Source/UI/Shop/ItemDrawing.h +++ b/Source/UI/Shop/ItemDrawing.h @@ -7,11 +7,10 @@ class UIWindow; class ResourceMgr; class FontCache; struct TextLocale; -struct TextureNames; void DrawItemIcon(UIWindow& window, ResourceMgr& resources, ItemDescriptions& descriptions, int x, int y, const ItemInfo& item, unsigned char identified); -void DrawItemIconById(UIWindow& window, TextureNames& names, ItemDescriptions& descriptions, int x, int y, const char* id, unsigned char identified); -void DrawItemSlotBackground(UIWindow& window, TextureNames& names, int x, int y); +void DrawItemIconById(UIWindow& window, ItemDescriptions& descriptions, int x, int y, const char* id, unsigned char identified); +void DrawItemSlotBackground(UIWindow& window, int x, int y); void DrawItemWithQuantity( UIWindow& window, ResourceMgr& resources, ItemDescriptions& descriptions, FontCache& fonts, const TextLocale& locale, int x, int y, const ItemInfo& item, unsigned char identified, unsigned char plain diff --git a/Source/UI/Window/UIBank_NewWnd.h b/Source/UI/Window/UIBank_NewWnd.h index 517f50b..e652fe2 100644 --- a/Source/UI/Window/UIBank_NewWnd.h +++ b/Source/UI/Window/UIBank_NewWnd.h @@ -5,7 +5,6 @@ class UIEditCtrl; struct UIButtonContext; -struct TextureNames; class UIBank_NewWnd : public UIFrameWnd { public: @@ -18,7 +17,6 @@ protected: /* 00B4 */ UIEditCtrl* m_amountEdit; /* 00B8 */ std::string m_status; UIButtonContext* m_controls; - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Window/UIChatRoomWnd.h b/Source/UI/Window/UIChatRoomWnd.h index 31656e1..17aea1f 100644 --- a/Source/UI/Window/UIChatRoomWnd.h +++ b/Source/UI/Window/UIChatRoomWnd.h @@ -4,7 +4,6 @@ #include "UI/Window/UIFrameWnd.h" struct UIButtonContext; -struct TextureNames; class UIChatRoomWnd : public UIFrameWnd { public: @@ -12,7 +11,6 @@ public: protected: UIButtonContext* m_controls; - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Window/UICntWnd.h b/Source/UI/Window/UICntWnd.h index fe33897..e7683ef 100644 --- a/Source/UI/Window/UICntWnd.h +++ b/Source/UI/Window/UICntWnd.h @@ -3,7 +3,6 @@ #include "UI/Window/UIFrameWnd.h" -struct TextureNames; class UICntWnd : public UIFrameWnd { public: @@ -11,7 +10,6 @@ public: void DrawBorder(int x, int y, int width, int height); protected: - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index 72cabf8..d63cec1 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -1,7 +1,26 @@ #include "UI/Window/UIControl.h" +#include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" +#include "Resource/TextureNames.h" #include +// OFFSET: 0x009EF520 +// FUNCTION: fn_14635 +CBitmapRes* CUIControl::LoadBitmapResource(const std::string& name, bool resolveSkin) { + if (name.size() == 0) { + return nullptr; + } + + ResourceMgr& resources = ResourceMgr::Instance(); + + if (resolveSkin) { + return static_cast(resources.Load(Resolve(name.c_str()))); + } + + return static_cast(resources.Load(name)); +} + // INLINED CUIControl::CUIControl(UIWindowContext& context) : UIWindow(context, 0), hitEnabled(1) { } diff --git a/Source/UI/Window/UIControl.h b/Source/UI/Window/UIControl.h index 0b04e45..4196fc7 100644 --- a/Source/UI/Window/UIControl.h +++ b/Source/UI/Window/UIControl.h @@ -3,8 +3,14 @@ #include "UI/Window/UIWindow.h" +#include + +class CBitmapRes; + class CUIControl : public UIWindow { public: + CBitmapRes* LoadBitmapResource(const std::string& name, bool resolveSkin); + explicit CUIControl(UIWindowContext& context); ~CUIControl() override; bool CanHitTest() override; diff --git a/Source/UI/Window/UIMerInfoWnd.h b/Source/UI/Window/UIMerInfoWnd.h index 2f56caa..3230ddc 100644 --- a/Source/UI/Window/UIMerInfoWnd.h +++ b/Source/UI/Window/UIMerInfoWnd.h @@ -4,7 +4,6 @@ #include "UI/Window/UIFrameWnd.h" struct UIButtonContext; -struct TextureNames; class UIMerInfoWnd : public UIFrameWnd { public: @@ -12,7 +11,6 @@ public: protected: UIButtonContext* m_controls; - TextureNames* m_textureNames; }; #endif diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index 63c3dab..06490d4 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -143,8 +143,7 @@ void UILoginWnd::Paint() { // FUNCTION: fn_11767 void UIMerInfoWnd::Paint() { auto& controls = *this->m_controls; - auto& names = *this->m_textureNames; - const auto* background = static_cast(names.resources.Load(names.Resolve("유저인터페이스\\basic_interface\\homuninfo_bg.bmp"))); + const auto* background = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\homuninfo_bg.bmp"))); this->DrawBitmap(0, 0, &background->image, false); char title[50] = {}; const unsigned kind = g_session.m_mercenaryClass; @@ -267,9 +266,8 @@ bool UIBank_NewWnd::IsNumeric(std::string text) { // FUNCTION: fn_11760 void UIBank_NewWnd::Paint() { auto& controls = *this->m_controls; - auto& names = *this->m_textureNames; - const auto* background = static_cast(names.resources.Load(names.Resolve("유저인터페이스\\bank\\bg_bank.bmp"))); - const int titleHeight = this->DrawTitleBar(names, controls.fonts, controls.locale, true, controls.services.MessageText(2771), 0); + const auto* background = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\bank\\bg_bank.bmp"))); + const int titleHeight = this->DrawTitleBar(controls.fonts, controls.locale, true, controls.services.MessageText(2771), 0); this->DrawBitmap(0, titleHeight, &background->image, false); char number[260] = {}; char text[260] = {}; @@ -293,14 +291,13 @@ void UIBank_NewWnd::Paint() { // FUNCTION: fn_11761 void UIChatRoomWnd::Paint() { auto& controls = *this->m_controls; - auto& names = *this->m_textureNames; - const int titleHeight = this->DrawTitleBar(names, controls.fonts, controls.locale, false, "", 0); - this->DrawPanelBackground(names, titleHeight, 0, ""); + const int titleHeight = this->DrawTitleBar(controls.fonts, controls.locale, false, "", 0); + this->DrawPanelBackground(titleHeight, 0, ""); unsigned red, green, blue; - SkinPaletteChannels(names.resources, names, 20, 6, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 20, 6, red, green, blue); const int width = this->geometry.width; this->FillRegion(width - width * 56 / 280 - 2, 17, 1, this->geometry.height - 38, RGB(red, green, blue)); - this->DrawButtonBar(names, 0, 0, 1); + this->DrawButtonBar(0, 0, 1); } // OFFSET: 0x008B7DA0 @@ -318,9 +315,8 @@ void UICntWnd::DrawBorder(int x, int y, int width, int height) { if (height == 0) { height = this->geometry.height; } - auto& names = *this->m_textureNames; const auto load = [&](const char* name) { - return static_cast(names.resources.Load(names.Resolve(name))); + return static_cast(ResourceMgr::Instance().Load(Resolve(name))); }; const int innerWidth = width - 28; const int columns = innerWidth / 14 + (innerWidth % 14 != 0); @@ -351,7 +347,7 @@ void UICntWnd::DrawBorder(int x, int y, int width, int height) { bitmap = load("유저인터페이스\\sysbox_rd.bmp"); this->DrawBitmap(x + width - bitmap->image.width, y + height - bitmap->image.height, &bitmap->image, false); unsigned red, green, blue; - SkinPaletteChannels(names.resources, names, 2, 2, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue); this->FillRegion(x + 14, y + 14, innerWidth, innerHeight, RGB(red, green, blue)); } diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 0021112..dea9b2c 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -21,7 +21,6 @@ struct RenderQueues; struct BitmapImage; class FontCache; struct TextLocale; -struct TextureNames; struct tagRECT; struct tagSIZE; struct ActionFrame; @@ -143,13 +142,13 @@ public: int FormattedTextWidth(FontCache& fonts, const TextLocale& locale, std::string text, int family, int height, unsigned char bold); int RestoreEditTexts(const unsigned char* data); bool FitSprite(const ActionFrame* frame, const CSprRes* sprite, int width, int height, int* x, int* y, float* scale); - int DrawTitleBar(TextureNames& names, FontCache& fonts, const TextLocale& locale, bool closeButton, const char* title, int width); - int DrawTitleBarAt(TextureNames& names, FontCache& fonts, const TextLocale& locale, int x, int width, bool closeButton, const char* title); - void DrawPanelBackground(TextureNames& names, int y, int width, const char* bitmapName); - void DrawPanelBackgroundAt(TextureNames& names, int x, int y, int width, const char* bitmapName); - int DrawButtonBar(TextureNames& names, int style, int width, int rows); - int DrawButtonBarAt(TextureNames& names, int style, int x, int width, int rows); - CBitmapRes* LoadStyledBitmap(TextureNames& names, int style, const char* format, const char* name); + int DrawTitleBar(FontCache& fonts, const TextLocale& locale, bool closeButton, const char* title, int width); + int DrawTitleBarAt(FontCache& fonts, const TextLocale& locale, int x, int width, bool closeButton, const char* title); + void DrawPanelBackground(int y, int width, const char* bitmapName); + void DrawPanelBackgroundAt(int x, int y, int width, const char* bitmapName); + int DrawButtonBar(int style, int width, int rows); + int DrawButtonBarAt(int style, int x, int width, int rows); + CBitmapRes* LoadStyledBitmap(int style, const char* format, const char* name); // INLINED bool HasTextBackground() const { diff --git a/Source/UI/Window/WindowBorder.cpp b/Source/UI/Window/WindowBorder.cpp index 3cf5485..96d4eac 100644 --- a/Source/UI/Window/WindowBorder.cpp +++ b/Source/UI/Window/WindowBorder.cpp @@ -77,7 +77,7 @@ void FillTriangle(UIWindow& window, int x0, int y0, int x1, int y1, int x2, int // OFFSET: 0x008D0920 // FUNCTION: fn_12088 -int UIWindow::DrawButtonBar(TextureNames& names, int style, int width, int rows) { +int UIWindow::DrawButtonBar(int style, int width, int rows) { if (width == 0) { width = this->geometry.width; } @@ -95,7 +95,7 @@ int UIWindow::DrawButtonBar(TextureNames& names, int style, int width, int rows) name = "유저인터페이스\\basic_interface\\btnbar_left.bmp"; } - auto* left = static_cast(ResourceMgr::Instance().Load(names.Resolve(name))); + auto* left = static_cast(ResourceMgr::Instance().Load(Resolve(name))); if (left) { leftWidth = left->image.width; barHeight = left->image.height; @@ -112,7 +112,7 @@ int UIWindow::DrawButtonBar(TextureNames& names, int style, int width, int rows) name = "유저인터페이스\\basic_interface\\btnbar_right.bmp"; } - auto* right = static_cast(ResourceMgr::Instance().Load(names.Resolve(name))); + auto* right = static_cast(ResourceMgr::Instance().Load(Resolve(name))); if (right) { rightWidth = right->image.width; @@ -128,7 +128,7 @@ int UIWindow::DrawButtonBar(TextureNames& names, int style, int width, int rows) name = "유저인터페이스\\basic_interface\\btnbar_mid.bmp"; } - auto* middle = static_cast(ResourceMgr::Instance().Load(names.Resolve(name))); + auto* middle = static_cast(ResourceMgr::Instance().Load(Resolve(name))); if (!middle) { return 0; } diff --git a/Source/UI/WindowBackground.cpp b/Source/UI/WindowBackground.cpp index 7e957bd..1743876 100644 --- a/Source/UI/WindowBackground.cpp +++ b/Source/UI/WindowBackground.cpp @@ -10,9 +10,9 @@ // OFFSET: 0x008D03E0 // FUNCTION: fn_12085 -void UIWindow::DrawPanelBackground(TextureNames& names, int y, int width, const char* bitmapName) { +void UIWindow::DrawPanelBackground(int y, int width, const char* bitmapName) { if (std::strlen(bitmapName) != 0) { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(names.Resolve(bitmapName))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve(bitmapName))); if (bitmap) { this->DrawBitmap(0, y, &bitmap->image, false); } @@ -26,20 +26,20 @@ void UIWindow::DrawPanelBackground(TextureNames& names, int y, int width, const unsigned red; unsigned green; unsigned blue; - SkinPaletteChannels(ResourceMgr::Instance(), names, 14, 6, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 14, 6, red, green, blue); DrawRoundedBorder(*this, 0, y, width, this->geometry.height - y, RGB(red, green, blue)); this->FillRegion(0, y, width, 5, RGB(red, green, blue)); - SkinPaletteChannels(ResourceMgr::Instance(), names, 2, 2, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue); this->FillRegion(1, y, width - 2, this->geometry.height - y - 2, RGB(red, green, blue)); this->FillRegion(2, this->geometry.height - 2, width - 4, 1, RGB(red, green, blue)); } // OFFSET: 0x008D0530 // FUNCTION: fn_12086 -void UIWindow::DrawPanelBackgroundAt(TextureNames& names, int x, int y, int width, const char* bitmapName) { +void UIWindow::DrawPanelBackgroundAt(int x, int y, int width, const char* bitmapName) { if (bitmapName && std::strlen(bitmapName) != 0) { - auto* bitmap = static_cast(ResourceMgr::Instance().Load(names.Resolve(bitmapName))); + auto* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve(bitmapName))); if (bitmap) { this->DrawBitmap(x, y, &bitmap->image, false); } @@ -54,11 +54,11 @@ void UIWindow::DrawPanelBackgroundAt(TextureNames& names, int x, int y, int widt unsigned red; unsigned green; unsigned blue; - SkinPaletteChannels(ResourceMgr::Instance(), names, 14, 6, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 14, 6, red, green, blue); DrawRoundedBorder(*this, x, y, width, height - y, RGB(red, green, blue)); this->FillRegion(x, y, width, 5, RGB(red, green, blue)); - SkinPaletteChannels(ResourceMgr::Instance(), names, 2, 2, red, green, blue); + SkinPaletteChannels(ResourceMgr::Instance(), 2, 2, red, green, blue); this->FillRegion(x + 1, y, width - 2, height - y - 2, RGB(red, green, blue)); this->FillRegion(x + 2, height - 2, width - 4, 1, RGB(red, green, blue)); } diff --git a/Source/UI/WindowLowerBorder.cpp b/Source/UI/WindowLowerBorder.cpp index c2039f5..7ec177e 100644 --- a/Source/UI/WindowLowerBorder.cpp +++ b/Source/UI/WindowLowerBorder.cpp @@ -9,7 +9,7 @@ // OFFSET: 0x008D0BE0 // FUNCTION: fn_12089 -int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, int rows) { +int UIWindow::DrawButtonBarAt(int style, int x, int width, int rows) { if (width == 0) { width = this->geometry.width - x; } @@ -20,7 +20,7 @@ int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, int barHeight = 0; CBitmapRes* left = - this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_left%d.bmp", "유저인터페이스\\basic_interface\\btnbar_left.bmp"); + this->LoadStyledBitmap(style, "유저인터페이스\\basic_interface\\btnbar_left%d.bmp", "유저인터페이스\\basic_interface\\btnbar_left.bmp"); if (left) { leftWidth = left->image.width; barHeight = left->image.height; @@ -31,7 +31,7 @@ int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, } CBitmapRes* right = - this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_right%d.bmp", "유저인터페이스\\basic_interface\\btnbar_right.bmp"); + this->LoadStyledBitmap(style, "유저인터페이스\\basic_interface\\btnbar_right%d.bmp", "유저인터페이스\\basic_interface\\btnbar_right.bmp"); if (right) { rightWidth = right->image.width; @@ -41,7 +41,7 @@ int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, } CBitmapRes* middle = - this->LoadStyledBitmap(names, style, "유저인터페이스\\basic_interface\\btnbar_mid%d.bmp", "유저인터페이스\\basic_interface\\btnbar_mid.bmp"); + this->LoadStyledBitmap(style, "유저인터페이스\\basic_interface\\btnbar_mid%d.bmp", "유저인터페이스\\basic_interface\\btnbar_mid.bmp"); if (!middle) { return 0; } @@ -64,14 +64,14 @@ int UIWindow::DrawButtonBarAt(TextureNames& names, int style, int x, int width, // OFFSET: 0x008D7570 // FUNCTION: fn_12120 -CBitmapRes* UIWindow::LoadStyledBitmap(TextureNames& names, int style, const char* format, const char* name) { +CBitmapRes* UIWindow::LoadStyledBitmap(int style, const char* format, const char* name) { if (style > 0) { if (format && std::strlen(format) != 0) { std::string filename = FormatOwnedString(format, style); - return static_cast(ResourceMgr::Instance().Load(names.Resolve(filename.c_str()))); + return static_cast(ResourceMgr::Instance().Load(Resolve(filename.c_str()))); } } else if (name && std::strlen(name) != 0) { - return static_cast(ResourceMgr::Instance().Load(names.Resolve(name))); + return static_cast(ResourceMgr::Instance().Load(Resolve(name))); } return nullptr; } diff --git a/Source/UI/WindowTitlebar.cpp b/Source/UI/WindowTitlebar.cpp index b740c0c..d6fcf23 100644 --- a/Source/UI/WindowTitlebar.cpp +++ b/Source/UI/WindowTitlebar.cpp @@ -5,27 +5,27 @@ // OFFSET: 0x008D2CE0 // FUNCTION: fn_12098 -int UIWindow::DrawTitleBar(TextureNames& names, FontCache& fonts, const TextLocale& locale, bool closeButton, const char* title, int width) { +int UIWindow::DrawTitleBar(FontCache& fonts, const TextLocale& locale, bool closeButton, const char* title, int width) { if (width == 0) { width = this->geometry.width; } int left = 0; int titleHeight = 0; - auto* leftBar = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_left.bmp"))); + auto* leftBar = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_left.bmp"))); if (leftBar) { this->DrawBitmap(0, 0, &leftBar->image, false); left = leftBar->image.width; } int right = 0; - auto* rightBar = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_right.bmp"))); + auto* rightBar = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_right.bmp"))); if (rightBar) { right = rightBar->image.width; this->DrawBitmap(width - right, 0, &rightBar->image, false); } - auto* middle = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_mid.bmp"))); + auto* middle = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_mid.bmp"))); if (middle) { titleHeight = middle->image.height; const int extent = width - right - left; @@ -41,7 +41,7 @@ int UIWindow::DrawTitleBar(TextureNames& names, FontCache& fonts, const TextLoca this->DrawTextAt(fonts, locale, 18, titleHeight - 14, title, 0, 0, 12, 0, 0, 0); if (closeButton) { - auto* icon = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\sys_base_off.bmp"))); + auto* icon = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sys_base_off.bmp"))); this->DrawBitmap(3, 3, icon ? &icon->image : nullptr, true); } @@ -50,7 +50,7 @@ int UIWindow::DrawTitleBar(TextureNames& names, FontCache& fonts, const TextLoca // OFFSET: 0x008D2E50 // FUNCTION: fn_12099 -int UIWindow::DrawTitleBarAt(TextureNames& names, FontCache& fonts, const TextLocale& locale, int x, int width, bool closeButton, const char* title) { +int UIWindow::DrawTitleBarAt(FontCache& fonts, const TextLocale& locale, int x, int width, bool closeButton, const char* title) { if (width <= 0) { width = this->geometry.width - x; } @@ -58,19 +58,19 @@ int UIWindow::DrawTitleBarAt(TextureNames& names, FontCache& fonts, const TextLo int left = 0; int right = 0; int titleHeight = 0; - auto* leftBar = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_left.bmp"))); + auto* leftBar = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_left.bmp"))); if (leftBar) { this->DrawBitmap(x, 0, &leftBar->image, false); left = leftBar->image.width; } - auto* rightBar = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_right.bmp"))); + auto* rightBar = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_right.bmp"))); if (rightBar) { right = rightBar->image.width; this->DrawBitmap(x - right + width, 0, &rightBar->image, false); } - auto* middle = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\titlebar_mid.bmp"))); + auto* middle = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\titlebar_mid.bmp"))); if (middle) { titleHeight = middle->image.height; const int extent = width - right - left; @@ -85,7 +85,7 @@ int UIWindow::DrawTitleBarAt(TextureNames& names, FontCache& fonts, const TextLo this->DrawTextAt(fonts, locale, x + 18, titleHeight - 14, title, 0, 0, 12, 0, 0, 0); if (closeButton) { - auto* icon = static_cast(ResourceMgr::Instance().Load(names.Resolve("유저인터페이스\\basic_interface\\sys_base_off.bmp"))); + auto* icon = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\sys_base_off.bmp"))); if (icon) { this->DrawBitmap(x + 3, 3, &icon->image, true); } diff --git a/data/compile.json b/data/compile.json index d86737a..afd2d88 100644 --- a/data/compile.json +++ b/data/compile.json @@ -406,6 +406,7 @@ "Source/Contents/Skills/SkillLevelRegistry.cpp": 4, "Source/Contents/Skills/SkillTreeScript.cpp": 4, "Source/Contents/SkinInfo.cpp": 3, + "Source/Contents/SkinMgr.cpp": 4, "Source/Contents/Sound/SoundConfiguration.cpp": 4, "Source/Contents/Sound/SoundMaker.cpp": 4, "Source/Contents/Sound/SoundMgr.cpp": 4,