summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-28 18:36:52 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-28 18:36:52 +0300
commit887a4d50d0c966af5f19e5ed2fe8b5556a6f818d (patch)
tree16ac03d6c9d8182ef39913501985d45bd33e7a5a
parent8cd16a9a9ca605137276379361b0328af736c2cc (diff)
downloadmanaplus-887a4d50d0c966af5f19e5ed2fe8b5556a6f818d.tar.gz
manaplus-887a4d50d0c966af5f19e5ed2fe8b5556a6f818d.tar.bz2
manaplus-887a4d50d0c966af5f19e5ed2fe8b5556a6f818d.tar.xz
manaplus-887a4d50d0c966af5f19e5ed2fe8b5556a6f818d.zip
In npc skinned dialogs add support for hide text part from npc window.
-rw-r--r--src/gui/windows/npcdialog.cpp53
-rw-r--r--src/gui/windows/npcdialog.h1
-rw-r--r--src/resources/db/npcdialogdb.cpp2
-rw-r--r--src/resources/npcdialoginfo.h4
4 files changed, 42 insertions, 18 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index bb6a84eb7..53f64f41c 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -136,7 +136,8 @@ NpcDialog::NpcDialog(const BeingId npcId) :
mCameraX(0),
mCameraY(0),
mShowAvatar(false),
- mLogInteraction(config.getBoolValue("logNpcInGui"))
+ mLogInteraction(config.getBoolValue("logNpcInGui")),
+ mHideText(false)
{
// Basic Window Setup
setWindowName("NpcText");
@@ -828,22 +829,43 @@ void NpcDialog::placeMenuControls()
void NpcDialog::placeSkinControls()
{
createSkinControls();
- if (mShowAvatar)
+ if (mHideText)
{
- place(0, 0, mPlayerBox);
- place(1, 0, mScrollArea, 6, 3);
- place(0, 3, mSkinScrollArea, 7, 3);
- place(1, 6, mButton2, 2);
- place(3, 6, mClearButton, 2);
- place(5, 6, mButton, 2);
+ if (mShowAvatar)
+ {
+ place(0, 0, mPlayerBox);
+ place(1, 0, mSkinScrollArea, 7, 3);
+ place(1, 3, mButton2, 2);
+ place(3, 3, mClearButton, 2);
+ place(5, 3, mButton, 2);
+ }
+ else
+ {
+ place(0, 0, mSkinScrollArea, 6, 3);
+ place(0, 3, mButton2, 2);
+ place(2, 3, mClearButton, 2);
+ place(4, 3, mButton, 2);
+ }
}
else
{
- place(0, 0, mScrollArea, 6, 3);
- place(0, 3, mSkinScrollArea, 6, 3);
- place(0, 6, mButton2, 2);
- place(2, 6, mClearButton, 2);
- place(4, 6, mButton, 2);
+ if (mShowAvatar)
+ {
+ place(0, 0, mPlayerBox);
+ place(1, 0, mScrollArea, 6, 3);
+ place(0, 3, mSkinScrollArea, 7, 3);
+ place(1, 6, mButton2, 2);
+ place(3, 6, mClearButton, 2);
+ place(5, 6, mButton, 2);
+ }
+ else
+ {
+ place(0, 0, mScrollArea, 6, 3);
+ place(0, 3, mSkinScrollArea, 6, 3);
+ place(0, 6, mButton2, 2);
+ place(2, 6, mClearButton, 2);
+ place(4, 6, mButton, 2);
+ }
}
}
@@ -1143,6 +1165,7 @@ void NpcDialog::createSkinControls()
return;
}
+ mHideText = dialog->hideText;
FOR_EACH (std::vector<NpcButtonInfo*>::const_iterator, it, dialog->buttons)
{
const NpcButtonInfo *const info = *it;
@@ -1158,10 +1181,6 @@ void NpcDialog::createSkinControls()
button->loadImageSet(info->image);
}
mSkinContainer->add(button);
- logger->log("test 1");
button->adjustSize();
- logger->log("test 2");
- button->setWidth(20);
- button->setHeight(20);
}
}
diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h
index 6c6ea7fba..445cb03ba 100644
--- a/src/gui/windows/npcdialog.h
+++ b/src/gui/windows/npcdialog.h
@@ -315,6 +315,7 @@ class NpcDialog final : public Window,
int mCameraY;
bool mShowAvatar;
bool mLogInteraction;
+ bool mHideText;
};
#endif // GUI_WINDOWS_NPCDIALOG_H
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index cf334a601..cdb96a2ee 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -107,6 +107,8 @@ void NpcDialogDB::loadXmlFile(const std::string &fileName)
deleteDialog(name);
NpcDialogInfo *const dialog = new NpcDialogInfo;
dialog->name = name;
+ dialog->hideText = XML::getBoolProperty(
+ node, "hideText", false);
mDialogs[name] = dialog;
loadNpcDialog(dialog, node);
}
diff --git a/src/resources/npcdialoginfo.h b/src/resources/npcdialoginfo.h
index c1c7b8c1a..ce3e8e92a 100644
--- a/src/resources/npcdialoginfo.h
+++ b/src/resources/npcdialoginfo.h
@@ -31,12 +31,14 @@ struct NpcDialogInfo final
{
NpcDialogInfo() :
buttons(),
- name()
+ name(),
+ hideText(false)
{
}
std::vector<NpcButtonInfo*> buttons;
std::string name;
+ bool hideText;
};
#endif // RESOURCES_NPCDIALOGINFO_H