Move animation handling from ScenePresence into its own class.
parent
d3fb6039ca
commit
dce5c470b6
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
|
{
|
||||||
|
public class Animation
|
||||||
|
{
|
||||||
|
private LLUUID animID;
|
||||||
|
public LLUUID AnimID
|
||||||
|
{
|
||||||
|
get { return animID; }
|
||||||
|
set { animID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int sequenceNum;
|
||||||
|
public int SequenceNum
|
||||||
|
{
|
||||||
|
get { return sequenceNum; }
|
||||||
|
set { sequenceNum = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Animation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Animation(LLUUID animID, int sequenceNum)
|
||||||
|
{
|
||||||
|
this.animID = animID;
|
||||||
|
this.sequenceNum = sequenceNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
|
{
|
||||||
|
public class AnimationSet
|
||||||
|
{
|
||||||
|
public static AvatarAnimations Animations = new AvatarAnimations();
|
||||||
|
|
||||||
|
private Animation m_defaultAnimation = new Animation();
|
||||||
|
private List<Animation> m_animations = new List<Animation>();
|
||||||
|
|
||||||
|
public AnimationSet()
|
||||||
|
{
|
||||||
|
ResetDefaultAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasAnimation(LLUUID animID)
|
||||||
|
{
|
||||||
|
if (m_defaultAnimation.AnimID == animID)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_animations.Count; ++i)
|
||||||
|
{
|
||||||
|
if (m_animations[i].AnimID == animID)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Add(LLUUID animID, int sequenceNum)
|
||||||
|
{
|
||||||
|
lock (m_animations)
|
||||||
|
{
|
||||||
|
if (!HasAnimation(animID))
|
||||||
|
{
|
||||||
|
m_animations.Add(new Animation(animID, sequenceNum));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Remove(LLUUID animID)
|
||||||
|
{
|
||||||
|
lock (m_animations)
|
||||||
|
{
|
||||||
|
if (m_defaultAnimation.AnimID == animID)
|
||||||
|
{
|
||||||
|
ResetDefaultAnimation();
|
||||||
|
}
|
||||||
|
else if (HasAnimation(animID))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_animations.Count; i++)
|
||||||
|
{
|
||||||
|
if (m_animations[i].AnimID == animID)
|
||||||
|
{
|
||||||
|
m_animations.RemoveAt(i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
ResetDefaultAnimation();
|
||||||
|
m_animations.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default animation is reserved for "main" animations
|
||||||
|
/// that are mutually exclusive, e.g. flying and sitting.
|
||||||
|
/// </summary>
|
||||||
|
public bool SetDefaultAnimation(LLUUID animID, int sequenceNum)
|
||||||
|
{
|
||||||
|
if (m_defaultAnimation.AnimID != animID)
|
||||||
|
{
|
||||||
|
m_defaultAnimation = new Animation(animID, sequenceNum);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool ResetDefaultAnimation()
|
||||||
|
{
|
||||||
|
return TrySetDefaultAnimation("STAND", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the animation as the default animation if it's known
|
||||||
|
/// </summary>
|
||||||
|
public bool TrySetDefaultAnimation(string anim, int sequenceNum)
|
||||||
|
{
|
||||||
|
if (Animations.AnimsLLUUID.ContainsKey(anim))
|
||||||
|
{
|
||||||
|
return SetDefaultAnimation(Animations.AnimsLLUUID[anim], sequenceNum);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetArrays(out LLUUID[] animIDs, out int[] sequenceNums)
|
||||||
|
{
|
||||||
|
lock (m_animations)
|
||||||
|
{
|
||||||
|
animIDs = new LLUUID[m_animations.Count + 1];
|
||||||
|
sequenceNums = new int[m_animations.Count + 1];
|
||||||
|
|
||||||
|
animIDs[0] = m_defaultAnimation.AnimID;
|
||||||
|
sequenceNums[0] = m_defaultAnimation.SequenceNum;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_animations.Count; ++i)
|
||||||
|
{
|
||||||
|
animIDs[i + 1] = m_animations[i].AnimID;
|
||||||
|
sequenceNums[i + 1] = m_animations[i].SequenceNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -73,12 +73,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public static AvatarAnimations Animations = new AvatarAnimations();
|
|
||||||
public static byte[] DefaultTexture;
|
public static byte[] DefaultTexture;
|
||||||
|
|
||||||
public LLUUID currentParcelUUID = LLUUID.Zero;
|
public LLUUID currentParcelUUID = LLUUID.Zero;
|
||||||
private List<LLUUID> m_animations = new List<LLUUID>();
|
private AnimationSet m_animations = new AnimationSet();
|
||||||
private List<int> m_animationSeqs = new List<int>();
|
|
||||||
private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>();
|
private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>();
|
||||||
private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
|
||||||
private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
|
private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
|
||||||
|
@ -608,15 +606,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void MakeChildAgent()
|
public void MakeChildAgent()
|
||||||
{
|
{
|
||||||
if (m_animations.Count > 0)
|
|
||||||
{
|
|
||||||
LLUUID movementAnim = m_animations[0];
|
|
||||||
|
|
||||||
m_animations.Clear();
|
m_animations.Clear();
|
||||||
m_animationSeqs.Clear();
|
|
||||||
|
|
||||||
SetMovementAnimation(movementAnim);
|
|
||||||
}
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}",
|
// "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}",
|
||||||
// Name, UUID, m_scene.RegionInfo.RegionName);
|
// Name, UUID, m_scene.RegionInfo.RegionName);
|
||||||
|
@ -1104,66 +1095,31 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't let this animation become the movement animation
|
if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber))
|
||||||
if (m_animations.Count < 1)
|
|
||||||
TrySetMovementAnimation("STAND");
|
|
||||||
|
|
||||||
if (!m_animations.Contains(animID))
|
|
||||||
{
|
{
|
||||||
m_animations.Add(animID);
|
|
||||||
m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
|
|
||||||
SendAnimPack();
|
SendAnimPack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddAnimation(string name)
|
||||||
|
{
|
||||||
|
if (m_isChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LLUUID animID = m_controllingClient.GetDefaultAnimation(name);
|
||||||
|
if (animID == LLUUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AddAnimation(animID);
|
||||||
|
}
|
||||||
|
|
||||||
public void RemoveAnimation(LLUUID animID)
|
public void RemoveAnimation(LLUUID animID)
|
||||||
{
|
{
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_animations.Contains(animID))
|
if (m_animations.Remove(animID))
|
||||||
{
|
{
|
||||||
if (m_animations[0] == animID)
|
|
||||||
{
|
|
||||||
TrySetMovementAnimation("STAND");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// What a HACK!! Anim list really needs to be an object!
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
for(idx=0;idx < m_animations.Count;idx++)
|
|
||||||
{
|
|
||||||
if (m_animations[idx] == animID)
|
|
||||||
{
|
|
||||||
int seq=m_animationSeqs[idx];
|
|
||||||
|
|
||||||
m_animations.Remove(animID);
|
|
||||||
m_animationSeqs.Remove(seq);
|
|
||||||
SendAnimPack();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void AddAnimation(string name)
|
|
||||||
{
|
|
||||||
if (m_isChildAgent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Don't let this animation become the movement animation
|
|
||||||
if (m_animations.Count < 1)
|
|
||||||
TrySetMovementAnimation("STAND");
|
|
||||||
|
|
||||||
LLUUID animID = m_controllingClient.GetDefaultAnimation(name);
|
|
||||||
if (animID == LLUUID.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!m_animations.Contains(animID))
|
|
||||||
{
|
|
||||||
m_animations.Add(animID);
|
|
||||||
m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber);
|
|
||||||
SendAnimPack();
|
SendAnimPack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1177,33 +1133,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (animID == LLUUID.Zero)
|
if (animID == LLUUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_animations.Contains(animID))
|
RemoveAnimation(animID);
|
||||||
{
|
|
||||||
if (m_animations[0] == animID)
|
|
||||||
{
|
|
||||||
TrySetMovementAnimation("STAND");
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// What a HACK!! Anim list really needs to be an object!
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
for(idx = 0; idx < m_animations.Count; idx++)
|
|
||||||
{
|
|
||||||
if (m_animations[idx] == animID)
|
|
||||||
{
|
|
||||||
int seq = m_animationSeqs[idx];
|
|
||||||
|
|
||||||
m_animations.Remove(animID);
|
|
||||||
m_animationSeqs.Remove(seq);
|
|
||||||
SendAnimPack();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID)
|
public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID)
|
||||||
{
|
{
|
||||||
|
@ -1216,88 +1147,63 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The movement animation is the first element of the animation list,
|
/// The movement animation is reserved for "main" animations
|
||||||
/// reserved for "main" animations that are mutually exclusive,
|
/// that are mutually exclusive, e.g. flying and sitting.
|
||||||
/// like flying and sitting, for example.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void SetMovementAnimation(LLUUID animID)
|
protected void SetMovementAnimation(LLUUID animID)
|
||||||
{
|
{
|
||||||
if (m_animations.Count < 1)
|
if (m_animations.SetDefaultAnimation(animID, m_controllingClient.NextAnimationSequenceNumber))
|
||||||
{
|
{
|
||||||
m_animations.Add(Animations.AnimsLLUUID["STAND"]);
|
|
||||||
m_animationSeqs.Add(1);
|
|
||||||
SendAnimPack();
|
SendAnimPack();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (m_animations[0] != animID)
|
|
||||||
{
|
|
||||||
m_animations[0] = animID;
|
|
||||||
m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
|
|
||||||
SendAnimPack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery...");
|
|
||||||
m_animations[0] = animID;
|
|
||||||
m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber;
|
|
||||||
SendAnimPack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the first known animation in the given list as the movement animation
|
/// The movement animation is reserved for "main" animations
|
||||||
|
/// that are mutually exclusive, e.g. flying and sitting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void TrySetMovementAnimation(params string[] anims)
|
protected void TrySetMovementAnimation(string anim)
|
||||||
{
|
{
|
||||||
foreach (string anim in anims)
|
if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber))
|
||||||
{
|
{
|
||||||
if (Animations.AnimsLLUUID.ContainsKey(anim))
|
SendAnimPack();
|
||||||
{
|
|
||||||
SetMovementAnimation(Animations.AnimsLLUUID[anim]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method handles agent movement related animations
|
/// This method determines the proper movement related animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void UpdateMovementAnimations()
|
protected string GetMovementAnimation()
|
||||||
{
|
{
|
||||||
if (m_movementflag != 0)
|
if (m_movementflag != 0)
|
||||||
{
|
{
|
||||||
// We are moving
|
// We are moving
|
||||||
if (m_physicsActor.Flying)
|
if (m_physicsActor.Flying)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("FLY");
|
return "FLY";
|
||||||
}
|
}
|
||||||
else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
|
else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
|
||||||
PhysicsActor.IsColliding)
|
PhysicsActor.IsColliding)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("CROUCHWALK");
|
return "CROUCHWALK";
|
||||||
}
|
}
|
||||||
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6)
|
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6)
|
||||||
{
|
{
|
||||||
// Client is moving and falling at a velocity greater then 6 meters per unit
|
// Client is moving and falling at a velocity greater then 6 meters per unit
|
||||||
TrySetMovementAnimation("FALLDOWN");
|
return "FALLDOWN";
|
||||||
}
|
}
|
||||||
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 &&
|
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 &&
|
||||||
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
|
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("JUMP");
|
return "JUMP";
|
||||||
}
|
}
|
||||||
else if (m_setAlwaysRun)
|
else if (m_setAlwaysRun)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("RUN");
|
return "RUN";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("WALK");
|
return "WALK";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1307,29 +1213,34 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
|
if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
|
||||||
PhysicsActor.IsColliding)
|
PhysicsActor.IsColliding)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("CROUCH");
|
return "CROUCH";
|
||||||
}
|
}
|
||||||
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying)
|
else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("FALLDOWN");
|
return "FALLDOWN";
|
||||||
}
|
}
|
||||||
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying &&
|
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying &&
|
||||||
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
|
(m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
|
||||||
{
|
{
|
||||||
// This is the standing jump
|
// This is the standing jump
|
||||||
TrySetMovementAnimation("JUMP");
|
return "JUMP";
|
||||||
}
|
}
|
||||||
else if (m_physicsActor.Flying)
|
else if (m_physicsActor.Flying)
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("HOVER");
|
return "HOVER";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TrySetMovementAnimation("STAND");
|
return "STAND";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void UpdateMovementAnimations()
|
||||||
|
{
|
||||||
|
TrySetMovementAnimation(GetMovementAnimation());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new movement
|
/// Adds a new movement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1422,21 +1333,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement
|
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
|
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
|
||||||
// doing the above assures us that we know what we sent the clients last
|
// doing the above assures us that we know what we sent the clients last
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
m_updateCount = 0;
|
m_updateCount = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// followed suggestion from mic bowman. reversed the two lines below.
|
// followed suggestion from mic bowman. reversed the two lines below.
|
||||||
CheckForBorderCrossing();
|
CheckForBorderCrossing();
|
||||||
CheckForSignificantMovement(); // sends update to the modules.
|
CheckForSignificantMovement(); // sends update to the modules.
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1621,7 +1526,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendAnimPack()
|
public void SendAnimPack()
|
||||||
{
|
{
|
||||||
SendAnimPack(m_animations.ToArray(), m_animationSeqs.ToArray());
|
if (m_isChildAgent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LLUUID[] animIDs;
|
||||||
|
int[] sequenceNums;
|
||||||
|
|
||||||
|
m_animations.GetArrays(out animIDs, out sequenceNums);
|
||||||
|
|
||||||
|
SendAnimPack(animIDs, sequenceNums);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -2142,14 +2055,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
DefaultTexture = textu.ToBytes();
|
DefaultTexture = textu.ToBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>));
|
m_animations = (AnimationSet)info.GetValue("m_animations", typeof(AnimationSet));
|
||||||
|
|
||||||
foreach (Guid guid in animations_work)
|
|
||||||
{
|
|
||||||
m_animations.Add(new LLUUID(guid));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>));
|
|
||||||
m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool));
|
m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool));
|
||||||
m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte));
|
m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte));
|
||||||
m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>));
|
m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>));
|
||||||
|
@ -2304,16 +2210,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
base.GetObjectData(info, context);
|
base.GetObjectData(info, context);
|
||||||
|
|
||||||
List<Guid> animations_work = new List<Guid>();
|
info.AddValue("m_animations", m_animations);
|
||||||
|
|
||||||
foreach (LLUUID uuid in m_animations)
|
|
||||||
{
|
|
||||||
animations_work.Add(uuid.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
info.AddValue("m_animations", animations_work);
|
|
||||||
|
|
||||||
info.AddValue("m_animationSeqs", m_animationSeqs);
|
|
||||||
info.AddValue("m_updateflag", m_updateflag);
|
info.AddValue("m_updateflag", m_updateflag);
|
||||||
info.AddValue("m_movementflag", m_movementflag);
|
info.AddValue("m_movementflag", m_movementflag);
|
||||||
info.AddValue("m_forcesList", m_forcesList);
|
info.AddValue("m_forcesList", m_forcesList);
|
||||||
|
|
Loading…
Reference in New Issue