Don't use xmesh.nif over mesh.nif for classes that don't make use of the separated keyframes

coverity_scan^2
scrawl 8 years ago
parent 3b24bb9a5e
commit 22482b7eec

@ -38,7 +38,6 @@ namespace MWClass
{
if(!model.empty())
physics.addObject(ptr, model);
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}
std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const
@ -52,6 +51,11 @@ namespace MWClass
return "";
}
bool Activator::useAnim() const
{
return true;
}
std::string Activator::getName (const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();

@ -39,6 +39,9 @@ namespace MWClass
static void registerSelf();
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool useAnim() const;
///< Whether or not to use animated variant of model (default false)
};
}

@ -34,7 +34,11 @@ namespace MWClass
if (getCreatureStats(ptr).isDead())
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
}
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}
bool Actor::useAnim() const
{
return true;
}
void Actor::block(const MWWorld::Ptr &ptr) const

@ -26,6 +26,8 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual bool useAnim() const;
virtual void block(const MWWorld::Ptr &ptr) const;
virtual osg::Vec3f getRotationVector(const MWWorld::Ptr& ptr) const;

@ -100,7 +100,6 @@ namespace MWClass
{
if(!model.empty())
physics.addObject(ptr, model);
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}
std::string Container::getModel(const MWWorld::ConstPtr &ptr) const
@ -114,6 +113,11 @@ namespace MWClass
return "";
}
bool Container::useAnim() const
{
return true;
}
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{

@ -70,6 +70,8 @@ namespace MWClass
virtual void restock (const MWWorld::Ptr &ptr) const;
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool useAnim() const;
};
}

@ -74,8 +74,11 @@ namespace MWClass
MWBase::Environment::get().getWorld()->activateDoor(ptr, customData.mDoorState);
}
}
}
MWBase::Environment::get().getMechanicsManager()->add(ptr);
bool Door::useAnim() const
{
return true;
}
std::string Door::getModel(const MWWorld::ConstPtr &ptr) const

@ -20,6 +20,8 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual bool useAnim() const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -51,8 +51,11 @@ namespace MWClass
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
MWBase::SoundManager::Play_TypeSfx,
MWBase::SoundManager::Play_Loop);
}
MWBase::Environment::get().getMechanicsManager()->add(ptr);
bool Light::useAnim() const
{
return true;
}
std::string Light::getModel(const MWWorld::ConstPtr &ptr) const

@ -16,6 +16,8 @@ namespace MWClass
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
virtual bool useAnim() const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -304,6 +304,11 @@ namespace MWWorld
return "";
}
bool Class::useAnim() const
{
return false;
}
void Class::getModelsToPreload(const Ptr &ptr, std::vector<std::string> &models) const
{
std::string model = getModel(ptr);

@ -271,6 +271,9 @@ namespace MWWorld
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
virtual bool useAnim() const;
///< Whether or not to use animated variant of model (default false)
virtual void getModelsToPreload(const MWWorld::Ptr& ptr, std::vector<std::string>& models) const;
///< Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel().

@ -53,15 +53,23 @@ namespace
void addObject(const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics,
MWRender::RenderingManager& rendering)
{
std::string model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr), rendering.getResourceSystem()->getVFS());
bool useAnim = ptr.getClass().useAnim();
std::string model = ptr.getClass().getModel(ptr);
if (useAnim)
model = Misc::ResourceHelpers::correctActorModelPath(model, rendering.getResourceSystem()->getVFS());
std::string id = ptr.getCellRef().getRefId();
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
model = ""; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
ptr.getClass().insertObjectRendering(ptr, model, rendering);
setNodeRotation(ptr, rendering, false);
ptr.getClass().insertObject (ptr, model, physics);
if (useAnim)
MWBase::Environment::get().getMechanicsManager()->add(ptr);
if (ptr.getClass().isActor())
rendering.addWaterRippleEmitter(ptr);
}

Loading…
Cancel
Save