aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region
diff options
context:
space:
mode:
authorMW2007-06-15 13:11:26 +0000
committerMW2007-06-15 13:11:26 +0000
commit95676b298819d6b2d1df74d1f52668e2549a2c2f (patch)
treee3152f0685f262253e72a482a4a3e4b64aae631a /OpenSim/OpenSim.Region
parentand some more (diff)
downloadopensim-SC-95676b298819d6b2d1df74d1f52668e2549a2c2f.zip
opensim-SC-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.gz
opensim-SC-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.bz2
opensim-SC-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.xz
Preliminary movement added to sugilite, forwards walking only and no animations.
Diffstat (limited to 'OpenSim/OpenSim.Region')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs27
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.cs102
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs8
3 files changed, 101 insertions, 36 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
index d5c25f3..3f87e10 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
@@ -36,14 +36,26 @@ using OpenSim.Framework.Interfaces;
36namespace OpenSim.Region.Scenes 36namespace OpenSim.Region.Scenes
37{ 37{
38 partial class Avatar 38 partial class Avatar
39 { 39 {
40 /// <summary> 40 /// <summary>
41 /// 41 ///
42 /// </summary> 42 /// </summary>
43 public override void update() 43 public override void update()
44 { 44 {
45 45 if (this.newForce)
46 46 {
47 this.SendTerseUpdateToALLClients();
48 _updateCount = 0;
49 }
50 else if (movementflag != 0)
51 {
52 _updateCount++;
53 if (_updateCount > 3)
54 {
55 this.SendTerseUpdateToALLClients();
56 _updateCount = 0;
57 }
58 }
47 } 59 }
48 60
49 /// <summary> 61 /// <summary>
@@ -117,15 +129,6 @@ namespace OpenSim.Region.Scenes
117 } 129 }
118 130
119 /// <summary> 131 /// <summary>
120 /// Very likely to be deleted soon!
121 /// </summary>
122 /// <returns></returns>
123 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
124 {
125 return null;
126 }
127
128 /// <summary>
129 /// 132 ///
130 /// </summary> 133 /// </summary>
131 /// <param name="animID"></param> 134 /// <param name="animID"></param>
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
index 6ae4319..17b2437 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Scenes
61 private ulong m_regionHandle; 61 private ulong m_regionHandle;
62 private Dictionary<uint, IClientAPI> m_clientThreads; 62 private Dictionary<uint, IClientAPI> m_clientThreads;
63 private bool childAvatar = false; 63 private bool childAvatar = false;
64 private bool newForce = false;
64 65
65 protected RegionInfo m_regionInfo; 66 protected RegionInfo m_regionInfo;
66 /// <summary> 67 /// <summary>
@@ -78,6 +79,7 @@ namespace OpenSim.Region.Scenes
78 this.uuid = theClient.AgentId; 79 this.uuid = theClient.AgentId;
79 80
80 m_regionInfo = reginfo; 81 m_regionInfo = reginfo;
82 m_regionHandle = reginfo.RegionHandle;
81 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)"); 83 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)");
82 ControllingClient = theClient; 84 ControllingClient = theClient;
83 this.firstname = ControllingClient.FirstName; 85 this.firstname = ControllingClient.FirstName;
@@ -99,8 +101,8 @@ namespace OpenSim.Region.Scenes
99 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 101 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
100 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement); 102 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
101 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition); 103 ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
102 /* ControllingClient.OnAgentUpdate += new GenericCall3(this.HandleAgentUpdate); 104 ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
103 ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 105 /* ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
104 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 106 ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
105 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 107 ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
106 */ 108 */
@@ -135,31 +137,51 @@ namespace OpenSim.Region.Scenes
135 /// </summary> 137 /// </summary>
136 public override void addForces() 138 public override void addForces()
137 { 139 {
138 140 lock (this.forcesList)
141 {
142 newForce = false;
143 if (this.forcesList.Count > 0)
144 {
145 for (int i = 0; i < this.forcesList.Count; i++)
146 {
147 NewForce force = this.forcesList[i];
148 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
149 lock (m_world.SyncRoot)
150 {
151 this._physActor.Velocity = phyVector;
152 }
153 this.updateflag = true;
154 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
155 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
156 this.newForce = true;
157 }
158 for (int i = 0; i < this.forcesList.Count; i++)
159 {
160 this.forcesList.RemoveAt(0);
161 }
162 }
163 }
139 } 164 }
140 165
141 /// <summary> 166 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
142 /// likely to removed very soon
143 /// </summary>
144 /// <param name="name"></param>
145 public static void SetupTemplate(string name)
146 { 167 {
147 168 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.localid, new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z), new LLVector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z));
148 } 169 }
149 170
150 /// <summary> 171 /// <summary>
151 /// likely to removed very soon 172 ///
152 /// </summary> 173 /// </summary>
153 /// <param name="objdata"></param> 174 public void SendTerseUpdateToALLClients()
154 protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata)
155 { 175 {
156 176 List<Avatar> avatars = this.m_world.RequestAvatarList();
157 177 for (int i = 0; i < avatars.Count; i++)
158 178 {
179 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
180 }
159 } 181 }
160 182
161 /// <summary> 183 /// <summary>
162 /// 184 /// Complete Avatar's movement into the region
163 /// </summary> 185 /// </summary>
164 public void CompleteMovement() 186 public void CompleteMovement()
165 { 187 {
@@ -187,9 +209,55 @@ namespace OpenSim.Region.Scenes
187 /// <summary> 209 /// <summary>
188 /// 210 ///
189 /// </summary> 211 /// </summary>
190 public void SendRegionHandshake() 212 /// <param name="pack"></param>
213 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
191 { 214 {
192 215
216 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
217 {
218 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
219 if (((movementflag & 1) == 0) || (q != this.bodyRot))
220 {
221 //we should add a new force to the list
222 // but for now we will deal with velocities
223 NewForce newVelocity = new NewForce();
224 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
225 Axiom.MathLib.Vector3 direc = q * v3;
226 direc.Normalize();
227
228 //work out velocity for sim physics system
229 direc = direc * ((0.03f) * 128f);
230 if (this._physActor.Flying)
231 direc *= 4;
232
233 newVelocity.X = direc.x;
234 newVelocity.Y = direc.y;
235 newVelocity.Z = direc.z;
236 this.forcesList.Add(newVelocity);
237 movementflag = 1;
238 this.bodyRot = q;
239 }
240 }
241 else
242 {
243 if (movementflag == 16)
244 {
245 movementflag = 0;
246 }
247 if ((movementflag) != 0)
248 {
249 NewForce newVelocity = new NewForce();
250 newVelocity.X = 0;
251 newVelocity.Y = 0;
252 newVelocity.Z = 0;
253 this.forcesList.Add(newVelocity);
254 movementflag = 0;
255
256 this.movementflag = 16;
257
258 }
259 }
260
193 } 261 }
194 262
195 /// <summary> 263 /// <summary>
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 7c61c90..98f5027 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -123,14 +123,8 @@ namespace OpenSim.Region.Scenes
123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating LandMap"); 123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating LandMap");
124 TerrainManager = new TerrainManager(new SecondLife()); 124 TerrainManager = new TerrainManager(new SecondLife());
125 Terrain = new TerrainEngine(); 125 Terrain = new TerrainEngine();
126 Avatar.SetupTemplate("avatar-texture.dat"); 126
127
128 Avatar.LoadAnims(); 127 Avatar.LoadAnims();
129
130 //this.SetDefaultScripts();
131 //this.LoadScriptEngines();
132
133
134 } 128 }
135 catch (Exception e) 129 catch (Exception e)
136 { 130 {