diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Animation.cs | 59 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AnimationSet.cs | 151 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 201 |
3 files changed, 259 insertions, 152 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Animation.cs b/OpenSim/Region/Environment/Scenes/Animation.cs new file mode 100644 index 0000000..b2fca90 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Animation.cs | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using libsecondlife; | ||
30 | |||
31 | namespace OpenSim.Region.Environment.Scenes | ||
32 | { | ||
33 | public class Animation | ||
34 | { | ||
35 | private LLUUID animID; | ||
36 | public LLUUID AnimID | ||
37 | { | ||
38 | get { return animID; } | ||
39 | set { animID = value; } | ||
40 | } | ||
41 | |||
42 | private int sequenceNum; | ||
43 | public int SequenceNum | ||
44 | { | ||
45 | get { return sequenceNum; } | ||
46 | set { sequenceNum = value; } | ||
47 | } | ||
48 | |||
49 | public Animation() | ||
50 | { | ||
51 | } | ||
52 | |||
53 | public Animation(LLUUID animID, int sequenceNum) | ||
54 | { | ||
55 | this.animID = animID; | ||
56 | this.sequenceNum = sequenceNum; | ||
57 | } | ||
58 | } | ||
59 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/AnimationSet.cs b/OpenSim/Region/Environment/Scenes/AnimationSet.cs new file mode 100644 index 0000000..c485d30 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/AnimationSet.cs | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using libsecondlife; | ||
31 | |||
32 | namespace OpenSim.Region.Environment.Scenes | ||
33 | { | ||
34 | public class AnimationSet | ||
35 | { | ||
36 | public static AvatarAnimations Animations = new AvatarAnimations(); | ||
37 | |||
38 | private Animation m_defaultAnimation = new Animation(); | ||
39 | private List<Animation> m_animations = new List<Animation>(); | ||
40 | |||
41 | public AnimationSet() | ||
42 | { | ||
43 | ResetDefaultAnimation(); | ||
44 | } | ||
45 | |||
46 | public bool HasAnimation(LLUUID animID) | ||
47 | { | ||
48 | if (m_defaultAnimation.AnimID == animID) | ||
49 | return true; | ||
50 | |||
51 | for (int i = 0; i < m_animations.Count; ++i) | ||
52 | { | ||
53 | if (m_animations[i].AnimID == animID) | ||
54 | return true; | ||
55 | } | ||
56 | |||
57 | return false; | ||
58 | } | ||
59 | |||
60 | public bool Add(LLUUID animID, int sequenceNum) | ||
61 | { | ||
62 | lock (m_animations) | ||
63 | { | ||
64 | if (!HasAnimation(animID)) | ||
65 | { | ||
66 | m_animations.Add(new Animation(animID, sequenceNum)); | ||
67 | return true; | ||
68 | } | ||
69 | } | ||
70 | return false; | ||
71 | } | ||
72 | |||
73 | public bool Remove(LLUUID animID) | ||
74 | { | ||
75 | lock (m_animations) | ||
76 | { | ||
77 | if (m_defaultAnimation.AnimID == animID) | ||
78 | { | ||
79 | ResetDefaultAnimation(); | ||
80 | } | ||
81 | else if (HasAnimation(animID)) | ||
82 | { | ||
83 | for (int i = 0; i < m_animations.Count; i++) | ||
84 | { | ||
85 | if (m_animations[i].AnimID == animID) | ||
86 | { | ||
87 | m_animations.RemoveAt(i); | ||
88 | return true; | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | return false; | ||
94 | } | ||
95 | |||
96 | public void Clear() | ||
97 | { | ||
98 | ResetDefaultAnimation(); | ||
99 | m_animations.Clear(); | ||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// The default animation is reserved for "main" animations | ||
104 | /// that are mutually exclusive, e.g. flying and sitting. | ||
105 | /// </summary> | ||
106 | public bool SetDefaultAnimation(LLUUID animID, int sequenceNum) | ||
107 | { | ||
108 | if (m_defaultAnimation.AnimID != animID) | ||
109 | { | ||
110 | m_defaultAnimation = new Animation(animID, sequenceNum); | ||
111 | return true; | ||
112 | } | ||
113 | return false; | ||
114 | } | ||
115 | |||
116 | protected bool ResetDefaultAnimation() | ||
117 | { | ||
118 | return TrySetDefaultAnimation("STAND", 1); | ||
119 | } | ||
120 | |||
121 | /// <summary> | ||
122 | /// Set the animation as the default animation if it's known | ||
123 | /// </summary> | ||
124 | public bool TrySetDefaultAnimation(string anim, int sequenceNum) | ||
125 | { | ||
126 | if (Animations.AnimsLLUUID.ContainsKey(anim)) | ||
127 | { | ||
128 | return SetDefaultAnimation(Animations.AnimsLLUUID[anim], sequenceNum); | ||
129 | } | ||
130 | return false; | ||
131 | } | ||
132 | |||
133 | public void GetArrays(out LLUUID[] animIDs, out int[] sequenceNums) | ||
134 | { | ||
135 | lock (m_animations) | ||
136 | { | ||
137 | animIDs = new LLUUID[m_animations.Count + 1]; | ||
138 | sequenceNums = new int[m_animations.Count + 1]; | ||
139 | |||
140 | animIDs[0] = m_defaultAnimation.AnimID; | ||
141 | sequenceNums[0] = m_defaultAnimation.SequenceNum; | ||
142 | |||
143 | for (int i = 0; i < m_animations.Count; ++i) | ||
144 | { | ||
145 | animIDs[i + 1] = m_animations[i].AnimID; | ||
146 | sequenceNums[i + 1] = m_animations[i].SequenceNum; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index ef55bd2..5b10bfc 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -73,12 +73,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
73 | 73 | ||
74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
75 | 75 | ||
76 | public static AvatarAnimations Animations = new AvatarAnimations(); | ||
77 | public static byte[] DefaultTexture; | 76 | public static byte[] DefaultTexture; |
78 | 77 | ||
79 | public LLUUID currentParcelUUID = LLUUID.Zero; | 78 | public LLUUID currentParcelUUID = LLUUID.Zero; |
80 | private List<LLUUID> m_animations = new List<LLUUID>(); | 79 | private AnimationSet m_animations = new AnimationSet(); |
81 | private List<int> m_animationSeqs = new List<int>(); | ||
82 | private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>(); | 80 | private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>(); |
83 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 81 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
84 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 82 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
@@ -608,15 +606,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
608 | /// </summary> | 606 | /// </summary> |
609 | public void MakeChildAgent() | 607 | public void MakeChildAgent() |
610 | { | 608 | { |
611 | if (m_animations.Count > 0) | 609 | m_animations.Clear(); |
612 | { | ||
613 | LLUUID movementAnim = m_animations[0]; | ||
614 | |||
615 | m_animations.Clear(); | ||
616 | m_animationSeqs.Clear(); | ||
617 | 610 | ||
618 | SetMovementAnimation(movementAnim); | ||
619 | } | ||
620 | // m_log.DebugFormat( | 611 | // m_log.DebugFormat( |
621 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", | 612 | // "[SCENEPRESENCE]: Downgrading child agent {0}, {1} to a root agent in {2}", |
622 | // Name, UUID, m_scene.RegionInfo.RegionName); | 613 | // Name, UUID, m_scene.RegionInfo.RegionName); |
@@ -1104,66 +1095,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
1104 | if (m_isChildAgent) | 1095 | if (m_isChildAgent) |
1105 | return; | 1096 | return; |
1106 | 1097 | ||
1107 | // Don't let this animation become the movement animation | 1098 | if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber)) |
1108 | if (m_animations.Count < 1) | ||
1109 | TrySetMovementAnimation("STAND"); | ||
1110 | |||
1111 | if (!m_animations.Contains(animID)) | ||
1112 | { | 1099 | { |
1113 | m_animations.Add(animID); | ||
1114 | m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber); | ||
1115 | SendAnimPack(); | 1100 | SendAnimPack(); |
1116 | } | 1101 | } |
1117 | } | 1102 | } |
1118 | 1103 | ||
1119 | public void RemoveAnimation(LLUUID animID) | 1104 | public void AddAnimation(string name) |
1120 | { | 1105 | { |
1121 | if (m_isChildAgent) | 1106 | if (m_isChildAgent) |
1122 | return; | 1107 | return; |
1123 | 1108 | ||
1124 | if (m_animations.Contains(animID)) | 1109 | LLUUID animID = m_controllingClient.GetDefaultAnimation(name); |
1125 | { | 1110 | if (animID == LLUUID.Zero) |
1126 | if (m_animations[0] == animID) | 1111 | return; |
1127 | { | ||
1128 | TrySetMovementAnimation("STAND"); | ||
1129 | } | ||
1130 | else | ||
1131 | { | ||
1132 | // What a HACK!! Anim list really needs to be an object! | ||
1133 | int idx; | ||
1134 | |||
1135 | for(idx=0;idx < m_animations.Count;idx++) | ||
1136 | { | ||
1137 | if (m_animations[idx] == animID) | ||
1138 | { | ||
1139 | int seq=m_animationSeqs[idx]; | ||
1140 | 1112 | ||
1141 | m_animations.Remove(animID); | 1113 | AddAnimation(animID); |
1142 | m_animationSeqs.Remove(seq); | ||
1143 | SendAnimPack(); | ||
1144 | break; | ||
1145 | } | ||
1146 | } | ||
1147 | } | ||
1148 | } | ||
1149 | } | 1114 | } |
1150 | public void AddAnimation(string name) | 1115 | |
1116 | public void RemoveAnimation(LLUUID animID) | ||
1151 | { | 1117 | { |
1152 | if (m_isChildAgent) | 1118 | if (m_isChildAgent) |
1153 | return; | 1119 | return; |
1154 | 1120 | ||
1155 | // Don't let this animation become the movement animation | 1121 | if (m_animations.Remove(animID)) |
1156 | if (m_animations.Count < 1) | ||
1157 | TrySetMovementAnimation("STAND"); | ||
1158 | |||
1159 | LLUUID animID = m_controllingClient.GetDefaultAnimation(name); | ||
1160 | if (animID == LLUUID.Zero) | ||
1161 | return; | ||
1162 | |||
1163 | if (!m_animations.Contains(animID)) | ||
1164 | { | 1122 | { |
1165 | m_animations.Add(animID); | ||
1166 | m_animationSeqs.Add(m_controllingClient.NextAnimationSequenceNumber); | ||
1167 | SendAnimPack(); | 1123 | SendAnimPack(); |
1168 | } | 1124 | } |
1169 | } | 1125 | } |
@@ -1177,34 +1133,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1177 | if (animID == LLUUID.Zero) | 1133 | if (animID == LLUUID.Zero) |
1178 | return; | 1134 | return; |
1179 | 1135 | ||
1180 | if (m_animations.Contains(animID)) | 1136 | RemoveAnimation(animID); |
1181 | { | ||
1182 | if (m_animations[0] == animID) | ||
1183 | { | ||
1184 | TrySetMovementAnimation("STAND"); | ||
1185 | } | ||
1186 | else | ||
1187 | { | ||
1188 | // What a HACK!! Anim list really needs to be an object! | ||
1189 | int idx; | ||
1190 | |||
1191 | for(idx = 0; idx < m_animations.Count; idx++) | ||
1192 | { | ||
1193 | if (m_animations[idx] == animID) | ||
1194 | { | ||
1195 | int seq = m_animationSeqs[idx]; | ||
1196 | |||
1197 | m_animations.Remove(animID); | ||
1198 | m_animationSeqs.Remove(seq); | ||
1199 | SendAnimPack(); | ||
1200 | break; | ||
1201 | } | ||
1202 | } | ||
1203 | } | ||
1204 | } | ||
1205 | } | 1137 | } |
1206 | 1138 | ||
1207 | |||
1208 | public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID) | 1139 | public void HandleStartAnim(IClientAPI remoteClient, LLUUID animID) |
1209 | { | 1140 | { |
1210 | AddAnimation(animID); | 1141 | AddAnimation(animID); |
@@ -1216,88 +1147,63 @@ namespace OpenSim.Region.Environment.Scenes | |||
1216 | } | 1147 | } |
1217 | 1148 | ||
1218 | /// <summary> | 1149 | /// <summary> |
1219 | /// The movement animation is the first element of the animation list, | 1150 | /// The movement animation is reserved for "main" animations |
1220 | /// reserved for "main" animations that are mutually exclusive, | 1151 | /// that are mutually exclusive, e.g. flying and sitting. |
1221 | /// like flying and sitting, for example. | ||
1222 | /// </summary> | 1152 | /// </summary> |
1223 | protected void SetMovementAnimation(LLUUID animID) | 1153 | protected void SetMovementAnimation(LLUUID animID) |
1224 | { | 1154 | { |
1225 | if (m_animations.Count < 1) | 1155 | if (m_animations.SetDefaultAnimation(animID, m_controllingClient.NextAnimationSequenceNumber)) |
1226 | { | 1156 | { |
1227 | m_animations.Add(Animations.AnimsLLUUID["STAND"]); | ||
1228 | m_animationSeqs.Add(1); | ||
1229 | SendAnimPack(); | 1157 | SendAnimPack(); |
1230 | } | 1158 | } |
1231 | else | ||
1232 | { | ||
1233 | try | ||
1234 | { | ||
1235 | if (m_animations[0] != animID) | ||
1236 | { | ||
1237 | m_animations[0] = animID; | ||
1238 | m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; | ||
1239 | SendAnimPack(); | ||
1240 | } | ||
1241 | } | ||
1242 | catch | ||
1243 | { | ||
1244 | m_log.Warn("[AVATAR]: SetMovementAnimation for avatar failed. Attempting recovery..."); | ||
1245 | m_animations[0] = animID; | ||
1246 | m_animationSeqs[0] = m_controllingClient.NextAnimationSequenceNumber; | ||
1247 | SendAnimPack(); | ||
1248 | } | ||
1249 | } | ||
1250 | } | 1159 | } |
1251 | 1160 | ||
1252 | /// <summary> | 1161 | /// <summary> |
1253 | /// Set the first known animation in the given list as the movement animation | 1162 | /// The movement animation is reserved for "main" animations |
1163 | /// that are mutually exclusive, e.g. flying and sitting. | ||
1254 | /// </summary> | 1164 | /// </summary> |
1255 | protected void TrySetMovementAnimation(params string[] anims) | 1165 | protected void TrySetMovementAnimation(string anim) |
1256 | { | 1166 | { |
1257 | foreach (string anim in anims) | 1167 | if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber)) |
1258 | { | 1168 | { |
1259 | if (Animations.AnimsLLUUID.ContainsKey(anim)) | 1169 | SendAnimPack(); |
1260 | { | ||
1261 | SetMovementAnimation(Animations.AnimsLLUUID[anim]); | ||
1262 | break; | ||
1263 | } | ||
1264 | } | 1170 | } |
1265 | } | 1171 | } |
1266 | 1172 | ||
1267 | /// <summary> | 1173 | /// <summary> |
1268 | /// This method handles agent movement related animations | 1174 | /// This method determines the proper movement related animation |
1269 | /// </summary> | 1175 | /// </summary> |
1270 | protected void UpdateMovementAnimations() | 1176 | protected string GetMovementAnimation() |
1271 | { | 1177 | { |
1272 | if (m_movementflag != 0) | 1178 | if (m_movementflag != 0) |
1273 | { | 1179 | { |
1274 | // We are moving | 1180 | // We are moving |
1275 | if (m_physicsActor.Flying) | 1181 | if (m_physicsActor.Flying) |
1276 | { | 1182 | { |
1277 | TrySetMovementAnimation("FLY"); | 1183 | return "FLY"; |
1278 | } | 1184 | } |
1279 | else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | 1185 | else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && |
1280 | PhysicsActor.IsColliding) | 1186 | PhysicsActor.IsColliding) |
1281 | { | 1187 | { |
1282 | TrySetMovementAnimation("CROUCHWALK"); | 1188 | return "CROUCHWALK"; |
1283 | } | 1189 | } |
1284 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6) | 1190 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6) |
1285 | { | 1191 | { |
1286 | // Client is moving and falling at a velocity greater then 6 meters per unit | 1192 | // Client is moving and falling at a velocity greater then 6 meters per unit |
1287 | TrySetMovementAnimation("FALLDOWN"); | 1193 | return "FALLDOWN"; |
1288 | } | 1194 | } |
1289 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && | 1195 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && |
1290 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | 1196 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) |
1291 | { | 1197 | { |
1292 | TrySetMovementAnimation("JUMP"); | 1198 | return "JUMP"; |
1293 | } | 1199 | } |
1294 | else if (m_setAlwaysRun) | 1200 | else if (m_setAlwaysRun) |
1295 | { | 1201 | { |
1296 | TrySetMovementAnimation("RUN"); | 1202 | return "RUN"; |
1297 | } | 1203 | } |
1298 | else | 1204 | else |
1299 | { | 1205 | { |
1300 | TrySetMovementAnimation("WALK"); | 1206 | return "WALK"; |
1301 | } | 1207 | } |
1302 | } | 1208 | } |
1303 | else | 1209 | else |
@@ -1307,29 +1213,34 @@ namespace OpenSim.Region.Environment.Scenes | |||
1307 | if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | 1213 | if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && |
1308 | PhysicsActor.IsColliding) | 1214 | PhysicsActor.IsColliding) |
1309 | { | 1215 | { |
1310 | TrySetMovementAnimation("CROUCH"); | 1216 | return "CROUCH"; |
1311 | } | 1217 | } |
1312 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying) | 1218 | else if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying) |
1313 | { | 1219 | { |
1314 | TrySetMovementAnimation("FALLDOWN"); | 1220 | return "FALLDOWN"; |
1315 | } | 1221 | } |
1316 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && | 1222 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && |
1317 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | 1223 | (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) |
1318 | { | 1224 | { |
1319 | // This is the standing jump | 1225 | // This is the standing jump |
1320 | TrySetMovementAnimation("JUMP"); | 1226 | return "JUMP"; |
1321 | } | 1227 | } |
1322 | else if (m_physicsActor.Flying) | 1228 | else if (m_physicsActor.Flying) |
1323 | { | 1229 | { |
1324 | TrySetMovementAnimation("HOVER"); | 1230 | return "HOVER"; |
1325 | } | 1231 | } |
1326 | else | 1232 | else |
1327 | { | 1233 | { |
1328 | TrySetMovementAnimation("STAND"); | 1234 | return "STAND"; |
1329 | } | 1235 | } |
1330 | } | 1236 | } |
1331 | } | 1237 | } |
1332 | 1238 | ||
1239 | protected void UpdateMovementAnimations() | ||
1240 | { | ||
1241 | TrySetMovementAnimation(GetMovementAnimation()); | ||
1242 | } | ||
1243 | |||
1333 | /// <summary> | 1244 | /// <summary> |
1334 | /// Adds a new movement | 1245 | /// Adds a new movement |
1335 | /// </summary> | 1246 | /// </summary> |
@@ -1422,21 +1333,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1422 | } | 1333 | } |
1423 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement | 1334 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement |
1424 | { | 1335 | { |
1425 | |||
1426 | |||
1427 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity | 1336 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity |
1428 | // doing the above assures us that we know what we sent the clients last | 1337 | // doing the above assures us that we know what we sent the clients last |
1429 | SendTerseUpdateToAllClients(); | 1338 | SendTerseUpdateToAllClients(); |
1430 | m_updateCount = 0; | 1339 | m_updateCount = 0; |
1431 | |||
1432 | |||
1433 | |||
1434 | } | 1340 | } |
1435 | 1341 | ||
1436 | // followed suggestion from mic bowman. reversed the two lines below. | 1342 | // followed suggestion from mic bowman. reversed the two lines below. |
1437 | CheckForBorderCrossing(); | 1343 | CheckForBorderCrossing(); |
1438 | CheckForSignificantMovement(); // sends update to the modules. | 1344 | CheckForSignificantMovement(); // sends update to the modules. |
1439 | |||
1440 | } | 1345 | } |
1441 | } | 1346 | } |
1442 | 1347 | ||
@@ -1621,7 +1526,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1621 | /// </summary> | 1526 | /// </summary> |
1622 | public void SendAnimPack() | 1527 | public void SendAnimPack() |
1623 | { | 1528 | { |
1624 | SendAnimPack(m_animations.ToArray(), m_animationSeqs.ToArray()); | 1529 | if (m_isChildAgent) |
1530 | return; | ||
1531 | |||
1532 | LLUUID[] animIDs; | ||
1533 | int[] sequenceNums; | ||
1534 | |||
1535 | m_animations.GetArrays(out animIDs, out sequenceNums); | ||
1536 | |||
1537 | SendAnimPack(animIDs, sequenceNums); | ||
1625 | } | 1538 | } |
1626 | 1539 | ||
1627 | #endregion | 1540 | #endregion |
@@ -2142,14 +2055,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2142 | DefaultTexture = textu.ToBytes(); | 2055 | DefaultTexture = textu.ToBytes(); |
2143 | } | 2056 | } |
2144 | 2057 | ||
2145 | List<Guid> animations_work = (List<Guid>)info.GetValue("m_animations", typeof(List<Guid>)); | 2058 | m_animations = (AnimationSet)info.GetValue("m_animations", typeof(AnimationSet)); |
2146 | |||
2147 | foreach (Guid guid in animations_work) | ||
2148 | { | ||
2149 | m_animations.Add(new LLUUID(guid)); | ||
2150 | } | ||
2151 | |||
2152 | m_animationSeqs = (List<int>)info.GetValue("m_animationSeqs", typeof(List<int>)); | ||
2153 | m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool)); | 2059 | m_updateflag = (bool)info.GetValue("m_updateflag", typeof(bool)); |
2154 | m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte)); | 2060 | m_movementflag = (byte)info.GetValue("m_movementflag", typeof(byte)); |
2155 | m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>)); | 2061 | m_forcesList = (List<NewForce>)info.GetValue("m_forcesList", typeof(List<NewForce>)); |
@@ -2304,16 +2210,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2304 | 2210 | ||
2305 | base.GetObjectData(info, context); | 2211 | base.GetObjectData(info, context); |
2306 | 2212 | ||
2307 | List<Guid> animations_work = new List<Guid>(); | 2213 | info.AddValue("m_animations", m_animations); |
2308 | |||
2309 | foreach (LLUUID uuid in m_animations) | ||
2310 | { | ||
2311 | animations_work.Add(uuid.UUID); | ||
2312 | } | ||
2313 | |||
2314 | info.AddValue("m_animations", animations_work); | ||
2315 | |||
2316 | info.AddValue("m_animationSeqs", m_animationSeqs); | ||
2317 | info.AddValue("m_updateflag", m_updateflag); | 2214 | info.AddValue("m_updateflag", m_updateflag); |
2318 | info.AddValue("m_movementflag", m_movementflag); | 2215 | info.AddValue("m_movementflag", m_movementflag); |
2319 | info.AddValue("m_forcesList", m_forcesList); | 2216 | info.AddValue("m_forcesList", m_forcesList); |