diff options
author | cw | 2007-02-12 01:38:21 +0000 |
---|---|---|
committer | cw | 2007-02-12 01:38:21 +0000 |
commit | 7322d41d81309bc2dbdcc42c2f984676230688d9 (patch) | |
tree | 23a6828cf1b7fe179388030846d16f5de5a10215 /Controller.cs | |
parent | (no commit message) (diff) | |
download | opensim-SC_OLD-7322d41d81309bc2dbdcc42c2f984676230688d9.zip opensim-SC_OLD-7322d41d81309bc2dbdcc42c2f984676230688d9.tar.gz opensim-SC_OLD-7322d41d81309bc2dbdcc42c2f984676230688d9.tar.bz2 opensim-SC_OLD-7322d41d81309bc2dbdcc42c2f984676230688d9.tar.xz |
[0000048] Animations
Diffstat (limited to 'Controller.cs')
-rw-r--r-- | Controller.cs | 221 |
1 files changed, 118 insertions, 103 deletions
diff --git a/Controller.cs b/Controller.cs index b7112f1..73d516e 100644 --- a/Controller.cs +++ b/Controller.cs | |||
@@ -104,133 +104,146 @@ namespace OpenSim | |||
104 | if( pack.Type == PacketType.AgentSetAppearance ) { | 104 | if( pack.Type == PacketType.AgentSetAppearance ) { |
105 | 105 | ||
106 | } | 106 | } |
107 | else if( pack.Type == PacketType.FetchInventory) | 107 | else if (pack.Type == PacketType.AgentAnimation) |
108 | { | 108 | { |
109 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)pack; | 109 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)pack; |
110 | _inventoryManager.FetchInventory(userInfo, FetchInventory); | 110 | if (AgentAni.AgentData.AgentID == userInfo.AgentID) |
111 | } | 111 | { |
112 | else if( pack.Type == PacketType.FetchInventoryDescendents) | 112 | _agentManager.UpdateAnim(userInfo, AgentAni.AnimationList[0].AnimID, 1); |
113 | { | 113 | } |
114 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack; | 114 | } |
115 | _inventoryManager.FetchInventoryDescendents(userInfo, Fetch); | 115 | else if (pack.Type == PacketType.FetchInventory) |
116 | } | 116 | { |
117 | else if(pack.Type == PacketType.MapBlockRequest) | 117 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)pack; |
118 | { | 118 | _inventoryManager.FetchInventory(userInfo, FetchInventory); |
119 | MapBlockRequestPacket MapRequest=(MapBlockRequestPacket)pack; | 119 | } |
120 | this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | 120 | else if (pack.Type == PacketType.FetchInventoryDescendents) |
121 | 121 | { | |
122 | } | 122 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)pack; |
123 | else if( pack.Type == PacketType.UUIDNameRequest) | 123 | _inventoryManager.FetchInventoryDescendents(userInfo, Fetch); |
124 | { | 124 | } |
125 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket) pack; | 125 | else if (pack.Type == PacketType.MapBlockRequest) |
126 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); | 126 | { |
127 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; | 127 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)pack; |
128 | 128 | this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | |
129 | for(int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) | 129 | |
130 | { | 130 | } |
131 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | 131 | else if (pack.Type == PacketType.UUIDNameRequest) |
132 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; | 132 | { |
133 | nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("harry \0"); //for now send any name | 133 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)pack; |
134 | nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("tom \0"); //in future need to look it up | 134 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); |
135 | } | 135 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; |
136 | 136 | ||
137 | _server.SendPacket(nameReply, true, userInfo); | 137 | for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) |
138 | } | 138 | { |
139 | else if(pack.Type == PacketType.CloseCircuit) | 139 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); |
140 | { | 140 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; |
141 | this._agentManager.RemoveAgent(userInfo); | 141 | nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("harry \0"); //for now send any name |
142 | } | 142 | nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("tom \0"); //in future need to look it up |
143 | else if(pack.Type == PacketType.MapLayerRequest) | 143 | } |
144 | { | 144 | |
145 | this._gridManager.RequestMapLayer(userInfo); | 145 | _server.SendPacket(nameReply, true, userInfo); |
146 | } | 146 | } |
147 | else if((pack.Type == PacketType.TeleportRequest ) || (pack.Type == PacketType.TeleportLocationRequest)) | 147 | else if (pack.Type == PacketType.CloseCircuit) |
148 | { | 148 | { |
149 | TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack; | 149 | this._agentManager.RemoveAgent(userInfo); |
150 | this._gridManager.RequestTeleport(userInfo,Request); | 150 | } |
151 | 151 | else if (pack.Type == PacketType.MapLayerRequest) | |
152 | } | 152 | { |
153 | else if( pack.Type == PacketType.TransferRequest ) { | 153 | this._gridManager.RequestMapLayer(userInfo); |
154 | } | ||
155 | else if ((pack.Type == PacketType.TeleportRequest) || (pack.Type == PacketType.TeleportLocationRequest)) | ||
156 | { | ||
157 | TeleportLocationRequestPacket Request = (TeleportLocationRequestPacket)pack; | ||
158 | this._gridManager.RequestTeleport(userInfo, Request); | ||
159 | |||
160 | } | ||
161 | else if (pack.Type == PacketType.TransferRequest) | ||
162 | { | ||
154 | TransferRequestPacket transfer = (TransferRequestPacket)pack; | 163 | TransferRequestPacket transfer = (TransferRequestPacket)pack; |
155 | LLUUID id = new LLUUID( transfer.TransferInfo.Params, 0 ); | 164 | LLUUID id = new LLUUID(transfer.TransferInfo.Params, 0); |
156 | _assetManager.AddAssetRequest( userInfo, id, transfer ); | 165 | _assetManager.AddAssetRequest(userInfo, id, transfer); |
157 | } | 166 | } |
158 | else if( ( pack.Type == PacketType.StartPingCheck ) ) { | 167 | else if ((pack.Type == PacketType.StartPingCheck)) |
168 | { | ||
159 | //reply to pingcheck | 169 | //reply to pingcheck |
160 | libsecondlife.Packets.StartPingCheckPacket startping = (libsecondlife.Packets.StartPingCheckPacket)pack; | 170 | libsecondlife.Packets.StartPingCheckPacket startping = (libsecondlife.Packets.StartPingCheckPacket)pack; |
161 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); | 171 | libsecondlife.Packets.CompletePingCheckPacket endping = new CompletePingCheckPacket(); |
162 | endping.PingID.PingID = startping.PingID.PingID; | 172 | endping.PingID.PingID = startping.PingID.PingID; |
163 | _server.SendPacket(endping, true, userInfo ); | 173 | _server.SendPacket(endping, true, userInfo); |
174 | } | ||
175 | else if (pack.Type == PacketType.CompleteAgentMovement) | ||
176 | { | ||
177 | _agentManager.AgentJoin(userInfo); | ||
164 | } | 178 | } |
165 | else if( pack.Type == PacketType.CompleteAgentMovement ) | 179 | else if (pack.Type == PacketType.RequestImage) |
166 | { | 180 | { |
167 | _agentManager.AgentJoin(userInfo ); | ||
168 | } | ||
169 | else if( pack.Type == PacketType.RequestImage ) | ||
170 | { | ||
171 | RequestImagePacket imageRequest = (RequestImagePacket)pack; | 181 | RequestImagePacket imageRequest = (RequestImagePacket)pack; |
172 | for( int i = 0; i < imageRequest.RequestImage.Length; i++ ) | 182 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) |
173 | { | 183 | { |
174 | this._assetManager.AddTextureRequest(userInfo, imageRequest.RequestImage[i].Image); | 184 | this._assetManager.AddTextureRequest(userInfo, imageRequest.RequestImage[i].Image); |
175 | } | 185 | } |
176 | } | 186 | } |
177 | else if( pack.Type == PacketType.RegionHandshakeReply ) { | 187 | else if (pack.Type == PacketType.RegionHandshakeReply) |
188 | { | ||
178 | //recieved regionhandshake so can now start sending info | 189 | //recieved regionhandshake so can now start sending info |
179 | _agentManager.SendInitialData(userInfo ); | 190 | _agentManager.SendInitialData(userInfo); |
180 | } | 191 | } |
181 | else if( pack.Type == PacketType.ObjectAdd ) | 192 | else if (pack.Type == PacketType.ObjectAdd) |
182 | { | 193 | { |
183 | ObjectAddPacket ad = (ObjectAddPacket)pack; | 194 | ObjectAddPacket ad = (ObjectAddPacket)pack; |
184 | _primManager.CreatePrim(userInfo, ad.ObjectData.RayEnd, ad ); | 195 | _primManager.CreatePrim(userInfo, ad.ObjectData.RayEnd, ad); |
185 | } | 196 | } |
186 | else if( pack.Type == PacketType.ObjectPosition ) { | 197 | else if (pack.Type == PacketType.ObjectPosition) |
198 | { | ||
187 | //System.Console.WriteLine(pack.ToString()); | 199 | //System.Console.WriteLine(pack.ToString()); |
188 | } | 200 | } |
189 | else if( pack.Type == PacketType.MultipleObjectUpdate ) | 201 | else if (pack.Type == PacketType.MultipleObjectUpdate) |
190 | { | 202 | { |
191 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)pack; | 203 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)pack; |
192 | 204 | ||
193 | for( int i = 0; i < multipleupdate.ObjectData.Length; i++ ) | 205 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) |
194 | { | 206 | { |
195 | if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position | 207 | if (multipleupdate.ObjectData[i].Type == 9) //change position |
196 | { | 208 | { |
197 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 ); | 209 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
198 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID ,false ,libsecondlife.LLQuaternion.Identity); | 210 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[i].ObjectLocalID, false, libsecondlife.LLQuaternion.Identity); |
199 | //should update stored position of the prim | 211 | //should update stored position of the prim |
200 | } | 212 | } |
201 | else if(multipleupdate.ObjectData[i].Type == 10 )//rotation | 213 | else if (multipleupdate.ObjectData[i].Type == 10)//rotation |
202 | { | 214 | { |
203 | libsecondlife.LLVector3 pos = new LLVector3(100,100,22); | 215 | libsecondlife.LLVector3 pos = new LLVector3(100, 100, 22); |
204 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | 216 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); |
205 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[ i ].ObjectLocalID, true ,rot); | 217 | _primManager.UpdatePrimPosition(userInfo, pos, multipleupdate.ObjectData[i].ObjectLocalID, true, rot); |
206 | } | 218 | } |
207 | } | 219 | } |
208 | } | 220 | } |
209 | else if( pack.Type == PacketType.AgentWearablesRequest ) | 221 | else if (pack.Type == PacketType.AgentWearablesRequest) |
210 | { | 222 | { |
211 | _agentManager.SendIntialAvatarAppearance(userInfo ); | 223 | _agentManager.SendIntialAvatarAppearance(userInfo); |
212 | } | 224 | } |
213 | else if(pack.Type == PacketType.AgentUpdate) | 225 | else if (pack.Type == PacketType.AgentUpdate) |
214 | { | 226 | { |
215 | // System.Console.WriteLine("agent update"); | 227 | // System.Console.WriteLine("agent update"); |
216 | AgentUpdatePacket agent = (AgentUpdatePacket)pack; | 228 | AgentUpdatePacket agent = (AgentUpdatePacket)pack; |
217 | uint mask = agent.AgentData.ControlFlags & ( 1 ); | 229 | uint mask = agent.AgentData.ControlFlags & (1); |
218 | AvatarData avatar = _agentManager.GetAgent(userInfo.AgentID ); | 230 | AvatarData avatar = _agentManager.GetAgent(userInfo.AgentID); |
219 | if(avatar != null ) | 231 | if (avatar != null) |
220 | { | 232 | { |
221 | if(avatar.Started ) | 233 | if (avatar.Started) |
222 | { | 234 | { |
223 | if( mask == ( 1 ) ) | 235 | if (mask == (1)) |
224 | { | 236 | { |
225 | if(!avatar.Walk) | 237 | if (!avatar.Walk) |
226 | { | 238 | { |
227 | //start walking | 239 | //start walking |
228 | _agentManager.SendMoveCommand(userInfo, false, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation ); | 240 | _agentManager.SendMoveCommand(userInfo, false, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation); |
229 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3( 1, 0, 0 ); | 241 | _agentManager.UpdateAnim(avatar.NetInfo, Globals.Instance.ANIM_AGENT_WALK, 1); |
230 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion( agent.AgentData.BodyRotation.W, agent.AgentData.BodyRotation.X, agent.AgentData.BodyRotation.Y, agent.AgentData.BodyRotation.Z ); | 242 | Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); |
243 | Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(agent.AgentData.BodyRotation.W, agent.AgentData.BodyRotation.X, agent.AgentData.BodyRotation.Y, agent.AgentData.BodyRotation.Z); | ||
231 | Axiom.MathLib.Vector3 direc = q * v3; | 244 | Axiom.MathLib.Vector3 direc = q * v3; |
232 | direc.Normalize(); | 245 | direc.Normalize(); |
233 | direc = direc * ( ( 0.03f ) * 128f ); | 246 | direc = direc * ((0.03f) * 128f); |
234 | 247 | ||
235 | avatar.Velocity.X = direc.x; | 248 | avatar.Velocity.X = direc.x; |
236 | avatar.Velocity.Y = direc.y; | 249 | avatar.Velocity.Y = direc.y; |
@@ -238,12 +251,13 @@ namespace OpenSim | |||
238 | avatar.Walk = true; | 251 | avatar.Walk = true; |
239 | } | 252 | } |
240 | } | 253 | } |
241 | else | 254 | else |
242 | { | 255 | { |
243 | if(avatar.Walk) | 256 | if (avatar.Walk) |
244 | { | 257 | { |
245 | //walking but key not pressed so need to stop | 258 | //walking but key not pressed so need to stop |
246 | _agentManager.SendMoveCommand(userInfo, true, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation ); | 259 | _agentManager.SendMoveCommand(userInfo, true, avatar.Position.X, avatar.Position.Y, avatar.Position.Z, 0, agent.AgentData.BodyRotation); |
260 | _agentManager.UpdateAnim(avatar.NetInfo, Globals.Instance.ANIM_AGENT_STAND, 1); | ||
247 | avatar.Walk = false; | 261 | avatar.Walk = false; |
248 | avatar.Velocity.X = 0; | 262 | avatar.Velocity.X = 0; |
249 | avatar.Velocity.Y = 0; | 263 | avatar.Velocity.Y = 0; |
@@ -254,32 +268,33 @@ namespace OpenSim | |||
254 | } | 268 | } |
255 | else | 269 | else |
256 | { | 270 | { |
257 | 271 | ||
258 | } | 272 | } |
259 | } | 273 | } |
260 | else if( pack.Type == PacketType.ChatFromViewer ) | 274 | else if (pack.Type == PacketType.ChatFromViewer) |
261 | { | 275 | { |
262 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; | 276 | ChatFromViewerPacket chat = (ChatFromViewerPacket)pack; |
263 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | 277 | System.Text.Encoding enc = System.Text.Encoding.ASCII; |
264 | 278 | ||
265 | string myString = enc.GetString(chat.ChatData.Message ); | 279 | string myString = enc.GetString(chat.ChatData.Message); |
266 | if( myString != "" ) { | 280 | if (myString != "") |
267 | string[] comp = new string[ 10 ]; | 281 | { |
282 | string[] comp = new string[10]; | ||
268 | string delimStr = " , "; | 283 | string delimStr = " , "; |
269 | char[] delimiter = delimStr.ToCharArray(); | 284 | char[] delimiter = delimStr.ToCharArray(); |
270 | string line; | 285 | string line; |
271 | 286 | ||
272 | line = myString; | 287 | line = myString; |
273 | comp = line.Split( delimiter ); | 288 | comp = line.Split(delimiter); |
274 | if( comp[ 0 ] == "pos" ) | 289 | if (comp[0] == "pos") |
275 | { | 290 | { |
276 | } | 291 | } |
277 | else if( comp[ 0 ] == "veloc" ) | 292 | else if (comp[0] == "veloc") |
278 | { | 293 | { |
279 | } | 294 | } |
280 | else | 295 | else |
281 | { | 296 | { |
282 | _agentManager.SendChatMessage(userInfo, line ); | 297 | _agentManager.SendChatMessage(userInfo, line); |
283 | } | 298 | } |
284 | } | 299 | } |
285 | } | 300 | } |