mirror of https://github.com/OpenMW/openmw.git
resolving conflicts
commit
18cc435aa1
@ -0,0 +1,197 @@
|
||||
#include "levelupdialog.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
#include <components/esm_store/reclists.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
LevelupDialog::LevelupDialog(MWBase::WindowManager &parWindowManager)
|
||||
: WindowBase("openmw_levelup_dialog.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mOkButton, "OkButton");
|
||||
getWidget(mClassImage, "ClassImage");
|
||||
getWidget(mLevelText, "LevelText");
|
||||
|
||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onOkButtonClicked);
|
||||
|
||||
for (int i=1; i<9; ++i)
|
||||
{
|
||||
MyGUI::TextBox* t;
|
||||
getWidget(t, "AttribVal" + boost::lexical_cast<std::string>(i));
|
||||
|
||||
MyGUI::Button* b;
|
||||
getWidget(b, "Attrib" + boost::lexical_cast<std::string>(i));
|
||||
b->setUserData (i-1);
|
||||
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
|
||||
mAttributes.push_back(b);
|
||||
|
||||
mAttributeValues.push_back(t);
|
||||
|
||||
getWidget(t, "AttribMultiplier" + boost::lexical_cast<std::string>(i));
|
||||
|
||||
mAttributeMultipliers.push_back(t);
|
||||
}
|
||||
|
||||
int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
MyGUI::ImageBox* image = mMainWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(curX,250,16,16), MyGUI::Align::Default);
|
||||
image->setImageTexture ("icons\\tx_goldicon.dds");
|
||||
curX += 24+2;
|
||||
mCoins.push_back(image);
|
||||
}
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
void LevelupDialog::setAttributeValues()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
int val = creatureStats.getAttribute (i).getBase ();
|
||||
if (std::find(mSpentAttributes.begin(), mSpentAttributes.end(), i) != mSpentAttributes.end())
|
||||
{
|
||||
val += pcStats.getLevelupAttributeMultiplier (i);
|
||||
}
|
||||
|
||||
if (val >= 100)
|
||||
val = 100;
|
||||
|
||||
mAttributeValues[i]->setCaption(boost::lexical_cast<std::string>(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LevelupDialog::resetCoins ()
|
||||
{
|
||||
int curX = mMainWidget->getWidth()/2 - (16 + 2) * 1.5;
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
MyGUI::ImageBox* image = mCoins[i];
|
||||
image->setCoord(MyGUI::IntCoord(curX,250,16,16));
|
||||
curX += 24+2;
|
||||
}
|
||||
}
|
||||
|
||||
void LevelupDialog::assignCoins ()
|
||||
{
|
||||
resetCoins();
|
||||
for (unsigned int i=0; i<mSpentAttributes.size(); ++i)
|
||||
{
|
||||
MyGUI::ImageBox* image = mCoins[i];
|
||||
int attribute = mSpentAttributes[i];
|
||||
|
||||
int xdiff = mAttributeMultipliers[attribute]->getCaption() == "" ? 0 : 30;
|
||||
|
||||
MyGUI::IntPoint pos = mAttributes[attribute]->getAbsolutePosition() - mMainWidget->getAbsolutePosition() - MyGUI::IntPoint(24+xdiff,-4);
|
||||
image->setPosition(pos);
|
||||
}
|
||||
|
||||
setAttributeValues();
|
||||
}
|
||||
|
||||
void LevelupDialog::open()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
center();
|
||||
|
||||
mSpentAttributes.clear();
|
||||
resetCoins();
|
||||
|
||||
setAttributeValues();
|
||||
|
||||
// set class image
|
||||
const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass ();
|
||||
// retrieve the ID to this class
|
||||
std::string classId;
|
||||
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list;
|
||||
for (std::map<std::string, ESM::Class>::iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
if (playerClass.mName == it->second.mName)
|
||||
classId = it->first;
|
||||
}
|
||||
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");
|
||||
|
||||
/// \todo replace this with INI-imported texts
|
||||
int level = creatureStats.getLevel ()+1;
|
||||
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
if (mSpentAttributes.size() < 3)
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}", std::vector<std::string>());
|
||||
else
|
||||
{
|
||||
// increase attributes
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
MWMechanics::Stat<int>& attribute = creatureStats.getAttribute(mSpentAttributes[i]);
|
||||
attribute.setBase (attribute.getBase () + pcStats.getLevelupAttributeMultiplier (mSpentAttributes[i]));
|
||||
|
||||
if (attribute.getBase() >= 100)
|
||||
attribute.setBase(100);
|
||||
}
|
||||
|
||||
// "When you gain a level, in addition to increasing three primary attributes, your Health
|
||||
// will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
|
||||
// the Health increase is calculated from the increased Endurance"
|
||||
creatureStats.increaseLevelHealthBonus (creatureStats.getAttribute(ESM::Attribute::Endurance).getBase() * 0.1f);
|
||||
|
||||
creatureStats.setLevel (creatureStats.getLevel()+1);
|
||||
pcStats.levelUp ();
|
||||
|
||||
mWindowManager.removeGuiMode (GM_Levelup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LevelupDialog::onAttributeClicked (MyGUI::Widget *sender)
|
||||
{
|
||||
int attribute = *sender->getUserData<int>();
|
||||
|
||||
std::vector<int>::iterator found = std::find(mSpentAttributes.begin(), mSpentAttributes.end(), attribute);
|
||||
if (found != mSpentAttributes.end())
|
||||
mSpentAttributes.erase (found);
|
||||
else
|
||||
{
|
||||
if (mSpentAttributes.size() == 3)
|
||||
mSpentAttributes[2] = attribute;
|
||||
else
|
||||
mSpentAttributes.push_back(attribute);
|
||||
}
|
||||
assignCoins();
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
#ifndef MWGUI_LEVELUPDIALOG_H
|
||||
#define MWGUI_LEVELUPDIALOG_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class LevelupDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
LevelupDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
private:
|
||||
MyGUI::Button* mOkButton;
|
||||
MyGUI::ImageBox* mClassImage;
|
||||
MyGUI::TextBox* mLevelText;
|
||||
|
||||
std::vector<MyGUI::Button*> mAttributes;
|
||||
std::vector<MyGUI::TextBox*> mAttributeValues;
|
||||
std::vector<MyGUI::TextBox*> mAttributeMultipliers;
|
||||
std::vector<MyGUI::ImageBox*> mCoins;
|
||||
|
||||
std::vector<int> mSpentAttributes;
|
||||
|
||||
void onOkButtonClicked (MyGUI::Widget* sender);
|
||||
void onAttributeClicked (MyGUI::Widget* sender);
|
||||
|
||||
void assignCoins();
|
||||
void resetCoins();
|
||||
|
||||
void setAttributeValues();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,213 @@
|
||||
#include "waitdialog.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <libs/openengine/ogre/fader.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include "../mwworld/timestamp.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
WaitDialogProgressBar::WaitDialogProgressBar(MWBase::WindowManager &parWindowManager)
|
||||
: WindowBase("openmw_wait_dialog_progressbar.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mProgressBar, "ProgressBar");
|
||||
getWidget(mProgressText, "ProgressText");
|
||||
}
|
||||
|
||||
void WaitDialogProgressBar::open()
|
||||
{
|
||||
center();
|
||||
}
|
||||
|
||||
void WaitDialogProgressBar::setProgress (int cur, int total)
|
||||
{
|
||||
mProgressBar->setProgressRange (total);
|
||||
mProgressBar->setProgressPosition (cur);
|
||||
mProgressText->setCaption(boost::lexical_cast<std::string>(cur) + "/" + boost::lexical_cast<std::string>(total));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
WaitDialog::WaitDialog(MWBase::WindowManager &parWindowManager)
|
||||
: WindowBase("openmw_wait_dialog.layout", parWindowManager)
|
||||
, mProgressBar(parWindowManager)
|
||||
, mWaiting(false)
|
||||
, mSleeping(false)
|
||||
, mHours(1)
|
||||
, mRemainingTime(0.05)
|
||||
{
|
||||
getWidget(mDateTimeText, "DateTimeText");
|
||||
getWidget(mRestText, "RestText");
|
||||
getWidget(mHourText, "HourText");
|
||||
getWidget(mHourSlider, "HourSlider");
|
||||
getWidget(mUntilHealedButton, "UntilHealedButton");
|
||||
getWidget(mWaitButton, "WaitButton");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
|
||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WaitDialog::onCancelButtonClicked);
|
||||
mUntilHealedButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WaitDialog::onUntilHealedButtonClicked);
|
||||
mWaitButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WaitDialog::onWaitButtonClicked);
|
||||
|
||||
mHourSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &WaitDialog::onHourSliderChangedPosition);
|
||||
|
||||
mProgressBar.setVisible (false);
|
||||
}
|
||||
|
||||
void WaitDialog::open()
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager ()->getRestEnabled ())
|
||||
{
|
||||
mWindowManager.popGuiMode ();
|
||||
}
|
||||
|
||||
int canRest = MWBase::Environment::get().getWorld ()->canRest ();
|
||||
|
||||
if (canRest == 2)
|
||||
{
|
||||
// resting underwater or mid-air not allowed
|
||||
mWindowManager.messageBox ("#{sNotifyMessage1}", std::vector<std::string>());
|
||||
mWindowManager.popGuiMode ();
|
||||
}
|
||||
|
||||
setCanRest(canRest == 0);
|
||||
|
||||
onHourSliderChangedPosition(mHourSlider, 0);
|
||||
mHourSlider->setScrollPosition (0);
|
||||
|
||||
// http://www.uesp.net/wiki/Lore:Calendar
|
||||
std::string month;
|
||||
int m = MWBase::Environment::get().getWorld ()->getMonth ();
|
||||
if (m == 0)
|
||||
month = "#{sMonthMorningstar}";
|
||||
else if (m == 1)
|
||||
month = "#{sMonthSunsdawn}";
|
||||
else if (m == 2)
|
||||
month = "#{sMonthFirstseed}";
|
||||
else if (m == 3)
|
||||
month = "#{sMonthRainshand}";
|
||||
else if (m == 4)
|
||||
month = "#{sMonthSecondseed}";
|
||||
else if (m == 5)
|
||||
month = "#{sMonthMidyear}";
|
||||
else if (m == 6)
|
||||
month = "#{sMonthSunsheight}";
|
||||
else if (m == 7)
|
||||
month = "#{sMonthLastseed}";
|
||||
else if (m == 8)
|
||||
month = "#{sMonthHeartfire}";
|
||||
else if (m == 9)
|
||||
month = "#{sMonthFrostfall}";
|
||||
else if (m == 10)
|
||||
month = "#{sMonthSunsdusk}";
|
||||
else if (m == 11)
|
||||
month = "#{sMonthEveningstar}";
|
||||
|
||||
int hour = MWBase::Environment::get().getWorld ()->getTimeStamp ().getHour ();
|
||||
bool pm = hour >= 12;
|
||||
if (hour >= 13) hour -= 12;
|
||||
|
||||
std::string dateTimeText =
|
||||
boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getDay ()+1) + " "
|
||||
+ month + " (#{sDay} " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getTimeStamp ().getDay ()+1)
|
||||
+ ") " + boost::lexical_cast<std::string>(hour) + " " + (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}");
|
||||
|
||||
mDateTimeText->setCaptionWithReplacing (dateTimeText);
|
||||
}
|
||||
|
||||
void WaitDialog::onUntilHealedButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
startWaiting();
|
||||
}
|
||||
|
||||
void WaitDialog::onWaitButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
startWaiting();
|
||||
}
|
||||
|
||||
void WaitDialog::startWaiting ()
|
||||
{
|
||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(0.2);
|
||||
setVisible(false);
|
||||
mProgressBar.setVisible (true);
|
||||
mWaiting = true;
|
||||
mCurHour = 0;
|
||||
mRemainingTime = 0.05;
|
||||
mProgressBar.setProgress (0, mHours);
|
||||
}
|
||||
|
||||
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
mWindowManager.popGuiMode ();
|
||||
}
|
||||
|
||||
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
|
||||
{
|
||||
mHourText->setCaptionWithReplacing (boost::lexical_cast<std::string>(position+1) + " #{sRestMenu2}");
|
||||
mHours = position+1;
|
||||
}
|
||||
|
||||
void WaitDialog::setCanRest (bool canRest)
|
||||
{
|
||||
mUntilHealedButton->setVisible(canRest);
|
||||
mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}");
|
||||
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
||||
|
||||
mSleeping = canRest;
|
||||
|
||||
dynamic_cast<Widgets::Box*>(mMainWidget)->notifyChildrenSizeChanged();
|
||||
center();
|
||||
}
|
||||
|
||||
void WaitDialog::onFrame(float dt)
|
||||
{
|
||||
if (!mWaiting)
|
||||
return;
|
||||
|
||||
mRemainingTime -= dt;
|
||||
|
||||
if (mRemainingTime < 0)
|
||||
{
|
||||
mRemainingTime = 0.05;
|
||||
++mCurHour;
|
||||
mProgressBar.setProgress (mCurHour, mHours);
|
||||
|
||||
if (mCurHour <= mHours)
|
||||
MWBase::Environment::get().getWorld ()->advanceTime (1);
|
||||
}
|
||||
|
||||
if (mCurHour > mHours)
|
||||
stopWaiting();
|
||||
}
|
||||
|
||||
void WaitDialog::stopWaiting ()
|
||||
{
|
||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeIn(0.2);
|
||||
mProgressBar.setVisible (false);
|
||||
mWindowManager.popGuiMode ();
|
||||
mWaiting = false;
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::NpcStats pcstats = MWWorld::Class::get(player).getNpcStats(player);
|
||||
|
||||
// trigger levelup if possible
|
||||
if (mSleeping && pcstats.getLevelProgress () >= 10)
|
||||
{
|
||||
mWindowManager.pushGuiMode (GM_Levelup);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
#ifndef MWGUI_WAIT_DIALOG_H
|
||||
#define MWGUI_WAIT_DIALOG_H
|
||||
|
||||
#include "window_base.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class WaitDialogProgressBar : public WindowBase
|
||||
{
|
||||
public:
|
||||
WaitDialogProgressBar(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
void setProgress(int cur, int total);
|
||||
|
||||
protected:
|
||||
MyGUI::ProgressBar* mProgressBar;
|
||||
MyGUI::TextBox* mProgressText;
|
||||
};
|
||||
|
||||
class WaitDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
WaitDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
void onFrame(float dt);
|
||||
|
||||
void bedActivated() { setCanRest(true); }
|
||||
|
||||
bool getSleeping() { return mWaiting && mSleeping; }
|
||||
|
||||
protected:
|
||||
MyGUI::TextBox* mDateTimeText;
|
||||
MyGUI::TextBox* mRestText;
|
||||
MyGUI::TextBox* mHourText;
|
||||
MyGUI::ScrollBar* mHourSlider;
|
||||
MyGUI::Button* mUntilHealedButton;
|
||||
MyGUI::Button* mWaitButton;
|
||||
MyGUI::Button* mCancelButton;
|
||||
|
||||
bool mWaiting;
|
||||
bool mSleeping;
|
||||
int mCurHour;
|
||||
int mHours;
|
||||
float mRemainingTime;
|
||||
|
||||
WaitDialogProgressBar mProgressBar;
|
||||
|
||||
void onUntilHealedButtonClicked(MyGUI::Widget* sender);
|
||||
void onWaitButtonClicked(MyGUI::Widget* sender);
|
||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||
void onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position);
|
||||
|
||||
void setCanRest(bool canRest);
|
||||
|
||||
void startWaiting();
|
||||
void stopWaiting();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,148 @@
|
||||
#include "globalmap.hpp"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <OgreImage.h>
|
||||
#include <OgreTextureManager.h>
|
||||
#include <OgreColourValue.h>
|
||||
#include <OgreHardwareVertexBuffer.h>
|
||||
#include <OgreRoot.h>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include <components/esm_store/reclists.hpp>
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
GlobalMap::GlobalMap(const std::string &cacheDir)
|
||||
: mCacheDir(cacheDir)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GlobalMap::render ()
|
||||
{
|
||||
Ogre::TexturePtr tex;
|
||||
|
||||
if (!boost::filesystem::exists(mCacheDir + "/GlobalMap.png"))
|
||||
{
|
||||
|
||||
int cellSize = 24;
|
||||
|
||||
Ogre::Image image;
|
||||
|
||||
int width = cellSize*61;
|
||||
int height = cellSize*61;
|
||||
|
||||
Ogre::uchar data[width * height * 3];
|
||||
|
||||
for (int x = -30; x <= 30; ++x)
|
||||
{
|
||||
for (int y = -30; y <= 30; ++y)
|
||||
{
|
||||
ESM::Land* land = MWBase::Environment::get().getWorld ()->getStore ().lands.search (x,y);
|
||||
|
||||
if (land)
|
||||
{
|
||||
if (!land->isDataLoaded(ESM::Land::DATA_VHGT))
|
||||
{
|
||||
land->loadData(ESM::Land::DATA_VHGT);
|
||||
}
|
||||
}
|
||||
|
||||
for (int cellY=0; cellY<cellSize; ++cellY)
|
||||
{
|
||||
for (int cellX=0; cellX<cellSize; ++cellX)
|
||||
{
|
||||
int vertexX = float(cellX)/float(cellSize) * ESM::Land::LAND_SIZE;
|
||||
int vertexY = float(cellY)/float(cellSize) * ESM::Land::LAND_SIZE;
|
||||
|
||||
|
||||
int texelX = (x+30) * cellSize + cellX;
|
||||
int texelY = (height-1) - ((y+30) * cellSize + cellY);
|
||||
|
||||
Ogre::ColourValue waterShallowColour(0.15, 0.2, 0.19);
|
||||
Ogre::ColourValue waterDeepColour(0.1, 0.14, 0.13);
|
||||
Ogre::ColourValue groundColour(0.254, 0.19, 0.13);
|
||||
Ogre::ColourValue mountainColour(0.05, 0.05, 0.05);
|
||||
Ogre::ColourValue hillColour(0.16, 0.12, 0.08);
|
||||
|
||||
float mountainHeight = 15000.f;
|
||||
float hillHeight = 2500.f;
|
||||
|
||||
unsigned char r,g,b;
|
||||
|
||||
if (land)
|
||||
{
|
||||
float landHeight = land->mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX];
|
||||
|
||||
|
||||
if (landHeight >= 0)
|
||||
{
|
||||
if (landHeight >= hillHeight)
|
||||
{
|
||||
float factor = std::min(1.f, float(landHeight-hillHeight)/mountainHeight);
|
||||
r = (hillColour.r * (1-factor) + mountainColour.r * factor) * 255;
|
||||
g = (hillColour.g * (1-factor) + mountainColour.g * factor) * 255;
|
||||
b = (hillColour.b * (1-factor) + mountainColour.b * factor) * 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
float factor = std::min(1.f, float(landHeight)/hillHeight);
|
||||
r = (groundColour.r * (1-factor) + hillColour.r * factor) * 255;
|
||||
g = (groundColour.g * (1-factor) + hillColour.g * factor) * 255;
|
||||
b = (groundColour.b * (1-factor) + hillColour.b * factor) * 255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (landHeight >= -100)
|
||||
{
|
||||
float factor = std::min(1.f, -1*landHeight/100.f);
|
||||
r = (((waterShallowColour+groundColour)/2).r * (1-factor) + waterShallowColour.r * factor) * 255;
|
||||
g = (((waterShallowColour+groundColour)/2).g * (1-factor) + waterShallowColour.g * factor) * 255;
|
||||
b = (((waterShallowColour+groundColour)/2).b * (1-factor) + waterShallowColour.b * factor) * 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
float factor = std::min(1.f, -1*(landHeight-100)/1000.f);
|
||||
r = (waterShallowColour.r * (1-factor) + waterDeepColour.r * factor) * 255;
|
||||
g = (waterShallowColour.g * (1-factor) + waterDeepColour.g * factor) * 255;
|
||||
b = (waterShallowColour.b * (1-factor) + waterDeepColour.b * factor) * 255;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
r = waterDeepColour.r * 255;
|
||||
g = waterDeepColour.g * 255;
|
||||
b = waterDeepColour.b * 255;
|
||||
}
|
||||
|
||||
data[texelY * height * 3 + texelX * 3] = r;
|
||||
data[texelY * height * 3 + texelX * 3+1] = g;
|
||||
data[texelY * height * 3 + texelX * 3+2] = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image.loadDynamicImage (data, width, height, Ogre::PF_B8G8R8);
|
||||
|
||||
image.save (mCacheDir + "/GlobalMap.png");
|
||||
|
||||
tex = Ogre::TextureManager::getSingleton ().createManual ("GlobalMap.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
||||
Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_B8G8R8, Ogre::TU_DEFAULT);
|
||||
tex->loadImage(image);
|
||||
}
|
||||
else
|
||||
tex = Ogre::TextureManager::getSingleton ().getByName ("GlobalMap.png");
|
||||
|
||||
tex->load();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
#ifndef _GAME_RENDER_GLOBALMAP_H
|
||||
#define _GAME_RENDER_GLOBALMAP_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
class GlobalMap
|
||||
{
|
||||
public:
|
||||
GlobalMap(const std::string& cacheDir);
|
||||
|
||||
void render();
|
||||
|
||||
private:
|
||||
std::string mCacheDir;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,138 @@
|
||||
<?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="Widget" skin="MW_Box" position="28 14 391 198">
|
||||
<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>
|
||||
|
||||
<Widget type="Widget" skin="" position="36 280 400 400">
|
||||
<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"/>
|
||||
<Widget type="TextBox" skin="SandText" position="0 72 100 24" name="AttribMultiplier4"/>
|
||||
<Widget type="TextBox" skin="SandText" position="200 0 100 24" name="AttribMultiplier5"/>
|
||||
<Widget type="TextBox" skin="SandText" position="200 24 100 24" name="AttribMultiplier6"/>
|
||||
<Widget type="TextBox" skin="SandText" position="200 48 100 24" name="AttribMultiplier7"/>
|
||||
<Widget type="TextBox" skin="SandText" position="200 72 100 24" name="AttribMultiplier8"/>
|
||||
|
||||
<Widget type="HBox" position="22 0 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib1">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeStrength}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sStrDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_strength.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeStrength}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal1">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="22 24 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib2">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeIntelligence}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sIntDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_int.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeIntelligence}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal2">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="22 48 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib3">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeWillpower}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sWilDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_wilpower.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeWillpower}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal3">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="22 72 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib4">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeAgility}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sAgiDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_agility.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeAgility}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal4">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
|
||||
<Widget type="HBox" position="222 0 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib5">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeSpeed}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sSpdDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_speed.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeSpeed}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal5">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="222 24 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib6">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeEndurance}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sEndDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_endurance.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeEndurance}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal6">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="222 48 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib7">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributePersonality}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sPerDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_personality.dds"/>
|
||||
<Property key="Caption" value="#{sAttributePersonality}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal7">
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" position="222 72 200 24">
|
||||
<Widget type="AutoSizedButton" skin="SandTextButton" name="Attrib8">
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="AttributeToolTip"/>
|
||||
<UserString key="Caption_AttributeName" value="#{sAttributeLuck}"/>
|
||||
<UserString key="Caption_AttributeDescription" value="#{sLucDesc}"/>
|
||||
<UserString key="ImageTexture_AttributeImage" value="icons\k\attribute_luck.dds"/>
|
||||
<Property key="Caption" value="#{sAttributeLuck}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="AttribVal8">
|
||||
</Widget>
|
||||
</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>
|
||||
|
||||
</Widget>
|
||||
|
||||
</MyGUI>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 600 200" name="_Main">
|
||||
<Property key="Padding" value="12"/>
|
||||
<Property key="Spacing" value="8"/>
|
||||
<Property key="AutoResize" value="true"/>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="DateTimeText">
|
||||
<Property key="Caption" value="24 Herzfeuer (Tag 24) 2 a.m."/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="RestText">
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" name="HourText">
|
||||
</Widget>
|
||||
|
||||
<Widget type="ScrollBar" skin="MW_HScroll" name="HourSlider" position="0 0 0 18">
|
||||
<Property key="MoveToClick" value="true"/>
|
||||
<Property key="Range" value="24"/>
|
||||
<UserString key="HStretch" value="true"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox">
|
||||
<UserString key="HStretch" value="true"/>
|
||||
<Widget type="Widget">
|
||||
<UserString key="HStretch" value="true"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" name="UntilHealedButton">
|
||||
<Property key="Caption" value="#{sUntilHealed}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" name="WaitButton">
|
||||
<Property key="Caption" value="#{sRest}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" name="CancelButton">
|
||||
<Property key="Caption" value="#{sCancel}"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 219 40" name="_Main">
|
||||
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="5 6 199 20" name="ProgressBar">
|
||||
<Widget type="TextBox" skin="SandText" position="0 0 199 20" name="ProgressText">
|
||||
<Property key="TextAlign" value="Center"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
</MyGUI>
|
Loading…
Reference in New Issue