mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-21 13:20:54 +00:00
Merge branch 'cast-fix' into 'master'
Fix bad cast of loop count in animation bindings. See merge request OpenMW/openmw!3819
This commit is contained in:
commit
c86ca0ef01
@ -64,7 +64,7 @@ namespace MWBase
|
|||||||
virtual void animationTextKey(const MWWorld::Ptr& actor, const std::string& key) = 0;
|
virtual void animationTextKey(const MWWorld::Ptr& actor, const std::string& key) = 0;
|
||||||
virtual void playAnimation(const MWWorld::Ptr& object, const std::string& groupname,
|
virtual void playAnimation(const MWWorld::Ptr& object, const std::string& groupname,
|
||||||
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
||||||
std::string_view start, std::string_view stop, float startpoint, size_t loops, bool loopfallback)
|
std::string_view start, std::string_view stop, float startpoint, uint32_t loops, bool loopfallback)
|
||||||
= 0;
|
= 0;
|
||||||
virtual void exteriorCreated(MWWorld::CellStore& cell) = 0;
|
virtual void exteriorCreated(MWWorld::CellStore& cell) = 0;
|
||||||
virtual void actorDied(const MWWorld::Ptr& actor) = 0;
|
virtual void actorDied(const MWWorld::Ptr& actor) = 0;
|
||||||
|
@ -171,7 +171,7 @@ namespace MWBase
|
|||||||
///< Forces an object to refresh its animation state.
|
///< Forces an object to refresh its animation state.
|
||||||
|
|
||||||
virtual bool playAnimationGroup(
|
virtual bool playAnimationGroup(
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number = 1, bool scripted = false)
|
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number = 1, bool scripted = false)
|
||||||
= 0;
|
= 0;
|
||||||
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
||||||
/// in the scene should be ignored.
|
/// in the scene should be ignored.
|
||||||
@ -180,8 +180,8 @@ namespace MWBase
|
|||||||
/// \param number How many times the animation should be run
|
/// \param number How many times the animation should be run
|
||||||
/// \param scripted Whether the animation should be treated as a scripted animation.
|
/// \param scripted Whether the animation should be treated as a scripted animation.
|
||||||
/// \return Success or error
|
/// \return Success or error
|
||||||
virtual bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
virtual bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
float speed, std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
||||||
= 0;
|
= 0;
|
||||||
///< Lua variant of playAnimationGroup. The mode parameter is omitted
|
///< Lua variant of playAnimationGroup. The mode parameter is omitted
|
||||||
/// and forced to 0. modes 1 and 2 can be emulated by doing clearAnimationQueue() and
|
/// and forced to 0. modes 1 and 2 can be emulated by doing clearAnimationQueue() and
|
||||||
|
@ -249,7 +249,7 @@ namespace MWLua
|
|||||||
// Extended variant of MWScript's PlayGroup and LoopGroup
|
// Extended variant of MWScript's PlayGroup and LoopGroup
|
||||||
api["playQueued"] = sol::overload(
|
api["playQueued"] = sol::overload(
|
||||||
[mechanics](const sol::object& object, const std::string& groupname, const sol::table& options) {
|
[mechanics](const sol::object& object, const std::string& groupname, const sol::table& options) {
|
||||||
int numberOfLoops = options.get_or("loops", std::numeric_limits<int>::max());
|
uint32_t numberOfLoops = options.get_or("loops", std::numeric_limits<uint32_t>::max());
|
||||||
float speed = options.get_or("speed", 1.f);
|
float speed = options.get_or("speed", 1.f);
|
||||||
std::string startKey = options.get_or<std::string>("startkey", "start");
|
std::string startKey = options.get_or<std::string>("startkey", "start");
|
||||||
std::string stopKey = options.get_or<std::string>("stopkey", "stop");
|
std::string stopKey = options.get_or<std::string>("stopkey", "stop");
|
||||||
@ -265,7 +265,7 @@ namespace MWLua
|
|||||||
});
|
});
|
||||||
|
|
||||||
api["playBlended"] = [](const sol::object& object, std::string_view groupname, const sol::table& options) {
|
api["playBlended"] = [](const sol::object& object, std::string_view groupname, const sol::table& options) {
|
||||||
int loops = options.get_or("loops", 0);
|
uint32_t loops = options.get_or("loops", 0u);
|
||||||
MWRender::Animation::AnimPriority priority = getPriorityArgument(options);
|
MWRender::Animation::AnimPriority priority = getPriorityArgument(options);
|
||||||
BlendMask blendMask = options.get_or("blendmask", BlendMask::BlendMask_All);
|
BlendMask blendMask = options.get_or("blendmask", BlendMask::BlendMask_All);
|
||||||
bool autoDisable = options.get_or("autodisable", true);
|
bool autoDisable = options.get_or("autodisable", true);
|
||||||
|
@ -373,7 +373,7 @@ namespace MWLua
|
|||||||
|
|
||||||
void LuaManager::playAnimation(const MWWorld::Ptr& actor, const std::string& groupname,
|
void LuaManager::playAnimation(const MWWorld::Ptr& actor, const std::string& groupname,
|
||||||
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
||||||
std::string_view start, std::string_view stop, float startpoint, size_t loops, bool loopfallback)
|
std::string_view start, std::string_view stop, float startpoint, uint32_t loops, bool loopfallback)
|
||||||
{
|
{
|
||||||
sol::table options = mLua.newTable();
|
sol::table options = mLua.newTable();
|
||||||
options["blendmask"] = blendMask;
|
options["blendmask"] = blendMask;
|
||||||
|
@ -82,7 +82,8 @@ namespace MWLua
|
|||||||
void animationTextKey(const MWWorld::Ptr& actor, const std::string& key) override;
|
void animationTextKey(const MWWorld::Ptr& actor, const std::string& key) override;
|
||||||
void playAnimation(const MWWorld::Ptr& actor, const std::string& groupname,
|
void playAnimation(const MWWorld::Ptr& actor, const std::string& groupname,
|
||||||
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
const MWRender::AnimPriority& priority, int blendMask, bool autodisable, float speedmult,
|
||||||
std::string_view start, std::string_view stop, float startpoint, size_t loops, bool loopfallback) override;
|
std::string_view start, std::string_view stop, float startpoint, uint32_t loops,
|
||||||
|
bool loopfallback) override;
|
||||||
void exteriorCreated(MWWorld::CellStore& cell) override
|
void exteriorCreated(MWWorld::CellStore& cell) override
|
||||||
{
|
{
|
||||||
mEngineEvents.addToQueue(EngineEvents::OnNewExterior{ cell });
|
mEngineEvents.addToQueue(EngineEvents::OnNewExterior{ cell });
|
||||||
|
@ -2005,7 +2005,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Actors::playAnimationGroup(
|
bool Actors::playAnimationGroup(
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted) const
|
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number, bool scripted) const
|
||||||
{
|
{
|
||||||
const auto iter = mIndex.find(ptr.mRef);
|
const auto iter = mIndex.find(ptr.mRef);
|
||||||
if (iter != mIndex.end())
|
if (iter != mIndex.end())
|
||||||
@ -2020,7 +2020,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Actors::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
bool Actors::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops, float speed,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
||||||
{
|
{
|
||||||
const auto iter = mIndex.find(ptr.mRef);
|
const auto iter = mIndex.find(ptr.mRef);
|
||||||
|
@ -112,9 +112,9 @@ namespace MWMechanics
|
|||||||
|
|
||||||
void forceStateUpdate(const MWWorld::Ptr& ptr) const;
|
void forceStateUpdate(const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
bool playAnimationGroup(
|
bool playAnimationGroup(const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number,
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted = false) const;
|
bool scripted = false) const;
|
||||||
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops, float speed,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop);
|
std::string_view startKey, std::string_view stopKey, bool forceLoop);
|
||||||
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable);
|
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable);
|
||||||
void skipAnimation(const MWWorld::Ptr& ptr) const;
|
void skipAnimation(const MWWorld::Ptr& ptr) const;
|
||||||
|
@ -483,7 +483,8 @@ namespace MWMechanics
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
playBlendedAnimation(mCurrentHit, priority, MWRender::BlendMask_All, true, 1, startKey, stopKey, 0.0f, ~0ul);
|
playBlendedAnimation(mCurrentHit, priority, MWRender::BlendMask_All, true, 1, startKey, stopKey, 0.0f,
|
||||||
|
std::numeric_limits<uint32_t>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::refreshJumpAnims(JumpingState jump, bool force)
|
void CharacterController::refreshJumpAnims(JumpingState jump, bool force)
|
||||||
@ -521,7 +522,7 @@ namespace MWMechanics
|
|||||||
mCurrentJump = jumpAnimName;
|
mCurrentJump = jumpAnimName;
|
||||||
if (mJumpState == JumpState_InAir)
|
if (mJumpState == JumpState_InAir)
|
||||||
playBlendedAnimation(jumpAnimName, Priority_Jump, jumpmask, false, 1.0f,
|
playBlendedAnimation(jumpAnimName, Priority_Jump, jumpmask, false, 1.0f,
|
||||||
startAtLoop ? "loop start" : "start", "stop", 0.f, ~0ul);
|
startAtLoop ? "loop start" : "start", "stop", 0.f, std::numeric_limits<uint32_t>::max());
|
||||||
else if (mJumpState == JumpState_Landing)
|
else if (mJumpState == JumpState_Landing)
|
||||||
playBlendedAnimation(jumpAnimName, Priority_Jump, jumpmask, true, 1.0f, "loop stop", "stop", 0.0f, 0);
|
playBlendedAnimation(jumpAnimName, Priority_Jump, jumpmask, true, 1.0f, "loop stop", "stop", 0.0f, 0);
|
||||||
}
|
}
|
||||||
@ -749,8 +750,8 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playBlendedAnimation(
|
playBlendedAnimation(mCurrentMovement, Priority_Movement, movemask, false, 1.f, "start", "stop", startpoint,
|
||||||
mCurrentMovement, Priority_Movement, movemask, false, 1.f, "start", "stop", startpoint, ~0ul, true);
|
std::numeric_limits<uint32_t>::max(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::refreshIdleAnims(CharacterState idle, bool force)
|
void CharacterController::refreshIdleAnims(CharacterState idle, bool force)
|
||||||
@ -778,7 +779,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
MWRender::Animation::AnimPriority priority = getIdlePriority(mIdleState);
|
MWRender::Animation::AnimPriority priority = getIdlePriority(mIdleState);
|
||||||
size_t numLoops = std::numeric_limits<size_t>::max();
|
size_t numLoops = std::numeric_limits<uint32_t>::max();
|
||||||
|
|
||||||
// Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to
|
// Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to
|
||||||
// "idle"+weapon or "idle".
|
// "idle"+weapon or "idle".
|
||||||
@ -1192,8 +1193,8 @@ namespace MWMechanics
|
|||||||
if (!animPlaying)
|
if (!animPlaying)
|
||||||
{
|
{
|
||||||
int mask = MWRender::BlendMask_Torso | MWRender::BlendMask_RightArm;
|
int mask = MWRender::BlendMask_Torso | MWRender::BlendMask_RightArm;
|
||||||
playBlendedAnimation(
|
playBlendedAnimation("idlestorm", Priority_Storm, mask, true, 1.0f, "start", "stop", 0.0f,
|
||||||
"idlestorm", Priority_Storm, mask, true, 1.0f, "start", "stop", 0.0f, ~0ul, true);
|
std::numeric_limits<uint32_t>::max(), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1326,7 +1327,7 @@ namespace MWMechanics
|
|||||||
mAnimation->disable("shield");
|
mAnimation->disable("shield");
|
||||||
|
|
||||||
playBlendedAnimation("torch", Priority_Torch, MWRender::BlendMask_LeftArm, false, 1.0f, "start", "stop",
|
playBlendedAnimation("torch", Priority_Torch, MWRender::BlendMask_LeftArm, false, 1.0f, "start", "stop",
|
||||||
0.0f, std::numeric_limits<size_t>::max(), true);
|
0.0f, std::numeric_limits<uint32_t>::max(), true);
|
||||||
}
|
}
|
||||||
else if (mAnimation->isPlaying("torch"))
|
else if (mAnimation->isPlaying("torch"))
|
||||||
{
|
{
|
||||||
@ -2515,7 +2516,8 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
AnimationQueueEntry entry;
|
AnimationQueueEntry entry;
|
||||||
entry.mGroup = iter->mGroup;
|
entry.mGroup = iter->mGroup;
|
||||||
entry.mLoopCount = iter->mLoopCount;
|
entry.mLoopCount
|
||||||
|
= static_cast<uint32_t>(std::min<uint64_t>(iter->mLoopCount, std::numeric_limits<uint32_t>::max()));
|
||||||
entry.mLooping = mAnimation->isLoopingAnimation(entry.mGroup);
|
entry.mLooping = mAnimation->isLoopingAnimation(entry.mGroup);
|
||||||
entry.mStartKey = "start";
|
entry.mStartKey = "start";
|
||||||
entry.mStopKey = "stop";
|
entry.mStopKey = "stop";
|
||||||
@ -2538,7 +2540,7 @@ namespace MWMechanics
|
|||||||
|
|
||||||
void CharacterController::playBlendedAnimation(const std::string& groupname, const MWRender::AnimPriority& priority,
|
void CharacterController::playBlendedAnimation(const std::string& groupname, const MWRender::AnimPriority& priority,
|
||||||
int blendMask, bool autodisable, float speedmult, std::string_view start, std::string_view stop,
|
int blendMask, bool autodisable, float speedmult, std::string_view start, std::string_view stop,
|
||||||
float startpoint, size_t loops, bool loopfallback) const
|
float startpoint, uint32_t loops, bool loopfallback) const
|
||||||
{
|
{
|
||||||
if (mLuaAnimations)
|
if (mLuaAnimations)
|
||||||
MWBase::Environment::get().getLuaManager()->playAnimation(mPtr, groupname, priority, blendMask, autodisable,
|
MWBase::Environment::get().getLuaManager()->playAnimation(mPtr, groupname, priority, blendMask, autodisable,
|
||||||
@ -2548,7 +2550,7 @@ namespace MWMechanics
|
|||||||
groupname, priority, blendMask, autodisable, speedmult, start, stop, startpoint, loops, loopfallback);
|
groupname, priority, blendMask, autodisable, speedmult, start, stop, startpoint, loops, loopfallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterController::playGroup(std::string_view groupname, int mode, int count, bool scripted)
|
bool CharacterController::playGroup(std::string_view groupname, int mode, uint32_t count, bool scripted)
|
||||||
{
|
{
|
||||||
if (!mAnimation || !mAnimation->hasAnimation(groupname))
|
if (!mAnimation || !mAnimation->hasAnimation(groupname))
|
||||||
return false;
|
return false;
|
||||||
@ -2583,9 +2585,8 @@ namespace MWMechanics
|
|||||||
// if played with a count of 0, all objects play exactly once from start to stop.
|
// if played with a count of 0, all objects play exactly once from start to stop.
|
||||||
// But if the count is x > 0, actors and non-actors behave differently. actors will loop
|
// But if the count is x > 0, actors and non-actors behave differently. actors will loop
|
||||||
// exactly x times, while non-actors will loop x+1 instead.
|
// exactly x times, while non-actors will loop x+1 instead.
|
||||||
if (mPtr.getClass().isActor())
|
if (mPtr.getClass().isActor() && count > 0)
|
||||||
count--;
|
count--;
|
||||||
count = std::max(count, 0);
|
|
||||||
|
|
||||||
AnimationQueueEntry entry;
|
AnimationQueueEntry entry;
|
||||||
entry.mGroup = groupname;
|
entry.mGroup = groupname;
|
||||||
@ -2620,7 +2621,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterController::playGroupLua(std::string_view groupname, float speed, std::string_view startKey,
|
bool CharacterController::playGroupLua(std::string_view groupname, float speed, std::string_view startKey,
|
||||||
std::string_view stopKey, int loops, bool forceLoop)
|
std::string_view stopKey, uint32_t loops, bool forceLoop)
|
||||||
{
|
{
|
||||||
// Note: In mwscript, "idle" is a special case used to clear the anim queue.
|
// Note: In mwscript, "idle" is a special case used to clear the anim queue.
|
||||||
// In lua we offer an explicit clear method instead so this method does not treat "idle" special.
|
// In lua we offer an explicit clear method instead so this method does not treat "idle" special.
|
||||||
@ -2632,7 +2633,7 @@ namespace MWMechanics
|
|||||||
entry.mGroup = groupname;
|
entry.mGroup = groupname;
|
||||||
// Note: MWScript gives one less loop to actors than non-actors.
|
// Note: MWScript gives one less loop to actors than non-actors.
|
||||||
// But this is the Lua version. We don't need to reproduce this weirdness here.
|
// But this is the Lua version. We don't need to reproduce this weirdness here.
|
||||||
entry.mLoopCount = std::max(loops, 0);
|
entry.mLoopCount = loops;
|
||||||
entry.mStartKey = startKey;
|
entry.mStartKey = startKey;
|
||||||
entry.mStopKey = stopKey;
|
entry.mStopKey = stopKey;
|
||||||
entry.mLooping = mAnimation->isLoopingAnimation(groupname) || forceLoop;
|
entry.mLooping = mAnimation->isLoopingAnimation(groupname) || forceLoop;
|
||||||
|
@ -134,7 +134,7 @@ namespace MWMechanics
|
|||||||
struct AnimationQueueEntry
|
struct AnimationQueueEntry
|
||||||
{
|
{
|
||||||
std::string mGroup;
|
std::string mGroup;
|
||||||
size_t mLoopCount;
|
uint32_t mLoopCount;
|
||||||
float mTime;
|
float mTime;
|
||||||
bool mLooping;
|
bool mLooping;
|
||||||
bool mScripted;
|
bool mScripted;
|
||||||
@ -276,10 +276,10 @@ namespace MWMechanics
|
|||||||
|
|
||||||
void playBlendedAnimation(const std::string& groupname, const MWRender::AnimPriority& priority, int blendMask,
|
void playBlendedAnimation(const std::string& groupname, const MWRender::AnimPriority& priority, int blendMask,
|
||||||
bool autodisable, float speedmult, std::string_view start, std::string_view stop, float startpoint,
|
bool autodisable, float speedmult, std::string_view start, std::string_view stop, float startpoint,
|
||||||
size_t loops, bool loopfallback = false) const;
|
uint32_t loops, bool loopfallback = false) const;
|
||||||
bool playGroup(std::string_view groupname, int mode, int count, bool scripted = false);
|
bool playGroup(std::string_view groupname, int mode, uint32_t count, bool scripted = false);
|
||||||
bool playGroupLua(std::string_view groupname, float speed, std::string_view startKey, std::string_view stopKey,
|
bool playGroupLua(std::string_view groupname, float speed, std::string_view startKey, std::string_view stopKey,
|
||||||
int loops, bool forceLoop);
|
uint32_t loops, bool forceLoop);
|
||||||
void enableLuaAnimations(bool enable);
|
void enableLuaAnimations(bool enable);
|
||||||
void skipAnim();
|
void skipAnim();
|
||||||
bool isAnimPlaying(std::string_view groupName) const;
|
bool isAnimPlaying(std::string_view groupName) const;
|
||||||
|
@ -749,14 +749,14 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MechanicsManager::playAnimationGroup(
|
bool MechanicsManager::playAnimationGroup(
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted)
|
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number, bool scripted)
|
||||||
{
|
{
|
||||||
if (ptr.getClass().isActor())
|
if (ptr.getClass().isActor())
|
||||||
return mActors.playAnimationGroup(ptr, groupName, mode, number, scripted);
|
return mActors.playAnimationGroup(ptr, groupName, mode, number, scripted);
|
||||||
else
|
else
|
||||||
return mObjects.playAnimationGroup(ptr, groupName, mode, number, scripted);
|
return mObjects.playAnimationGroup(ptr, groupName, mode, number, scripted);
|
||||||
}
|
}
|
||||||
bool MechanicsManager::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops,
|
bool MechanicsManager::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops,
|
||||||
float speed, std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
float speed, std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
||||||
{
|
{
|
||||||
if (ptr.getClass().isActor())
|
if (ptr.getClass().isActor())
|
||||||
|
@ -141,9 +141,9 @@ namespace MWMechanics
|
|||||||
|
|
||||||
/// Attempt to play an animation group
|
/// Attempt to play an animation group
|
||||||
/// @return Success or error
|
/// @return Success or error
|
||||||
bool playAnimationGroup(
|
bool playAnimationGroup(const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number,
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted = false) override;
|
bool scripted = false) override;
|
||||||
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops, float speed,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop) override;
|
std::string_view startKey, std::string_view stopKey, bool forceLoop) override;
|
||||||
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable) override;
|
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable) override;
|
||||||
void skipAnimation(const MWWorld::Ptr& ptr) override;
|
void skipAnimation(const MWWorld::Ptr& ptr) override;
|
||||||
|
@ -99,7 +99,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Objects::playAnimationGroup(
|
bool Objects::playAnimationGroup(
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted)
|
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number, bool scripted)
|
||||||
{
|
{
|
||||||
const auto iter = mIndex.find(ptr.mRef);
|
const auto iter = mIndex.find(ptr.mRef);
|
||||||
if (iter != mIndex.end())
|
if (iter != mIndex.end())
|
||||||
@ -114,8 +114,8 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Objects::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
bool Objects::playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
float speed, std::string_view startKey, std::string_view stopKey, bool forceLoop)
|
||||||
{
|
{
|
||||||
const auto iter = mIndex.find(ptr.mRef);
|
const auto iter = mIndex.find(ptr.mRef);
|
||||||
if (iter != mIndex.end())
|
if (iter != mIndex.end())
|
||||||
|
@ -46,8 +46,8 @@ namespace MWMechanics
|
|||||||
void onClose(const MWWorld::Ptr& ptr);
|
void onClose(const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
bool playAnimationGroup(
|
bool playAnimationGroup(
|
||||||
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, int number, bool scripted = false);
|
const MWWorld::Ptr& ptr, std::string_view groupName, int mode, uint32_t number, bool scripted = false);
|
||||||
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, int loops, float speed,
|
bool playAnimationGroupLua(const MWWorld::Ptr& ptr, std::string_view groupName, uint32_t loops, float speed,
|
||||||
std::string_view startKey, std::string_view stopKey, bool forceLoop);
|
std::string_view startKey, std::string_view stopKey, bool forceLoop);
|
||||||
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable);
|
void enableLuaAnimations(const MWWorld::Ptr& ptr, bool enable);
|
||||||
void skipAnimation(const MWWorld::Ptr& ptr);
|
void skipAnimation(const MWWorld::Ptr& ptr);
|
||||||
|
@ -805,7 +805,7 @@ namespace MWRender
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Animation::play(std::string_view groupname, const AnimPriority& priority, int blendMask, bool autodisable,
|
void Animation::play(std::string_view groupname, const AnimPriority& priority, int blendMask, bool autodisable,
|
||||||
float speedmult, std::string_view start, std::string_view stop, float startpoint, size_t loops,
|
float speedmult, std::string_view start, std::string_view stop, float startpoint, uint32_t loops,
|
||||||
bool loopfallback)
|
bool loopfallback)
|
||||||
{
|
{
|
||||||
if (!mObjectRoot || mAnimSources.empty())
|
if (!mObjectRoot || mAnimSources.empty())
|
||||||
|
@ -153,7 +153,7 @@ namespace MWRender
|
|||||||
|
|
||||||
bool mPlaying;
|
bool mPlaying;
|
||||||
bool mLoopingEnabled;
|
bool mLoopingEnabled;
|
||||||
size_t mLoopCount;
|
uint32_t mLoopCount;
|
||||||
|
|
||||||
AnimPriority mPriority;
|
AnimPriority mPriority;
|
||||||
int mBlendMask;
|
int mBlendMask;
|
||||||
@ -379,7 +379,7 @@ namespace MWRender
|
|||||||
* the "start" and "stop" keys for looping?
|
* the "start" and "stop" keys for looping?
|
||||||
*/
|
*/
|
||||||
void play(std::string_view groupname, const AnimPriority& priority, int blendMask, bool autodisable,
|
void play(std::string_view groupname, const AnimPriority& priority, int blendMask, bool autodisable,
|
||||||
float speedmult, std::string_view start, std::string_view stop, float startpoint, size_t loops,
|
float speedmult, std::string_view start, std::string_view stop, float startpoint, uint32_t loops,
|
||||||
bool loopfallback = false);
|
bool loopfallback = false);
|
||||||
|
|
||||||
/** Adjust the speed multiplier of an already playing animation.
|
/** Adjust the speed multiplier of an already playing animation.
|
||||||
|
@ -464,7 +464,7 @@ namespace MWRender
|
|||||||
{
|
{
|
||||||
if (!mAnimation->getInfo("torch"))
|
if (!mAnimation->getInfo("torch"))
|
||||||
mAnimation->play(
|
mAnimation->play(
|
||||||
"torch", 2, BlendMask::BlendMask_LeftArm, false, 1.0f, "start", "stop", 0.0f, ~0ul, true);
|
"torch", 2, BlendMask::BlendMask_LeftArm, false, 1.0f, "start", "stop", 0.0f, std::numeric_limits<uint32_t>::max(), true);
|
||||||
}
|
}
|
||||||
else if (mAnimation->getInfo("torch"))
|
else if (mAnimation->getInfo("torch"))
|
||||||
mAnimation->disable("torch");
|
mAnimation->disable("torch");
|
||||||
|
@ -56,7 +56,7 @@ namespace MWScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(
|
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(
|
||||||
ptr, group, mode, std::numeric_limits<int>::max(), true);
|
ptr, group, mode, std::numeric_limits<uint32_t>::max(), true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user