moveref
scrawl 10 years ago
commit 7abbca8be9

@ -516,8 +516,13 @@ void OMW::Engine::activate()
if (ptr.getClass().getName(ptr) == "") // objects without name presented to user can never be activated
return;
if (ptr.getClass().isActor() && ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat())
return;
if (ptr.getClass().isActor())
{
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
if (stats.getAiSequence().isInCombat() && !stats.isDead())
return;
}
MWBase::Environment::get().getWorld()->activate(ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
}

@ -193,6 +193,9 @@ namespace MWGui
MyGUI::Gui::getInstance().destroyWidget(parent->getChildAt(0));
}
mTextStyle = TextStyle();
mBlockStyle = BlockStyle();
MyGUI::Widget * paper = parent->createWidget<MyGUI::Widget>("Widget", MyGUI::IntCoord(0, 0, pag.getPageWidth(), pag.getPageHeight()), MyGUI::Align::Left | MyGUI::Align::Top);
paper->setNeedMouseFocus(false);
@ -207,8 +210,25 @@ namespace MWGui
continue;
std::string plainText = parser.getReadyText();
// for cases when linebreaks are used to cause a shift to the next page
// if the split text block ends in an empty line, proceeding text block(s) should have leading empty lines removed
if (pag.getIgnoreLeadingEmptyLines())
{
while (!plainText.empty())
{
if (plainText[0] == '\n')
plainText.erase(plainText.begin());
else
{
pag.setIgnoreLeadingEmptyLines(false);
break;
}
}
}
if (plainText.empty())
brBeforeLastTag = false;
brBeforeLastTag = true;
else
{
// Each block of text (between two tags / boundary and tag) will be displayed in a separate editbox widget,
@ -252,6 +272,8 @@ namespace MWGui
{
case BookTextParser::Event_ImgTag:
{
pag.setIgnoreLeadingEmptyLines(false);
const BookTextParser::Attributes & attr = parser.getAttributes();
if (attr.find("src") == attr.end() || attr.find("width") == attr.end() || attr.find("height") == attr.end())
@ -331,9 +353,7 @@ namespace MWGui
if (attr.find("face") != attr.end())
{
std::string face = attr.at("face");
if (face != "Magic Cards")
mTextStyle.mFont = face;
mTextStyle.mFont = face;
}
if (attr.find("size") != attr.end())
{
@ -408,13 +428,18 @@ namespace MWGui
// first empty lines that would go to the next page should be ignored
// unfortunately, getLineInfo method won't be available until 3.2.2
#if (MYGUI_VERSION >= MYGUI_DEFINE_VERSION(3, 2, 2))
mPaginator.setIgnoreLeadingEmptyLines(true);
const MyGUI::VectorLineInfo & lines = mEditBox->getSubWidgetText()->castType<MyGUI::EditText>()->getLineInfo();
for (unsigned int i = lastLine; i < lines.size(); ++i)
{
if (lines[i].width == 0)
ret += lineHeight;
else
{
mPaginator.setIgnoreLeadingEmptyLines(false);
break;
}
}
#endif
return ret;

@ -81,7 +81,8 @@ namespace MWGui
Paginator(int pageWidth, int pageHeight)
: mStartTop(0), mCurrentTop(0),
mPageWidth(pageWidth), mPageHeight(pageHeight)
mPageWidth(pageWidth), mPageHeight(pageHeight),
mIgnoreLeadingEmptyLines(false)
{
}
@ -89,10 +90,12 @@ namespace MWGui
int getCurrentTop() const { return mCurrentTop; }
int getPageWidth() const { return mPageWidth; }
int getPageHeight() const { return mPageHeight; }
bool getIgnoreLeadingEmptyLines() const { return mIgnoreLeadingEmptyLines; }
Pages getPages() const { return mPages; }
void setStartTop(int top) { mStartTop = top; }
void setCurrentTop(int top) { mCurrentTop = top; }
void setIgnoreLeadingEmptyLines(bool ignore) { mIgnoreLeadingEmptyLines = ignore; }
Paginator & operator<<(const Page & page)
{
@ -103,6 +106,7 @@ namespace MWGui
private:
int mStartTop, mCurrentTop;
int mPageWidth, mPageHeight;
bool mIgnoreLeadingEmptyLines;
Pages mPages;
};

@ -71,6 +71,7 @@ Michael Papageorgiou (werdanith)
Michał Bień (Glorf)
Miroslav Puda (pakanek)
MiroslavR
Narmo
Nathan Jeffords (blunted2night)
Nikolay Kasyanov (corristo)
nobrakal

Loading…
Cancel
Save