1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Use normalized path for model in ProjectileManager

This commit is contained in:
elsid 2024-10-06 11:23:16 +02:00
parent 6e0eb64538
commit 0665de4c09
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 8 additions and 8 deletions

View File

@ -189,7 +189,7 @@ namespace MWWorld
float mRotateSpeed;
};
void ProjectileManager::createModel(State& state, const std::string& model, const osg::Vec3f& pos,
void ProjectileManager::createModel(State& state, VFS::Path::NormalizedView model, const osg::Vec3f& pos,
const osg::Quat& orient, bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, const std::string& texture)
{
state.mNode = new osg::PositionAttitudeTransform;
@ -207,8 +207,7 @@ namespace MWWorld
attachTo = rotateNode;
}
osg::ref_ptr<osg::Node> projectile
= mResourceSystem->getSceneManager()->getInstance(VFS::Path::toNormalized(model), attachTo);
osg::ref_ptr<osg::Node> projectile = mResourceSystem->getSceneManager()->getInstance(model, attachTo);
if (state.mIdMagic.size() > 1)
{
@ -315,7 +314,7 @@ namespace MWWorld
osg::Vec4 lightDiffuseColor = getMagicBoltLightDiffuseColor(state.mEffects);
auto model = ptr.getClass().getCorrectedModel(ptr);
VFS::Path::Normalized model = ptr.getClass().getCorrectedModel(ptr);
createModel(state, model, pos, orient, true, true, lightDiffuseColor, texture);
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
@ -355,7 +354,7 @@ namespace MWWorld
MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), projectile.getCellRef().getRefId());
MWWorld::Ptr ptr = ref.getPtr();
const auto model = ptr.getClass().getCorrectedModel(ptr);
const VFS::Path::Normalized model = ptr.getClass().getCorrectedModel(ptr);
createModel(state, model, pos, orient, false, false, osg::Vec4(0, 0, 0, 0));
if (!ptr.getClass().getEnchantment(ptr).empty())
SceneUtil::addEnchantedGlow(state.mNode, mResourceSystem, ptr.getClass().getEnchantmentColor(ptr));
@ -695,7 +694,7 @@ namespace MWWorld
state.mAttackStrength = esm.mAttackStrength;
state.mToDelete = false;
std::string model;
VFS::Path::Normalized model;
try
{
MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), esm.mId);
@ -750,7 +749,7 @@ namespace MWWorld
// file's effect list, which is already trimmed of non-projectile
// effects. We need to use the stored value.
std::string model;
VFS::Path::Normalized model;
try
{
MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), state.mIdMagic.at(0));

View File

@ -7,6 +7,7 @@
#include <osg/ref_ptr>
#include <components/esm3/effectlist.hpp>
#include <components/vfs/pathutil.hpp>
#include "../mwbase/soundmanager.hpp"
@ -135,7 +136,7 @@ namespace MWWorld
void moveProjectiles(float dt);
void moveMagicBolts(float dt);
void createModel(State& state, const std::string& model, const osg::Vec3f& pos, const osg::Quat& orient,
void createModel(State& state, VFS::Path::NormalizedView model, const osg::Vec3f& pos, const osg::Quat& orient,
bool rotate, bool createLight, osg::Vec4 lightDiffuseColor, const std::string& texture = "");
void update(State& state, float duration);