Merge remote-tracking branch 'scrawl/next' into next

actorid
Marc Zinnschlag 12 years ago
commit 25fd7a41eb

@ -183,13 +183,10 @@ namespace MWClass
std::string bodyRaceID = headID.substr(0, end);
std::string model = "meshes\\base_anim.nif";
if (bodyRaceID == "b_n_khajiit_m_" ||
bodyRaceID == "b_n_khajiit_f_" ||
bodyRaceID == "b_n_argonian_m_" ||
bodyRaceID == "b_n_argonian_f_")
{
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
if(race->mData.mFlags & ESM::Race::Beast)
model = "meshes\\base_animkna.nif";
}
return model;
}

@ -23,6 +23,8 @@ namespace MWGui
getWidget(mOkButton, "OkButton");
getWidget(mClassImage, "ClassImage");
getWidget(mLevelText, "LevelText");
getWidget(mLevelDescription, "LevelDescription");
getWidget(mCoinBox, "Coins");
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onOkButtonClicked);
@ -80,11 +82,13 @@ namespace MWGui
void LevelupDialog::resetCoins ()
{
int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
int curX = 0;
for (int i=0; i<3; ++i)
{
MyGUI::ImageBox* image = mCoins[i];
image->setCoord(MyGUI::IntCoord(curX,250,16,16));
image->detachFromWidget();
image->attachToWidget(mCoinBox);
image->setCoord(MyGUI::IntCoord(curX,0,16,16));
curX += 24+2;
}
}
@ -95,6 +99,9 @@ namespace MWGui
for (unsigned int i=0; i<mSpentAttributes.size(); ++i)
{
MyGUI::ImageBox* image = mCoins[i];
image->detachFromWidget();
image->attachToWidget(mMainWidget);
int attribute = mSpentAttributes[i];
int xdiff = mAttributeMultipliers[attribute]->getCaption() == "" ? 0 : 30;
@ -113,8 +120,6 @@ namespace MWGui
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
center();
mSpentAttributes.clear();
resetCoins();
@ -128,16 +133,25 @@ namespace MWGui
mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds");
/// \todo replace this with INI-imported texts
int level = creatureStats.getLevel ()+1;
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level));
std::string levelupdescription;
if(level>20)
levelupdescription=world->getFallback("Level_Up_Default");
else
levelupdescription=world->getFallback("Level_Up_Level"+boost::lexical_cast<std::string>(level));
mLevelDescription->setCaption (levelupdescription);
for (int i=0; i<8; ++i)
{
MyGUI::TextBox* text = mAttributeMultipliers[i];
int mult = pcStats.getLevelupAttributeMultiplier (i);
text->setCaption(mult <= 1 ? "" : "x" + boost::lexical_cast<std::string>(mult));
}
center();
}
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)

@ -17,6 +17,9 @@ namespace MWGui
MyGUI::Button* mOkButton;
MyGUI::ImageBox* mClassImage;
MyGUI::TextBox* mLevelText;
MyGUI::EditBox* mLevelDescription;
MyGUI::Widget* mCoinBox;
std::vector<MyGUI::Button*> mAttributes;
std::vector<MyGUI::TextBox*> mAttributeValues;

@ -586,6 +586,30 @@ void AutoSizedTextBox::setPropertyOverride(const std::string& _key, const std::s
}
}
MyGUI::IntSize AutoSizedEditBox::getRequestedSize()
{
return MyGUI::IntSize(getSize().width, getTextSize().height);
}
void AutoSizedEditBox::setCaption(const MyGUI::UString& _value)
{
EditBox::setCaption(_value);
notifySizeChange (this);
}
void AutoSizedEditBox::setPropertyOverride(const std::string& _key, const std::string& _value)
{
if (_key == "ExpandDirection")
{
mExpandDirection = MyGUI::Align::parse (_value);
}
else
{
EditBox::setPropertyOverride (_key, _value);
}
}
MyGUI::IntSize AutoSizedButton::getRequestedSize()
{
@ -660,6 +684,8 @@ void HBox::align ()
{
sizes.push_back (std::make_pair(w->getSize(), hstretch));
total_width += w->getSize().width;
if (!(w->getUserString("VStretch") == "true"))
total_height = std::max(total_height, w->getSize().height);
}
if (i != count-1)
@ -783,6 +809,9 @@ void VBox::align ()
{
sizes.push_back (std::make_pair(w->getSize(), vstretch));
total_height += w->getSize().height;
if (!(w->getUserString("HStretch") == "true"))
total_width = std::max(total_width, w->getSize().width);
}
if (i != count-1)

@ -7,6 +7,7 @@
#include <MyGUI_Widget.h>
#include <MyGUI_TextBox.h>
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
namespace MyGUI
{
@ -340,6 +341,18 @@ namespace MWGui
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
};
class AutoSizedEditBox : public AutoSizedWidget, public MyGUI::EditBox
{
MYGUI_RTTI_DERIVED( AutoSizedEditBox )
public:
virtual MyGUI::IntSize getRequestedSize();
virtual void setCaption(const MyGUI::UString& _value);
protected:
virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
};
class AutoSizedButton : public AutoSizedWidget, public MyGUI::Button
{
MYGUI_RTTI_DERIVED( AutoSizedButton )

@ -129,6 +129,7 @@ WindowManager::WindowManager(
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::HBox>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::VBox>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedTextBox>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedEditBox>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");

@ -162,7 +162,8 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
mBounds.merge(Vector3(c4.x, c4.y, 0));
// apply a little padding
mBounds.scale ((mBounds.getSize ()+Ogre::Vector3(1000,1000,0)) / mBounds.getSize ());
mBounds.setMinimum (mBounds.getMinimum() - Vector3(500,500,0));
mBounds.setMaximum (mBounds.getMaximum() + Vector3(500,500,0));
Vector2 center(mBounds.getCenter().x, mBounds.getCenter().y);

@ -45,11 +45,12 @@ namespace MWWorld
{
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)
if(npcRace == "argonian" || npcRace == "khajiit")
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
if(race->mData.mFlags & ESM::Race::Beast)
{
if(*slot == MWWorld::InventoryStore::Slot_Helmet){
if(*slot == MWWorld::InventoryStore::Slot_Helmet)
{
std::vector<ESM::PartReference> parts;
if(it.getType() == MWWorld::ContainerStore::Type_Clothing)
parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
else
@ -74,19 +75,35 @@ namespace MWWorld
if (*slot == MWWorld::InventoryStore::Slot_Boots)
{
// Only notify the player, not npcs
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
bool allow = true;
std::vector<ESM::PartReference> parts;
if(it.getType() == MWWorld::ContainerStore::Type_Clothing)
parts = it->get<ESM::Clothing>()->mBase->mParts.mParts;
else
parts = it->get<ESM::Armor>()->mBase->mParts.mParts;
for(std::vector<ESM::PartReference>::iterator itr = parts.begin(); itr != parts.end(); ++itr)
{
if(it.getType() == MWWorld::ContainerStore::Type_Clothing){ // It's shoes
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}", std::vector<std::string>());
}
else // It's boots
if((*itr).mPart == ESM::PRT_LFoot || (*itr).mPart == ESM::PRT_RFoot)
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}", std::vector<std::string>());
allow = false;
// Only notify the player, not npcs
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
{
if(it.getType() == MWWorld::ContainerStore::Type_Clothing){ // It's shoes
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}", std::vector<std::string>());
}
else // It's boots
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}", std::vector<std::string>());
}
}
break;
}
}
break;
if(!allow)
break;
}
}

@ -233,8 +233,6 @@ namespace MWWorld
mPlayer = new MWWorld::Player (mStore.get<ESM::NPC>().find ("player"), *this);
mRendering->attachCameraTo(mPlayer->getPlayer());
mPhysics->addActor(mPlayer->getPlayer());
// global variables
mGlobalVariables = new Globals (mStore);
@ -940,19 +938,16 @@ namespace MWWorld
if (Misc::StringUtils::ciEqual(record.mId, "player"))
{
static const char *sRaces[] =
{
"Argonian", "Breton", "Dark Elf", "High Elf", "Imperial", "Khajiit", "Nord", "Orc", "Redguard",
"Woodelf", 0
};
std::vector<std::string> ids;
getStore().get<ESM::Race>().listIdentifier(ids);
int i=0;
unsigned int i=0;
for (; sRaces[i]; ++i)
if (Misc::StringUtils::ciEqual (sRaces[i], record.mRace))
for (; i<ids.size(); ++i)
if (Misc::StringUtils::ciEqual (ids[i], record.mRace))
break;
mGlobalVariables->setInt ("pcrace", sRaces[i] ? i+1 : 0);
mGlobalVariables->setInt ("pcrace", (i == ids.size()) ? 0 : i+1);
const ESM::NPC *player =
mPlayer->getPlayer().get<ESM::NPC>()->mBase;
@ -1318,6 +1313,7 @@ namespace MWWorld
void World::renderPlayer()
{
mRendering->renderPlayer(mPlayer->getPlayer());
mPhysics->addActor(mPlayer->getPlayer());
}
void World::setupExternalRendering (MWRender::ExternalRendering& rendering)

@ -1,17 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 440 438" name="_Main">
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 0 0" name="_Main">
<Property key="Padding" value="12"/>
<Property key="Spacing" value="8"/>
<Property key="AutoResize" value="true"/>
<Widget type="Widget" skin="MW_Box" position="28 14 391 198">
<UserString key="HStretch" value="false"/>
<UserString key="VStretch" value="false"/>
<Widget type="ImageBox" skin="ImageBox" name="ClassImage" position="4 4 383 190">
</Widget>
</Widget>
<Widget type="TextBox" skin="SandText" position="28 218 391 24" name="LevelText">
<Widget type="AutoSizedTextBox" skin="SandText" position="28 218 391 24" name="LevelText">
</Widget>
<Widget type="Widget" skin="" position="36 280 400 400">
<Widget type="AutoSizedEditBox" skin="SandText" position="36 280 330 24" name="LevelDescription">
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="Static" value="true"/>
</Widget>
<Widget type="Widget" skin="" position="0 0 100 16" name="Coins">
<UserString key="HStretch" value="false"/>
<UserString key="VStretch" value="false"/>
</Widget>
<Widget type="Widget" skin="" position="0 280 350 100">
<UserString key="HStretch" value="false"/>
<UserString key="VStretch" value="false"/>
<Widget type="TextBox" skin="SandText" position="0 0 100 24" name="AttribMultiplier1"/>
<Widget type="TextBox" skin="SandText" position="0 24 100 24" name="AttribMultiplier2"/>
<Widget type="TextBox" skin="SandText" position="0 48 100 24" name="AttribMultiplier3"/>
@ -127,12 +146,17 @@
</Widget>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="422 398 0 24" name="OkButton">
<Property key="ExpandDirection" value="Left"/>
<Property key="Caption" value="#{sOk}"/>
<Widget type="HBox" skin="" position="0 0 330 24">
<UserString key="HStretch" value="true"/>
<Widget type="Widget">
<UserString key="HStretch" value="true"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 0 24" name="OkButton">
<Property key="Caption" value="#{sOk}"/>
</Widget>
</Widget>
</Widget>
</MyGUI>

Loading…
Cancel
Save