aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs49
1 files changed, 33 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4cf854e..43cfd80 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
54 /// <value> 54 /// <value>
55 /// The current movement animation 55 /// The current movement animation
56 /// </value> 56 /// </value>
57 public string CurrentMovementAnimation 57 public string CurrentMovementAnimation { get; private set; }
58 { 58
59 get { return m_movementAnimation; }
60 }
61 protected string m_movementAnimation = "CROUCH";
62 private int m_animTickFall; 59 private int m_animTickFall;
63 public int m_animTickJump; // ScenePresence has to see this to control +Z force 60 public int m_animTickJump; // ScenePresence has to see this to control +Z force
64 public bool m_jumping = false; 61 public bool m_jumping = false;
@@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
79 public ScenePresenceAnimator(ScenePresence sp) 76 public ScenePresenceAnimator(ScenePresence sp)
80 { 77 {
81 m_scenePresence = sp; 78 m_scenePresence = sp;
79 CurrentMovementAnimation = "CROUCH";
82 } 80 }
83 81
84 public void AddAnimation(UUID animID, UUID objectID) 82 public void AddAnimation(UUID animID, UUID objectID)
@@ -131,8 +129,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
131 129
132 public void ResetAnimations() 130 public void ResetAnimations()
133 { 131 {
132// m_log.DebugFormat(
133// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
134// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
135
134 m_animations.Clear(); 136 m_animations.Clear();
135 TrySetMovementAnimation("STAND");
136 } 137 }
137 138
138 /// <summary> 139 /// <summary>
@@ -143,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
143 { 144 {
144 if (!m_scenePresence.IsChildAgent) 145 if (!m_scenePresence.IsChildAgent)
145 { 146 {
147// m_log.DebugFormat(
148// "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}",
149// anim, m_scenePresence.Name);
150
146 if (m_animations.TrySetDefaultAnimation( 151 if (m_animations.TrySetDefaultAnimation(
147 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 152 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
148 { 153 {
@@ -155,12 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
155 SendAnimPack(); 160 SendAnimPack();
156 } 161 }
157 } 162 }
163 else
164 {
165 m_log.WarnFormat(
166 "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
167 anim, m_scenePresence.Name);
168 }
158 } 169 }
159 170
160 /// <summary> 171 /// <summary>
161 /// This method determines the proper movement related animation 172 /// This method determines the proper movement related animation
162 /// </summary> 173 /// </summary>
163 public string GetMovementAnimation() 174 private string DetermineMovementAnimation()
164 { 175 {
165 const float FALL_DELAY = 800f; 176 const float FALL_DELAY = 800f;
166 const float PREJUMP_DELAY = 200f; 177 const float PREJUMP_DELAY = 200f;
@@ -263,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
263 return "FALLDOWN"; 274 return "FALLDOWN";
264 } 275 }
265 276
266 return m_movementAnimation; 277 return CurrentMovementAnimation;
267 } 278 }
268 279
269 #endregion Falling/Floating/Landing 280 #endregion Falling/Floating/Landing
@@ -274,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
274 int jumptime; 285 int jumptime;
275 jumptime = Environment.TickCount - m_animTickJump; 286 jumptime = Environment.TickCount - m_animTickJump;
276 287
277
278 if ((move.Z > 0f) && (!m_jumping)) 288 if ((move.Z > 0f) && (!m_jumping))
279 { 289 {
280 // Start jumping, prejump 290 // Start jumping, prejump
@@ -318,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
318 328
319 #region Ground Movement 329 #region Ground Movement
320 330
321 if (m_movementAnimation == "FALLDOWN") 331 if (CurrentMovementAnimation == "FALLDOWN")
322 { 332 {
323 m_falling = false; 333 m_falling = false;
324 m_animTickFall = Environment.TickCount; 334 m_animTickFall = Environment.TickCount;
@@ -331,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
331 else 341 else
332 return "LAND"; 342 return "LAND";
333 } 343 }
334 else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) 344 else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP"))
335 { 345 {
336 int landElapsed = Environment.TickCount - m_animTickFall; 346 int landElapsed = Environment.TickCount - m_animTickFall;
337 int limit = 1000; 347 int limit = 1000;
338 if(m_movementAnimation == "LAND") limit = 350; 348 if (CurrentMovementAnimation == "LAND")
349 limit = 350;
339 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client 350 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
340 351
341 if ((m_animTickFall != 0) && (landElapsed <= limit)) 352 if ((m_animTickFall != 0) && (landElapsed <= limit))
342 { 353 {
343 return m_movementAnimation; 354 return CurrentMovementAnimation;
344 } 355 }
345 else 356 else
346 { 357 {
@@ -378,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
378 #endregion Ground Movement 389 #endregion Ground Movement
379 390
380 m_falling = false; 391 m_falling = false;
381 return m_movementAnimation; 392
393 return CurrentMovementAnimation;
382 } 394 }
383 395
384 /// <summary> 396 /// <summary>
@@ -386,8 +398,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
386 /// </summary> 398 /// </summary>
387 public void UpdateMovementAnimations() 399 public void UpdateMovementAnimations()
388 { 400 {
389 m_movementAnimation = GetMovementAnimation(); 401 CurrentMovementAnimation = DetermineMovementAnimation();
390 TrySetMovementAnimation(m_movementAnimation); 402
403// m_log.DebugFormat(
404// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
405// CurrentMovementAnimation, m_scenePresence.Name);
406
407 TrySetMovementAnimation(CurrentMovementAnimation);
391 } 408 }
392 409
393 public UUID[] GetAnimationArray() 410 public UUID[] GetAnimationArray()