diff --git a/assets/opensb/interface/actionbar/actionbarbottombg.png b/assets/opensb/interface/actionbar/actionbarbottombg.png new file mode 100644 index 0000000..df7e9e2 Binary files /dev/null and b/assets/opensb/interface/actionbar/actionbarbottombg.png differ diff --git a/assets/opensb/interface/windowconfig/actionbarbottom.config b/assets/opensb/interface/windowconfig/actionbarbottom.config new file mode 100644 index 0000000..f13a213 --- /dev/null +++ b/assets/opensb/interface/windowconfig/actionbarbottom.config @@ -0,0 +1,7 @@ +{ // gets merged over actionbar.config - game flips it all, this is just for the text and icons in the sprite + "paneLayout" : { + "background" : { + "fileBody" : "/interface/actionbar/actionbarbottombg.png" + } + } +} \ No newline at end of file diff --git a/source/frontend/StarActionBar.cpp b/source/frontend/StarActionBar.cpp index 82eb7d2..acaa3d1 100644 --- a/source/frontend/StarActionBar.cpp +++ b/source/frontend/StarActionBar.cpp @@ -12,6 +12,7 @@ #include "StarPlayer.hpp" #include "StarPlayerInventory.hpp" #include "StarAssets.hpp" +#include "StarImageMetadataDatabase.hpp" #include "StarItem.hpp" #include "StarMerchantInterface.hpp" @@ -50,7 +51,29 @@ ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) { swapCustomBar(); }); + auto configuration = Root::singleton().configuration(); + bool bottomBar = configuration->getPath("inventory.bottomActionBar").optBool().value(false); + if (bottomBar) + m_config = jsonMerge(m_config, assets->json("/interface/windowconfig/actionbarbottom.config")); + reader.construct(m_config.get("paneLayout"), this); + if (bottomBar) { + setAnchor(PaneAnchor::CenterBottom); + m_anchorOffset[1] *= -1; + + if (!m_bgBody.empty()) + m_bgBody += "?flipy"; + if (!m_bgHeader.empty()) + m_bgHeader += "?flipy"; + if (!m_bgFooter.empty()) + m_bgFooter += "?flipy"; + swap(m_bgHeader, m_bgFooter); + + for (auto& child : m_members) { + auto position = child->relativePosition(); + child->setPosition({position[0], m_bodySize[1] - position[1] - child->size()[1] + 1}); + } + } for (uint8_t i = 0; i < m_player->inventory()->customBarIndexes(); ++i) { auto customBarLeft = fetchChild(strf("customBar{}L", i + 1));