1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-03 17:37:18 +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 <components/misc/resourcehelpers.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
@ -182,9 +184,7 @@ namespace MWGui
const ESM::BirthSign *birth =
store.get<ESM::BirthSign>().find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->mTexture;
Widgets::fixTexturePath(texturePath);
mBirthImage->setImageTexture(texturePath);
mBirthImage->setImageTexture(Misc::ResourceHelpers::correctTexturePath(birth->mTexture));
std::vector<std::string> abilities, powers, spells;

View File

@ -2,6 +2,8 @@
#include <boost/lexical_cast.hpp>
#include <components/misc/resourcehelpers.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.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);
std::string icon = effect->mIcon;
int slashPos = icon.find("\\");
int slashPos = icon.rfind('\\');
icon.insert(slashPos+1, "b_");
icon = std::string("icons\\") + icon;
Widgets::fixTexturePath(icon);
icon = Misc::ResourceHelpers::correctIconPath(icon);
mSpellImage->setItem(MWWorld::Ptr());
mSpellImage->setIcon(icon);

View File

@ -5,6 +5,8 @@
#include <sstream>
#include <iomanip>
#include <components/misc/resourcehelpers.hpp>
#include <MyGUI_ProgressBar.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_ControllerManager.h>
@ -20,21 +22,6 @@ namespace MWGui
{
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()
@ -486,9 +473,7 @@ namespace MWGui
static_cast<MyGUI::TextBox*>(mTextWidget)->setCaptionWithReplacing(spellLine);
mRequestedWidth = mTextWidget->getTextSize().width + 24;
std::string path = std::string("icons\\") + magicEffect->mIcon;
fixTexturePath(path);
mImageWidget->setImageTexture(path);
mImageWidget->setImageTexture(Misc::ResourceHelpers::correctIconPath(magicEffect->mIcon));
}
MWSpellEffect::~MWSpellEffect()