From 382d24526919eafc08df19169046fdae190e10da Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Oct 2015 23:57:54 +0300 Subject: Add support for npc dialog inventory theming from npc skin. --- src/gui/windows/npcdialog.cpp | 62 ++++++++++++++++++++++++++++++++----------- src/gui/windows/npcdialog.h | 1 - 2 files changed, 46 insertions(+), 17 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index de74037f8..406e90c1a 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -139,8 +139,7 @@ NpcDialog::NpcDialog(const BeingId npcId) : mCameraX(0), mCameraY(0), mShowAvatar(false), - mLogInteraction(config.getBoolValue("logNpcInGui")), - mHideText(false) + mLogInteraction(config.getBoolValue("logNpcInGui")) { // Basic Window Setup setWindowName("NpcText"); @@ -816,7 +815,7 @@ void NpcDialog::placeMenuControls() void NpcDialog::placeSkinControls() { createSkinControls(); - if (mHideText) + if (mDialogInfo && mDialogInfo->hideText) { if (mShowAvatar) { @@ -896,22 +895,54 @@ void NpcDialog::placeIntInputControls() void NpcDialog::placeItemInputControls() { - if (mShowAvatar) + if (mDialogInfo) { - place(0, 0, mPlayerBox); - place(1, 0, mScrollArea, 6, 3); - place(0, 3, mItemScrollArea, 7, 3); - place(1, 6, mButton3, 2); - place(3, 6, mClearButton, 2); - place(5, 6, mButton, 2); + mItemContainer->setCellBackgroundImage(mDialogInfo->inventory.cell); + mItemContainer->setMaxColumns(mDialogInfo->inventory.columns); } else { - place(0, 0, mScrollArea, 6, 3); - place(0, 3, mItemScrollArea, 6, 3); - place(0, 6, mButton3, 2); - place(2, 6, mClearButton, 2); - place(4, 6, mButton, 2); + mItemContainer->setCellBackgroundImage("inventory_cell.xml"); + mItemContainer->setMaxColumns(10000); + } + + if (mDialogInfo && mDialogInfo->hideText) + { + if (mShowAvatar) + { + place(0, 0, mPlayerBox); + place(1, 0, mItemScrollArea, 7, 3); + place(1, 3, mButton3, 2); + place(3, 3, mClearButton, 2); + place(5, 3, mButton, 2); + } + else + { + place(0, 0, mItemScrollArea, 6, 3); + place(0, 3, mButton3, 2); + place(2, 3, mClearButton, 2); + place(4, 3, mButton, 2); + } + } + else + { + if (mShowAvatar) + { + place(0, 0, mPlayerBox); + place(1, 0, mScrollArea, 6, 3); + place(0, 3, mItemScrollArea, 7, 3); + place(1, 6, mButton3, 2); + place(3, 6, mClearButton, 2); + place(5, 6, mButton, 2); + } + else + { + place(0, 0, mScrollArea, 6, 3); + place(0, 3, mItemScrollArea, 6, 3); + place(0, 6, mButton3, 2); + place(2, 6, mClearButton, 2); + place(4, 6, mButton, 2); + } } } @@ -1153,7 +1184,6 @@ void NpcDialog::createSkinControls() if (!mDialogInfo) return; - mHideText = mDialogInfo->hideText; FOR_EACH (std::vector::const_iterator, it, mDialogInfo->menu.images) diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 997f97e8a..ffe021bc6 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -318,7 +318,6 @@ class NpcDialog final : public Window, int mCameraY; bool mShowAvatar; bool mLogInteraction; - bool mHideText; }; #endif // GUI_WINDOWS_NPCDIALOG_H -- cgit v1.2.3-70-g09d2