mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 18:40:01 +00:00
Make scripted animations shut down pathfinding (bug #5065)
This commit is contained in:
parent
961c53f1c4
commit
01dcca3363
@ -18,6 +18,7 @@
|
||||
Bug #4822: Non-weapon equipment and body parts can't inherit time from parent animation
|
||||
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
|
||||
Bug #5062: Root bone rotations for NPC animation don't work the same as for creature animation
|
||||
Bug #5065: Actors with scripted animation still try to wander and turn around without moving
|
||||
Bug #5066: Quirks with starting and stopping scripted animations
|
||||
Bug #5129: Stuttering animation on Centurion Archer
|
||||
Bug #5280: Unskinned shapes in skinned equipment are rendered in the wrong place
|
||||
|
@ -187,6 +187,8 @@ namespace MWBase
|
||||
|
||||
virtual bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName) = 0;
|
||||
|
||||
virtual bool checkScriptedAnimationPlaying(const MWWorld::Ptr& ptr) const = 0;
|
||||
|
||||
/// Save the current animation state of managed references to their RefData.
|
||||
virtual void persistAnimationStates() = 0;
|
||||
|
||||
|
@ -2034,6 +2034,14 @@ namespace MWMechanics
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Actors::checkScriptedAnimationPlaying(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const auto iter = mIndex.find(ptr.mRef);
|
||||
if (iter != mIndex.end())
|
||||
return iter->second->getCharacterController().isScriptedAnimPlaying();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Actors::persistAnimationStates() const
|
||||
{
|
||||
for (const Actor& actor : mActors)
|
||||
|
@ -116,6 +116,7 @@ namespace MWMechanics
|
||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted = false) const;
|
||||
void skipAnimation(const MWWorld::Ptr& ptr) const;
|
||||
bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName) const;
|
||||
bool checkScriptedAnimationPlaying(const MWWorld::Ptr& ptr) const;
|
||||
void persistAnimationStates() const;
|
||||
|
||||
void getObjectsInRange(const osg::Vec3f& position, float radius, std::vector<MWWorld::Ptr>& out) const;
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/luamanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
@ -120,12 +121,12 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
const DetourNavigator::AgentBounds agentBounds = world->getPathfindingAgentBounds(actor);
|
||||
|
||||
/// Stops the actor when it gets too close to a unloaded cell
|
||||
//... At current time, this test is unnecessary. AI shuts down when actor is more than "actors processing range"
|
||||
// setting value
|
||||
//... units from player, and exterior cells are 8192 units long and wide.
|
||||
/// Stops the actor when it gets too close to a unloaded cell or when the actor is playing a scripted animation
|
||||
//... At current time, the first test is unnecessary. AI shuts down when actor is more than
|
||||
//... "actors processing range" setting value units from player, and exterior cells are 8192 units long and wide.
|
||||
//... But AI processing distance may increase in the future.
|
||||
if (isNearInactiveCell(position))
|
||||
if (isNearInactiveCell(position)
|
||||
|| MWBase::Environment::get().getMechanicsManager()->checkScriptedAnimationPlaying(actor))
|
||||
{
|
||||
actor.getClass().getMovementSettings(actor).mPosition[0] = 0;
|
||||
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
|
||||
|
@ -217,7 +217,6 @@ namespace MWMechanics
|
||||
std::string chooseRandomAttackAnimation() const;
|
||||
static bool isRandomAttackAnimation(std::string_view group);
|
||||
|
||||
bool isScriptedAnimPlaying() const;
|
||||
bool isMovementAnimationControlled() const;
|
||||
|
||||
void updateAnimQueue();
|
||||
@ -278,6 +277,7 @@ namespace MWMechanics
|
||||
bool playGroup(std::string_view groupname, int mode, int count, bool scripted = false);
|
||||
void skipAnim();
|
||||
bool isAnimPlaying(std::string_view groupName) const;
|
||||
bool isScriptedAnimPlaying() const;
|
||||
|
||||
enum KillResult
|
||||
{
|
||||
|
@ -771,6 +771,14 @@ namespace MWMechanics
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MechanicsManager::checkScriptedAnimationPlaying(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
if (ptr.getClass().isActor())
|
||||
return mActors.checkScriptedAnimationPlaying(ptr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MechanicsManager::onOpen(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
if (ptr.getClass().isActor())
|
||||
|
@ -145,6 +145,7 @@ namespace MWMechanics
|
||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted = false) override;
|
||||
void skipAnimation(const MWWorld::Ptr& ptr) override;
|
||||
bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName) override;
|
||||
bool checkScriptedAnimationPlaying(const MWWorld::Ptr& ptr) const override;
|
||||
void persistAnimationStates() override;
|
||||
|
||||
/// Update magic effects for an actor. Usually done automatically once per frame, but if we're currently
|
||||
|
Loading…
x
Reference in New Issue
Block a user