aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/OpenSimClient.cs34
-rw-r--r--src/world/Avatar.cs2
-rw-r--r--src/world/Primitive.cs91
-rw-r--r--src/world/World.cs1
4 files changed, 125 insertions, 3 deletions
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index 5f68806..9544e7b 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -35,6 +35,7 @@ using System.IO;
35using System.Threading; 35using System.Threading;
36using System.Timers; 36using System.Timers;
37using OpenSim.GridServers; 37using OpenSim.GridServers;
38using OpenSim.world;
38 39
39namespace OpenSim 40namespace OpenSim
40{ 41{
@@ -102,6 +103,39 @@ namespace OpenSim
102 case PacketType.ObjectAdd: 103 case PacketType.ObjectAdd:
103 OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); 104 OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
104 break; 105 break;
106 case PacketType.MultipleObjectUpdate :
107 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack;
108
109 for( int i = 0; i < multipleupdate.ObjectData.Length; i++ )
110 {
111 if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position
112 {
113 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 );
114 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
115 {
116 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
117 {
118 ent.position = pos;
119 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
120 }
121 }
122
123 //should update stored position of the prim
124 }
125 else if(multipleupdate.ObjectData[i].Type == 10 )//rotation
126 {
127 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
128 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
129 {
130 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
131 {
132 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W);
133 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
134 }
135 }
136 }
137 }
138 break;
105 case PacketType.TransferRequest: 139 case PacketType.TransferRequest:
106 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 140 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
107 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 141 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index 1a53acc..cf95f76 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -104,7 +104,6 @@ namespace OpenSim.world
104 104
105 public static void SetupTemplate(string name) 105 public static void SetupTemplate(string name)
106 { 106 {
107
108 int i = 0; 107 int i = 0;
109 FileInfo fInfo = new FileInfo(name); 108 FileInfo fInfo = new FileInfo(name);
110 long numBytes = fInfo.Length; 109 long numBytes = fInfo.Length;
@@ -127,7 +126,6 @@ namespace OpenSim.world
127 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); 126 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
128 127
129 Avatar.AvatarTemplate = objdata; 128 Avatar.AvatarTemplate = objdata;
130
131 } 129 }
132 130
133 public void CompleteMovement(World RegionInfo) { 131 public void CompleteMovement(World RegionInfo) {
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
index 7b1f69a..1fb7142 100644
--- a/src/world/Primitive.cs
+++ b/src/world/Primitive.cs
@@ -13,8 +13,21 @@ namespace OpenSim.world
13 protected float mesh_cutend; 13 protected float mesh_cutend;
14 protected PrimData primData; 14 protected PrimData primData;
15 protected bool newPrimFlag; 15 protected bool newPrimFlag;
16 protected bool updateFlag;
16 protected ObjectUpdatePacket OurPacket; 17 protected ObjectUpdatePacket OurPacket;
17 18
19 public bool UpdateFlag
20 {
21 get
22 {
23 return updateFlag;
24 }
25 set
26 {
27 updateFlag = value;
28 }
29 }
30
18 public Primitive() 31 public Primitive()
19 { 32 {
20 mesh_cutbegin = 0.0f; 33 mesh_cutbegin = 0.0f;
@@ -44,6 +57,18 @@ namespace OpenSim.world
44 } 57 }
45 this.newPrimFlag = false; 58 this.newPrimFlag = false;
46 } 59 }
60 else if(this.updateFlag)
61 {
62 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
63 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
64 terse.RegionData.TimeDilation = 64096;
65 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
66 terse.ObjectData[0] = this.CreateImprovedBlock();
67 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
68 client.OutPacket(terse);
69 }
70 this.updateFlag = false;
71 }
47 } 72 }
48 73
49 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) 74 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
@@ -109,6 +134,72 @@ namespace OpenSim.world
109 this.position = pos1; 134 this.position = pos1;
110 this.OurPacket = objupdate; 135 this.OurPacket = objupdate;
111 } 136 }
137
138 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
139 {
140 uint ID = this.localid;
141 byte[] bytes = new byte[60];
142
143
144 int i = 0;
145 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
146 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
147
148 bytes[i++] = (byte)(ID % 256);
149 bytes[i++] = (byte)((ID >> 8) % 256);
150 bytes[i++] = (byte)((ID >> 16) % 256);
151 bytes[i++] = (byte)((ID >> 24) % 256);
152 bytes[i++]= 0;
153 bytes[i++]= 0;
154
155 byte[] pb = this.position.GetBytes();
156 Array.Copy(pb, 0, bytes, i, pb.Length);
157 i += 12;
158 ushort ac = 32767;
159
160 //vel
161 bytes[i++] = (byte)(ac % 256);
162 bytes[i++] = (byte)((ac >> 8) % 256);
163 bytes[i++] = (byte)(ac % 256);
164 bytes[i++] = (byte)((ac >> 8) % 256);
165 bytes[i++] = (byte)(ac % 256);
166 bytes[i++] = (byte)((ac >> 8) % 256);
167
168 //accel
169 bytes[i++] = (byte)(ac % 256);
170 bytes[i++] = (byte)((ac >> 8) % 256);
171 bytes[i++] = (byte)(ac % 256);
172 bytes[i++] = (byte)((ac >> 8) % 256);
173 bytes[i++] = (byte)(ac % 256);
174 bytes[i++] = (byte)((ac >> 8) % 256);
175
176 ushort rw, rx,ry,rz;
177 rw = (ushort)(32768 * (this.rotation.w+1));
178 rx = (ushort)(32768 * (this.rotation.x+1));
179 ry = (ushort)(32768 * (this.rotation.y+1));
180 rz = (ushort)(32768 * (this.rotation.z+1));
181
182 //rot
183 bytes[i++] = (byte)(rx % 256);
184 bytes[i++] = (byte)((rx >> 8) % 256);
185 bytes[i++] = (byte)(ry % 256);
186 bytes[i++] = (byte)((ry >> 8) % 256);
187 bytes[i++] = (byte)(rz % 256);
188 bytes[i++] = (byte)((rz >> 8) % 256);
189 bytes[i++] = (byte)(rw % 256);
190 bytes[i++] = (byte)((rw >> 8) % 256);
191
192 //rotation vel
193 bytes[i++] = (byte)(ac % 256);
194 bytes[i++] = (byte)((ac >> 8) % 256);
195 bytes[i++] = (byte)(ac % 256);
196 bytes[i++] = (byte)((ac >> 8) % 256);
197 bytes[i++] = (byte)(ac % 256);
198 bytes[i++] = (byte)((ac >> 8) % 256);
199
200 dat.Data=bytes;
201 return dat;
202 }
112 } 203 }
113 204
114 public class PrimData 205 public class PrimData
diff --git a/src/world/World.cs b/src/world/World.cs
index 41a7a34..f6f58c7 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -29,7 +29,6 @@ namespace OpenSim.world
29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
30 TerrainManager = new TerrainManager(new SecondLife()); 30 TerrainManager = new TerrainManager(new SecondLife());
31 Avatar.SetupTemplate("avatar-template.dat"); 31 Avatar.SetupTemplate("avatar-template.dat");
32
33 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 32 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
34 // Initialise this only after the world has loaded 33 // Initialise this only after the world has loaded
35 // Scripts = new ScriptEngine(this); 34 // Scripts = new ScriptEngine(this);