mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
Merge branch 'master' of https://github.com/OpenMW/openmw
Conflicts: apps/openmw/mwrender/terrainstorage.cpp
This commit is contained in:
commit
e2ee3b2497
23 changed files with 181 additions and 164 deletions
|
@ -50,7 +50,7 @@ QVariant CSMWorld::ResourceTable::headerData (int section, Qt::Orientation orien
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (role==ColumnBase::Role_Flags)
|
if (role==ColumnBase::Role_Flags)
|
||||||
return ColumnBase::Flag_Table;
|
return section==0 ? ColumnBase::Flag_Table : 0;
|
||||||
|
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,8 @@ void CSVWidget::PushButton::setExtendedToolTip()
|
||||||
"<p>(left click to activate,"
|
"<p>(left click to activate,"
|
||||||
"<br>shift-left click to activate and keep panel open)";
|
"<br>shift-left click to activate and keep panel open)";
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case Type_Toggle:
|
case Type_Toggle:
|
||||||
|
|
||||||
tooltip += "<p>(left click to ";
|
tooltip += "<p>(left click to ";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "formatting.hpp"
|
#include "formatting.hpp"
|
||||||
|
|
||||||
#include <components/interpreter/defines.hpp>
|
#include <components/interpreter/defines.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "../mwscript/interpretercontext.hpp"
|
||||||
|
|
||||||
|
@ -269,15 +270,6 @@ namespace MWGui
|
||||||
void BookTextParser::parseImage(std::string tag, bool createWidget)
|
void BookTextParser::parseImage(std::string tag, bool createWidget)
|
||||||
{
|
{
|
||||||
int src_start = tag.find("SRC=")+5;
|
int src_start = tag.find("SRC=")+5;
|
||||||
std::string image = tag.substr(src_start, tag.find('"', src_start)-src_start);
|
|
||||||
|
|
||||||
// fix texture extension to .dds
|
|
||||||
if (image.size() > 4)
|
|
||||||
{
|
|
||||||
image[image.size()-3] = 'd';
|
|
||||||
image[image.size()-2] = 'd';
|
|
||||||
image[image.size()-1] = 's';
|
|
||||||
}
|
|
||||||
|
|
||||||
int width_start = tag.find("WIDTH=")+7;
|
int width_start = tag.find("WIDTH=")+7;
|
||||||
int width = boost::lexical_cast<int>(tag.substr(width_start, tag.find('"', width_start)-width_start));
|
int width = boost::lexical_cast<int>(tag.substr(width_start, tag.find('"', width_start)-width_start));
|
||||||
|
@ -291,16 +283,8 @@ namespace MWGui
|
||||||
MyGUI::IntCoord(0, mHeight, width, height), MyGUI::Align::Left | MyGUI::Align::Top,
|
MyGUI::IntCoord(0, mHeight, width, height), MyGUI::Align::Left | MyGUI::Align::Top,
|
||||||
mParent->getName() + boost::lexical_cast<std::string>(mParent->getChildCount()));
|
mParent->getName() + boost::lexical_cast<std::string>(mParent->getChildCount()));
|
||||||
|
|
||||||
// Apparently a bug with some morrowind versions, they reference the image without the size suffix.
|
std::string image = Misc::ResourceHelpers::correctBookartPath(tag.substr(src_start, tag.find('"', src_start)-src_start), width, height);
|
||||||
// So if the image isn't found, try appending the size.
|
box->setImageTexture(image);
|
||||||
if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup("bookart\\"+image))
|
|
||||||
{
|
|
||||||
std::stringstream str;
|
|
||||||
str << image.substr(0, image.rfind(".")) << "_" << width << "_" << height << image.substr(image.rfind("."));
|
|
||||||
image = str.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
box->setImageTexture("bookart\\" + image);
|
|
||||||
box->setProperty("NeedMouse", "false");
|
box->setProperty("NeedMouse", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <MyGUI_FactoryManager.h>
|
#include <MyGUI_FactoryManager.h>
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
|
@ -63,15 +65,7 @@ namespace MWGui
|
||||||
|
|
||||||
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
|
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
|
||||||
{
|
{
|
||||||
// image
|
setIcon(Misc::ResourceHelpers::correctIconPath(ptr.getClass().getInventoryIcon(ptr)));
|
||||||
std::string path = std::string("icons\\");
|
|
||||||
path += ptr.getClass().getInventoryIcon(ptr);
|
|
||||||
|
|
||||||
std::string::size_type pos = path.rfind(".");
|
|
||||||
if(pos != std::string::npos)
|
|
||||||
path.erase(pos);
|
|
||||||
path.append(".dds");
|
|
||||||
setIcon(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include <components/esm/quickkeys.hpp>
|
#include <components/esm/quickkeys.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -226,12 +227,9 @@ namespace MWGui
|
||||||
esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
||||||
|
|
||||||
std::string path = effect->mIcon;
|
std::string path = effect->mIcon;
|
||||||
int slashPos = path.find("\\");
|
int slashPos = path.rfind('\\');
|
||||||
path.insert(slashPos+1, "b_");
|
path.insert(slashPos+1, "b_");
|
||||||
path = std::string("icons\\") + path;
|
path = Misc::ResourceHelpers::correctIconPath(path);
|
||||||
int pos = path.rfind(".");
|
|
||||||
path.erase(pos);
|
|
||||||
path.append(".dds");
|
|
||||||
|
|
||||||
button->setFrame("textures\\menu_icon_select_magic.dds", MyGUI::IntCoord(2, 2, 40, 40));
|
button->setFrame("textures\\menu_icon_select_magic.dds", MyGUI::IntCoord(2, 2, 40, 40));
|
||||||
button->setIcon(path);
|
button->setIcon(path);
|
||||||
|
|
|
@ -181,6 +181,10 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||||
std::string message = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sNotifyMessage51")->getString();
|
std::string message = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sNotifyMessage51")->getString();
|
||||||
message = boost::str(boost::format(message) % gem.getClass().getName(gem));
|
message = boost::str(boost::format(message) % gem.getClass().getName(gem));
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox(message);
|
MWBase::Environment::get().getWindowManager()->messageBox(message);
|
||||||
|
|
||||||
|
// special case: readd Azura's Star
|
||||||
|
if (Misc::StringUtils::ciEqual(gem.get<ESM::Miscellaneous>()->mBase->mId, "Misc_SoulGem_Azura"))
|
||||||
|
player.getClass().getContainerStore(player).add("Misc_SoulGem_Azura", 1, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateView();
|
updateView();
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -143,13 +145,7 @@ namespace MWGui
|
||||||
|
|
||||||
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
|
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
|
||||||
{
|
{
|
||||||
std::string icon = effect->mIcon;
|
mEffectImage->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon));
|
||||||
icon[icon.size()-3] = 'd';
|
|
||||||
icon[icon.size()-2] = 'd';
|
|
||||||
icon[icon.size()-1] = 's';
|
|
||||||
icon = "icons\\" + icon;
|
|
||||||
|
|
||||||
mEffectImage->setImageTexture (icon);
|
|
||||||
|
|
||||||
mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}");
|
mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString (effect->mIndex)+"}");
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -133,13 +135,7 @@ namespace MWGui
|
||||||
("ImageBox", MyGUI::IntCoord(w,2,16,16), MyGUI::Align::Default);
|
("ImageBox", MyGUI::IntCoord(w,2,16,16), MyGUI::Align::Default);
|
||||||
mWidgetMap[it->first] = image;
|
mWidgetMap[it->first] = image;
|
||||||
|
|
||||||
std::string icon = effect->mIcon;
|
image->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon));
|
||||||
icon[icon.size()-3] = 'd';
|
|
||||||
icon[icon.size()-2] = 'd';
|
|
||||||
icon[icon.size()-1] = 's';
|
|
||||||
icon = "icons\\" + icon;
|
|
||||||
|
|
||||||
image->setImageTexture(icon);
|
|
||||||
|
|
||||||
std::string name = ESM::MagicEffect::effectIdToString (it->first);
|
std::string name = ESM::MagicEffect::effectIdToString (it->first);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -319,20 +321,6 @@ namespace MWGui
|
||||||
return tooltipSize;
|
return tooltipSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::findImageExtension(std::string& image)
|
|
||||||
{
|
|
||||||
int len = image.size();
|
|
||||||
if (len < 4) return;
|
|
||||||
|
|
||||||
if (!Ogre::ResourceGroupManager::getSingleton().resourceExists(Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, image))
|
|
||||||
{
|
|
||||||
// Change texture extension to .dds
|
|
||||||
image[len-3] = 'd';
|
|
||||||
image[len-2] = 'd';
|
|
||||||
image[len-1] = 's';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
{
|
{
|
||||||
mDynamicToolTipBox->setVisible(true);
|
mDynamicToolTipBox->setVisible(true);
|
||||||
|
@ -371,8 +359,7 @@ namespace MWGui
|
||||||
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
|
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
|
||||||
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
|
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
|
||||||
|
|
||||||
std::string realImage = "icons\\" + image;
|
std::string realImage = Misc::ResourceHelpers::correctIconPath(image);
|
||||||
findImageExtension(realImage);
|
|
||||||
|
|
||||||
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
||||||
captionWidget->setProperty("Static", "true");
|
captionWidget->setProperty("Static", "true");
|
||||||
|
@ -644,9 +631,7 @@ namespace MWGui
|
||||||
|
|
||||||
widget->setUserString("ToolTipType", "Layout");
|
widget->setUserString("ToolTipType", "Layout");
|
||||||
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||||
std::string image = sign->mTexture;
|
widget->setUserString("ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture));
|
||||||
image.replace(image.size()-3, 3, "dds");
|
|
||||||
widget->setUserString("ImageTexture_BirthSignImage", "textures\\" + image);
|
|
||||||
std::string text;
|
std::string text;
|
||||||
|
|
||||||
text += sign->mName;
|
text += sign->mName;
|
||||||
|
@ -739,15 +724,9 @@ namespace MWGui
|
||||||
const std::string &name = ESM::MagicEffect::effectIdToString (id);
|
const std::string &name = ESM::MagicEffect::effectIdToString (id);
|
||||||
|
|
||||||
std::string icon = effect->mIcon;
|
std::string icon = effect->mIcon;
|
||||||
|
int slashPos = icon.rfind('\\');
|
||||||
int slashPos = icon.find("\\");
|
|
||||||
icon.insert(slashPos+1, "b_");
|
icon.insert(slashPos+1, "b_");
|
||||||
|
icon = Misc::ResourceHelpers::correctIconPath(icon);
|
||||||
icon[icon.size()-3] = 'd';
|
|
||||||
icon[icon.size()-2] = 'd';
|
|
||||||
icon[icon.size()-1] = 's';
|
|
||||||
|
|
||||||
icon = "icons\\" + icon;
|
|
||||||
|
|
||||||
std::vector<std::string> schools;
|
std::vector<std::string> schools;
|
||||||
schools.push_back ("#{sSchoolAlteration}");
|
schools.push_back ("#{sSchoolAlteration}");
|
||||||
|
|
|
@ -84,8 +84,6 @@ namespace MWGui
|
||||||
|
|
||||||
MWWorld::Ptr mFocusObject;
|
MWWorld::Ptr mFocusObject;
|
||||||
|
|
||||||
void findImageExtension(std::string& image);
|
|
||||||
|
|
||||||
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
||||||
///< @return requested tooltip size
|
///< @return requested tooltip size
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <components/esm/loadweap.hpp>
|
#include <components/esm/loadweap.hpp>
|
||||||
#include <components/esm/loadench.hpp>
|
#include <components/esm/loadench.hpp>
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <libs/openengine/ogre/lights.hpp>
|
#include <libs/openengine/ogre/lights.hpp>
|
||||||
|
|
||||||
|
@ -1207,13 +1208,7 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
|
||||||
if (it->mLoop && loop && it->mEffectId == effectId && it->mBoneName == bonename)
|
if (it->mLoop && loop && it->mEffectId == effectId && it->mBoneName == bonename)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fix texture extension to .dds
|
std::string correctedTexture = Misc::ResourceHelpers::correctTexturePath(texture);
|
||||||
if (texture.size() > 4)
|
|
||||||
{
|
|
||||||
texture[texture.size()-3] = 'd';
|
|
||||||
texture[texture.size()-2] = 'd';
|
|
||||||
texture[texture.size()-1] = 's';
|
|
||||||
}
|
|
||||||
|
|
||||||
EffectParams params;
|
EffectParams params;
|
||||||
params.mModelName = model;
|
params.mModelName = model;
|
||||||
|
@ -1271,7 +1266,7 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
|
||||||
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
||||||
{
|
{
|
||||||
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
||||||
tus->setTextureName("textures\\" + texture);
|
tus->setTextureName(correctedTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1301,7 +1296,7 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
|
||||||
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
||||||
{
|
{
|
||||||
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
||||||
tus->setTextureName("textures\\" + texture);
|
tus->setTextureName(correctedTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "effectmanager.hpp"
|
#include "effectmanager.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <OgreSceneManager.h>
|
#include <OgreSceneManager.h>
|
||||||
#include <OgreParticleSystem.h>
|
#include <OgreParticleSystem.h>
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
|
@ -21,15 +23,6 @@ void EffectManager::addEffect(const std::string &model, std::string textureOverr
|
||||||
Ogre::SceneNode* sceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(worldPosition);
|
Ogre::SceneNode* sceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(worldPosition);
|
||||||
sceneNode->setScale(scale,scale,scale);
|
sceneNode->setScale(scale,scale,scale);
|
||||||
|
|
||||||
// fix texture extension to .dds
|
|
||||||
if (textureOverride.size() > 4)
|
|
||||||
{
|
|
||||||
textureOverride[textureOverride.size()-3] = 'd';
|
|
||||||
textureOverride[textureOverride.size()-2] = 'd';
|
|
||||||
textureOverride[textureOverride.size()-1] = 's';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NifOgre::ObjectScenePtr scene = NifOgre::Loader::createObjects(sceneNode, model);
|
NifOgre::ObjectScenePtr scene = NifOgre::Loader::createObjects(sceneNode, model);
|
||||||
|
|
||||||
// TODO: turn off shadow casting
|
// TODO: turn off shadow casting
|
||||||
|
@ -44,6 +37,7 @@ void EffectManager::addEffect(const std::string &model, std::string textureOverr
|
||||||
|
|
||||||
if (!textureOverride.empty())
|
if (!textureOverride.empty())
|
||||||
{
|
{
|
||||||
|
std::string correctedTexture = Misc::ResourceHelpers::correctTexturePath(textureOverride);
|
||||||
for(size_t i = 0;i < scene->mParticles.size(); ++i)
|
for(size_t i = 0;i < scene->mParticles.size(); ++i)
|
||||||
{
|
{
|
||||||
Ogre::ParticleSystem* partSys = scene->mParticles[i];
|
Ogre::ParticleSystem* partSys = scene->mParticles[i];
|
||||||
|
@ -59,7 +53,7 @@ void EffectManager::addEffect(const std::string &model, std::string textureOverr
|
||||||
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
for (int tex=0; tex<pass->getNumTextureUnitStates(); ++tex)
|
||||||
{
|
{
|
||||||
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
Ogre::TextureUnitState* tus = pass->getTextureUnitState(tex);
|
||||||
tus->setTextureName("textures\\" + textureOverride);
|
tus->setTextureName(correctedTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include <components/nifogre/ogrenifloader.hpp>
|
#include <components/nifogre/ogrenifloader.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <extern/shiny/Platforms/Ogre/OgreMaterial.hpp>
|
#include <extern/shiny/Platforms/Ogre/OgreMaterial.hpp>
|
||||||
|
|
||||||
|
@ -589,13 +590,13 @@ void SkyManager::setWeather(const MWWorld::WeatherResult& weather)
|
||||||
|
|
||||||
if (mClouds != weather.mCloudTexture)
|
if (mClouds != weather.mCloudTexture)
|
||||||
{
|
{
|
||||||
sh::Factory::getInstance().setTextureAlias ("cloud_texture_1", "textures\\"+weather.mCloudTexture);
|
sh::Factory::getInstance().setTextureAlias ("cloud_texture_1", Misc::ResourceHelpers::correctTexturePath(weather.mCloudTexture));
|
||||||
mClouds = weather.mCloudTexture;
|
mClouds = weather.mCloudTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNextClouds != weather.mNextCloudTexture)
|
if (mNextClouds != weather.mNextCloudTexture)
|
||||||
{
|
{
|
||||||
sh::Factory::getInstance().setTextureAlias ("cloud_texture_2", "textures\\"+weather.mNextCloudTexture);
|
sh::Factory::getInstance().setTextureAlias ("cloud_texture_2", Misc::ResourceHelpers::correctTexturePath(weather.mNextCloudTexture));
|
||||||
mNextClouds = weather.mNextCloudTexture;
|
mNextClouds = weather.mNextCloudTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,11 +73,6 @@ Rain Height Max=700 ?
|
||||||
Rain Threshold=0.6 ?
|
Rain Threshold=0.6 ?
|
||||||
Max Raindrops=650 ?
|
Max Raindrops=650 ?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size_t offset = weather.mCloudTexture.find(".tga");
|
|
||||||
if (offset != std::string::npos)
|
|
||||||
weather.mCloudTexture.replace(offset, weather.mCloudTexture.length() - offset, ".dds");
|
|
||||||
|
|
||||||
weather.mIsStorm = (name == "ashstorm" || name == "blight");
|
weather.mIsStorm = (name == "ashstorm" || name == "blight");
|
||||||
|
|
||||||
mWeatherSettings[name] = weather;
|
mWeatherSettings[name] = weather;
|
||||||
|
|
|
@ -237,7 +237,7 @@ if (OGRE_STATIC)
|
||||||
find_package(OpenGLES2 QUIET)
|
find_package(OpenGLES2 QUIET)
|
||||||
find_package(ZLIB QUIET)
|
find_package(ZLIB QUIET)
|
||||||
find_package(ZZip QUIET)
|
find_package(ZZip QUIET)
|
||||||
if (UNIX AND NOT APPLE OR NOT ANDROID)
|
if (UNIX AND (NOT APPLE AND NOT ANDROID))
|
||||||
find_package(X11 QUIET)
|
find_package(X11 QUIET)
|
||||||
find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
|
find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
|
||||||
if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
|
if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
|
||||||
|
|
|
@ -50,7 +50,7 @@ add_component_dir (esmterrain
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (misc
|
add_component_dir (misc
|
||||||
utf8stream stringops
|
utf8stream stringops resourcehelpers
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (files
|
add_component_dir (files
|
||||||
|
|
|
@ -38,13 +38,28 @@ void Script::load(ESMReader &esm)
|
||||||
char* str = &tmp[0];
|
char* str = &tmp[0];
|
||||||
for (size_t i = 0; i < mVarNames.size(); i++)
|
for (size_t i = 0; i < mVarNames.size(); i++)
|
||||||
{
|
{
|
||||||
|
// Support '\r' terminated strings like vanilla. See Bug #1324.
|
||||||
char *termsym = strchr(str, '\r');
|
char *termsym = strchr(str, '\r');
|
||||||
if(termsym) *termsym = '\0';
|
if(termsym) *termsym = '\0';
|
||||||
mVarNames[i] = std::string(str);
|
mVarNames[i] = std::string(str);
|
||||||
str += mVarNames[i].size() + 1;
|
str += mVarNames[i].size() + 1;
|
||||||
|
|
||||||
if (str - &tmp[0] > s)
|
if (str - &tmp[0] > s)
|
||||||
esm.fail("String table overflow");
|
{
|
||||||
|
// Apparently SCVR subrecord is not used and variable names are
|
||||||
|
// determined on the fly from the script text. Therefore don't throw
|
||||||
|
// an exeption, just log an error and continue.
|
||||||
|
std::stringstream ss;
|
||||||
|
|
||||||
|
ss << "ESM Error: " << "String table overflow";
|
||||||
|
ss << "\n File: " << esm.getName();
|
||||||
|
ss << "\n Record: " << esm.getContext().recName.toString();
|
||||||
|
ss << "\n Subrecord: " << "SCVR";
|
||||||
|
ss << "\n Offset: 0x" << std::hex << esm.getFileOffset();
|
||||||
|
std::cerr << ss.str() << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <components/terrain/quadtreenode.hpp>
|
#include <components/terrain/quadtreenode.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
namespace ESMTerrain
|
namespace ESMTerrain
|
||||||
{
|
{
|
||||||
|
@ -276,14 +277,13 @@ namespace ESMTerrain
|
||||||
std::string Storage::getTextureName(UniqueTextureId id)
|
std::string Storage::getTextureName(UniqueTextureId id)
|
||||||
{
|
{
|
||||||
if (id.first == 0)
|
if (id.first == 0)
|
||||||
return "_land_default.dds"; // Not sure if the default texture really is hardcoded?
|
return "textures\\_land_default.dds"; // Not sure if the default texture really is hardcoded?
|
||||||
|
|
||||||
// NB: All vtex ids are +1 compared to the ltex ids
|
// NB: All vtex ids are +1 compared to the ltex ids
|
||||||
const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second);
|
const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second);
|
||||||
|
|
||||||
std::string texture = ltex->mTexture;
|
|
||||||
//TODO this is needed due to MWs messed up texture handling
|
//TODO this is needed due to MWs messed up texture handling
|
||||||
texture = texture.substr(0, texture.rfind(".")) + ".dds";
|
std::string texture = Misc::ResourceHelpers::correctTexturePath(ltex->mTexture);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
@ -472,27 +472,28 @@ namespace ESMTerrain
|
||||||
Terrain::LayerInfo info;
|
Terrain::LayerInfo info;
|
||||||
info.mParallax = false;
|
info.mParallax = false;
|
||||||
info.mSpecular = false;
|
info.mSpecular = false;
|
||||||
info.mDiffuseMap = "textures\\" + texture;
|
info.mDiffuseMap = texture;
|
||||||
std::string texture_ = texture;
|
std::string texture_ = texture;
|
||||||
boost::replace_last(texture_, ".", "_nh.");
|
boost::replace_last(texture_, ".", "_nh.");
|
||||||
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup("textures\\" + texture_))
|
|
||||||
|
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texture_))
|
||||||
{
|
{
|
||||||
info.mNormalMap = "textures\\" + texture_;
|
info.mNormalMap = texture_;
|
||||||
info.mParallax = true;
|
info.mParallax = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texture_ = texture;
|
texture_ = texture;
|
||||||
boost::replace_last(texture_, ".", "_n.");
|
boost::replace_last(texture_, ".", "_n.");
|
||||||
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup("textures\\" + texture_))
|
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texture_))
|
||||||
info.mNormalMap = "textures\\" + texture_;
|
info.mNormalMap = texture_;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_ = texture;
|
texture_ = texture;
|
||||||
boost::replace_last(texture_, ".", "_diffusespec.");
|
boost::replace_last(texture_, ".", "_diffusespec.");
|
||||||
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup("textures\\" + texture_))
|
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texture_))
|
||||||
{
|
{
|
||||||
info.mDiffuseMap = "textures\\" + texture_;
|
info.mDiffuseMap = texture_;
|
||||||
info.mSpecular = true;
|
info.mSpecular = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
90
components/misc/resourcehelpers.cpp
Normal file
90
components/misc/resourcehelpers.cpp
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#include "resourcehelpers.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
|
#include <OgreResourceGroupManager.h>
|
||||||
|
|
||||||
|
bool Misc::ResourceHelpers::changeExtensionToDds(std::string &path)
|
||||||
|
{
|
||||||
|
Ogre::String::size_type pos = path.rfind('.');
|
||||||
|
if(pos != Ogre::String::npos && path.compare(pos, path.length() - pos, ".dds") != 0)
|
||||||
|
{
|
||||||
|
path.replace(pos, path.length(), ".dds");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctResourcePath(const std::string &topLevelDirectory, const std::string &resPath)
|
||||||
|
{
|
||||||
|
/* Bethesda at some point converted all their BSA
|
||||||
|
* textures from tga to dds for increased load speed, but all
|
||||||
|
* texture file name references were kept as .tga.
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::string prefix1 = topLevelDirectory + '\\';
|
||||||
|
std::string prefix2 = topLevelDirectory + '/';
|
||||||
|
|
||||||
|
std::string correctedPath = resPath;
|
||||||
|
Misc::StringUtils::toLower(correctedPath);
|
||||||
|
|
||||||
|
// Apparently, leading separators are allowed
|
||||||
|
while (correctedPath.size() && (correctedPath[0] == '/' || correctedPath[0] == '\\'))
|
||||||
|
correctedPath.erase(0, 1);
|
||||||
|
|
||||||
|
if(correctedPath.compare(0, prefix1.size(), prefix1.data()) != 0 &&
|
||||||
|
correctedPath.compare(0, prefix2.size(), prefix2.data()) != 0)
|
||||||
|
correctedPath = prefix1 + correctedPath;
|
||||||
|
|
||||||
|
std::string origExt = correctedPath;
|
||||||
|
|
||||||
|
// since we know all (GOTY edition or less) textures end
|
||||||
|
// in .dds, we change the extension
|
||||||
|
if (changeExtensionToDds(correctedPath))
|
||||||
|
{
|
||||||
|
// if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods)
|
||||||
|
// verify, and revert if false (this call succeeds quickly, but fails slowly)
|
||||||
|
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(correctedPath))
|
||||||
|
{
|
||||||
|
return origExt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return correctedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctTexturePath(const std::string &resPath)
|
||||||
|
{
|
||||||
|
static const std::string dir = "textures";
|
||||||
|
return correctResourcePath(dir, resPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctIconPath(const std::string &resPath)
|
||||||
|
{
|
||||||
|
static const std::string dir = "icons";
|
||||||
|
return correctResourcePath(dir, resPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctBookartPath(const std::string &resPath)
|
||||||
|
{
|
||||||
|
static const std::string dir = "bookart";
|
||||||
|
std::string image = correctResourcePath(dir, resPath);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Misc::ResourceHelpers::correctBookartPath(const std::string &resPath, int width, int height)
|
||||||
|
{
|
||||||
|
std::string image = correctBookartPath(resPath);
|
||||||
|
|
||||||
|
// Apparently a bug with some morrowind versions, they reference the image without the size suffix.
|
||||||
|
// So if the image isn't found, try appending the size.
|
||||||
|
if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(image))
|
||||||
|
{
|
||||||
|
std::stringstream str;
|
||||||
|
str << image.substr(0, image.rfind('.')) << "_" << width << "_" << height << image.substr(image.rfind('.'));
|
||||||
|
image = Misc::ResourceHelpers::correctBookartPath(str.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
19
components/misc/resourcehelpers.hpp
Normal file
19
components/misc/resourcehelpers.hpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef MISC_RESOURCEHELPERS_H
|
||||||
|
#define MISC_RESOURCEHELPERS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Misc
|
||||||
|
{
|
||||||
|
namespace ResourceHelpers
|
||||||
|
{
|
||||||
|
bool changeExtensionToDds(std::string &path);
|
||||||
|
std::string correctResourcePath(const std::string &topLevelDirectory, const std::string &resPath);
|
||||||
|
std::string correctTexturePath(const std::string &resPath);
|
||||||
|
std::string correctIconPath(const std::string &resPath);
|
||||||
|
std::string correctBookartPath(const std::string &resPath);
|
||||||
|
std::string correctBookartPath(const std::string &resPath, int width, int height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
|
|
||||||
#include <components/nif/node.hpp>
|
#include <components/nif/node.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
#include <components/nifoverrides/nifoverrides.hpp>
|
#include <components/nifoverrides/nifoverrides.hpp>
|
||||||
|
|
||||||
|
@ -54,49 +54,6 @@ static const char *getTestMode(int mode)
|
||||||
return "less_equal";
|
return "less_equal";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string NIFMaterialLoader::findTextureName(const std::string &filename)
|
|
||||||
{
|
|
||||||
/* Bethesda at some point converted all their BSA
|
|
||||||
* textures from tga to dds for increased load speed, but all
|
|
||||||
* texture file name references were kept as .tga.
|
|
||||||
*/
|
|
||||||
static const char path[] = "textures\\";
|
|
||||||
static const char path2[] = "textures/";
|
|
||||||
|
|
||||||
std::string texname = filename;
|
|
||||||
Misc::StringUtils::toLower(texname);
|
|
||||||
|
|
||||||
// Apparently, leading separators are allowed
|
|
||||||
while (texname.size() && (texname[0] == '/' || texname[0] == '\\'))
|
|
||||||
texname.erase(0, 1);
|
|
||||||
|
|
||||||
if(texname.compare(0, sizeof(path)-1, path) != 0 &&
|
|
||||||
texname.compare(0, sizeof(path2)-1, path2) != 0)
|
|
||||||
texname = path + texname;
|
|
||||||
|
|
||||||
Ogre::String::size_type pos = texname.rfind('.');
|
|
||||||
if(pos != Ogre::String::npos && texname.compare(pos, texname.length() - pos, ".dds") != 0)
|
|
||||||
{
|
|
||||||
// since we know all (GOTY edition or less) textures end
|
|
||||||
// in .dds, we change the extension
|
|
||||||
texname.replace(pos, texname.length(), ".dds");
|
|
||||||
|
|
||||||
// if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods)
|
|
||||||
// verify, and revert if false (this call succeeds quickly, but fails slowly)
|
|
||||||
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texname))
|
|
||||||
{
|
|
||||||
texname = filename;
|
|
||||||
Misc::StringUtils::toLower(texname);
|
|
||||||
if(texname.compare(0, sizeof(path)-1, path) != 0 &&
|
|
||||||
texname.compare(0, sizeof(path2)-1, path2) != 0)
|
|
||||||
texname = path + texname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return texname;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
|
Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
|
||||||
const Ogre::String &name, const Ogre::String &group,
|
const Ogre::String &name, const Ogre::String &group,
|
||||||
const Nif::NiTexturingProperty *texprop,
|
const Nif::NiTexturingProperty *texprop,
|
||||||
|
@ -146,7 +103,7 @@ Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
|
||||||
|
|
||||||
const Nif::NiSourceTexture *st = texprop->textures[i].texture.getPtr();
|
const Nif::NiSourceTexture *st = texprop->textures[i].texture.getPtr();
|
||||||
if(st->external)
|
if(st->external)
|
||||||
texName[i] = findTextureName(st->filename);
|
texName[i] = Misc::ResourceHelpers::correctTexturePath(st->filename);
|
||||||
else
|
else
|
||||||
warn("Found internal texture, ignoring.");
|
warn("Found internal texture, ignoring.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ class NIFMaterialLoader {
|
||||||
static std::map<size_t,std::string> sMaterialMap;
|
static std::map<size_t,std::string> sMaterialMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::string findTextureName(const std::string &filename);
|
|
||||||
|
|
||||||
static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
static Ogre::String getMaterial(const Nif::ShapeData *shapedata,
|
||||||
const Ogre::String &name, const Ogre::String &group,
|
const Ogre::String &name, const Ogre::String &group,
|
||||||
const Nif::NiTexturingProperty *texprop,
|
const Nif::NiTexturingProperty *texprop,
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
#include <components/nif/node.hpp>
|
#include <components/nif/node.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "skeleton.hpp"
|
#include "skeleton.hpp"
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
|
@ -169,7 +170,7 @@ public:
|
||||||
const Nif::NiSourceTexture* tex = ctrl->mSources[i].getPtr();
|
const Nif::NiSourceTexture* tex = ctrl->mSources[i].getPtr();
|
||||||
if (!tex->external)
|
if (!tex->external)
|
||||||
std::cerr << "Warning: Found internal texture, ignoring." << std::endl;
|
std::cerr << "Warning: Found internal texture, ignoring." << std::endl;
|
||||||
mTextures.push_back(NIFMaterialLoader::findTextureName(tex->filename));
|
mTextures.push_back(Misc::ResourceHelpers::correctTexturePath(tex->filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue