All pastes #609018 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-08 16:57 UTC
rendered paste body
Index: OpenSim/Region/ClientStack/ClientView.API.cs
===================================================================
--- OpenSim/Region/ClientStack/ClientView.API.cs        (revision 1198)
+++ OpenSim/Region/ClientStack/ClientView.API.cs        (working copy)
@@ -527,6 +527,21 @@
             OutPacket(avp);
         }
 
+       public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
+       {
+           AvatarAnimationPacket ani = new AvatarAnimationPacket();
+           ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
+           ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
+           ani.AnimationSourceList[0].ObjectID = sourceAgentId;
+           ani.Sender = new AvatarAnimationPacket.SenderBlock();
+           ani.Sender.ID = sourceAgentId;
+           ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1];
+           ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
+           ani.AnimationList[0].AnimID = animID;
+           ani.AnimationList[0].AnimSequenceID = seq;
+           this.OutPacket(ani);
+       }
+
         #endregion
 
         #region Avatar Packet/data sending Methods
Index: OpenSim/Region/Environment/Scenes/ScenePresence.cs
===================================================================
--- OpenSim/Region/Environment/Scenes/ScenePresence.cs  (revision 1198)
+++ OpenSim/Region/Environment/Scenes/ScenePresence.cs  (working copy)
@@ -122,6 +122,8 @@
             }
 
             Wearables = AvatarWearable.DefaultWearables;
+            Animations = new ScenePresence.AvatarAnimations();
+            Animations.LoadAnims();
             
             this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
 
@@ -274,9 +276,27 @@
             {
                 this.AddNewMovement(agent_control_v3, q);
             }
-
+           UpdateMovementAnimations(update_movementflag);
         }
 
+       protected void UpdateMovementAnimations(bool update_movementflag)
+       {
+           if (update_movementflag)
+           {
+               if (movementflag != 0) {
+                   if (this._physActor.Flying) {
+                       this.SendAnimPack(Animations.AnimsLLUUID["FLY"], 1);
+                   } else {
+                       this.SendAnimPack(Animations.AnimsLLUUID["WALK"], 1);
+                   }
+               } else {
+                   this.SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
+               }
+           }
+
+       }
+
+
         protected void AddNewMovement(Vector3 vec, Quaternion rotation)
         {
             NewForce newVelocity = new NewForce();
@@ -403,8 +423,13 @@
         /// <param name="seq"></param>
         public void SendAnimPack(LLUUID animID, int seq)
         {
-
-
+           this.current_anim = animID;
+           this.anim_seq = anim_seq;
+           List<ScenePresence> avatars = this.m_world.RequestAvatarList();
+           for (int i = 0; i < avatars.Count; i++)
+           {
+               avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
+           }
         }
 
         /// <summary>
@@ -412,7 +437,7 @@
         /// </summary>
         public void SendAnimPack()
         {
-
+           this.SendAnimPack(this.current_anim, this.anim_seq);
         }
         #endregion
 
Index: OpenSim/Framework/General/Interfaces/IClientAPI.cs
===================================================================
--- OpenSim/Framework/General/Interfaces/IClientAPI.cs  (revision 1198)
+++ OpenSim/Framework/General/Interfaces/IClientAPI.cs  (working copy)
@@ -145,6 +145,7 @@
 
         void OutPacket(Packet newPack);
         void SendWearables(AvatarWearable[] wearables);
+        void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId);
         void SendRegionHandshake(RegionInfo regionInfo);
         void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
         void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);