1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 12:09:41 +00:00

Replace more .tga->.dds hacks with ResourceHelpers

This commit is contained in:
MiroslavR 2014-08-16 18:12:18 +02:00
parent 47619d957a
commit 195f044f3b
3 changed files with 10 additions and 24 deletions

View file

@ -2,6 +2,8 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/misc/resourcehelpers.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -182,9 +184,7 @@ namespace MWGui
const ESM::BirthSign *birth = const ESM::BirthSign *birth =
store.get<ESM::BirthSign>().find(mCurrentBirthId); store.get<ESM::BirthSign>().find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->mTexture; mBirthImage->setImageTexture(Misc::ResourceHelpers::correctTexturePath(birth->mTexture));
Widgets::fixTexturePath(texturePath);
mBirthImage->setImageTexture(texturePath);
std::vector<std::string> abilities, powers, spells; std::vector<std::string> abilities, powers, spells;

View file

@ -2,6 +2,8 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/misc/resourcehelpers.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -430,10 +432,9 @@ namespace MWGui
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID); MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
std::string icon = effect->mIcon; std::string icon = effect->mIcon;
int slashPos = icon.find("\\"); int slashPos = icon.rfind('\\');
icon.insert(slashPos+1, "b_"); icon.insert(slashPos+1, "b_");
icon = std::string("icons\\") + icon; icon = Misc::ResourceHelpers::correctIconPath(icon);
Widgets::fixTexturePath(icon);
mSpellImage->setItem(MWWorld::Ptr()); mSpellImage->setItem(MWWorld::Ptr());
mSpellImage->setIcon(icon); mSpellImage->setIcon(icon);

View file

@ -5,6 +5,8 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <components/misc/resourcehelpers.hpp>
#include <MyGUI_ProgressBar.h> #include <MyGUI_ProgressBar.h>
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_ControllerManager.h> #include <MyGUI_ControllerManager.h>
@ -20,21 +22,6 @@ namespace MWGui
{ {
namespace Widgets namespace Widgets
{ {
/* Helper functions */
/*
* Fixes the filename of a texture path to use the correct .dds extension.
* This is needed on some ESM entries which point to a .tga file instead.
*/
void fixTexturePath(std::string &path)
{
int offset = path.rfind(".");
if (offset < 0)
return;
path.replace(offset, path.length() - offset, ".dds");
}
/* MWSkill */ /* MWSkill */
MWSkill::MWSkill() MWSkill::MWSkill()
@ -486,9 +473,7 @@ namespace MWGui
static_cast<MyGUI::TextBox*>(mTextWidget)->setCaptionWithReplacing(spellLine); static_cast<MyGUI::TextBox*>(mTextWidget)->setCaptionWithReplacing(spellLine);
mRequestedWidth = mTextWidget->getTextSize().width + 24; mRequestedWidth = mTextWidget->getTextSize().width + 24;
std::string path = std::string("icons\\") + magicEffect->mIcon; mImageWidget->setImageTexture(Misc::ResourceHelpers::correctIconPath(magicEffect->mIcon));
fixTexturePath(path);
mImageWidget->setImageTexture(path);
} }
MWSpellEffect::~MWSpellEffect() MWSpellEffect::~MWSpellEffect()