diff --git a/assets/opensb/interface/windowconfig/playerinventory.config.patch b/assets/opensb/interface/windowconfig/playerinventory.config.patch new file mode 100644 index 0000000..4002c9e --- /dev/null +++ b/assets/opensb/interface/windowconfig/playerinventory.config.patch @@ -0,0 +1,7 @@ +{ + "paneLayout" : { + "portrait" : { + "renderHumanoid" : true + } + } +} \ No newline at end of file diff --git a/source/windowing/StarPortraitWidget.cpp b/source/windowing/StarPortraitWidget.cpp index 9341d55..6af27ba 100644 --- a/source/windowing/StarPortraitWidget.cpp +++ b/source/windowing/StarPortraitWidget.cpp @@ -17,6 +17,7 @@ PortraitWidget::PortraitWidget() { m_entity = {}; m_portraitMode = PortraitMode::Full; m_scale = 1; + m_renderHumanoid = false; m_iconMode = false; init(); @@ -37,9 +38,15 @@ void PortraitWidget::renderImpl() { context()->drawInterfaceQuad(m_iconImage, Vec2F(screenPosition()), m_scale); } if (m_entity) { - List portrait = m_entity->portrait(m_portraitMode); + HumanoidPtr humanoid = nullptr; + if (m_renderHumanoid) { + if (auto player = as(m_entity)) + humanoid = player->humanoid(); + } + + List portrait = humanoid ? humanoid->render() : m_entity->portrait(m_portraitMode); for (auto& i : portrait) { - i.scale(m_scale); + i.scale(humanoid ? m_scale * 8.0f : m_scale); context()->drawInterfaceDrawable(i, Vec2F(screenPosition() + offset)); } } else { @@ -88,6 +95,10 @@ void PortraitWidget::setIconMode() { updateSize(); } +void PortraitWidget::setRenderHumanoid(bool renderHumanoid) { + m_renderHumanoid = renderHumanoid; +} + bool PortraitWidget::sendEvent(InputEvent const&) { return false; } diff --git a/source/windowing/StarPortraitWidget.hpp b/source/windowing/StarPortraitWidget.hpp index c56f003..37b77dc 100644 --- a/source/windowing/StarPortraitWidget.hpp +++ b/source/windowing/StarPortraitWidget.hpp @@ -19,6 +19,7 @@ public: void setMode(PortraitMode mode); void setScale(float scale); void setIconMode(); + void setRenderHumanoid(bool); bool sendEvent(InputEvent const& event); protected: @@ -35,6 +36,7 @@ private: AssetPath m_noEntityImagePart; float m_scale; + bool m_renderHumanoid; bool m_iconMode; AssetPath m_iconImage; Vec2I m_iconOffset; diff --git a/source/windowing/StarWidgetParsing.cpp b/source/windowing/StarWidgetParsing.cpp index a8a08df..8e27ecd 100644 --- a/source/windowing/StarWidgetParsing.cpp +++ b/source/windowing/StarWidgetParsing.cpp @@ -378,6 +378,8 @@ WidgetConstructResult WidgetParser::portraitHandler(String const& name, Json con if (config.contains("portraitMode")) portrait->setMode(PortraitModeNames.getLeft(config.getString("portraitMode"))); + if (config.contains("renderHumanoid")) + portrait->setRenderHumanoid(config.getBool("renderHumanoid")); portrait->setScale(config.getFloat("scale", 1));