diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 6b1208c..2a6b8ea 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) |
@@ -146,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
146 | { | 144 | { |
147 | if (!m_scenePresence.IsChildAgent) | 145 | if (!m_scenePresence.IsChildAgent) |
148 | { | 146 | { |
147 | // m_log.DebugFormat( | ||
148 | // "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}", | ||
149 | // anim, m_scenePresence.Name); | ||
150 | |||
149 | if (m_animations.TrySetDefaultAnimation( | 151 | if (m_animations.TrySetDefaultAnimation( |
150 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 152 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
151 | { | 153 | { |
@@ -158,20 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
158 | SendAnimPack(); | 160 | SendAnimPack(); |
159 | } | 161 | } |
160 | } | 162 | } |
161 | // Don't leave this on since on teleports SP.HandleAgentUpdate() still hammers us for a while after it teleports | 163 | else |
162 | // else | 164 | { |
163 | // { | 165 | m_log.WarnFormat( |
164 | // m_log.WarnFormat( | 166 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", |
165 | // "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", | 167 | anim, m_scenePresence.Name); |
166 | // anim, m_scenePresence.Name); | 168 | } |
167 | // throw new Exception(string.Format("aaargh on setting {0}", anim)); | ||
168 | // } | ||
169 | } | 169 | } |
170 | 170 | ||
171 | /// <summary> | 171 | /// <summary> |
172 | /// This method determines the proper movement related animation | 172 | /// This method determines the proper movement related animation |
173 | /// </summary> | 173 | /// </summary> |
174 | public string GetMovementAnimation() | 174 | private string DetermineMovementAnimation() |
175 | { | 175 | { |
176 | const float FALL_DELAY = 800f; | 176 | const float FALL_DELAY = 800f; |
177 | const float PREJUMP_DELAY = 200f; | 177 | const float PREJUMP_DELAY = 200f; |
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
274 | return "FALLDOWN"; | 274 | return "FALLDOWN"; |
275 | } | 275 | } |
276 | 276 | ||
277 | return m_movementAnimation; | 277 | return CurrentMovementAnimation; |
278 | } | 278 | } |
279 | 279 | ||
280 | #endregion Falling/Floating/Landing | 280 | #endregion Falling/Floating/Landing |
@@ -285,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
285 | int jumptime; | 285 | int jumptime; |
286 | jumptime = Environment.TickCount - m_animTickJump; | 286 | jumptime = Environment.TickCount - m_animTickJump; |
287 | 287 | ||
288 | |||
289 | if ((move.Z > 0f) && (!m_jumping)) | 288 | if ((move.Z > 0f) && (!m_jumping)) |
290 | { | 289 | { |
291 | // Start jumping, prejump | 290 | // Start jumping, prejump |
@@ -329,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
329 | 328 | ||
330 | #region Ground Movement | 329 | #region Ground Movement |
331 | 330 | ||
332 | if (m_movementAnimation == "FALLDOWN") | 331 | if (CurrentMovementAnimation == "FALLDOWN") |
333 | { | 332 | { |
334 | m_falling = false; | 333 | m_falling = false; |
335 | m_animTickFall = Environment.TickCount; | 334 | m_animTickFall = Environment.TickCount; |
@@ -342,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
342 | else | 341 | else |
343 | return "LAND"; | 342 | return "LAND"; |
344 | } | 343 | } |
345 | else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) | 344 | else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP")) |
346 | { | 345 | { |
347 | int landElapsed = Environment.TickCount - m_animTickFall; | 346 | int landElapsed = Environment.TickCount - m_animTickFall; |
348 | int limit = 1000; | 347 | int limit = 1000; |
349 | if(m_movementAnimation == "LAND") limit = 350; | 348 | if (CurrentMovementAnimation == "LAND") |
349 | limit = 350; | ||
350 | // 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 |
351 | 351 | ||
352 | if ((m_animTickFall != 0) && (landElapsed <= limit)) | 352 | if ((m_animTickFall != 0) && (landElapsed <= limit)) |
353 | { | 353 | { |
354 | return m_movementAnimation; | 354 | return CurrentMovementAnimation; |
355 | } | 355 | } |
356 | else | 356 | else |
357 | { | 357 | { |
@@ -389,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
389 | #endregion Ground Movement | 389 | #endregion Ground Movement |
390 | 390 | ||
391 | m_falling = false; | 391 | m_falling = false; |
392 | return m_movementAnimation; | 392 | |
393 | return CurrentMovementAnimation; | ||
393 | } | 394 | } |
394 | 395 | ||
395 | /// <summary> | 396 | /// <summary> |
@@ -397,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
397 | /// </summary> | 398 | /// </summary> |
398 | public void UpdateMovementAnimations() | 399 | public void UpdateMovementAnimations() |
399 | { | 400 | { |
400 | m_movementAnimation = GetMovementAnimation(); | 401 | CurrentMovementAnimation = DetermineMovementAnimation(); |
401 | TrySetMovementAnimation(m_movementAnimation); | 402 | TrySetMovementAnimation(CurrentMovementAnimation); |
402 | } | 403 | } |
403 | 404 | ||
404 | public UUID[] GetAnimationArray() | 405 | public UUID[] GetAnimationArray() |