aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs17
-rw-r--r--OpenSim/Region/Application/OpenSimController.cs68
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs68
-rw-r--r--OpenSim/Region/Application/VersionInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs6
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs538
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs89
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketQueue.cs39
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs270
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs86
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs33
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs25
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs60
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs20
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs63
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs21
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs49
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs8
-rw-r--r--OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs8
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs104
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs18
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs17
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs63
-rw-r--r--OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs28
-rw-r--r--OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs5
-rw-r--r--OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionModule.cs4
-rw-r--r--OpenSim/Region/Environment/Interfaces/ISimChat.cs7
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrain.cs3
-rw-r--r--OpenSim/Region/Environment/Interfaces/IWorldComm.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXMLRPC.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IXfer.cs2
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs3
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs1
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/AssetDownloadModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs266
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/EmailModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/FriendsModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/GroupsModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/InstantMessageModule.cs30
-rw-r--r--OpenSim/Region/Environment/Modules/InventoryModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/LoadImageURLModule.cs33
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/TeleportModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs49
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs146
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs65
-rw-r--r--OpenSim/Region/Environment/Modules/XferModule.cs7
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs197
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs44
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs83
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs2
-rw-r--r--OpenSim/Region/Environment/StorageManager.cs2
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs45
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs2
-rw-r--r--OpenSim/Region/Examples/SimpleApp/ComplexObject.cs65
-rw-r--r--OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs25
-rw-r--r--OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs14
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs286
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs32
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs87
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs13
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs16
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs5
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs5
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs222
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs5
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs454
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs44
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs63
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs4
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs4
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs5
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs32
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs55
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs7
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs7
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs7
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Script.cs8
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs11
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs7
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs52
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs9
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs26
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs22
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs106
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs24
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs589
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs22
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs110
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs143
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs26
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs22
-rw-r--r--OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs72
-rw-r--r--OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs256
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs274
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs22
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs643
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Executor.cs88
-rw-r--r--OpenSim/Region/ScriptEngine/Common/IScript.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs82
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs2007
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs149
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs186
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs135
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs208
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs1810
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs173
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs74
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs101
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs20
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs289
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs19
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs169
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs8
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs20
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs18
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs33
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs29
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs14
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs15
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs10
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs5
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs77
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs4
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs47
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs35
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs14
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs42
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs23
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs19
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs100
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs18
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs10
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs9
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs6
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs31
182 files changed, 8023 insertions, 5541 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 0288f63..bb26ce3 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -26,27 +26,24 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Scenes;
31using Nini.Config; 29using Nini.Config;
32using System.Threading;
33using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console;
34 32
35namespace OpenSim 33namespace OpenSim
36{ 34{
37 public class Application 35 public class Application
38 { 36 {
39 //could move our main function into OpenSimMain and kill this class 37 //could move our main function into OpenSimMain and kill this class
40 [STAThread] 38 [STAThread]
41 public static void Main(string[] args) 39 public static void Main(string[] args)
42 { 40 {
43
44 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); 41 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
45 42
46 43
47 Console.Write("Performing compatibility checks... "); 44 Console.Write("Performing compatibility checks... ");
48 string supported = ""; 45 string supported = "";
49 if (OpenSim.Framework.Util.IsEnvironmentSupported(ref supported)) 46 if (Util.IsEnvironmentSupported(ref supported))
50 { 47 {
51 Console.WriteLine(" Environment is compatible.\n"); 48 Console.WriteLine(" Environment is compatible.\n");
52 } 49 }
@@ -54,10 +51,10 @@ namespace OpenSim
54 { 51 {
55 Console.WriteLine(" Environment is unsupported (" + supported + ")\n"); 52 Console.WriteLine(" Environment is unsupported (" + supported + ")\n");
56 } 53 }
57 54
58 Console.WriteLine("Starting...\n"); 55 Console.WriteLine("Starting...\n");
59 56
60 Culture.SetCurrentCulture(); 57 Culture.SetCurrentCulture();
61 58
62 ArgvConfigSource configSource = new ArgvConfigSource(args); 59 ArgvConfigSource configSource = new ArgvConfigSource(args);
63 60
@@ -80,4 +77,4 @@ namespace OpenSim
80 } 77 }
81 } 78 }
82 } 79 }
83} 80} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs
index da93b54..1fa4b04 100644
--- a/OpenSim/Region/Application/OpenSimController.cs
+++ b/OpenSim/Region/Application/OpenSimController.cs
@@ -1,28 +1,15 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Collections; 2using System.Collections;
4using System.IO; 3using System.Net;
5using System.Text; 4using System.Timers;
6using Nini.Config; 5using Nwc.XmlRpc;
7using OpenSim.Framework.Communications.Cache; 6using OpenSim.Framework;
8using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
11using OpenSim.Framework;
12using OpenSim.Framework;
13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.Communications.OGS1;
16using OpenSim.Region.Environment;
17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Region.Physics.Manager;
19using System.Globalization;
20using Nwc.XmlRpc;
21using RegionInfo = OpenSim.Framework.RegionInfo;
22 9
23namespace OpenSim 10namespace OpenSim
24{ 11{
25 class OpenSimController 12 internal class OpenSimController
26 { 13 {
27 private OpenSimMain m_app; 14 private OpenSimMain m_app;
28 private BaseHttpServer m_httpServer; 15 private BaseHttpServer m_httpServer;
@@ -44,22 +31,23 @@ namespace OpenSim
44 { 31 {
45 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); 32 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
46 XmlRpcResponse response = new XmlRpcResponse(); 33 XmlRpcResponse response = new XmlRpcResponse();
47 Hashtable requestData = (Hashtable)request.Params[0]; 34 Hashtable requestData = (Hashtable) request.Params[0];
48 35
49 if ((string)requestData["shutdown"] == "delayed") 36 if ((string) requestData["shutdown"] == "delayed")
50 { 37 {
51 int timeout = Convert.ToInt32((string)requestData["milliseconds"]); 38 int timeout = Convert.ToInt32((string) requestData["milliseconds"]);
52 39
53 Hashtable responseData = new Hashtable(); 40 Hashtable responseData = new Hashtable();
54 responseData["accepted"] = "true"; 41 responseData["accepted"] = "true";
55 response.Value = responseData; 42 response.Value = responseData;
56 43
57 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); 44 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
45 " second(s). Please save what you are doing and log out.");
58 46
59 // Perform shutdown 47 // Perform shutdown
60 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 48 Timer shutdownTimer = new Timer(timeout); // Wait before firing
61 shutdownTimer.AutoReset = false; 49 shutdownTimer.AutoReset = false;
62 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 50 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
63 51
64 return response; 52 return response;
65 } 53 }
@@ -72,15 +60,15 @@ namespace OpenSim
72 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 60 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
73 61
74 // Perform shutdown 62 // Perform shutdown
75 System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing 63 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
76 shutdownTimer.AutoReset = false; 64 shutdownTimer.AutoReset = false;
77 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 65 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
78 66
79 return response; 67 return response;
80 } 68 }
81 } 69 }
82 70
83 void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 71 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
84 { 72 {
85 m_app.Shutdown(); 73 m_app.Shutdown();
86 } 74 }
@@ -89,28 +77,28 @@ namespace OpenSim
89 { 77 {
90 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); 78 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
91 XmlRpcResponse response = new XmlRpcResponse(); 79 XmlRpcResponse response = new XmlRpcResponse();
92 Hashtable requestData = (Hashtable)request.Params[0]; 80 Hashtable requestData = (Hashtable) request.Params[0];
93 81
94 RegionInfo newRegionData = new RegionInfo(); 82 RegionInfo newRegionData = new RegionInfo();
95 83
96 try 84 try
97 { 85 {
98 newRegionData.RegionID = (string)requestData["region_id"]; 86 newRegionData.RegionID = (string) requestData["region_id"];
99 newRegionData.RegionName = (string)requestData["region_name"]; 87 newRegionData.RegionName = (string) requestData["region_name"];
100 newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); 88 newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]);
101 newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); 89 newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]);
102 90
103 // Security risk 91 // Security risk
104 newRegionData.DataStore = (string)requestData["datastore"]; 92 newRegionData.DataStore = (string) requestData["datastore"];
105 93
106 newRegionData.InternalEndPoint = new System.Net.IPEndPoint( 94 newRegionData.InternalEndPoint = new IPEndPoint(
107 System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); 95 IPAddress.Parse((string) requestData["listen_ip"]), 0);
108 96
109 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); 97 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]);
110 newRegionData.ExternalHostName = (string)requestData["external_address"]; 98 newRegionData.ExternalHostName = (string) requestData["external_address"];
111 99
112 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 100 newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"];
113 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 101 newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"];
114 102
115 m_app.CreateRegion(newRegionData); 103 m_app.CreateRegion(newRegionData);
116 104
@@ -129,4 +117,4 @@ namespace OpenSim
129 return response; 117 return response;
130 } 118 }
131 } 119 }
132} 120} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index b938227..7245482 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -31,21 +31,17 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Text; 32using System.Text;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework;
39using OpenSim.Framework;
40using OpenSim.Region.ClientStack; 38using OpenSim.Region.ClientStack;
41using OpenSim.Region.Communications.Local; 39using OpenSim.Region.Communications.Local;
42using OpenSim.Region.Communications.OGS1; 40using OpenSim.Region.Communications.OGS1;
43using OpenSim.Region.Environment; 41using OpenSim.Region.Environment;
42using OpenSim.Region.Environment.Interfaces;
44using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
45using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Physics.Manager;
46using OpenSim.Framework;
47using System.Globalization;
48using RegionInfo = OpenSim.Framework.RegionInfo;
49 45
50namespace OpenSim 46namespace OpenSim
51{ 47{
@@ -114,7 +110,6 @@ namespace OpenSim
114 } 110 }
115 else 111 else
116 { 112 {
117
118 // no default config files, so set default values, and save it 113 // no default config files, so set default values, and save it
119 SetDefaultConfig(); 114 SetDefaultConfig();
120 115
@@ -125,7 +120,6 @@ namespace OpenSim
125 } 120 }
126 121
127 ReadConfigSettings(); 122 ReadConfigSettings();
128
129 } 123 }
130 124
131 protected void SetDefaultConfig() 125 protected void SetDefaultConfig()
@@ -148,7 +142,6 @@ namespace OpenSim
148 config.Set("script_engine", "DotNetEngine"); 142 config.Set("script_engine", "DotNetEngine");
149 143
150 config.Set("asset_database", "sqlite"); 144 config.Set("asset_database", "sqlite");
151
152 } 145 }
153 146
154 if (m_config.Configs["StandAlone"] == null) 147 if (m_config.Configs["StandAlone"] == null)
@@ -217,7 +210,8 @@ namespace OpenSim
217 standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll"); 210 standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
218 m_standaloneUserPlugin = 211 m_standaloneUserPlugin =
219 standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll"); 212 standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
220 m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll"); 213 m_standaloneAssetPlugin =
214 standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
221 215
222 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); 216 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
223 } 217 }
@@ -230,7 +224,6 @@ namespace OpenSim
230 /// </summary> 224 /// </summary>
231 public override void StartUp() 225 public override void StartUp()
232 { 226 {
233
234 if (!Directory.Exists(Util.logDir())) 227 if (!Directory.Exists(Util.logDir()))
235 { 228 {
236 Directory.CreateDirectory(Util.logDir()); 229 Directory.CreateDirectory(Util.logDir());
@@ -248,22 +241,28 @@ namespace OpenSim
248 LocalInventoryService inventoryService = new LocalInventoryService(); 241 LocalInventoryService inventoryService = new LocalInventoryService();
249 inventoryService.AddPlugin(m_standaloneInventoryPlugin); 242 inventoryService.AddPlugin(m_standaloneInventoryPlugin);
250 243
251 LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); 244 LocalUserServices userService =
245 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
246 m_networkServersInfo.DefaultHomeLocY, inventoryService);
252 userService.AddPlugin(m_standaloneUserPlugin); 247 userService.AddPlugin(m_standaloneUserPlugin);
253 248
254 LocalBackEndServices backendService = new LocalBackEndServices(); 249 LocalBackEndServices backendService = new LocalBackEndServices();
255 250
256 CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, m_dumpAssetsToFile); 251 CommunicationsLocal localComms =
252 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService,
253 inventoryService, backendService, backendService, m_dumpAssetsToFile);
257 m_commsManager = localComms; 254 m_commsManager = localComms;
258 255
259 m_loginService = new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, m_standaloneAuthenticate); 256 m_loginService =
257 new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo,
258 m_standaloneAuthenticate);
260 m_loginService.OnLoginToRegion += backendService.AddNewSession; 259 m_loginService.OnLoginToRegion += backendService.AddNewSession;
261 260
262 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 261 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
263 262
264 if (m_standaloneAuthenticate) 263 if (m_standaloneAuthenticate)
265 { 264 {
266 this.CreateAccount = localComms.doCreate; 265 CreateAccount = localComms.doCreate;
267 } 266 }
268 } 267 }
269 else 268 else
@@ -308,7 +307,7 @@ namespace OpenSim
308 // Start UDP servers 307 // Start UDP servers
309 for (int i = 0; i < m_udpServers.Count; i++) 308 for (int i = 0; i < m_udpServers.Count; i++)
310 { 309 {
311 this.m_udpServers[i].ServerListener(); 310 m_udpServers[i].ServerListener();
312 } 311 }
313 312
314 //Run Startup Commands 313 //Run Startup Commands
@@ -321,7 +320,8 @@ namespace OpenSim
321 MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); 320 MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on...");
322 } 321 }
323 322
324 MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); 323 MainLog.Instance.Status("STARTUP",
324 "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
325 } 325 }
326 326
327 public UDPServer CreateRegion(RegionInfo regionInfo) 327 public UDPServer CreateRegion(RegionInfo regionInfo)
@@ -365,9 +365,12 @@ namespace OpenSim
365 return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName); 365 return new StorageManager(m_storageDLL, regionInfo.DataStore, regionInfo.RegionName);
366 } 366 }
367 367
368 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) 368 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
369 AgentCircuitManager circuitManager)
369 { 370 {
370 return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader, m_dumpAssetsToFile); 371 return
372 new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer,
373 m_moduleLoader, m_dumpAssetsToFile);
371 } 374 }
372 375
373 protected override void Initialize() 376 protected override void Initialize()
@@ -436,7 +439,6 @@ namespace OpenSim
436 439
437 protected void ConnectToRemoteGridServer() 440 protected void ConnectToRemoteGridServer()
438 { 441 {
439
440 } 442 }
441 443
442 #endregion 444 #endregion
@@ -464,6 +466,7 @@ namespace OpenSim
464 } 466 }
465 467
466 #region Console Commands 468 #region Console Commands
469
467 /// <summary> 470 /// <summary>
468 /// 471 ///
469 /// </summary> 472 /// </summary>
@@ -649,11 +652,10 @@ namespace OpenSim
649 case "change-region": 652 case "change-region":
650 if (cmdparams.Length > 0) 653 if (cmdparams.Length > 0)
651 { 654 {
652 string regionName = this.CombineParams(cmdparams, 0); 655 string regionName = CombineParams(cmdparams, 0);
653 656
654 if (m_sceneManager.TrySetCurrentScene(regionName)) 657 if (m_sceneManager.TrySetCurrentScene(regionName))
655 { 658 {
656
657 } 659 }
658 else 660 else
659 { 661 {
@@ -663,11 +665,13 @@ namespace OpenSim
663 665
664 if (m_sceneManager.CurrentScene == null) 666 if (m_sceneManager.CurrentScene == null)
665 { 667 {
666 MainLog.Instance.Verbose("Currently at Root level. To change region please use 'change-region <regioname>'"); 668 MainLog.Instance.Verbose(
669 "Currently at Root level. To change region please use 'change-region <regioname>'");
667 } 670 }
668 else 671 else
669 { 672 {
670 MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + ". To change region please use 'change-region <regioname>'"); 673 MainLog.Instance.Verbose("Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
674 ". To change region please use 'change-region <regioname>'");
671 } 675 }
672 676
673 break; 677 break;
@@ -676,7 +680,6 @@ namespace OpenSim
676 m_log.Error("Unknown command"); 680 m_log.Error("Unknown command");
677 break; 681 break;
678 } 682 }
679
680 } 683 }
681 684
682 public void Debug(string[] args) 685 public void Debug(string[] args)
@@ -695,8 +698,7 @@ namespace OpenSim
695 { 698 {
696 m_log.Error("packet debug should be 0..2"); 699 m_log.Error("packet debug should be 0..2");
697 } 700 }
698 System.Console.WriteLine("New packet debug: " + newDebug.ToString()); 701 Console.WriteLine("New packet debug: " + newDebug.ToString());
699
700 } 702 }
701 703
702 break; 704 break;
@@ -704,7 +706,6 @@ namespace OpenSim
704 m_log.Error("Unknown debug"); 706 m_log.Error("Unknown debug");
705 break; 707 break;
706 } 708 }
707
708 } 709 }
709 710
710 /// <summary> 711 /// <summary>
@@ -720,7 +721,9 @@ namespace OpenSim
720 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); 721 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString());
721 break; 722 break;
722 case "users": 723 case "users":
723 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 724 m_log.Error(
725 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
726 "Agent ID", "Session ID", "Circuit", "IP", "World"));
724 727
725 foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars()) 728 foreach (ScenePresence presence in m_sceneManager.GetCurrentSceneAvatars())
726 { 729 {
@@ -750,7 +753,7 @@ namespace OpenSim
750 break; 753 break;
751 case "modules": 754 case "modules":
752 m_log.Error("The currently loaded shared modules are:"); 755 m_log.Error("The currently loaded shared modules are:");
753 foreach (OpenSim.Region.Environment.Interfaces.IRegionModule module in m_moduleLoader.GetLoadedSharedModules ) 756 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
754 { 757 {
755 m_log.Error("Shared Module: " + module.Name); 758 m_log.Error("Shared Module: " + module.Name);
756 } 759 }
@@ -768,8 +771,7 @@ namespace OpenSim
768 result = result.TrimEnd(' '); 771 result = result.TrimEnd(' ');
769 return result; 772 return result;
770 } 773 }
774
771 #endregion 775 #endregion
772 } 776 }
773 777} \ No newline at end of file
774
775}
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs
index f045164..7840206 100644
--- a/OpenSim/Region/Application/VersionInfo.cs
+++ b/OpenSim/Region/Application/VersionInfo.cs
@@ -33,4 +33,4 @@ namespace OpenSim
33 { 33 {
34 public static string Version = "0.4, SVN build "; 34 public static string Version = "0.4, SVN build ";
35 } 35 }
36} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
index 3960c19..4b44ead 100644
--- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
+++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
@@ -29,12 +29,10 @@ using System.Net.Sockets;
29 29
30namespace OpenSim.Region.ClientStack 30namespace OpenSim.Region.ClientStack
31{ 31{
32
33 public interface ClientStackNetworkHandler 32 public interface ClientStackNetworkHandler
34 { 33 {
35 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); 34 void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
36 void RemoveClientCircuit(uint circuitcode); 35 void RemoveClientCircuit(uint circuitcode);
37 void RegisterPacketServer(PacketServer server); 36 void RegisterPacketServer(PacketServer server);
38 } 37 }
39 38} \ No newline at end of file
40}
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 24962f8..7dcf1e8 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -32,10 +32,8 @@ using System.Text;
32using Axiom.Math; 32using Axiom.Math;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework;
38using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console;
39 37
40namespace OpenSim.Region.ClientStack 38namespace OpenSim.Region.ClientStack
41{ 39{
@@ -116,26 +114,18 @@ namespace OpenSim.Region.ClientStack
116 /// </summary> 114 /// </summary>
117 public LLVector3 StartPos 115 public LLVector3 StartPos
118 { 116 {
119 get 117 get { return startpos; }
120 { 118 set { startpos = value; }
121 return startpos;
122 }
123 set
124 {
125 startpos = value;
126 }
127 } 119 }
128 120
129 /// <summary> 121 /// <summary>
130 /// 122 ///
131 /// </summary> 123 /// </summary>
132 private LLUUID m_agentId; 124 private LLUUID m_agentId;
125
133 public LLUUID AgentId 126 public LLUUID AgentId
134 { 127 {
135 get 128 get { return m_agentId; }
136 {
137 return m_agentId;
138 }
139 } 129 }
140 130
141 /// <summary> 131 /// <summary>
@@ -143,11 +133,7 @@ namespace OpenSim.Region.ClientStack
143 /// </summary> 133 /// </summary>
144 public string FirstName 134 public string FirstName
145 { 135 {
146 get 136 get { return firstName; }
147 {
148 return this.firstName;
149 }
150
151 } 137 }
152 138
153 /// <summary> 139 /// <summary>
@@ -155,10 +141,7 @@ namespace OpenSim.Region.ClientStack
155 /// </summary> 141 /// </summary>
156 public string LastName 142 public string LastName
157 { 143 {
158 get 144 get { return lastName; }
159 {
160 return this.lastName;
161 }
162 } 145 }
163 146
164 #region Scene/Avatar to Client 147 #region Scene/Avatar to Client
@@ -182,11 +165,11 @@ namespace OpenSim.Region.ClientStack
182 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; 165 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1;
183 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; 166 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2;
184 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; 167 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3;
185 handshake.RegionInfo.SimAccess = (byte)regionInfo.EstateSettings.simAccess; 168 handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess;
186 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; 169 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight;
187 170
188 171
189 handshake.RegionInfo.RegionFlags = (uint)regionInfo.EstateSettings.regionFlags; 172 handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags;
190 173
191 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); 174 handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0");
192 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; 175 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID;
@@ -200,7 +183,7 @@ namespace OpenSim.Region.ClientStack
200 handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3; 183 handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3;
201 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? 184 handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
202 185
203 this.OutPacket(handshake); 186 OutPacket(handshake);
204 } 187 }
205 188
206 /// <summary> 189 /// <summary>
@@ -210,14 +193,14 @@ namespace OpenSim.Region.ClientStack
210 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) 193 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
211 { 194 {
212 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 195 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
213 mov.AgentData.SessionID = this.m_sessionId; 196 mov.AgentData.SessionID = m_sessionId;
214 mov.AgentData.AgentID = this.AgentId; 197 mov.AgentData.AgentID = AgentId;
215 mov.Data.RegionHandle = regInfo.RegionHandle; 198 mov.Data.RegionHandle = regInfo.RegionHandle;
216 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this 199 mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this
217 200
218 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) 201 if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0))
219 { 202 {
220 mov.Data.Position = this.startpos; 203 mov.Data.Position = startpos;
221 } 204 }
222 else 205 else
223 { 206 {
@@ -255,7 +238,7 @@ namespace OpenSim.Region.ClientStack
255 reply.ChatData.OwnerID = fromAgentID; 238 reply.ChatData.OwnerID = fromAgentID;
256 reply.ChatData.SourceID = fromAgentID; 239 reply.ChatData.SourceID = fromAgentID;
257 240
258 this.OutPacket(reply); 241 OutPacket(reply);
259 } 242 }
260 243
261 /// <summary> 244 /// <summary>
@@ -264,27 +247,27 @@ namespace OpenSim.Region.ClientStack
264 /// <remarks>TODO</remarks> 247 /// <remarks>TODO</remarks>
265 /// <param name="message"></param> 248 /// <param name="message"></param>
266 /// <param name="target"></param> 249 /// <param name="target"></param>
267 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 250 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
251 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
268 { 252 {
269 253 Encoding enc = Encoding.ASCII;
270 Encoding enc = Encoding.ASCII; 254 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
271 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); 255 msg.AgentData.AgentID = fromAgent;
272 msg.AgentData.AgentID = fromAgent; 256 msg.AgentData.SessionID = fromAgentSession;
273 msg.AgentData.SessionID = fromAgentSession; 257 msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0");
274 msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); 258 msg.MessageBlock.Dialog = dialog;
275 msg.MessageBlock.Dialog = dialog; 259 msg.MessageBlock.FromGroup = false;
276 msg.MessageBlock.FromGroup = false; 260 msg.MessageBlock.ID = imSessionID;
277 msg.MessageBlock.ID = imSessionID; 261 msg.MessageBlock.Offline = 0;
278 msg.MessageBlock.Offline = 0; 262 msg.MessageBlock.ParentEstateID = 0;
279 msg.MessageBlock.ParentEstateID = 0; 263 msg.MessageBlock.Position = new LLVector3();
280 msg.MessageBlock.Position = new LLVector3(); 264 msg.MessageBlock.RegionID = LLUUID.Random();
281 msg.MessageBlock.RegionID = LLUUID.Random(); 265 msg.MessageBlock.Timestamp = timeStamp;
282 msg.MessageBlock.Timestamp = timeStamp; 266 msg.MessageBlock.ToAgentID = toAgent;
283 msg.MessageBlock.ToAgentID = toAgent; 267 msg.MessageBlock.Message = enc.GetBytes(message + "\0");
284 msg.MessageBlock.Message = enc.GetBytes(message + "\0"); 268 msg.MessageBlock.BinaryBucket = new byte[0];
285 msg.MessageBlock.BinaryBucket = new byte[0]; 269
286 270 OutPacket(msg);
287 this.OutPacket(msg);
288 } 271 }
289 272
290 /// <summary> 273 /// <summary>
@@ -301,10 +284,10 @@ namespace OpenSim.Region.ClientStack
301 { 284 {
302 for (int x = 0; x < 16; x = x + 4) 285 for (int x = 0; x < 16; x = x + 4)
303 { 286 {
304 patches[0] = x + 0 + y * 16; 287 patches[0] = x + 0 + y*16;
305 patches[1] = x + 1 + y * 16; 288 patches[1] = x + 1 + y*16;
306 patches[2] = x + 2 + y * 16; 289 patches[2] = x + 2 + y*16;
307 patches[3] = x + 3 + y * 16; 290 patches[3] = x + 3 + y*16;
308 291
309 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 292 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
310 OutPacket(layerpack); 293 OutPacket(layerpack);
@@ -313,7 +296,8 @@ namespace OpenSim.Region.ClientStack
313 } 296 }
314 catch (Exception e) 297 catch (Exception e)
315 { 298 {
316 MainLog.Instance.Warn("client", "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); 299 MainLog.Instance.Warn("client",
300 "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString());
317 } 301 }
318 } 302 }
319 303
@@ -332,14 +316,15 @@ namespace OpenSim.Region.ClientStack
332 patchx = px; 316 patchx = px;
333 patchy = py; 317 patchy = py;
334 318
335 patches[0] = patchx + 0 + patchy * 16; 319 patches[0] = patchx + 0 + patchy*16;
336 320
337 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 321 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
338 OutPacket(layerpack); 322 OutPacket(layerpack);
339 } 323 }
340 catch (Exception e) 324 catch (Exception e)
341 { 325 {
342 MainLog.Instance.Warn("client", "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); 326 MainLog.Instance.Warn("client",
327 "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
343 } 328 }
344 } 329 }
345 330
@@ -352,17 +337,17 @@ namespace OpenSim.Region.ClientStack
352 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) 337 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint)
353 { 338 {
354 IPAddress neighbourIP = neighbourEndPoint.Address; 339 IPAddress neighbourIP = neighbourEndPoint.Address;
355 ushort neighbourPort = (ushort)neighbourEndPoint.Port; 340 ushort neighbourPort = (ushort) neighbourEndPoint.Port;
356 341
357 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 342 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
358 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 343 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
359 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 344 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
360 345
361 byte[] byteIP = neighbourIP.GetAddressBytes(); 346 byte[] byteIP = neighbourIP.GetAddressBytes();
362 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; 347 enablesimpacket.SimulatorInfo.IP = (uint) byteIP[3] << 24;
363 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; 348 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[2] << 16;
364 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; 349 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[1] << 8;
365 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; 350 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[0];
366 enablesimpacket.SimulatorInfo.Port = neighbourPort; 351 enablesimpacket.SimulatorInfo.Port = neighbourPort;
367 OutPacket(enablesimpacket); 352 OutPacket(enablesimpacket);
368 } 353 }
@@ -374,46 +359,48 @@ namespace OpenSim.Region.ClientStack
374 public AgentCircuitData RequestClientInfo() 359 public AgentCircuitData RequestClientInfo()
375 { 360 {
376 AgentCircuitData agentData = new AgentCircuitData(); 361 AgentCircuitData agentData = new AgentCircuitData();
377 agentData.AgentID = this.AgentId; 362 agentData.AgentID = AgentId;
378 agentData.SessionID = this.m_sessionId; 363 agentData.SessionID = m_sessionId;
379 agentData.SecureSessionID = this.SecureSessionID; 364 agentData.SecureSessionID = SecureSessionID;
380 agentData.circuitcode = this.m_circuitCode; 365 agentData.circuitcode = m_circuitCode;
381 agentData.child = false; 366 agentData.child = false;
382 agentData.firstname = this.firstName; 367 agentData.firstname = firstName;
383 agentData.lastname = this.lastName; 368 agentData.lastname = lastName;
384 agentData.CapsPath = ""; 369 agentData.CapsPath = "";
385 return agentData; 370 return agentData;
386 } 371 }
387 372
388 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, string capsURL) 373 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint,
374 string capsURL)
389 { 375 {
390 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); 376 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10);
391 377
392 CrossedRegionPacket newSimPack = new CrossedRegionPacket(); 378 CrossedRegionPacket newSimPack = new CrossedRegionPacket();
393 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 379 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
394 newSimPack.AgentData.AgentID = this.AgentId; 380 newSimPack.AgentData.AgentID = AgentId;
395 newSimPack.AgentData.SessionID = this.m_sessionId; 381 newSimPack.AgentData.SessionID = m_sessionId;
396 newSimPack.Info = new CrossedRegionPacket.InfoBlock(); 382 newSimPack.Info = new CrossedRegionPacket.InfoBlock();
397 newSimPack.Info.Position = pos; 383 newSimPack.Info.Position = pos;
398 newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! 384 newSimPack.Info.LookAt = look;
385 // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!!
399 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); 386 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock();
400 newSimPack.RegionData.RegionHandle = newRegionHandle; 387 newSimPack.RegionData.RegionHandle = newRegionHandle;
401 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); 388 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes();
402 newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; 389 newSimPack.RegionData.SimIP = (uint) byteIP[3] << 24;
403 newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; 390 newSimPack.RegionData.SimIP += (uint) byteIP[2] << 16;
404 newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; 391 newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8;
405 newSimPack.RegionData.SimIP += (uint)byteIP[0]; 392 newSimPack.RegionData.SimIP += (uint) byteIP[0];
406 newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; 393 newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port;
407 //newSimPack.RegionData.SeedCapability = new byte[0]; 394 //newSimPack.RegionData.SeedCapability = new byte[0];
408 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); 395 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL);
409 396
410 this.OutPacket(newSimPack); 397 OutPacket(newSimPack);
411 } 398 }
412 399
413 public void SendMapBlock(List<MapBlockData> mapBlocks) 400 public void SendMapBlock(List<MapBlockData> mapBlocks)
414 { 401 {
415 MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); 402 MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
416 mapReply.AgentData.AgentID = this.AgentId; 403 mapReply.AgentData.AgentID = AgentId;
417 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; 404 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
418 mapReply.AgentData.Flags = 0; 405 mapReply.AgentData.Flags = 0;
419 406
@@ -429,13 +416,13 @@ namespace OpenSim.Region.ClientStack
429 mapReply.Data[i].Access = mapBlocks[i].Access; 416 mapReply.Data[i].Access = mapBlocks[i].Access;
430 mapReply.Data[i].Agents = mapBlocks[i].Agents; 417 mapReply.Data[i].Agents = mapBlocks[i].Agents;
431 } 418 }
432 this.OutPacket(mapReply); 419 OutPacket(mapReply);
433 } 420 }
434 421
435 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 422 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
436 { 423 {
437 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 424 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
438 tpLocal.Info.AgentID = this.AgentId; 425 tpLocal.Info.AgentID = AgentId;
439 tpLocal.Info.TeleportFlags = flags; 426 tpLocal.Info.TeleportFlags = flags;
440 tpLocal.Info.LocationID = 2; 427 tpLocal.Info.LocationID = 2;
441 tpLocal.Info.LookAt = lookAt; 428 tpLocal.Info.LookAt = lookAt;
@@ -443,10 +430,11 @@ namespace OpenSim.Region.ClientStack
443 OutPacket(tpLocal); 430 OutPacket(tpLocal);
444 } 431 }
445 432
446 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags, string capsURL) 433 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
434 uint flags, string capsURL)
447 { 435 {
448 TeleportFinishPacket teleport = new TeleportFinishPacket(); 436 TeleportFinishPacket teleport = new TeleportFinishPacket();
449 teleport.Info.AgentID = this.AgentId; 437 teleport.Info.AgentID = AgentId;
450 teleport.Info.RegionHandle = regionHandle; 438 teleport.Info.RegionHandle = regionHandle;
451 teleport.Info.SimAccess = simAccess; 439 teleport.Info.SimAccess = simAccess;
452 440
@@ -455,13 +443,13 @@ namespace OpenSim.Region.ClientStack
455 443
456 IPAddress oIP = newRegionEndPoint.Address; 444 IPAddress oIP = newRegionEndPoint.Address;
457 byte[] byteIP = oIP.GetAddressBytes(); 445 byte[] byteIP = oIP.GetAddressBytes();
458 uint ip = (uint)byteIP[3] << 24; 446 uint ip = (uint) byteIP[3] << 24;
459 ip += (uint)byteIP[2] << 16; 447 ip += (uint) byteIP[2] << 16;
460 ip += (uint)byteIP[1] << 8; 448 ip += (uint) byteIP[1] << 8;
461 ip += (uint)byteIP[0]; 449 ip += (uint) byteIP[0];
462 450
463 teleport.Info.SimIP = ip; 451 teleport.Info.SimIP = ip;
464 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; 452 teleport.Info.SimPort = (ushort) newRegionEndPoint.Port;
465 teleport.Info.LocationID = 4; 453 teleport.Info.LocationID = 4;
466 teleport.Info.TeleportFlags = 1 << 4; 454 teleport.Info.TeleportFlags = 1 << 4;
467 OutPacket(teleport); 455 OutPacket(teleport);
@@ -473,8 +461,8 @@ namespace OpenSim.Region.ClientStack
473 public void SendTeleportCancel() 461 public void SendTeleportCancel()
474 { 462 {
475 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 463 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
476 tpCancel.Info.SessionID = this.m_sessionId; 464 tpCancel.Info.SessionID = m_sessionId;
477 tpCancel.Info.AgentID = this.AgentId; 465 tpCancel.Info.AgentID = AgentId;
478 466
479 OutPacket(tpCancel); 467 OutPacket(tpCancel);
480 } 468 }
@@ -492,7 +480,7 @@ namespace OpenSim.Region.ClientStack
492 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) 480 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
493 { 481 {
494 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); 482 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
495 money.MoneyData.AgentID = this.AgentId; 483 money.MoneyData.AgentID = AgentId;
496 money.MoneyData.TransactionID = transaction; 484 money.MoneyData.TransactionID = transaction;
497 money.MoneyData.TransactionSuccess = success; 485 money.MoneyData.TransactionSuccess = success;
498 money.MoneyData.Description = description; 486 money.MoneyData.Description = description;
@@ -506,7 +494,6 @@ namespace OpenSim.Region.ClientStack
506 pc.PingID.PingID = seq; 494 pc.PingID.PingID = seq;
507 pc.Header.Reliable = false; 495 pc.Header.Reliable = false;
508 OutPacket(pc); 496 OutPacket(pc);
509
510 } 497 }
511 498
512 public void SendKillObject(ulong regionHandle, uint localID) 499 public void SendKillObject(ulong regionHandle, uint localID)
@@ -522,8 +509,8 @@ namespace OpenSim.Region.ClientStack
522 { 509 {
523 Encoding enc = Encoding.ASCII; 510 Encoding enc = Encoding.ASCII;
524 uint FULL_MASK_PERMISSIONS = 2147483647; 511 uint FULL_MASK_PERMISSIONS = 2147483647;
525 InventoryDescendentsPacket descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); 512 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
526 513
527 int count = 0; 514 int count = 0;
528 if (items.Count < 40) 515 if (items.Count < 40)
529 { 516 {
@@ -550,25 +537,30 @@ namespace OpenSim.Region.ClientStack
550 descend.ItemData[i].FolderID = item.parentFolderID; 537 descend.ItemData[i].FolderID = item.parentFolderID;
551 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 538 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
552 descend.ItemData[i].GroupMask = 0; 539 descend.ItemData[i].GroupMask = 0;
553 descend.ItemData[i].InvType = (sbyte)item.invType; 540 descend.ItemData[i].InvType = (sbyte) item.invType;
554 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); 541 descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0");
555 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; 542 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
556 descend.ItemData[i].OwnerID = item.avatarID; 543 descend.ItemData[i].OwnerID = item.avatarID;
557 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; 544 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
558 descend.ItemData[i].SalePrice = 0; 545 descend.ItemData[i].SalePrice = 0;
559 descend.ItemData[i].SaleType = 0; 546 descend.ItemData[i].SaleType = 0;
560 descend.ItemData[i].Type = (sbyte)item.assetType; 547 descend.ItemData[i].Type = (sbyte) item.assetType;
561 descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 548 descend.ItemData[i].CRC =
549 Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type,
550 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100,
551 descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID,
552 descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS,
553 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
562 554
563 i++; 555 i++;
564 count++; 556 count++;
565 if (i == 40) 557 if (i == 40)
566 { 558 {
567 this.OutPacket(descend); 559 OutPacket(descend);
568 560
569 if ((items.Count - count) > 0) 561 if ((items.Count - count) > 0)
570 { 562 {
571 descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); 563 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
572 if ((items.Count - count) < 40) 564 if ((items.Count - count) < 40)
573 { 565 {
574 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; 566 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
@@ -586,15 +578,14 @@ namespace OpenSim.Region.ClientStack
586 578
587 if (i < 40) 579 if (i < 40)
588 { 580 {
589 this.OutPacket(descend); 581 OutPacket(descend);
590 } 582 }
591
592 } 583 }
593 584
594 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) 585 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
595 { 586 {
596 InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); 587 InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
597 descend.AgentData.AgentID = this.AgentId; 588 descend.AgentData.AgentID = AgentId;
598 descend.AgentData.OwnerID = ownerID; 589 descend.AgentData.OwnerID = ownerID;
599 descend.AgentData.FolderID = folderID; 590 descend.AgentData.FolderID = folderID;
600 descend.AgentData.Version = 0; 591 descend.AgentData.Version = 0;
@@ -607,31 +598,39 @@ namespace OpenSim.Region.ClientStack
607 Encoding enc = Encoding.ASCII; 598 Encoding enc = Encoding.ASCII;
608 uint FULL_MASK_PERMISSIONS = 2147483647; 599 uint FULL_MASK_PERMISSIONS = 2147483647;
609 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); 600 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
610 inventoryReply.AgentData.AgentID = this.AgentId; 601 inventoryReply.AgentData.AgentID = AgentId;
611 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 602 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
612 inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); 603 inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
613 inventoryReply.InventoryData[0].ItemID = item.inventoryID; 604 inventoryReply.InventoryData[0].ItemID = item.inventoryID;
614 inventoryReply.InventoryData[0].AssetID = item.assetID; 605 inventoryReply.InventoryData[0].AssetID = item.assetID;
615 inventoryReply.InventoryData[0].CreatorID = item.creatorsID; 606 inventoryReply.InventoryData[0].CreatorID = item.creatorsID;
616 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; 607 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions;
617 inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 608 inventoryReply.InventoryData[0].CreationDate =
609 (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
618 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); 610 inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0");
619 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; 611 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions;
620 inventoryReply.InventoryData[0].Flags = 0; 612 inventoryReply.InventoryData[0].Flags = 0;
621 inventoryReply.InventoryData[0].FolderID = item.parentFolderID; 613 inventoryReply.InventoryData[0].FolderID = item.parentFolderID;
622 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 614 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
623 inventoryReply.InventoryData[0].GroupMask = 0; 615 inventoryReply.InventoryData[0].GroupMask = 0;
624 inventoryReply.InventoryData[0].InvType = (sbyte)item.invType; 616 inventoryReply.InventoryData[0].InvType = (sbyte) item.invType;
625 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); 617 inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0");
626 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; 618 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions;
627 inventoryReply.InventoryData[0].OwnerID = item.avatarID; 619 inventoryReply.InventoryData[0].OwnerID = item.avatarID;
628 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; 620 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions;
629 inventoryReply.InventoryData[0].SalePrice = 0; 621 inventoryReply.InventoryData[0].SalePrice = 0;
630 inventoryReply.InventoryData[0].SaleType = 0; 622 inventoryReply.InventoryData[0].SaleType = 0;
631 inventoryReply.InventoryData[0].Type = (sbyte)item.assetType; 623 inventoryReply.InventoryData[0].Type = (sbyte) item.assetType;
632 inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 624 inventoryReply.InventoryData[0].CRC =
633 625 Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
634 this.OutPacket(inventoryReply); 626 inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
627 inventoryReply.InventoryData[0].GroupID, 100,
628 inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID,
629 inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID,
630 FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
631 FULL_MASK_PERMISSIONS);
632
633 OutPacket(inventoryReply);
635 } 634 }
636 635
637 public void SendInventoryItemUpdate(InventoryItemBase Item) 636 public void SendInventoryItemUpdate(InventoryItemBase Item)
@@ -639,7 +638,7 @@ namespace OpenSim.Region.ClientStack
639 Encoding enc = Encoding.ASCII; 638 Encoding enc = Encoding.ASCII;
640 uint FULL_MASK_PERMISSIONS = 2147483647; 639 uint FULL_MASK_PERMISSIONS = 2147483647;
641 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); 640 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
642 InventoryReply.AgentData.AgentID = this.AgentId; 641 InventoryReply.AgentData.AgentID = AgentId;
643 InventoryReply.AgentData.SimApproved = true; 642 InventoryReply.AgentData.SimApproved = true;
644 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 643 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
645 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 644 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
@@ -654,15 +653,22 @@ namespace OpenSim.Region.ClientStack
654 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; 653 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID;
655 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 654 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
656 InventoryReply.InventoryData[0].GroupMask = 0; 655 InventoryReply.InventoryData[0].GroupMask = 0;
657 InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType; 656 InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType;
658 InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); 657 InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0");
659 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; 658 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions;
660 InventoryReply.InventoryData[0].OwnerID = Item.avatarID; 659 InventoryReply.InventoryData[0].OwnerID = Item.avatarID;
661 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; 660 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions;
662 InventoryReply.InventoryData[0].SalePrice = 100; 661 InventoryReply.InventoryData[0].SalePrice = 100;
663 InventoryReply.InventoryData[0].SaleType = 0; 662 InventoryReply.InventoryData[0].SaleType = 0;
664 InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType; 663 InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType;
665 InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); 664 InventoryReply.InventoryData[0].CRC =
665 Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
666 InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
667 InventoryReply.InventoryData[0].GroupID, 100,
668 InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID,
669 InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID,
670 FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
671 FULL_MASK_PERMISSIONS);
666 672
667 OutPacket(InventoryReply); 673 OutPacket(InventoryReply);
668 } 674 }
@@ -670,8 +676,8 @@ namespace OpenSim.Region.ClientStack
670 public void SendRemoveInventoryItem(LLUUID itemID) 676 public void SendRemoveInventoryItem(LLUUID itemID)
671 { 677 {
672 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); 678 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
673 remove.AgentData.AgentID = this.AgentId; 679 remove.AgentData.AgentID = AgentId;
674 remove.AgentData.SessionID = this.m_sessionId; 680 remove.AgentData.SessionID = m_sessionId;
675 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; 681 remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
676 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); 682 remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
677 remove.InventoryData[0].ItemID = itemID; 683 remove.InventoryData[0].ItemID = itemID;
@@ -716,13 +722,14 @@ namespace OpenSim.Region.ClientStack
716 public void SendAgentAlertMessage(string message, bool modal) 722 public void SendAgentAlertMessage(string message, bool modal)
717 { 723 {
718 AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); 724 AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket();
719 alertPack.AgentData.AgentID = this.AgentId; 725 alertPack.AgentData.AgentID = AgentId;
720 alertPack.AlertData.Message = Helpers.StringToField(message); 726 alertPack.AlertData.Message = Helpers.StringToField(message);
721 alertPack.AlertData.Modal = modal; 727 alertPack.AlertData.Modal = modal;
722 OutPacket(alertPack); 728 OutPacket(alertPack);
723 } 729 }
724 730
725 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) 731 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
732 string url)
726 { 733 {
727 LoadURLPacket loadURL = new LoadURLPacket(); 734 LoadURLPacket loadURL = new LoadURLPacket();
728 loadURL.Data.ObjectName = Helpers.StringToField(objectname); 735 loadURL.Data.ObjectName = Helpers.StringToField(objectname);
@@ -761,14 +768,13 @@ namespace OpenSim.Region.ClientStack
761 768
762 public void SendViewerTime(int phase) 769 public void SendViewerTime(int phase)
763 { 770 {
764
765 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); 771 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
766 //viewertime.TimeInfo.SecPerDay = 86400; 772 //viewertime.TimeInfo.SecPerDay = 86400;
767 // viewertime.TimeInfo.SecPerYear = 31536000; 773 // viewertime.TimeInfo.SecPerYear = 31536000;
768 viewertime.TimeInfo.SecPerDay = 1000; 774 viewertime.TimeInfo.SecPerDay = 1000;
769 viewertime.TimeInfo.SecPerYear = 365000; 775 viewertime.TimeInfo.SecPerYear = 365000;
770 viewertime.TimeInfo.SunPhase = 1; 776 viewertime.TimeInfo.SunPhase = 1;
771 int sunPhase = (phase + 2) / 2; 777 int sunPhase = (phase + 2)/2;
772 if ((sunPhase < 6) || (sunPhase > 36)) 778 if ((sunPhase < 6) || (sunPhase > 36))
773 { 779 {
774 viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); 780 viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f);
@@ -781,27 +787,41 @@ namespace OpenSim.Region.ClientStack
781 sunPhase = 12; 787 sunPhase = 12;
782 } 788 }
783 sunPhase = sunPhase - 12; 789 sunPhase = sunPhase - 12;
784 float yValue = 0.1f * (sunPhase); 790 float yValue = 0.1f*(sunPhase);
785 if (yValue > 1.2f) { yValue = yValue - 1.2f; } 791 if (yValue > 1.2f)
786 if (yValue > 1 ) { yValue = 1; } 792 {
787 if (yValue < 0) { yValue = 0; } 793 yValue = yValue - 1.2f;
794 }
795 if (yValue > 1)
796 {
797 yValue = 1;
798 }
799 if (yValue < 0)
800 {
801 yValue = 0;
802 }
788 if (sunPhase < 14) 803 if (sunPhase < 14)
789 { 804 {
790 yValue = 1 - yValue; 805 yValue = 1 - yValue;
791 } 806 }
792 if (sunPhase < 12) { yValue *= -1; } 807 if (sunPhase < 12)
808 {
809 yValue *= -1;
810 }
793 viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); 811 viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f);
794 //Console.WriteLine("sending sun update " + yValue); 812 //Console.WriteLine("sending sun update " + yValue);
795 } 813 }
796 viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); 814 viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f);
797 viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); 815 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch();
798 OutPacket(viewertime); 816 OutPacket(viewertime);
799 } 817 }
800 818
801 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) 819 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember,
820 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
821 LLUUID partnerID)
802 { 822 {
803 AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); 823 AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
804 avatarReply.AgentData.AgentID = this.AgentId; 824 avatarReply.AgentData.AgentID = AgentId;
805 avatarReply.AgentData.AvatarID = avatarID; 825 avatarReply.AgentData.AvatarID = avatarID;
806 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); 826 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
807 avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); 827 avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn);
@@ -827,6 +847,7 @@ namespace OpenSim.Region.ClientStack
827 847
828 OutPacket(avatarSitResponse); 848 OutPacket(avatarSitResponse);
829 } 849 }
850
830 #endregion 851 #endregion
831 852
832 #region Appearance/ Wearables Methods 853 #region Appearance/ Wearables Methods
@@ -838,22 +859,22 @@ namespace OpenSim.Region.ClientStack
838 public void SendWearables(AvatarWearable[] wearables) 859 public void SendWearables(AvatarWearable[] wearables)
839 { 860 {
840 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); 861 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
841 aw.AgentData.AgentID = this.AgentId; 862 aw.AgentData.AgentID = AgentId;
842 aw.AgentData.SerialNum = 0; 863 aw.AgentData.SerialNum = 0;
843 aw.AgentData.SessionID = this.m_sessionId; 864 aw.AgentData.SessionID = m_sessionId;
844 865
845 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; 866 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
846 AgentWearablesUpdatePacket.WearableDataBlock awb; 867 AgentWearablesUpdatePacket.WearableDataBlock awb;
847 for (int i = 0; i < wearables.Length; i++) 868 for (int i = 0; i < wearables.Length; i++)
848 { 869 {
849 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 870 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
850 awb.WearableType = (byte)i; 871 awb.WearableType = (byte) i;
851 awb.AssetID = wearables[i].AssetID; 872 awb.AssetID = wearables[i].AssetID;
852 awb.ItemID = wearables[i].ItemID; 873 awb.ItemID = wearables[i].ItemID;
853 aw.WearableData[i] = awb; 874 aw.WearableData[i] = awb;
854 } 875 }
855 876
856 this.OutPacket(aw); 877 OutPacket(aw);
857 } 878 }
858 879
859 /// <summary> 880 /// <summary>
@@ -893,7 +914,7 @@ namespace OpenSim.Region.ClientStack
893 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); 914 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
894 ani.AnimationList[0].AnimID = animID; 915 ani.AnimationList[0].AnimID = animID;
895 ani.AnimationList[0].AnimSequenceID = seq; 916 ani.AnimationList[0].AnimSequenceID = seq;
896 this.OutPacket(ani); 917 OutPacket(ani);
897 } 918 }
898 919
899 #endregion 920 #endregion
@@ -909,25 +930,26 @@ namespace OpenSim.Region.ClientStack
909 /// <param name="avatarID"></param> 930 /// <param name="avatarID"></param>
910 /// <param name="avatarLocalID"></param> 931 /// <param name="avatarLocalID"></param>
911 /// <param name="Pos"></param> 932 /// <param name="Pos"></param>
912 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) 933 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
934 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
913 { 935 {
914 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 936 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
915 objupdate.RegionData.RegionHandle = regionHandle; 937 objupdate.RegionData.RegionHandle = regionHandle;
916 objupdate.RegionData.TimeDilation = 64096; 938 objupdate.RegionData.TimeDilation = 64096;
917 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 939 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
918 objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); 940 objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry);
919 941
920 //give this avatar object a local id and assign the user a name 942 //give this avatar object a local id and assign the user a name
921 objupdate.ObjectData[0].ID = avatarLocalID; 943 objupdate.ObjectData[0].ID = avatarLocalID;
922 objupdate.ObjectData[0].FullID = avatarID; 944 objupdate.ObjectData[0].FullID = avatarID;
923 objupdate.ObjectData[0].ParentID = parentID; 945 objupdate.ObjectData[0].ParentID = parentID;
924 objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); 946 objupdate.ObjectData[0].NameValue =
925 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); 947 Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
948 LLVector3 pos2 = new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
926 byte[] pb = pos2.GetBytes(); 949 byte[] pb = pos2.GetBytes();
927 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 950 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
928 951
929 OutPacket(objupdate); 952 OutPacket(objupdate);
930
931 } 953 }
932 954
933 /// <summary> 955 /// <summary>
@@ -938,38 +960,41 @@ namespace OpenSim.Region.ClientStack
938 /// <param name="localID"></param> 960 /// <param name="localID"></param>
939 /// <param name="position"></param> 961 /// <param name="position"></param>
940 /// <param name="velocity"></param> 962 /// <param name="velocity"></param>
941 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) 963 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
964 LLVector3 velocity, LLQuaternion rotation)
942 { 965 {
943 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity, rotation); 966 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
967 CreateAvatarImprovedBlock(localID, position, velocity, rotation);
944 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 968 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
945 terse.RegionData.RegionHandle = regionHandle; 969 terse.RegionData.RegionHandle = regionHandle;
946 terse.RegionData.TimeDilation = timeDilation; 970 terse.RegionData.TimeDilation = timeDilation;
947 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 971 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
948 terse.ObjectData[0] = terseBlock; 972 terse.ObjectData[0] = terseBlock;
949 973
950 this.OutPacket(terse); 974 OutPacket(terse);
951 } 975 }
952 976
953 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) 977 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
954 { 978 {
955 CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); 979 CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket();
956 int total = CoarseLocations.Count; 980 int total = CoarseLocations.Count;
957 CoarseLocationUpdatePacket.IndexBlock ib = 981 CoarseLocationUpdatePacket.IndexBlock ib =
958 new CoarseLocationUpdatePacket.IndexBlock(); 982 new CoarseLocationUpdatePacket.IndexBlock();
959 loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; 983 loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total];
960 for(int i=0; i<total; i++) { 984 for (int i = 0; i < total; i++)
961 CoarseLocationUpdatePacket.LocationBlock lb = 985 {
962 new CoarseLocationUpdatePacket.LocationBlock(); 986 CoarseLocationUpdatePacket.LocationBlock lb =
963 lb.X = (byte)CoarseLocations[i].X; 987 new CoarseLocationUpdatePacket.LocationBlock();
964 lb.Y = (byte)CoarseLocations[i].Y; 988 lb.X = (byte) CoarseLocations[i].X;
965 lb.Z = (byte)(CoarseLocations[i].Z/4); 989 lb.Y = (byte) CoarseLocations[i].Y;
966 loc.Location[i] = lb; 990 lb.Z = (byte) (CoarseLocations[i].Z/4);
967 } 991 loc.Location[i] = lb;
968 ib.You = -1; 992 }
969 ib.Prey = -1; 993 ib.You = -1;
970 loc.Index = ib; 994 ib.Prey = -1;
971 this.OutPacket(loc); 995 loc.Index = ib;
972 } 996 OutPacket(loc);
997 }
973 998
974 #endregion 999 #endregion
975 1000
@@ -984,27 +1009,28 @@ namespace OpenSim.Region.ClientStack
984 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) 1009 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
985 { 1010 {
986 ObjectAttachPacket attach = new ObjectAttachPacket(); 1011 ObjectAttachPacket attach = new ObjectAttachPacket();
987 attach.AgentData.AgentID = this.AgentId; 1012 attach.AgentData.AgentID = AgentId;
988 attach.AgentData.SessionID = this.m_sessionId; 1013 attach.AgentData.SessionID = m_sessionId;
989 attach.AgentData.AttachmentPoint = attachPoint; 1014 attach.AgentData.AttachmentPoint = attachPoint;
990 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; 1015 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
991 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); 1016 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
992 attach.ObjectData[0].ObjectLocalID = localID; 1017 attach.ObjectData[0].ObjectLocalID = localID;
993 attach.ObjectData[0].Rotation = rotation; 1018 attach.ObjectData[0].Rotation = rotation;
994 1019
995 this.OutPacket(attach); 1020 OutPacket(attach);
996 } 1021 }
997 1022
998 public void SendPrimitiveToClient( 1023 public void SendPrimitiveToClient(
999 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, 1024 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos,
1025 uint flags,
1000 LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) 1026 LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation)
1001 { 1027 {
1002 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 1028 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
1003 outPacket.RegionData.RegionHandle = regionHandle; 1029 outPacket.RegionData.RegionHandle = regionHandle;
1004 outPacket.RegionData.TimeDilation = timeDilation; 1030 outPacket.RegionData.TimeDilation = timeDilation;
1005 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 1031 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
1006 1032
1007 outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); 1033 outPacket.ObjectData[0] = CreatePrimUpdateBlock(primShape, flags);
1008 1034
1009 outPacket.ObjectData[0].ID = localID; 1035 outPacket.ObjectData[0].ID = localID;
1010 outPacket.ObjectData[0].FullID = objectID; 1036 outPacket.ObjectData[0].FullID = objectID;
@@ -1033,35 +1059,38 @@ namespace OpenSim.Region.ClientStack
1033 /// <param name="localID"></param> 1059 /// <param name="localID"></param>
1034 /// <param name="position"></param> 1060 /// <param name="position"></param>
1035 /// <param name="rotation"></param> 1061 /// <param name="rotation"></param>
1036 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) 1062 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1063 LLQuaternion rotation)
1037 { 1064 {
1038 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1065 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1039 terse.RegionData.RegionHandle = regionHandle; 1066 terse.RegionData.RegionHandle = regionHandle;
1040 terse.RegionData.TimeDilation = timeDilation; 1067 terse.RegionData.TimeDilation = timeDilation;
1041 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 1068 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
1042 terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); 1069 terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation);
1043 1070
1044 this.OutPacket(terse); 1071 OutPacket(terse);
1045 } 1072 }
1046 1073
1047 #endregion 1074 #endregion
1048 1075
1049 #region Helper Methods 1076 #region Helper Methods
1050 1077
1051 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity, LLQuaternion rotation) 1078 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos,
1079 LLVector3 velocity,
1080 LLQuaternion rotation)
1052 { 1081 {
1053 byte[] bytes = new byte[60]; 1082 byte[] bytes = new byte[60];
1054 int i = 0; 1083 int i = 0;
1055 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 1084 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
1056 1085
1057 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; 1086 dat.TextureEntry = new byte[0]; // AvatarTemplate.TextureEntry;
1058 1087
1059 uint ID = localID; 1088 uint ID = localID;
1060 1089
1061 bytes[i++] = (byte)(ID % 256); 1090 bytes[i++] = (byte) (ID%256);
1062 bytes[i++] = (byte)((ID >> 8) % 256); 1091 bytes[i++] = (byte) ((ID >> 8)%256);
1063 bytes[i++] = (byte)((ID >> 16) % 256); 1092 bytes[i++] = (byte) ((ID >> 16)%256);
1064 bytes[i++] = (byte)((ID >> 24) % 256); 1093 bytes[i++] = (byte) ((ID >> 24)%256);
1065 bytes[i++] = 0; 1094 bytes[i++] = 0;
1066 bytes[i++] = 1; 1095 bytes[i++] = 1;
1067 i += 14; 1096 i += 14;
@@ -1078,55 +1107,55 @@ namespace OpenSim.Region.ClientStack
1078 1107
1079 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); 1108 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z);
1080 1109
1081 internDirec = internDirec / 128.0f; 1110 internDirec = internDirec/128.0f;
1082 internDirec.x += 1; 1111 internDirec.x += 1;
1083 internDirec.y += 1; 1112 internDirec.y += 1;
1084 internDirec.z += 1; 1113 internDirec.z += 1;
1085 1114
1086 InternVelocityX = (ushort)(32768 * internDirec.x); 1115 InternVelocityX = (ushort) (32768*internDirec.x);
1087 InternVelocityY = (ushort)(32768 * internDirec.y); 1116 InternVelocityY = (ushort) (32768*internDirec.y);
1088 InternVelocityZ = (ushort)(32768 * internDirec.z); 1117 InternVelocityZ = (ushort) (32768*internDirec.z);
1089 1118
1090 ushort ac = 32767; 1119 ushort ac = 32767;
1091 bytes[i++] = (byte)(InternVelocityX % 256); 1120 bytes[i++] = (byte) (InternVelocityX%256);
1092 bytes[i++] = (byte)((InternVelocityX >> 8) % 256); 1121 bytes[i++] = (byte) ((InternVelocityX >> 8)%256);
1093 bytes[i++] = (byte)(InternVelocityY % 256); 1122 bytes[i++] = (byte) (InternVelocityY%256);
1094 bytes[i++] = (byte)((InternVelocityY >> 8) % 256); 1123 bytes[i++] = (byte) ((InternVelocityY >> 8)%256);
1095 bytes[i++] = (byte)(InternVelocityZ % 256); 1124 bytes[i++] = (byte) (InternVelocityZ%256);
1096 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); 1125 bytes[i++] = (byte) ((InternVelocityZ >> 8)%256);
1097 1126
1098 //accel 1127 //accel
1099 bytes[i++] = (byte)(ac % 256); 1128 bytes[i++] = (byte) (ac%256);
1100 bytes[i++] = (byte)((ac >> 8) % 256); 1129 bytes[i++] = (byte) ((ac >> 8)%256);
1101 bytes[i++] = (byte)(ac % 256); 1130 bytes[i++] = (byte) (ac%256);
1102 bytes[i++] = (byte)((ac >> 8) % 256); 1131 bytes[i++] = (byte) ((ac >> 8)%256);
1103 bytes[i++] = (byte)(ac % 256); 1132 bytes[i++] = (byte) (ac%256);
1104 bytes[i++] = (byte)((ac >> 8) % 256); 1133 bytes[i++] = (byte) ((ac >> 8)%256);
1105 1134
1106 //rotation 1135 //rotation
1107 ushort rw, rx, ry, rz; 1136 ushort rw, rx, ry, rz;
1108 rw = (ushort)(32768 * (rotation.W + 1)); 1137 rw = (ushort) (32768*(rotation.W + 1));
1109 rx = (ushort)(32768 * (rotation.X + 1)); 1138 rx = (ushort) (32768*(rotation.X + 1));
1110 ry = (ushort)(32768 * (rotation.Y + 1)); 1139 ry = (ushort) (32768*(rotation.Y + 1));
1111 rz = (ushort)(32768 * (rotation.Z + 1)); 1140 rz = (ushort) (32768*(rotation.Z + 1));
1112 1141
1113 //rot 1142 //rot
1114 bytes[i++] = (byte)(rx % 256); 1143 bytes[i++] = (byte) (rx%256);
1115 bytes[i++] = (byte)((rx >> 8) % 256); 1144 bytes[i++] = (byte) ((rx >> 8)%256);
1116 bytes[i++] = (byte)(ry % 256); 1145 bytes[i++] = (byte) (ry%256);
1117 bytes[i++] = (byte)((ry >> 8) % 256); 1146 bytes[i++] = (byte) ((ry >> 8)%256);
1118 bytes[i++] = (byte)(rz % 256); 1147 bytes[i++] = (byte) (rz%256);
1119 bytes[i++] = (byte)((rz >> 8) % 256); 1148 bytes[i++] = (byte) ((rz >> 8)%256);
1120 bytes[i++] = (byte)(rw % 256); 1149 bytes[i++] = (byte) (rw%256);
1121 bytes[i++] = (byte)((rw >> 8) % 256); 1150 bytes[i++] = (byte) ((rw >> 8)%256);
1122 1151
1123 //rotation vel 1152 //rotation vel
1124 bytes[i++] = (byte)(ac % 256); 1153 bytes[i++] = (byte) (ac%256);
1125 bytes[i++] = (byte)((ac >> 8) % 256); 1154 bytes[i++] = (byte) ((ac >> 8)%256);
1126 bytes[i++] = (byte)(ac % 256); 1155 bytes[i++] = (byte) (ac%256);
1127 bytes[i++] = (byte)((ac >> 8) % 256); 1156 bytes[i++] = (byte) ((ac >> 8)%256);
1128 bytes[i++] = (byte)(ac % 256); 1157 bytes[i++] = (byte) (ac%256);
1129 bytes[i++] = (byte)((ac >> 8) % 256); 1158 bytes[i++] = (byte) ((ac >> 8)%256);
1130 1159
1131 dat.Data = bytes; 1160 dat.Data = bytes;
1132 1161
@@ -1140,7 +1169,9 @@ namespace OpenSim.Region.ClientStack
1140 /// <param name="position"></param> 1169 /// <param name="position"></param>
1141 /// <param name="rotation"></param> 1170 /// <param name="rotation"></param>
1142 /// <returns></returns> 1171 /// <returns></returns>
1143 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) 1172 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
1173 LLVector3 position,
1174 LLQuaternion rotation)
1144 { 1175 {
1145 uint ID = localID; 1176 uint ID = localID;
1146 byte[] bytes = new byte[60]; 1177 byte[] bytes = new byte[60];
@@ -1148,10 +1179,10 @@ namespace OpenSim.Region.ClientStack
1148 int i = 0; 1179 int i = 0;
1149 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 1180 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
1150 dat.TextureEntry = new byte[0]; 1181 dat.TextureEntry = new byte[0];
1151 bytes[i++] = (byte)(ID % 256); 1182 bytes[i++] = (byte) (ID%256);
1152 bytes[i++] = (byte)((ID >> 8) % 256); 1183 bytes[i++] = (byte) ((ID >> 8)%256);
1153 bytes[i++] = (byte)((ID >> 16) % 256); 1184 bytes[i++] = (byte) ((ID >> 16)%256);
1154 bytes[i++] = (byte)((ID >> 24) % 256); 1185 bytes[i++] = (byte) ((ID >> 24)%256);
1155 bytes[i++] = 0; 1186 bytes[i++] = 0;
1156 bytes[i++] = 0; 1187 bytes[i++] = 0;
1157 1188
@@ -1161,44 +1192,44 @@ namespace OpenSim.Region.ClientStack
1161 ushort ac = 32767; 1192 ushort ac = 32767;
1162 1193
1163 //vel 1194 //vel
1164 bytes[i++] = (byte)(ac % 256); 1195 bytes[i++] = (byte) (ac%256);
1165 bytes[i++] = (byte)((ac >> 8) % 256); 1196 bytes[i++] = (byte) ((ac >> 8)%256);
1166 bytes[i++] = (byte)(ac % 256); 1197 bytes[i++] = (byte) (ac%256);
1167 bytes[i++] = (byte)((ac >> 8) % 256); 1198 bytes[i++] = (byte) ((ac >> 8)%256);
1168 bytes[i++] = (byte)(ac % 256); 1199 bytes[i++] = (byte) (ac%256);
1169 bytes[i++] = (byte)((ac >> 8) % 256); 1200 bytes[i++] = (byte) ((ac >> 8)%256);
1170 1201
1171 //accel 1202 //accel
1172 bytes[i++] = (byte)(ac % 256); 1203 bytes[i++] = (byte) (ac%256);
1173 bytes[i++] = (byte)((ac >> 8) % 256); 1204 bytes[i++] = (byte) ((ac >> 8)%256);
1174 bytes[i++] = (byte)(ac % 256); 1205 bytes[i++] = (byte) (ac%256);
1175 bytes[i++] = (byte)((ac >> 8) % 256); 1206 bytes[i++] = (byte) ((ac >> 8)%256);
1176 bytes[i++] = (byte)(ac % 256); 1207 bytes[i++] = (byte) (ac%256);
1177 bytes[i++] = (byte)((ac >> 8) % 256); 1208 bytes[i++] = (byte) ((ac >> 8)%256);
1178 1209
1179 ushort rw, rx, ry, rz; 1210 ushort rw, rx, ry, rz;
1180 rw = (ushort)(32768 * (rotation.W + 1)); 1211 rw = (ushort) (32768*(rotation.W + 1));
1181 rx = (ushort)(32768 * (rotation.X + 1)); 1212 rx = (ushort) (32768*(rotation.X + 1));
1182 ry = (ushort)(32768 * (rotation.Y + 1)); 1213 ry = (ushort) (32768*(rotation.Y + 1));
1183 rz = (ushort)(32768 * (rotation.Z + 1)); 1214 rz = (ushort) (32768*(rotation.Z + 1));
1184 1215
1185 //rot 1216 //rot
1186 bytes[i++] = (byte)(rx % 256); 1217 bytes[i++] = (byte) (rx%256);
1187 bytes[i++] = (byte)((rx >> 8) % 256); 1218 bytes[i++] = (byte) ((rx >> 8)%256);
1188 bytes[i++] = (byte)(ry % 256); 1219 bytes[i++] = (byte) (ry%256);
1189 bytes[i++] = (byte)((ry >> 8) % 256); 1220 bytes[i++] = (byte) ((ry >> 8)%256);
1190 bytes[i++] = (byte)(rz % 256); 1221 bytes[i++] = (byte) (rz%256);
1191 bytes[i++] = (byte)((rz >> 8) % 256); 1222 bytes[i++] = (byte) ((rz >> 8)%256);
1192 bytes[i++] = (byte)(rw % 256); 1223 bytes[i++] = (byte) (rw%256);
1193 bytes[i++] = (byte)((rw >> 8) % 256); 1224 bytes[i++] = (byte) ((rw >> 8)%256);
1194 1225
1195 //rotation vel 1226 //rotation vel
1196 bytes[i++] = (byte)(ac % 256); 1227 bytes[i++] = (byte) (ac%256);
1197 bytes[i++] = (byte)((ac >> 8) % 256); 1228 bytes[i++] = (byte) ((ac >> 8)%256);
1198 bytes[i++] = (byte)(ac % 256); 1229 bytes[i++] = (byte) (ac%256);
1199 bytes[i++] = (byte)((ac >> 8) % 256); 1230 bytes[i++] = (byte) ((ac >> 8)%256);
1200 bytes[i++] = (byte)(ac % 256); 1231 bytes[i++] = (byte) (ac%256);
1201 bytes[i++] = (byte)((ac >> 8) % 256); 1232 bytes[i++] = (byte) ((ac >> 8)%256);
1202 1233
1203 dat.Data = bytes; 1234 dat.Data = bytes;
1204 return dat; 1235 return dat;
@@ -1212,16 +1243,15 @@ namespace OpenSim.Region.ClientStack
1212 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) 1243 protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags)
1213 { 1244 {
1214 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); 1245 ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
1215 this.SetDefaultPrimPacketValues(objupdate); 1246 SetDefaultPrimPacketValues(objupdate);
1216 objupdate.UpdateFlags = flags; 1247 objupdate.UpdateFlags = flags;
1217 this.SetPrimPacketShapeData(objupdate, primShape); 1248 SetPrimPacketShapeData(objupdate, primShape);
1218 1249
1219 return objupdate; 1250 return objupdate;
1220 } 1251 }
1221 1252
1222 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) 1253 protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData)
1223 { 1254 {
1224
1225 objectData.TextureEntry = primData.TextureEntry; 1255 objectData.TextureEntry = primData.TextureEntry;
1226 objectData.PCode = primData.PCode; 1256 objectData.PCode = primData.PCode;
1227 objectData.PathBegin = primData.PathBegin; 1257 objectData.PathBegin = primData.PathBegin;
@@ -1278,10 +1308,11 @@ namespace OpenSim.Region.ClientStack
1278 /// <returns></returns> 1308 /// <returns></returns>
1279 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) 1309 protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry)
1280 { 1310 {
1281 ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); 1311 ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock();
1312 // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
1282 1313
1283 SetDefaultAvatarPacketValues(ref objdata); 1314 SetDefaultAvatarPacketValues(ref objdata);
1284 objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); 1315 objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
1285 objdata.PathCurve = 16; 1316 objdata.PathCurve = 16;
1286 objdata.ProfileCurve = 1; 1317 objdata.ProfileCurve = 1;
1287 objdata.PathScaleX = 100; 1318 objdata.PathScaleX = 100;
@@ -1353,6 +1384,5 @@ namespace OpenSim.Region.ClientStack
1353 } 1384 }
1354 1385
1355 #endregion 1386 #endregion
1356
1357 } 1387 }
1358} 1388} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index 0771a4a..d589a7b 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -27,9 +27,8 @@
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using libsecondlife.Packets; 29using libsecondlife.Packets;
30using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console;
33 32
34namespace OpenSim.Region.ClientStack 33namespace OpenSim.Region.ClientStack
35{ 34{
@@ -37,17 +36,17 @@ namespace OpenSim.Region.ClientStack
37 { 36 {
38 protected virtual void RegisterLocalPacketHandlers() 37 protected virtual void RegisterLocalPacketHandlers()
39 { 38 {
40 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); 39 AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
41 this.AddLocalPacketHandler(PacketType.ViewerEffect, this.HandleViewerEffect); 40 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
42 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); 41 AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
43 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); 42 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
44 } 43 }
45 44
46 private bool HandleViewerEffect(IClientAPI sender, Packet Pack) 45 private bool HandleViewerEffect(IClientAPI sender, Packet Pack)
47 { 46 {
48 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 47 ViewerEffectPacket viewer = (ViewerEffectPacket) Pack;
49 48
50 if( OnViewerEffect != null ) 49 if (OnViewerEffect != null)
51 { 50 {
52 OnViewerEffect(sender, viewer.Effect); 51 OnViewerEffect(sender, viewer.Effect);
53 } 52 }
@@ -59,7 +58,7 @@ namespace OpenSim.Region.ClientStack
59 { 58 {
60 MainLog.Instance.Verbose("CLIENT", "Got a logout request"); 59 MainLog.Instance.Verbose("CLIENT", "Got a logout request");
61 60
62 if( OnLogout != null ) 61 if (OnLogout != null)
63 { 62 {
64 OnLogout(client); 63 OnLogout(client);
65 } 64 }
@@ -70,13 +69,14 @@ namespace OpenSim.Region.ClientStack
70 protected bool AgentTextureCached(IClientAPI simclient, Packet packet) 69 protected bool AgentTextureCached(IClientAPI simclient, Packet packet)
71 { 70 {
72 //System.Console.WriteLine("texture cached: " + packet.ToString()); 71 //System.Console.WriteLine("texture cached: " + packet.ToString());
73 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; 72 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
74 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); 73 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
75 cachedresp.AgentData.AgentID = this.AgentId; 74 cachedresp.AgentData.AgentID = AgentId;
76 cachedresp.AgentData.SessionID = this.m_sessionId; 75 cachedresp.AgentData.SessionID = m_sessionId;
77 cachedresp.AgentData.SerialNum = this.cachedtextureserial; 76 cachedresp.AgentData.SerialNum = cachedtextureserial;
78 this.cachedtextureserial++; 77 cachedtextureserial++;
79 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; 78 cachedresp.WearableData =
79 new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
80 for (int i = 0; i < chechedtex.WearableData.Length; i++) 80 for (int i = 0; i < chechedtex.WearableData.Length; i++)
81 { 81 {
82 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 82 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
@@ -84,17 +84,18 @@ namespace OpenSim.Region.ClientStack
84 cachedresp.WearableData[i].TextureID = LLUUID.Zero; 84 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
85 cachedresp.WearableData[i].HostName = new byte[0]; 85 cachedresp.WearableData[i].HostName = new byte[0];
86 } 86 }
87 this.OutPacket(cachedresp); 87 OutPacket(cachedresp);
88 return true; 88 return true;
89 } 89 }
90 90
91 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) 91 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet)
92 { 92 {
93 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 93 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet;
94 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); 94 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
95 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 95 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
96 { 96 {
97 #region position 97 #region position
98
98 if (multipleupdate.ObjectData[i].Type == 9) //change position 99 if (multipleupdate.ObjectData[i].Type == 9) //change position
99 { 100 {
100 if (OnUpdatePrimGroupPosition != null) 101 if (OnUpdatePrimGroupPosition != null)
@@ -102,20 +103,20 @@ namespace OpenSim.Region.ClientStack
102 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 103 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
103 OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 104 OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
104 } 105 }
105
106 } 106 }
107 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position 107 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
108 { 108 {
109 if (OnUpdatePrimSinglePosition != null) 109 if (OnUpdatePrimSinglePosition != null)
110 { 110 {
111 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 111 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
112 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 112 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
113 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 113 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
114 } 114 }
115 } 115 }
116 #endregion position 116 #endregion position
117 #region rotation 117 #region rotation
118 else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab 118
119 else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab
119 { 120 {
120 if (OnUpdatePrimSingleRotation != null) 121 if (OnUpdatePrimSingleRotation != null)
121 { 122 {
@@ -124,38 +125,39 @@ namespace OpenSim.Region.ClientStack
124 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 125 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
125 } 126 }
126 } 127 }
127 else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse 128 else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse
128 { 129 {
129 if (OnUpdatePrimSingleRotation != null) 130 if (OnUpdatePrimSingleRotation != null)
130 { 131 {
131 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 132 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
132 //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 133 //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
133 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 134 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
134 } 135 }
135 } 136 }
136 else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab 137 else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab
137 { 138 {
138 if (OnUpdatePrimGroupRotation != null) 139 if (OnUpdatePrimGroupRotation != null)
139 { 140 {
140 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 141 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
141 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 142 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
142 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 143 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
143 } 144 }
144 } 145 }
145 else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse 146 else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse
146 { 147 {
147 if (OnUpdatePrimGroupMouseRotation != null) 148 if (OnUpdatePrimGroupMouseRotation != null)
148 { 149 {
149 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 150 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
150 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 151 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
151 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 152 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
152 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 153 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
153 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); 154 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
154 } 155 }
155 } 156 }
156 #endregion 157 #endregion
157 #region scale 158 #region scale
158 else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab 159
160 else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab
159 { 161 {
160 if (OnUpdatePrimScale != null) 162 if (OnUpdatePrimScale != null)
161 { 163 {
@@ -164,40 +166,41 @@ namespace OpenSim.Region.ClientStack
164 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 166 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
165 167
166 // Change the position based on scale (for bug number 246) 168 // Change the position based on scale (for bug number 246)
167 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 169 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
168 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 170 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
169 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 171 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
170 } 172 }
171 } 173 }
172 else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse 174 else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse
173 { 175 {
174 if (OnUpdatePrimScale != null) 176 if (OnUpdatePrimScale != null)
175 { 177 {
176 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 178 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
177 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); 179 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
178 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 180 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
179 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 181 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
180 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 182 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
181 } 183 }
182 } 184 }
183 else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab 185 else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab
184 { 186 {
185 if (OnUpdatePrimScale != null) 187 if (OnUpdatePrimScale != null)
186 { 188 {
187 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 189 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
188 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 190 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
189 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 191 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
190 } 192 }
191 } 193 }
192 else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse 194 else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse
193 { 195 {
194 if (OnUpdatePrimScale != null) 196 if (OnUpdatePrimScale != null)
195 { 197 {
196 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 198 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
197 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 199 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
198 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 200 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
199 } 201 }
200 } 202 }
203
201 #endregion 204 #endregion
202 } 205 }
203 return true; 206 return true;
@@ -208,7 +211,7 @@ namespace OpenSim.Region.ClientStack
208 //should be getting the map layer from the grid server 211 //should be getting the map layer from the grid server
209 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) 212 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
210 MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); 213 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
211 mapReply.AgentData.AgentID = this.AgentId; 214 mapReply.AgentData.AgentID = AgentId;
212 mapReply.AgentData.Flags = 0; 215 mapReply.AgentData.Flags = 0;
213 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; 216 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
214 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); 217 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
@@ -217,7 +220,7 @@ namespace OpenSim.Region.ClientStack
217 mapReply.LayerData[0].Top = 30000; 220 mapReply.LayerData[0].Top = 30000;
218 mapReply.LayerData[0].Right = 30000; 221 mapReply.LayerData[0].Right = 30000;
219 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); 222 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
220 this.OutPacket(mapReply); 223 OutPacket(mapReply);
221 } 224 }
222 225
223 public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) 226 public void RequestMapBlocks(int minX, int minY, int maxX, int maxY)
@@ -251,4 +254,4 @@ namespace OpenSim.Region.ClientStack
251 */ 254 */
252 } 255 }
253 } 256 }
254} 257} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
index 5cd30ce..efeff29 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
@@ -32,13 +32,12 @@ using System.Net.Sockets;
32using System.Timers; 32using System.Timers;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Console;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Environment; 36using OpenSim.Framework.Console;
38 37
39namespace OpenSim.Region.ClientStack 38namespace OpenSim.Region.ClientStack
40{ 39{
41 public partial class ClientView 40 public partial class ClientView
42 { 41 {
43 protected BlockingQueue<QueItem> PacketQueue; 42 protected BlockingQueue<QueItem> PacketQueue;
44 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 43 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
@@ -84,7 +83,7 @@ namespace OpenSim.Region.ClientStack
84 Pack.Header.Sequence = Sequence; 83 Pack.Header.Sequence = Sequence;
85 } 84 }
86 85
87 if (Pack.Header.Reliable) //DIRTY HACK 86 if (Pack.Header.Reliable) //DIRTY HACK
88 { 87 {
89 lock (NeedAck) 88 lock (NeedAck)
90 { 89 {
@@ -148,19 +147,21 @@ namespace OpenSim.Region.ClientStack
148 if (Pack.Header.Zerocoded) 147 if (Pack.Header.Zerocoded)
149 { 148 {
150 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 149 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
151 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);//userEP); 150 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); //userEP);
152 } 151 }
153 else 152 else
154 { 153 {
155 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); //userEP); 154 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
155 //userEP);
156 } 156 }
157 } 157 }
158 catch (Exception) 158 catch (Exception)
159 { 159 {
160 MainLog.Instance.Warn("client", "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); 160 MainLog.Instance.Warn("client",
161 this.KillThread(); 161 "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
162 userEP.ToString() + " - killing thread");
163 KillThread();
162 } 164 }
163
164 } 165 }
165 166
166 public virtual void InPacket(Packet NewPack) 167 public virtual void InPacket(Packet NewPack)
@@ -180,7 +181,7 @@ namespace OpenSim.Region.ClientStack
180 // Handle PacketAck packets 181 // Handle PacketAck packets
181 if (NewPack.Type == PacketType.PacketAck) 182 if (NewPack.Type == PacketType.PacketAck)
182 { 183 {
183 PacketAckPacket ackPacket = (PacketAckPacket)NewPack; 184 PacketAckPacket ackPacket = (PacketAckPacket) NewPack;
184 185
185 lock (NeedAck) 186 lock (NeedAck)
186 { 187 {
@@ -193,7 +194,7 @@ namespace OpenSim.Region.ClientStack
193 else if ((NewPack.Type == PacketType.StartPingCheck)) 194 else if ((NewPack.Type == PacketType.StartPingCheck))
194 { 195 {
195 //reply to pingcheck 196 //reply to pingcheck
196 StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; 197 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
197 CompletePingCheckPacket endPing = new CompletePingCheckPacket(); 198 CompletePingCheckPacket endPing = new CompletePingCheckPacket();
198 endPing.PingID.PingID = startPing.PingID.PingID; 199 endPing.PingID.PingID = startPing.PingID.PingID;
199 OutPacket(endPing); 200 OutPacket(endPing);
@@ -203,9 +204,8 @@ namespace OpenSim.Region.ClientStack
203 QueItem item = new QueItem(); 204 QueItem item = new QueItem();
204 item.Packet = NewPack; 205 item.Packet = NewPack;
205 item.Incoming = true; 206 item.Incoming = true;
206 this.PacketQueue.Enqueue(item); 207 PacketQueue.Enqueue(item);
207 } 208 }
208
209 } 209 }
210 210
211 public virtual void OutPacket(Packet NewPack) 211 public virtual void OutPacket(Packet NewPack)
@@ -213,7 +213,7 @@ namespace OpenSim.Region.ClientStack
213 QueItem item = new QueItem(); 213 QueItem item = new QueItem();
214 item.Packet = NewPack; 214 item.Packet = NewPack;
215 item.Incoming = false; 215 item.Incoming = false;
216 this.PacketQueue.Enqueue(item); 216 PacketQueue.Enqueue(item);
217 } 217 }
218 218
219 # region Low Level Packet Methods 219 # region Low Level Packet Methods
@@ -229,7 +229,6 @@ namespace OpenSim.Region.ClientStack
229 ack_it.Header.Reliable = false; 229 ack_it.Header.Reliable = false;
230 230
231 OutPacket(ack_it); 231 OutPacket(ack_it);
232
233 } 232 }
234 /* 233 /*
235 if (Pack.Header.Reliable) 234 if (Pack.Header.Reliable)
@@ -252,8 +251,8 @@ namespace OpenSim.Region.ClientStack
252 { 251 {
253 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) 252 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
254 { 253 {
255 MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + 254 MainLog.Instance.Verbose("Resending " + packet.Type.ToString() + " packet, " +
256 (now - packet.TickCount) + "ms have passed"); 255 (now - packet.TickCount) + "ms have passed");
257 256
258 packet.Header.Resent = true; 257 packet.Header.Resent = true;
259 OutPacket(packet); 258 OutPacket(packet);
@@ -271,7 +270,7 @@ namespace OpenSim.Region.ClientStack
271 if (PendingAcks.Count > 250) 270 if (PendingAcks.Count > 250)
272 { 271 {
273 // FIXME: Handle the odd case where we have too many pending ACKs queued up 272 // FIXME: Handle the odd case where we have too many pending ACKs queued up
274 MainLog.Instance.Verbose( "Too many ACKs queued up!"); 273 MainLog.Instance.Verbose("Too many ACKs queued up!");
275 return; 274 return;
276 } 275 }
277 276
@@ -302,6 +301,7 @@ namespace OpenSim.Region.ClientStack
302 SendAcks(); 301 SendAcks();
303 ResendUnacked(); 302 ResendUnacked();
304 } 303 }
304
305 #endregion 305 #endregion
306 306
307 #region Nested Classes 307 #region Nested Classes
@@ -315,6 +315,7 @@ namespace OpenSim.Region.ClientStack
315 public Packet Packet; 315 public Packet Packet;
316 public bool Incoming; 316 public bool Incoming;
317 } 317 }
318
318 #endregion 319 #endregion
319 } 320 }
320} 321} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 13e8b43..dd2562c 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -31,8 +31,6 @@ using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes;
36 34
37namespace OpenSim.Region.ClientStack 35namespace OpenSim.Region.ClientStack
38{ 36{
@@ -63,7 +61,7 @@ namespace OpenSim.Region.ClientStack
63 { 61 {
64 ack_pack(Pack); 62 ack_pack(Pack);
65 63
66 if (this.ProcessPacketMethod(Pack)) 64 if (ProcessPacketMethod(Pack))
67 { 65 {
68 //there is a handler registered that handled this packet type 66 //there is a handler registered that handled this packet type
69 return; 67 return;
@@ -74,16 +72,17 @@ namespace OpenSim.Region.ClientStack
74 72
75 switch (Pack.Type) 73 switch (Pack.Type)
76 { 74 {
77 #region Scene/Avatar 75 #region Scene/Avatar
76
78 case PacketType.AvatarPropertiesRequest: 77 case PacketType.AvatarPropertiesRequest:
79 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 78 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket) Pack;
80 if (OnRequestAvatarProperties != null) 79 if (OnRequestAvatarProperties != null)
81 { 80 {
82 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); 81 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
83 } 82 }
84 break; 83 break;
85 case PacketType.ChatFromViewer: 84 case PacketType.ChatFromViewer:
86 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; 85 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
87 if (Util.FieldToString(inchatpack.ChatData.Message) == "") 86 if (Util.FieldToString(inchatpack.ChatData.Message) == "")
88 { 87 {
89 //empty message so don't bother with it 88 //empty message so don't bother with it
@@ -103,30 +102,32 @@ namespace OpenSim.Region.ClientStack
103 args.Channel = channel; 102 args.Channel = channel;
104 args.From = fromName; 103 args.From = fromName;
105 args.Message = Util.FieldToString(message); 104 args.Message = Util.FieldToString(message);
106 args.Type = (ChatTypeEnum)type; 105 args.Type = (ChatTypeEnum) type;
107 args.Position = fromPos; 106 args.Position = fromPos;
108 107
109 args.Scene = Scene; 108 args.Scene = Scene;
110 args.Sender = this; 109 args.Sender = this;
111 110
112 this.OnChatFromViewer(this, args); 111 OnChatFromViewer(this, args);
113 } 112 }
114 break; 113 break;
115 case PacketType.ImprovedInstantMessage: 114 case PacketType.ImprovedInstantMessage:
116 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 115 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
117 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 116 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
118 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); 117 string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message);
119 if (OnInstantMessage != null) 118 if (OnInstantMessage != null)
120 { 119 {
121 this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, 120 OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
122 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, msgpack.MessageBlock.Dialog); 121 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
122 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
123 msgpack.MessageBlock.Dialog);
123 } 124 }
124 break; 125 break;
125 case PacketType.RezObject: 126 case PacketType.RezObject:
126 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 127 RezObjectPacket rezPacket = (RezObjectPacket) Pack;
127 if (OnRezObject != null) 128 if (OnRezObject != null)
128 { 129 {
129 this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); 130 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd);
130 } 131 }
131 break; 132 break;
132 case PacketType.DeRezObject: 133 case PacketType.DeRezObject:
@@ -136,13 +137,15 @@ namespace OpenSim.Region.ClientStack
136 } 137 }
137 break; 138 break;
138 case PacketType.ModifyLand: 139 case PacketType.ModifyLand:
139 ModifyLandPacket modify = (ModifyLandPacket)Pack; 140 ModifyLandPacket modify = (ModifyLandPacket) Pack;
140 if (modify.ParcelData.Length > 0) 141 if (modify.ParcelData.Length > 0)
141 { 142 {
142 if (OnModifyTerrain != null) 143 if (OnModifyTerrain != null)
143 { 144 {
144 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, 145 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
145 modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West, this); 146 modify.ModifyBlock.BrushSize,
147 modify.ModifyBlock.Action, modify.ParcelData[0].North,
148 modify.ParcelData[0].West, this);
146 } 149 }
147 } 150 }
148 break; 151 break;
@@ -164,7 +167,7 @@ namespace OpenSim.Region.ClientStack
164 break; 167 break;
165 case PacketType.AgentSetAppearance: 168 case PacketType.AgentSetAppearance:
166 //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); 169 //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString());
167 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; 170 AgentSetAppearancePacket appear = (AgentSetAppearancePacket) Pack;
168 if (OnSetAppearance != null) 171 if (OnSetAppearance != null)
169 { 172 {
170 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); 173 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
@@ -179,17 +182,16 @@ namespace OpenSim.Region.ClientStack
179 case PacketType.AgentUpdate: 182 case PacketType.AgentUpdate:
180 if (OnAgentUpdate != null) 183 if (OnAgentUpdate != null)
181 { 184 {
182 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; 185 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack;
183 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); 186 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation);
184 } 187 }
185 break; 188 break;
186 case PacketType.AgentAnimation: 189 case PacketType.AgentAnimation:
187 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 190 AgentAnimationPacket AgentAni = (AgentAnimationPacket) Pack;
188 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 191 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
189 { 192 {
190 if (AgentAni.AnimationList[i].StartAnim) 193 if (AgentAni.AnimationList[i].StartAnim)
191 { 194 {
192
193 if (OnStartAnim != null) 195 if (OnStartAnim != null)
194 { 196 {
195 OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); 197 OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1);
@@ -198,27 +200,29 @@ namespace OpenSim.Region.ClientStack
198 } 200 }
199 break; 201 break;
200 case PacketType.AgentRequestSit: 202 case PacketType.AgentRequestSit:
201 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; 203 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack;
202 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 204 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
203 if (OnAgentRequestSit != null) 205 if (OnAgentRequestSit != null)
204 { 206 {
205 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID); 207 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
208 agentRequestSit.TargetObject.TargetID);
206 } 209 }
207 break; 210 break;
208 case PacketType.AgentSit: 211 case PacketType.AgentSit:
209 if (OnAgentSit != null) 212 if (OnAgentSit != null)
210 { 213 {
211 AgentSitPacket agentSit = (AgentSitPacket)Pack; 214 AgentSitPacket agentSit = (AgentSitPacket) Pack;
212 OnAgentSit(this, agentSit.AgentData.AgentID); 215 OnAgentSit(this, agentSit.AgentData.AgentID);
213 } 216 }
214 break; 217 break;
215 218
216 #endregion 219 #endregion
220
221 #region Objects/m_sceneObjects
217 222
218 #region Objects/m_sceneObjects
219 case PacketType.ObjectLink: 223 case PacketType.ObjectLink:
220 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 224 // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
221 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 225 ObjectLinkPacket link = (ObjectLinkPacket) Pack;
222 uint parentprimid = 0; 226 uint parentprimid = 0;
223 List<uint> childrenprims = new List<uint>(); 227 List<uint> childrenprims = new List<uint>();
224 if (link.ObjectData.Length > 1) 228 if (link.ObjectData.Length > 1)
@@ -238,13 +242,13 @@ namespace OpenSim.Region.ClientStack
238 case PacketType.ObjectAdd: 242 case PacketType.ObjectAdd:
239 if (OnAddPrim != null) 243 if (OnAddPrim != null)
240 { 244 {
241 ObjectAddPacket addPacket = (ObjectAddPacket)Pack; 245 ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
242 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); 246 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
243 OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); 247 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, shape);
244 } 248 }
245 break; 249 break;
246 case PacketType.ObjectShape: 250 case PacketType.ObjectShape:
247 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; 251 ObjectShapePacket shapePacket = (ObjectShapePacket) Pack;
248 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 252 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
249 { 253 {
250 if (OnUpdatePrimShape != null) 254 if (OnUpdatePrimShape != null)
@@ -254,26 +258,28 @@ namespace OpenSim.Region.ClientStack
254 } 258 }
255 break; 259 break;
256 case PacketType.ObjectExtraParams: 260 case PacketType.ObjectExtraParams:
257 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; 261 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack;
258 if (OnUpdateExtraParams != null) 262 if (OnUpdateExtraParams != null)
259 { 263 {
260 OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); 264 OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType,
265 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData);
261 } 266 }
262 break; 267 break;
263 case PacketType.ObjectDuplicate: 268 case PacketType.ObjectDuplicate:
264 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; 269 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack;
265 for (int i = 0; i < dupe.ObjectData.Length; i++) 270 for (int i = 0; i < dupe.ObjectData.Length; i++)
266 { 271 {
267 if (OnObjectDuplicate != null) 272 if (OnObjectDuplicate != null)
268 { 273 {
269 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); 274 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
275 dupe.SharedData.DuplicateFlags);
270 } 276 }
271 } 277 }
272 278
273 break; 279 break;
274 280
275 case PacketType.ObjectSelect: 281 case PacketType.ObjectSelect:
276 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 282 ObjectSelectPacket incomingselect = (ObjectSelectPacket) Pack;
277 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 283 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
278 { 284 {
279 if (OnObjectSelect != null) 285 if (OnObjectSelect != null)
@@ -283,7 +289,7 @@ namespace OpenSim.Region.ClientStack
283 } 289 }
284 break; 290 break;
285 case PacketType.ObjectDeselect: 291 case PacketType.ObjectDeselect:
286 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; 292 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket) Pack;
287 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 293 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
288 { 294 {
289 if (OnObjectDeselect != null) 295 if (OnObjectDeselect != null)
@@ -293,55 +299,58 @@ namespace OpenSim.Region.ClientStack
293 } 299 }
294 break; 300 break;
295 case PacketType.ObjectFlagUpdate: 301 case PacketType.ObjectFlagUpdate:
296 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 302 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket) Pack;
297 if (OnUpdatePrimFlags != null) 303 if (OnUpdatePrimFlags != null)
298 { 304 {
299 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 305 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
300 } 306 }
301 break; 307 break;
302 case PacketType.ObjectImage: 308 case PacketType.ObjectImage:
303 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 309 ObjectImagePacket imagePack = (ObjectImagePacket) Pack;
304 for (int i = 0; i < imagePack.ObjectData.Length; i++) 310 for (int i = 0; i < imagePack.ObjectData.Length; i++)
305 { 311 {
306 if (OnUpdatePrimTexture != null) 312 if (OnUpdatePrimTexture != null)
307 { 313 {
308 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); 314 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
315 imagePack.ObjectData[i].TextureEntry, this);
309 } 316 }
310 } 317 }
311 break; 318 break;
312 case PacketType.ObjectGrab: 319 case PacketType.ObjectGrab:
313 ObjectGrabPacket grab = (ObjectGrabPacket)Pack; 320 ObjectGrabPacket grab = (ObjectGrabPacket) Pack;
314 if (OnGrabObject != null) 321 if (OnGrabObject != null)
315 { 322 {
316 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); 323 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this);
317 } 324 }
318 break; 325 break;
319 case PacketType.ObjectGrabUpdate: 326 case PacketType.ObjectGrabUpdate:
320 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; 327 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket) Pack;
321 if (OnGrabUpdate != null) 328 if (OnGrabUpdate != null)
322 { 329 {
323 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this); 330 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
331 grabUpdate.ObjectData.GrabPosition, this);
324 } 332 }
325 break; 333 break;
326 case PacketType.ObjectDeGrab: 334 case PacketType.ObjectDeGrab:
327 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; 335 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket) Pack;
328 if (OnDeGrabObject != null) 336 if (OnDeGrabObject != null)
329 { 337 {
330 OnDeGrabObject(deGrab.ObjectData.LocalID, this); 338 OnDeGrabObject(deGrab.ObjectData.LocalID, this);
331 } 339 }
332 break; 340 break;
333 case PacketType.ObjectDescription: 341 case PacketType.ObjectDescription:
334 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; 342 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket) Pack;
335 for (int i = 0; i < objDes.ObjectData.Length; i++) 343 for (int i = 0; i < objDes.ObjectData.Length; i++)
336 { 344 {
337 if (OnObjectDescription != null) 345 if (OnObjectDescription != null)
338 { 346 {
339 OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); 347 OnObjectDescription(objDes.ObjectData[i].LocalID,
348 enc.GetString(objDes.ObjectData[i].Description));
340 } 349 }
341 } 350 }
342 break; 351 break;
343 case PacketType.ObjectName: 352 case PacketType.ObjectName:
344 ObjectNamePacket objName = (ObjectNamePacket)Pack; 353 ObjectNamePacket objName = (ObjectNamePacket) Pack;
345 for (int i = 0; i < objName.ObjectData.Length; i++) 354 for (int i = 0; i < objName.ObjectData.Length; i++)
346 { 355 {
347 if (OnObjectName != null) 356 if (OnObjectName != null)
@@ -353,15 +362,16 @@ namespace OpenSim.Region.ClientStack
353 case PacketType.ObjectPermissions: 362 case PacketType.ObjectPermissions:
354 //Console.WriteLine("permissions set " + Pack.ToString()); 363 //Console.WriteLine("permissions set " + Pack.ToString());
355 break; 364 break;
356 #endregion
357 365
358 #region Inventory/Asset/Other related packets 366 #endregion
367
368 #region Inventory/Asset/Other related packets
369
359 case PacketType.RequestImage: 370 case PacketType.RequestImage:
360 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 371 RequestImagePacket imageRequest = (RequestImagePacket) Pack;
361 //Console.WriteLine("image request: " + Pack.ToString()); 372 //Console.WriteLine("image request: " + Pack.ToString());
362 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 373 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
363 { 374 {
364
365 // still working on the Texture download module so for now using old method 375 // still working on the Texture download module so for now using old method
366 // TextureRequestArgs args = new TextureRequestArgs(); 376 // TextureRequestArgs args = new TextureRequestArgs();
367 // args.RequestedAssetID = imageRequest.RequestImage[i].Image; 377 // args.RequestedAssetID = imageRequest.RequestImage[i].Image;
@@ -373,86 +383,104 @@ namespace OpenSim.Region.ClientStack
373 // OnRequestTexture(this, args); 383 // OnRequestTexture(this, args);
374 // } 384 // }
375 385
376 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet, imageRequest.RequestImage[i].DiscardLevel); 386 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image,
387 imageRequest.RequestImage[i].Packet,
388 imageRequest.RequestImage[i].DiscardLevel);
377 } 389 }
378 break; 390 break;
379 case PacketType.TransferRequest: 391 case PacketType.TransferRequest:
380 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 392 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
381 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 393 TransferRequestPacket transfer = (TransferRequestPacket) Pack;
382 m_assetCache.AddAssetRequest(this, transfer); 394 m_assetCache.AddAssetRequest(this, transfer);
383 break; 395 break;
384 case PacketType.AssetUploadRequest: 396 case PacketType.AssetUploadRequest:
385 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 397 AssetUploadRequestPacket request = (AssetUploadRequestPacket) Pack;
386 // Console.WriteLine("upload request " + Pack.ToString()); 398 // Console.WriteLine("upload request " + Pack.ToString());
387 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); 399 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
388 if (OnAssetUploadRequest != null) 400 if (OnAssetUploadRequest != null)
389 { 401 {
390 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); 402 OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionID),
403 request.AssetBlock.TransactionID, request.AssetBlock.Type,
404 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
391 } 405 }
392 break; 406 break;
393 case PacketType.RequestXfer: 407 case PacketType.RequestXfer:
394 RequestXferPacket xferReq = (RequestXferPacket)Pack; 408 RequestXferPacket xferReq = (RequestXferPacket) Pack;
395 if (OnRequestXfer != null) 409 if (OnRequestXfer != null)
396 { 410 {
397 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); 411 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
398 } 412 }
399 break; 413 break;
400 case PacketType.SendXferPacket: 414 case PacketType.SendXferPacket:
401 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; 415 SendXferPacketPacket xferRec = (SendXferPacketPacket) Pack;
402 if (OnXferReceive != null) 416 if (OnXferReceive != null)
403 { 417 {
404 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 418 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
405 } 419 }
406 break; 420 break;
407 case PacketType.ConfirmXferPacket: 421 case PacketType.ConfirmXferPacket:
408 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; 422 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket) Pack;
409 if (OnConfirmXfer != null) 423 if (OnConfirmXfer != null)
410 { 424 {
411 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 425 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
412 } 426 }
413 break; 427 break;
414 case PacketType.CreateInventoryFolder: 428 case PacketType.CreateInventoryFolder:
415 if (this.OnCreateNewInventoryFolder != null) 429 if (OnCreateNewInventoryFolder != null)
416 { 430 {
417 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 431 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket) Pack;
418 this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); 432 OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID,
433 (ushort) invFolder.FolderData.Type,
434 Util.FieldToString(invFolder.FolderData.Name),
435 invFolder.FolderData.ParentID);
419 } 436 }
420 break; 437 break;
421 case PacketType.CreateInventoryItem: 438 case PacketType.CreateInventoryItem:
422 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; 439 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack;
423 if (this.OnCreateNewInventoryItem != null) 440 if (OnCreateNewInventoryItem != null)
424 { 441 {
425 this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID, 442 OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
426 Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType, 443 createItem.InventoryBlock.FolderID,
427 createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask); 444 createItem.InventoryBlock.CallbackID,
445 Util.FieldToString(createItem.InventoryBlock.Description),
446 Util.FieldToString(createItem.InventoryBlock.Name),
447 createItem.InventoryBlock.InvType,
448 createItem.InventoryBlock.Type,
449 createItem.InventoryBlock.WearableType,
450 createItem.InventoryBlock.NextOwnerMask);
428 } 451 }
429 break; 452 break;
430 case PacketType.FetchInventory: 453 case PacketType.FetchInventory:
431 if (this.OnFetchInventory != null) 454 if (OnFetchInventory != null)
432 { 455 {
433 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 456 FetchInventoryPacket FetchInventory = (FetchInventoryPacket) Pack;
434 for (int i = 0; i < FetchInventory.InventoryData.Length; i++) 457 for (int i = 0; i < FetchInventory.InventoryData.Length; i++)
435 { 458 {
436 this.OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, FetchInventory.InventoryData[i].OwnerID); 459 OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID,
460 FetchInventory.InventoryData[i].OwnerID);
437 } 461 }
438 } 462 }
439 break; 463 break;
440 case PacketType.FetchInventoryDescendents: 464 case PacketType.FetchInventoryDescendents:
441 if (this.OnFetchInventoryDescendents != null) 465 if (OnFetchInventoryDescendents != null)
442 { 466 {
443 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 467 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket) Pack;
444 this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); 468 OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
469 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
470 Fetch.InventoryData.SortOrder);
445 } 471 }
446 break; 472 break;
447 case PacketType.UpdateInventoryItem: 473 case PacketType.UpdateInventoryItem:
448 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 474 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack;
449 if (OnUpdateInventoryItem != null) 475 if (OnUpdateInventoryItem != null)
450 { 476 {
451 for (int i = 0; i < update.InventoryData.Length; i++) 477 for (int i = 0; i < update.InventoryData.Length; i++)
452 { 478 {
453 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 479 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
454 { 480 {
455 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID); 481 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
482 update.InventoryData[i].TransactionID.Combine(SecureSessionID),
483 update.InventoryData[i].ItemID);
456 } 484 }
457 } 485 }
458 } 486 }
@@ -488,25 +516,26 @@ namespace OpenSim.Region.ClientStack
488 }*/ 516 }*/
489 break; 517 break;
490 case PacketType.RequestTaskInventory: 518 case PacketType.RequestTaskInventory:
491 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 519 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack;
492 if (this.OnRequestTaskInventory != null) 520 if (OnRequestTaskInventory != null)
493 { 521 {
494 this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); 522 OnRequestTaskInventory(this, requesttask.InventoryData.LocalID);
495 } 523 }
496 break; 524 break;
497 case PacketType.UpdateTaskInventory: 525 case PacketType.UpdateTaskInventory:
498 //Console.WriteLine(Pack.ToString()); 526 //Console.WriteLine(Pack.ToString());
499 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 527 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket) Pack;
500 if (OnUpdateTaskInventory != null) 528 if (OnUpdateTaskInventory != null)
501 { 529 {
502 if (updatetask.UpdateData.Key == 0) 530 if (updatetask.UpdateData.Key == 0)
503 { 531 {
504 OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); 532 OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID,
533 updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID);
505 } 534 }
506 } 535 }
507 break; 536 break;
508 case PacketType.RemoveTaskInventory: 537 case PacketType.RemoveTaskInventory:
509 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; 538 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket) Pack;
510 if (OnRemoveTaskItem != null) 539 if (OnRemoveTaskItem != null)
511 { 540 {
512 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); 541 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
@@ -517,38 +546,39 @@ namespace OpenSim.Region.ClientStack
517 break; 546 break;
518 case PacketType.RezScript: 547 case PacketType.RezScript:
519 //Console.WriteLine(Pack.ToString()); 548 //Console.WriteLine(Pack.ToString());
520 RezScriptPacket rezScript = (RezScriptPacket)Pack; 549 RezScriptPacket rezScript = (RezScriptPacket) Pack;
521 if (OnRezScript != null) 550 if (OnRezScript != null)
522 { 551 {
523 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); 552 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID);
524 } 553 }
525 break; 554 break;
526 case PacketType.MapLayerRequest: 555 case PacketType.MapLayerRequest:
527 this.RequestMapLayer(); 556 RequestMapLayer();
528 break; 557 break;
529 case PacketType.MapBlockRequest: 558 case PacketType.MapBlockRequest:
530 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; 559 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket) Pack;
531 if (OnRequestMapBlocks != null) 560 if (OnRequestMapBlocks != null)
532 { 561 {
533 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 562 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
563 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
534 } 564 }
535 break; 565 break;
536 case PacketType.TeleportLandmarkRequest: 566 case PacketType.TeleportLandmarkRequest:
537 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 567 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
538 568
539 TeleportStartPacket tpStart = new TeleportStartPacket(); 569 TeleportStartPacket tpStart = new TeleportStartPacket();
540 tpStart.Info.TeleportFlags = 8; // tp via lm 570 tpStart.Info.TeleportFlags = 8; // tp via lm
541 this.OutPacket(tpStart); 571 OutPacket(tpStart);
542 572
543 TeleportProgressPacket tpProgress = new TeleportProgressPacket(); 573 TeleportProgressPacket tpProgress = new TeleportProgressPacket();
544 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 574 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
545 tpProgress.Info.TeleportFlags = 8; 575 tpProgress.Info.TeleportFlags = 8;
546 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 576 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
547 this.OutPacket(tpProgress); 577 OutPacket(tpProgress);
548 578
549 // Fetch landmark 579 // Fetch landmark
550 LLUUID lmid = tpReq.Info.LandmarkID; 580 LLUUID lmid = tpReq.Info.LandmarkID;
551 AssetBase lma = this.m_assetCache.GetAsset(lmid); 581 AssetBase lma = m_assetCache.GetAsset(lmid);
552 if (lma != null) 582 if (lma != null)
553 { 583 {
554 AssetLandmark lm = new AssetLandmark(lma); 584 AssetLandmark lm = new AssetLandmark(lma);
@@ -558,7 +588,7 @@ namespace OpenSim.Region.ClientStack
558 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 588 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
559 589
560 tpLocal.Info.AgentID = tpReq.Info.AgentID; 590 tpLocal.Info.AgentID = tpReq.Info.AgentID;
561 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 591 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
562 tpLocal.Info.LocationID = 2; 592 tpLocal.Info.LocationID = 2;
563 tpLocal.Info.Position = lm.Position; 593 tpLocal.Info.Position = lm.Position;
564 OutPacket(tpLocal); 594 OutPacket(tpLocal);
@@ -582,12 +612,13 @@ namespace OpenSim.Region.ClientStack
582 } 612 }
583 break; 613 break;
584 case PacketType.TeleportLocationRequest: 614 case PacketType.TeleportLocationRequest:
585 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 615 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket) Pack;
586 // Console.WriteLine(tpLocReq.ToString()); 616 // Console.WriteLine(tpLocReq.ToString());
587 617
588 if (OnTeleportLocationRequest != null) 618 if (OnTeleportLocationRequest != null)
589 { 619 {
590 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); 620 OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
621 tpLocReq.Info.LookAt, 16);
591 } 622 }
592 else 623 else
593 { 624 {
@@ -598,76 +629,94 @@ namespace OpenSim.Region.ClientStack
598 OutPacket(tpCancel); 629 OutPacket(tpCancel);
599 } 630 }
600 break; 631 break;
601 #endregion 632
633 #endregion
602 634
603 case PacketType.MoneyBalanceRequest: 635 case PacketType.MoneyBalanceRequest:
604 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); 636 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance);
605 break; 637 break;
606 case PacketType.UUIDNameRequest: 638 case PacketType.UUIDNameRequest:
607 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; 639 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket) Pack;
608 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 640 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
609 { 641 {
610 OnNameFromUUIDRequest(UUIDBlock.ID, this); 642 OnNameFromUUIDRequest(UUIDBlock.ID, this);
611 } 643 }
612 break; 644 break;
613 #region Parcel related packets 645
646 #region Parcel related packets
647
614 case PacketType.ParcelPropertiesRequest: 648 case PacketType.ParcelPropertiesRequest:
615 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; 649 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack;
616 if (OnParcelPropertiesRequest != null) 650 if (OnParcelPropertiesRequest != null)
617 { 651 {
618 OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); 652 OnParcelPropertiesRequest((int) Math.Round(propertiesRequest.ParcelData.West),
653 (int) Math.Round(propertiesRequest.ParcelData.South),
654 (int) Math.Round(propertiesRequest.ParcelData.East),
655 (int) Math.Round(propertiesRequest.ParcelData.North),
656 propertiesRequest.ParcelData.SequenceID,
657 propertiesRequest.ParcelData.SnapSelection, this);
619 } 658 }
620 break; 659 break;
621 case PacketType.ParcelDivide: 660 case PacketType.ParcelDivide:
622 ParcelDividePacket landDivide = (ParcelDividePacket)Pack; 661 ParcelDividePacket landDivide = (ParcelDividePacket) Pack;
623 if (OnParcelDivideRequest != null) 662 if (OnParcelDivideRequest != null)
624 { 663 {
625 OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), (int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.North), this); 664 OnParcelDivideRequest((int) Math.Round(landDivide.ParcelData.West),
665 (int) Math.Round(landDivide.ParcelData.South),
666 (int) Math.Round(landDivide.ParcelData.East),
667 (int) Math.Round(landDivide.ParcelData.North), this);
626 } 668 }
627 break; 669 break;
628 case PacketType.ParcelJoin: 670 case PacketType.ParcelJoin:
629 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; 671 ParcelJoinPacket landJoin = (ParcelJoinPacket) Pack;
630 if (OnParcelJoinRequest != null) 672 if (OnParcelJoinRequest != null)
631 { 673 {
632 OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), (int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.North), this); 674 OnParcelJoinRequest((int) Math.Round(landJoin.ParcelData.West),
675 (int) Math.Round(landJoin.ParcelData.South),
676 (int) Math.Round(landJoin.ParcelData.East),
677 (int) Math.Round(landJoin.ParcelData.North), this);
633 } 678 }
634 break; 679 break;
635 case PacketType.ParcelPropertiesUpdate: 680 case PacketType.ParcelPropertiesUpdate:
636 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; 681 ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket) Pack;
637 if (OnParcelPropertiesUpdateRequest != null) 682 if (OnParcelPropertiesUpdateRequest != null)
638 { 683 {
639 OnParcelPropertiesUpdateRequest(updatePacket, this); 684 OnParcelPropertiesUpdateRequest(updatePacket, this);
640
641 } 685 }
642 break; 686 break;
643 case PacketType.ParcelSelectObjects: 687 case PacketType.ParcelSelectObjects:
644 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; 688 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket) Pack;
645 if (OnParcelSelectObjects != null) 689 if (OnParcelSelectObjects != null)
646 { 690 {
647 OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); 691 OnParcelSelectObjects(selectPacket.ParcelData.LocalID,
692 Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
648 } 693 }
649 break; 694 break;
650 695
651 case PacketType.ParcelObjectOwnersRequest: 696 case PacketType.ParcelObjectOwnersRequest:
652 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; 697 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket) Pack;
653 if (OnParcelObjectOwnerRequest != null) 698 if (OnParcelObjectOwnerRequest != null)
654 { 699 {
655 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 700 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
656 } 701 }
657 break; 702 break;
658 #endregion
659 703
660 #region Estate Packets 704 #endregion
705
706 #region Estate Packets
707
661 case PacketType.EstateOwnerMessage: 708 case PacketType.EstateOwnerMessage:
662 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 709 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket) Pack;
663 if (OnEstateOwnerMessage != null) 710 if (OnEstateOwnerMessage != null)
664 { 711 {
665 OnEstateOwnerMessage(messagePacket, this); 712 OnEstateOwnerMessage(messagePacket, this);
666 } 713 }
667 break; 714 break;
668 #endregion
669 715
670 #region unimplemented handlers 716 #endregion
717
718 #region unimplemented handlers
719
671 case PacketType.AgentIsNowWearing: 720 case PacketType.AgentIsNowWearing:
672 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 721 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
673 //Console.WriteLine(Pack.ToString()); 722 //Console.WriteLine(Pack.ToString());
@@ -675,7 +724,8 @@ namespace OpenSim.Region.ClientStack
675 case PacketType.ObjectScale: 724 case PacketType.ObjectScale:
676 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); 725 //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
677 break; 726 break;
678 #endregion 727
728 #endregion
679 } 729 }
680 } 730 }
681 } 731 }
@@ -721,4 +771,4 @@ namespace OpenSim.Region.ClientStack
721 OutPacket(logReply); 771 OutPacket(logReply);
722 } 772 }
723 } 773 }
724} 774} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 6d49e34..55f50a4 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -36,7 +36,7 @@ using libsecondlife.Packets;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using Timer = System.Timers.Timer; 39using Timer=System.Timers.Timer;
40 40
41namespace OpenSim.Region.ClientStack 41namespace OpenSim.Region.ClientStack
42{ 42{
@@ -50,8 +50,11 @@ namespace OpenSim.Region.ClientStack
50 { 50 {
51 public static TerrainManager TerrainManager; 51 public static TerrainManager TerrainManager;
52 52
53 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients 53 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
54 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance 54 new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
55
56 protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>();
57 //local handlers for this instance
55 58
56 private LLUUID m_sessionId; 59 private LLUUID m_sessionId;
57 public LLUUID SecureSessionID = LLUUID.Zero; 60 public LLUUID SecureSessionID = LLUUID.Zero;
@@ -84,7 +87,9 @@ namespace OpenSim.Region.ClientStack
84 private int probesWithNoIngressPackets = 0; 87 private int probesWithNoIngressPackets = 0;
85 private int lastPacketsReceived = 0; 88 private int lastPacketsReceived = 0;
86 89
87 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) 90 public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager,
91 IScene scene, AssetCache assetCache, PacketServer packServer,
92 AgentCircuitManager authenSessions)
88 { 93 {
89 m_moneyBalance = 1000; 94 m_moneyBalance = 1000;
90 95
@@ -96,11 +101,11 @@ namespace OpenSim.Region.ClientStack
96 // m_inventoryCache = inventoryCache; 101 // m_inventoryCache = inventoryCache;
97 m_authenticateSessionsHandler = authenSessions; 102 m_authenticateSessionsHandler = authenSessions;
98 103
99 MainLog.Instance.Verbose("CLIENT","Started up new client thread to handle incoming request"); 104 MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request");
100 cirpack = initialcirpack; 105 cirpack = initialcirpack;
101 userEP = remoteEP; 106 userEP = remoteEP;
102 107
103 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); 108 startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
104 109
105 PacketQueue = new BlockingQueue<QueItem>(); 110 PacketQueue = new BlockingQueue<QueItem>();
106 111
@@ -109,7 +114,7 @@ namespace OpenSim.Region.ClientStack
109 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 114 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
110 AckTimer.Start(); 115 AckTimer.Start();
111 116
112 this.RegisterLocalPacketHandlers(); 117 RegisterLocalPacketHandlers();
113 118
114 ClientThread = new Thread(new ThreadStart(AuthUser)); 119 ClientThread = new Thread(new ThreadStart(AuthUser));
115 ClientThread.IsBackground = true; 120 ClientThread.IsBackground = true;
@@ -121,7 +126,7 @@ namespace OpenSim.Region.ClientStack
121 get { return m_sessionId; } 126 get { return m_sessionId; }
122 } 127 }
123 128
124 public void SetDebug(int newDebug) 129 public void SetDebug(int newDebug)
125 { 130 {
126 debug = newDebug; 131 debug = newDebug;
127 } 132 }
@@ -132,14 +137,15 @@ namespace OpenSim.Region.ClientStack
132 { 137 {
133 clientPingTimer.Stop(); 138 clientPingTimer.Stop();
134 139
135 m_scene.RemoveClient(this.AgentId); 140 m_scene.RemoveClient(AgentId);
136 141
137 this.ClientThread.Abort(); 142 ClientThread.Abort();
138 } 143 }
139 144
140 #endregion 145 #endregion
141 146
142 # region Packet Handling 147 # region Packet Handling
148
143 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) 149 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
144 { 150 {
145 bool result = false; 151 bool result = false;
@@ -195,23 +201,27 @@ namespace OpenSim.Region.ClientStack
195 201
196 protected void DebugPacket(string direction, Packet packet) 202 protected void DebugPacket(string direction, Packet packet)
197 { 203 {
198 if (debug > 0) { 204 if (debug > 0)
205 {
199 string info; 206 string info;
200 if (debug < 255 && packet.Type == PacketType.AgentUpdate) 207 if (debug < 255 && packet.Type == PacketType.AgentUpdate)
201 return; 208 return;
202 if (debug < 254 && packet.Type == PacketType.ViewerEffect) 209 if (debug < 254 && packet.Type == PacketType.ViewerEffect)
203 return; 210 return;
204 if (debug < 253 && ( 211 if (debug < 253 && (
205 packet.Type == PacketType.CompletePingCheck || 212 packet.Type == PacketType.CompletePingCheck ||
206 packet.Type == PacketType.StartPingCheck 213 packet.Type == PacketType.StartPingCheck
207 ) ) 214 ))
208 return; 215 return;
209 if (debug < 252 && packet.Type == PacketType.PacketAck) 216 if (debug < 252 && packet.Type == PacketType.PacketAck)
210 return; 217 return;
211 218
212 if (debug > 1) { 219 if (debug > 1)
220 {
213 info = packet.ToString(); 221 info = packet.ToString();
214 } else { 222 }
223 else
224 {
215 info = packet.Type.ToString(); 225 info = packet.Type.ToString();
216 } 226 }
217 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); 227 Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
@@ -242,6 +252,7 @@ namespace OpenSim.Region.ClientStack
242 } 252 }
243 } 253 }
244 } 254 }
255
245 # endregion 256 # endregion
246 257
247 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) 258 protected void CheckClientConnectivity(object sender, ElapsedEventArgs e)
@@ -251,7 +262,7 @@ namespace OpenSim.Region.ClientStack
251 probesWithNoIngressPackets++; 262 probesWithNoIngressPackets++;
252 if (probesWithNoIngressPackets > 30) 263 if (probesWithNoIngressPackets > 30)
253 { 264 {
254 if( OnConnectionClosed != null ) 265 if (OnConnectionClosed != null)
255 { 266 {
256 OnConnectionClosed(this); 267 OnConnectionClosed(this);
257 } 268 }
@@ -278,14 +289,16 @@ namespace OpenSim.Region.ClientStack
278 clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); 289 clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
279 clientPingTimer.Enabled = true; 290 clientPingTimer.Enabled = true;
280 291
281 MainLog.Instance.Verbose("CLIENT","Adding viewer agent to scene"); 292 MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene");
282 this.m_scene.AddNewClient(this, true); 293 m_scene.AddNewClient(this, true);
283 } 294 }
284 295
285 protected virtual void AuthUser() 296 protected virtual void AuthUser()
286 { 297 {
287 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); 298 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code);
288 AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 299 AuthenticateResponse sessionInfo =
300 m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID,
301 cirpack.CircuitCode.Code);
289 if (!sessionInfo.Authorised) 302 if (!sessionInfo.Authorised)
290 { 303 {
291 //session/circuit not authorised 304 //session/circuit not authorised
@@ -297,27 +310,26 @@ namespace OpenSim.Region.ClientStack
297 MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); 310 MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString());
298 //session is authorised 311 //session is authorised
299 m_agentId = cirpack.CircuitCode.ID; 312 m_agentId = cirpack.CircuitCode.ID;
300 this.m_sessionId = cirpack.CircuitCode.SessionID; 313 m_sessionId = cirpack.CircuitCode.SessionID;
301 this.m_circuitCode = cirpack.CircuitCode.Code; 314 m_circuitCode = cirpack.CircuitCode.Code;
302 this.firstName = sessionInfo.LoginInfo.First; 315 firstName = sessionInfo.LoginInfo.First;
303 this.lastName = sessionInfo.LoginInfo.Last; 316 lastName = sessionInfo.LoginInfo.Last;
304 317
305 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) 318 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
306 { 319 {
307 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; 320 SecureSessionID = sessionInfo.LoginInfo.SecureSession;
308 } 321 }
309 InitNewClient(); 322 InitNewClient();
310 323
311 ClientLoop(); 324 ClientLoop();
312 } 325 }
313 } 326 }
314 # endregion
315 327
328 # endregion
316 329
317 protected void KillThread() 330 protected void KillThread()
318 { 331 {
319 this.ClientThread.Abort(); 332 ClientThread.Abort();
320 } 333 }
321
322 } 334 }
323} 335} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index 1b64602..f75536a 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -25,15 +25,11 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic;
29using System.Net; 28using System.Net;
30using System.Net.Sockets; 29using System.Net.Sockets;
31using libsecondlife.Packets; 30using libsecondlife.Packets;
32using OpenSim.Framework; 31using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework;
35using OpenSim.Framework.Interfaces;
36using libsecondlife;
37 33
38namespace OpenSim.Region.ClientStack 34namespace OpenSim.Region.ClientStack
39{ 35{
@@ -56,10 +52,7 @@ namespace OpenSim.Region.ClientStack
56 52
57 public IScene LocalScene 53 public IScene LocalScene
58 { 54 {
59 set 55 set { m_scene = value; }
60 {
61 this.m_scene = value;
62 }
63 } 56 }
64 57
65 /// <summary> 58 /// <summary>
@@ -72,17 +65,21 @@ namespace OpenSim.Region.ClientStack
72 m_scene.ClientManager.InPacket(circuitCode, packet); 65 m_scene.ClientManager.InPacket(circuitCode, packet);
73 } 66 }
74 67
75 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) 68 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
69 ClientManager clientManager, IScene scene, AssetCache assetCache,
70 PacketServer packServer, AgentCircuitManager authenSessions)
76 { 71 {
77 return new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions ); 72 return
73 new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions);
78 } 74 }
79 75
80 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass) 76 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
77 AgentCircuitManager authenticateSessionsClass)
81 { 78 {
82 IClientAPI newuser; 79 IClientAPI newuser;
83 80
84 if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) 81 if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser))
85 { 82 {
86 return false; 83 return false;
87 } 84 }
88 else 85 else
@@ -104,7 +101,7 @@ namespace OpenSim.Region.ClientStack
104 { 101 {
105 client.SendLogoutPacket(); 102 client.SendLogoutPacket();
106 103
107 CloseClient( client ); 104 CloseClient(client);
108 } 105 }
109 106
110 107
@@ -117,7 +114,7 @@ namespace OpenSim.Region.ClientStack
117 /// <param name="circuitcode"></param> 114 /// <param name="circuitcode"></param>
118 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 115 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
119 { 116 {
120 this.m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); 117 m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode);
121 } 118 }
122 119
123 /// <summary> 120 /// <summary>
@@ -126,13 +123,13 @@ namespace OpenSim.Region.ClientStack
126 /// <param name="circuitcode"></param> 123 /// <param name="circuitcode"></param>
127 public virtual void CloseCircuit(uint circuitcode) 124 public virtual void CloseCircuit(uint circuitcode)
128 { 125 {
129 m_networkHandler.RemoveClientCircuit( circuitcode ); 126 m_networkHandler.RemoveClientCircuit(circuitcode);
130 m_scene.ClientManager.CloseAllAgents(circuitcode); 127 m_scene.ClientManager.CloseAllAgents(circuitcode);
131 } 128 }
132 129
133 public virtual void CloseClient( IClientAPI client ) 130 public virtual void CloseClient(IClientAPI client)
134 { 131 {
135 CloseCircuit( client.CircuitCode ); 132 CloseCircuit(client.CircuitCode);
136 } 133 }
137 } 134 }
138} 135} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 657af54..7551bff 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -28,17 +28,15 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using libsecondlife;
31using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
32using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
36using OpenSim.Framework;
37using OpenSim.Region.Physics.Manager;
38using OpenSim.Region.Environment; 37using OpenSim.Region.Environment;
39using libsecondlife;
40using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
41using OpenSim.Framework.Communications; 39using OpenSim.Region.Physics.Manager;
42 40
43namespace OpenSim.Region.ClientStack 41namespace OpenSim.Region.ClientStack
44{ 42{
@@ -67,9 +65,8 @@ namespace OpenSim.Region.ClientStack
67 m_startuptime = DateTime.Now; 65 m_startuptime = DateTime.Now;
68 } 66 }
69 67
70 virtual public void StartUp() 68 public virtual void StartUp()
71 { 69 {
72
73 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 70 ClientView.TerrainManager = new TerrainManager(new SecondLife());
74 71
75 Initialize(); 72 Initialize();
@@ -116,7 +113,10 @@ namespace OpenSim.Region.ClientStack
116 scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); 113 scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D());
117 114
118 //Master Avatar Setup 115 //Master Avatar Setup
119 UserProfileData masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); 116 UserProfileData masterAvatar =
117 m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
118 scene.RegionInfo.MasterAvatarLastName,
119 scene.RegionInfo.MasterAvatarSandboxPassword);
120 if (masterAvatar != null) 120 if (masterAvatar != null)
121 { 121 {
122 m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); 122 m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ClientStack
126 else 126 else
127 { 127 {
128 m_log.Verbose("PARCEL", "No master avatar found, using null."); 128 m_log.Verbose("PARCEL", "No master avatar found, using null.");
129 scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; 129 scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero;
130 //TODO: Load parcels from storageManager 130 //TODO: Load parcels from storageManager
131 } 131 }
132 132
@@ -138,8 +138,7 @@ namespace OpenSim.Region.ClientStack
138 return scene; 138 return scene;
139 } 139 }
140 140
141 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager); 141 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
142 142 AgentCircuitManager circuitManager);
143
144 } 143 }
145} 144} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 584b80c..e5965cb 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -32,13 +32,10 @@ using System.Net.Sockets;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework;
36using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
37using OpenSim.Framework.Interfaces;
38 36
39namespace OpenSim.Region.ClientStack 37namespace OpenSim.Region.ClientStack
40{ 38{
41
42 public class UDPServer : ClientStackNetworkHandler 39 public class UDPServer : ClientStackNetworkHandler
43 { 40 {
44 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 41 protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
@@ -59,22 +56,16 @@ namespace OpenSim.Region.ClientStack
59 56
60 public PacketServer PacketServer 57 public PacketServer PacketServer
61 { 58 {
62 get 59 get { return m_packetServer; }
63 { 60 set { m_packetServer = value; }
64 return m_packetServer;
65 }
66 set
67 {
68 m_packetServer = value;
69 }
70 } 61 }
71 62
72 public IScene LocalScene 63 public IScene LocalScene
73 { 64 {
74 set 65 set
75 { 66 {
76 this.m_localScene = value; 67 m_localScene = value;
77 this.m_packetServer.LocalScene = this.m_localScene; 68 m_packetServer.LocalScene = m_localScene;
78 } 69 }
79 } 70 }
80 71
@@ -85,10 +76,10 @@ namespace OpenSim.Region.ClientStack
85 public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) 76 public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass)
86 { 77 {
87 listenPort = port; 78 listenPort = port;
88 this.m_assetCache = assetCache; 79 m_assetCache = assetCache;
89 this.m_log = console; 80 m_log = console;
90 this.m_authenticateSessionsClass = authenticateClass; 81 m_authenticateSessionsClass = authenticateClass;
91 this.CreatePacketServer(); 82 CreatePacketServer();
92 } 83 }
93 84
94 protected virtual void CreatePacketServer() 85 protected virtual void CreatePacketServer()
@@ -99,7 +90,7 @@ namespace OpenSim.Region.ClientStack
99 protected virtual void OnReceivedData(IAsyncResult result) 90 protected virtual void OnReceivedData(IAsyncResult result)
100 { 91 {
101 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 92 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
102 epSender = (EndPoint)ipeSender; 93 epSender = (EndPoint) ipeSender;
103 Packet packet = null; 94 Packet packet = null;
104 95
105 int numBytes; 96 int numBytes;
@@ -108,7 +99,7 @@ namespace OpenSim.Region.ClientStack
108 { 99 {
109 numBytes = Server.EndReceiveFrom(result, ref epSender); 100 numBytes = Server.EndReceiveFrom(result, ref epSender);
110 } 101 }
111 catch (System.Net.Sockets.SocketException e) 102 catch (SocketException e)
112 { 103 {
113 // TODO : Actually only handle those states that we have control over, re-throw everything else, 104 // TODO : Actually only handle those states that we have control over, re-throw everything else,
114 // TODO: implement cases as we encounter them. 105 // TODO: implement cases as we encounter them.
@@ -134,7 +125,7 @@ namespace OpenSim.Region.ClientStack
134 if (clientCircuits.TryGetValue(epSender, out circuit)) 125 if (clientCircuits.TryGetValue(epSender, out circuit))
135 { 126 {
136 //if so then send packet to the packetserver 127 //if so then send packet to the packetserver
137 this.m_packetServer.InPacket(circuit, packet); 128 m_packetServer.InPacket(circuit, packet);
138 } 129 }
139 else if (packet.Type == PacketType.UseCircuitCode) 130 else if (packet.Type == PacketType.UseCircuitCode)
140 { 131 {
@@ -142,7 +133,8 @@ namespace OpenSim.Region.ClientStack
142 AddNewClient(packet); 133 AddNewClient(packet);
143 } 134 }
144 else 135 else
145 { // invalid client 136 {
137 // invalid client
146 m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); 138 m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString());
147 } 139 }
148 140
@@ -160,10 +152,10 @@ namespace OpenSim.Region.ClientStack
160 152
161 protected virtual void AddNewClient(Packet packet) 153 protected virtual void AddNewClient(Packet packet)
162 { 154 {
163 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 155 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
164 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 156 clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
165 157
166 this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); 158 PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass);
167 } 159 }
168 160
169 public void ServerListener() 161 public void ServerListener()
@@ -177,24 +169,24 @@ namespace OpenSim.Region.ClientStack
177 m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); 169 m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen");
178 170
179 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 171 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
180 epSender = (EndPoint)ipeSender; 172 epSender = (EndPoint) ipeSender;
181 ReceivedData = new AsyncCallback(this.OnReceivedData); 173 ReceivedData = new AsyncCallback(OnReceivedData);
182 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 174 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
183 175
184 m_log.Status("SERVER", "Listening..."); 176 m_log.Status("SERVER", "Listening...");
185
186 } 177 }
187 178
188 public virtual void RegisterPacketServer(PacketServer server) 179 public virtual void RegisterPacketServer(PacketServer server)
189 { 180 {
190 this.m_packetServer = server; 181 m_packetServer = server;
191 } 182 }
192 183
193 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) 184 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
185 //EndPoint packetSender)
194 { 186 {
195 // find the endpoint for this circuit 187 // find the endpoint for this circuit
196 EndPoint sendto = null; 188 EndPoint sendto = null;
197 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) 189 foreach (KeyValuePair<EndPoint, uint> p in clientCircuits)
198 { 190 {
199 if (p.Value == circuitcode) 191 if (p.Value == circuitcode)
200 { 192 {
@@ -205,22 +197,20 @@ namespace OpenSim.Region.ClientStack
205 if (sendto != null) 197 if (sendto != null)
206 { 198 {
207 //we found the endpoint so send the packet to it 199 //we found the endpoint so send the packet to it
208 this.Server.SendTo(buffer, size, flags, sendto); 200 Server.SendTo(buffer, size, flags, sendto);
209 } 201 }
210 } 202 }
211 203
212 public virtual void RemoveClientCircuit(uint circuitcode) 204 public virtual void RemoveClientCircuit(uint circuitcode)
213 { 205 {
214 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) 206 foreach (KeyValuePair<EndPoint, uint> p in clientCircuits)
215 { 207 {
216 if (p.Value == circuitcode) 208 if (p.Value == circuitcode)
217 { 209 {
218 this.clientCircuits.Remove(p.Key); 210 clientCircuits.Remove(p.Key);
219 break; 211 break;
220 } 212 }
221 } 213 }
222 } 214 }
223
224
225 } 215 }
226} \ No newline at end of file 216} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index ef5150f..eac293e 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -25,32 +25,30 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework;
28using OpenSim.Framework.Communications; 29using OpenSim.Framework.Communications;
29using OpenSim.Framework.Communications.Cache; 30using OpenSim.Framework.Communications.Cache;
30using OpenSim.Framework.Interfaces; 31using OpenSim.Framework.Interfaces;
31using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
32using OpenSim.Framework;
33 33
34namespace OpenSim.Region.Communications.Local 34namespace OpenSim.Region.Communications.Local
35{ 35{
36 public class CommunicationsLocal : CommunicationsManager 36 public class CommunicationsLocal : CommunicationsManager
37 { 37 {
38 public CommunicationsLocal( 38 public CommunicationsLocal(
39 NetworkServersInfo serversInfo, 39 NetworkServersInfo serversInfo,
40 BaseHttpServer httpServer, 40 BaseHttpServer httpServer,
41 AssetCache assetCache, 41 AssetCache assetCache,
42 IUserService userService, 42 IUserService userService,
43 LocalInventoryService inventoryService, 43 LocalInventoryService inventoryService,
44 IInterRegionCommunications interRegionService, 44 IInterRegionCommunications interRegionService,
45 IGridServices gridService, bool dumpAssetsToFile ) 45 IGridServices gridService, bool dumpAssetsToFile)
46 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile) 46 : base(serversInfo, httpServer, assetCache, dumpAssetsToFile)
47 { 47 {
48 m_inventoryService = inventoryService; 48 m_inventoryService = inventoryService;
49 m_userService = userService; 49 m_userService = userService;
50 m_gridService = gridService; 50 m_gridService = gridService;
51 m_interRegion = interRegionService; 51 m_interRegion = interRegionService;
52
53 } 52 }
54
55 } 53 }
56} 54} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 99c4bc3..3a0b47f 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -25,25 +25,25 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
32using OpenSim.Framework;
33using System.Collections;
34 33
35namespace OpenSim.Region.Communications.Local 34namespace OpenSim.Region.Communications.Local
36{ 35{
37
38 public class LocalBackEndServices : IGridServices, IInterRegionCommunications 36 public class LocalBackEndServices : IGridServices, IInterRegionCommunications
39 { 37 {
40 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>(); 38 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
41 protected Dictionary<ulong, RegionCommsListener> m_regionListeners = new Dictionary<ulong, RegionCommsListener>(); 39
40 protected Dictionary<ulong, RegionCommsListener> m_regionListeners =
41 new Dictionary<ulong, RegionCommsListener>();
42
42 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>(); 43 private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
43 44
44 public LocalBackEndServices() 45 public LocalBackEndServices()
45 { 46 {
46
47 } 47 }
48 48
49 /// <summary> 49 /// <summary>
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Communications.Local
54 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 54 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
55 { 55 {
56 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); 56 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
57 if (!this.m_regions.ContainsKey((uint)regionInfo.RegionHandle)) 57 if (!m_regions.ContainsKey((uint) regionInfo.RegionHandle))
58 { 58 {
59 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); 59 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
60 this.m_regions.Add(regionInfo.RegionHandle, regionInfo); 60 m_regions.Add(regionInfo.RegionHandle, regionInfo);
61 61
62 RegionCommsListener regionHost = new RegionCommsListener(); 62 RegionCommsListener regionHost = new RegionCommsListener();
63 this.m_regionListeners.Add(regionInfo.RegionHandle, regionHost); 63 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
64 64
65 return regionHost; 65 return regionHost;
66 } 66 }
@@ -103,9 +103,9 @@ namespace OpenSim.Region.Communications.Local
103 /// <returns></returns> 103 /// <returns></returns>
104 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 104 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
105 { 105 {
106 if (this.m_regions.ContainsKey(regionHandle)) 106 if (m_regions.ContainsKey(regionHandle))
107 { 107 {
108 return this.m_regions[regionHandle]; 108 return m_regions[regionHandle];
109 } 109 }
110 return null; 110 return null;
111 } 111 }
@@ -121,16 +121,18 @@ namespace OpenSim.Region.Communications.Local
121 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 121 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
122 { 122 {
123 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 123 List<MapBlockData> mapBlocks = new List<MapBlockData>();
124 foreach (RegionInfo regInfo in this.m_regions.Values) 124 foreach (RegionInfo regInfo in m_regions.Values)
125 { 125 {
126 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) 126 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
127 ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
127 { 128 {
128 MapBlockData map = new MapBlockData(); 129 MapBlockData map = new MapBlockData();
129 map.Name = regInfo.RegionName; 130 map.Name = regInfo.RegionName;
130 map.X = (ushort)regInfo.RegionLocX; 131 map.X = (ushort) regInfo.RegionLocX;
131 map.Y = (ushort)regInfo.RegionLocY; 132 map.Y = (ushort) regInfo.RegionLocY;
132 map.WaterHeight = (byte)regInfo.EstateSettings.waterHeight; 133 map.WaterHeight = (byte) regInfo.EstateSettings.waterHeight;
133 map.MapImageId = regInfo.EstateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007"); 134 map.MapImageId = regInfo.EstateSettings.terrainImageID;
135 //new LLUUID("00000000-0000-0000-9999-000000000007");
134 map.Agents = 1; 136 map.Agents = 1;
135 map.RegionFlags = 72458694; 137 map.RegionFlags = 72458694;
136 map.Access = 13; 138 map.Access = 13;
@@ -145,13 +147,14 @@ namespace OpenSim.Region.Communications.Local
145 /// <param name="regionHandle"></param> 147 /// <param name="regionHandle"></param>
146 /// <param name="agentData"></param> 148 /// <param name="agentData"></param>
147 /// <returns></returns> 149 /// <returns></returns>
148 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData 150 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
151 //should change from agentCircuitData
149 { 152 {
150 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); 153 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
151 if (this.m_regionListeners.ContainsKey(regionHandle)) 154 if (m_regionListeners.ContainsKey(regionHandle))
152 { 155 {
153 // Console.WriteLine("CommsManager- Informing a region to expect child agent"); 156 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
154 this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData); 157 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
155 return true; 158 return true;
156 } 159 }
157 return false; 160 return false;
@@ -166,10 +169,10 @@ namespace OpenSim.Region.Communications.Local
166 /// <returns></returns> 169 /// <returns></returns>
167 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 170 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
168 { 171 {
169 if (this.m_regionListeners.ContainsKey(regionHandle)) 172 if (m_regionListeners.ContainsKey(regionHandle))
170 { 173 {
171 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); 174 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
172 this.m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 175 m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
173 return true; 176 return true;
174 } 177 }
175 return false; 178 return false;
@@ -177,7 +180,7 @@ namespace OpenSim.Region.Communications.Local
177 180
178 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) 181 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
179 { 182 {
180 if (this.m_regionListeners.ContainsKey(regionHandle)) 183 if (m_regionListeners.ContainsKey(regionHandle))
181 { 184 {
182 return true; 185 return true;
183 } 186 }
@@ -210,15 +213,15 @@ namespace OpenSim.Region.Communications.Local
210 213
211 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) 214 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
212 { 215 {
213 if (this.m_regionListeners.ContainsKey(regionHandle)) 216 if (m_regionListeners.ContainsKey(regionHandle))
214 { 217 {
215 this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent); 218 m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
216 } 219 }
217 } 220 }
218 221
219 public void PingCheckReply(Hashtable respData) 222 public void PingCheckReply(Hashtable respData)
220 { 223 {
221 foreach (ulong region in this.m_regions.Keys) 224 foreach (ulong region in m_regions.Keys)
222 { 225 {
223 Hashtable regData = new Hashtable(); 226 Hashtable regData = new Hashtable();
224 RegionInfo reg = m_regions[region]; 227 RegionInfo reg = m_regions[region];
@@ -234,7 +237,7 @@ namespace OpenSim.Region.Communications.Local
234 if (m_regionListeners.ContainsKey(regionHandle)) 237 if (m_regionListeners.ContainsKey(regionHandle))
235 { 238 {
236 return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, 239 return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position,
237 isFlying); 240 isFlying);
238 } 241 }
239 242
240 return false; 243 return false;
@@ -250,11 +253,5 @@ namespace OpenSim.Region.Communications.Local
250 253
251 return false; 254 return false;
252 } 255 }
253
254
255
256 } 256 }
257} 257} \ No newline at end of file
258
259
260
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index b7d78bc..c38e922 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -28,29 +28,28 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
32using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework;
34 34
35namespace OpenSim.Region.Communications.Local 35namespace OpenSim.Region.Communications.Local
36{ 36{
37 public class LocalInventoryService : InventoryServiceBase 37 public class LocalInventoryService : InventoryServiceBase
38 { 38 {
39
40 public LocalInventoryService() 39 public LocalInventoryService()
41 { 40 {
42
43 } 41 }
44 42
45 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) 43 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
44 InventoryItemInfo itemCallBack)
46 { 45 {
47 List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); 46 List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
48 InventoryFolderImpl rootFolder = null; 47 InventoryFolderImpl rootFolder = null;
49 48
50 //need to make sure we send root folder first 49 //need to make sure we send root folder first
51 foreach (InventoryFolderBase folder in folders) 50 foreach (InventoryFolderBase folder in folders)
52 { 51 {
53 if (folder.parentID == libsecondlife.LLUUID.Zero) 52 if (folder.parentID == LLUUID.Zero)
54 { 53 {
55 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); 54 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
56 rootFolder = newfolder; 55 rootFolder = newfolder;
@@ -67,7 +66,7 @@ namespace OpenSim.Region.Communications.Local
67 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); 66 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
68 folderCallBack(userID, newfolder); 67 folderCallBack(userID, newfolder);
69 68
70 List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); 69 List<InventoryItemBase> items = RequestFolderItems(newfolder.folderID);
71 foreach (InventoryItemBase item in items) 70 foreach (InventoryItemBase item in items)
72 { 71 {
73 itemCallBack(userID, item); 72 itemCallBack(userID, item);
@@ -79,17 +78,17 @@ namespace OpenSim.Region.Communications.Local
79 78
80 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) 79 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
81 { 80 {
82 this.AddFolder(folder); 81 AddFolder(folder);
83 } 82 }
84 83
85 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 84 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
86 { 85 {
87 this.AddItem(item); 86 AddItem(item);
88 } 87 }
89 88
90 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 89 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
91 { 90 {
92 this.deleteItem(item); 91 deleteItem(item);
93 } 92 }
94 } 93 }
95} 94} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 1043683..aa1a0d9 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -30,9 +30,9 @@ using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Communications;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.UserManagement; 34using OpenSim.Framework.UserManagement;
35using InventoryFolder=OpenSim.Framework.InventoryFolder;
36 36
37namespace OpenSim.Region.Communications.Local 37namespace OpenSim.Region.Communications.Local
38{ 38{
@@ -49,23 +49,23 @@ namespace OpenSim.Region.Communications.Local
49 49
50 public event LoginToRegionEvent OnLoginToRegion; 50 public event LoginToRegionEvent OnLoginToRegion;
51 51
52 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) 52 public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent,
53 NetworkServersInfo serversInfo, bool authenticate)
53 : base(userManager, welcomeMess) 54 : base(userManager, welcomeMess)
54 { 55 {
55 m_Parent = parent; 56 m_Parent = parent;
56 this.serversInfo = serversInfo; 57 this.serversInfo = serversInfo;
57 defaultHomeX = this.serversInfo.DefaultHomeLocX; 58 defaultHomeX = this.serversInfo.DefaultHomeLocX;
58 defaultHomeY = this.serversInfo.DefaultHomeLocY; 59 defaultHomeY = this.serversInfo.DefaultHomeLocY;
59 this.authUsers = authenticate; 60 authUsers = authenticate;
60 } 61 }
61 62
62 63
63 public override UserProfileData GetTheUser(string firstname, string lastname) 64 public override UserProfileData GetTheUser(string firstname, string lastname)
64 { 65 {
65 UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); 66 UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
66 if (profile != null) 67 if (profile != null)
67 { 68 {
68
69 return profile; 69 return profile;
70 } 70 }
71 71
@@ -73,9 +73,9 @@ namespace OpenSim.Region.Communications.Local
73 { 73 {
74 //no current user account so make one 74 //no current user account so make one
75 Console.WriteLine("No User account found so creating a new one "); 75 Console.WriteLine("No User account found so creating a new one ");
76 this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 76 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
77 77
78 profile = this.m_userManager.GetUserProfile(firstname, lastname); 78 profile = m_userManager.GetUserProfile(firstname, lastname);
79 if (profile != null) 79 if (profile != null)
80 { 80 {
81 m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); 81 m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
@@ -113,18 +113,22 @@ namespace OpenSim.Region.Communications.Local
113 113
114 if (reg != null) 114 if (reg != null)
115 { 115 {
116 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + 116 response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" +
117 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 117 (reg.RegionLocY*256).ToString() + "], " +
118 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 118 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
119 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
120 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
121 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
119 string capsPath = Util.GetRandomCapsPath(); 122 string capsPath = Util.GetRandomCapsPath();
120 response.SimAddress = reg.ExternalEndPoint.Address.ToString(); 123 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
121 response.SimPort = (Int32)reg.ExternalEndPoint.Port; 124 response.SimPort = (Int32) reg.ExternalEndPoint.Port;
122 response.RegionX = reg.RegionLocX; 125 response.RegionX = reg.RegionLocX;
123 response.RegionY = reg.RegionLocY; 126 response.RegionY = reg.RegionLocY;
124
125 127
126 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; 128
127 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; 129 response.SeedCapability = "http://" + reg.ExternalHostName + ":" +
130 serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
131 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
128 theUser.currentAgent.currentRegion = reg.RegionID; 132 theUser.currentAgent.currentRegion = reg.RegionID;
129 theUser.currentAgent.currentHandle = reg.RegionHandle; 133 theUser.currentAgent.currentHandle = reg.RegionHandle;
130 134
@@ -135,11 +139,11 @@ namespace OpenSim.Region.Communications.Local
135 _login.Agent = response.AgentID; 139 _login.Agent = response.AgentID;
136 _login.Session = response.SessionID; 140 _login.Session = response.SessionID;
137 _login.SecureSession = response.SecureSessionID; 141 _login.SecureSession = response.SecureSessionID;
138 _login.CircuitCode = (uint)response.CircuitCode; 142 _login.CircuitCode = (uint) response.CircuitCode;
139 _login.StartPos = new LLVector3(128, 128, 70); 143 _login.StartPos = new LLVector3(128, 128, 70);
140 _login.CapsPath = capsPath; 144 _login.CapsPath = capsPath;
141 145
142 if( OnLoginToRegion != null ) 146 if (OnLoginToRegion != null)
143 { 147 {
144 OnLoginToRegion(currentRegion, _login); 148 OnLoginToRegion(currentRegion, _login);
145 } 149 }
@@ -148,7 +152,6 @@ namespace OpenSim.Region.Communications.Local
148 { 152 {
149 Console.WriteLine("not found region " + currentRegion); 153 Console.WriteLine("not found region " + currentRegion);
150 } 154 }
151
152 } 155 }
153 156
154 protected override InventoryData CreateInventoryData(LLUUID userID) 157 protected override InventoryData CreateInventoryData(LLUUID userID)
@@ -168,8 +171,8 @@ namespace OpenSim.Region.Communications.Local
168 TempHash = new Hashtable(); 171 TempHash = new Hashtable();
169 TempHash["name"] = InvFolder.name; 172 TempHash["name"] = InvFolder.name;
170 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); 173 TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
171 TempHash["version"] = (Int32)InvFolder.version; 174 TempHash["version"] = (Int32) InvFolder.version;
172 TempHash["type_default"] = (Int32)InvFolder.type; 175 TempHash["type_default"] = (Int32) InvFolder.type;
173 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); 176 TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
174 AgentInventoryArray.Add(TempHash); 177 AgentInventoryArray.Add(TempHash);
175 } 178 }
@@ -182,13 +185,13 @@ namespace OpenSim.Region.Communications.Local
182 185
183 ArrayList AgentInventoryArray = new ArrayList(); 186 ArrayList AgentInventoryArray = new ArrayList();
184 Hashtable TempHash; 187 Hashtable TempHash;
185 foreach (OpenSim.Framework.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) 188 foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
186 { 189 {
187 TempHash = new Hashtable(); 190 TempHash = new Hashtable();
188 TempHash["name"] = InvFolder.FolderName; 191 TempHash["name"] = InvFolder.FolderName;
189 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 192 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
190 TempHash["version"] = (Int32)InvFolder.Version; 193 TempHash["version"] = (Int32) InvFolder.Version;
191 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 194 TempHash["type_default"] = (Int32) InvFolder.DefaultType;
192 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 195 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
193 AgentInventoryArray.Add(TempHash); 196 AgentInventoryArray.Add(TempHash);
194 } 197 }
@@ -197,4 +200,4 @@ namespace OpenSim.Region.Communications.Local
197 } 200 }
198 } 201 }
199 } 202 }
200} 203} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 1dede97..a7687c7 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -27,8 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using OpenSim.Framework.Communications;
31using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications;
32using OpenSim.Framework.UserManagement; 32using OpenSim.Framework.UserManagement;
33 33
34namespace OpenSim.Region.Communications.Local 34namespace OpenSim.Region.Communications.Local
@@ -41,7 +41,8 @@ namespace OpenSim.Region.Communications.Local
41 private IInventoryServices m_inventoryService; 41 private IInventoryServices m_inventoryService;
42 42
43 43
44 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, IInventoryServices inventoryService) 44 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
45 IInventoryServices inventoryService)
45 { 46 {
46 m_serversInfo = serversInfo; 47 m_serversInfo = serversInfo;
47 48
@@ -49,7 +50,6 @@ namespace OpenSim.Region.Communications.Local
49 m_defaultHomeY = defaultHomeLocY; 50 m_defaultHomeY = defaultHomeLocY;
50 51
51 m_inventoryService = inventoryService; 52 m_inventoryService = inventoryService;
52
53 } 53 }
54 54
55 public override UserProfileData SetupMasterUser(string firstName, string lastName) 55 public override UserProfileData SetupMasterUser(string firstName, string lastName)
@@ -82,4 +82,4 @@ namespace OpenSim.Region.Communications.Local
82 return profile; 82 return profile;
83 } 83 }
84 } 84 }
85} 85} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
index ca64319..481577e 100644
--- a/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Communications/Local/Properties/AssemblyInfo.cs
@@ -1,24 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Region.Communications.Local")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Region.Communications.Local")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Region.Communications.Local")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Region.Communications.Local")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")] 24
25[assembly : Guid("fb173926-bd0a-4cd0-bb45-185b2f72ddfb")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 1807cc7..941cc30 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -26,17 +26,17 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework;
29using OpenSim.Framework.Communications; 30using OpenSim.Framework.Communications;
30using OpenSim.Framework.Communications.Cache; 31using OpenSim.Framework.Communications.Cache;
31using OpenSim.Framework;
32using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
33 33
34
35namespace OpenSim.Region.Communications.OGS1 34namespace OpenSim.Region.Communications.OGS1
36{ 35{
37 public class CommunicationsOGS1 : CommunicationsManager 36 public class CommunicationsOGS1 : CommunicationsManager
38 { 37 {
39 public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) :base(serversInfo, httpServer, assetCache, false) 38 public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
39 : base(serversInfo, httpServer, assetCache, false)
40 { 40 {
41 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); 41 OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
42 m_gridService = gridInterComms; 42 m_gridService = gridInterComms;
@@ -46,4 +46,4 @@ namespace OpenSim.Region.Communications.OGS1
46 m_userService = new OGS1UserServices(this); 46 m_userService = new OGS1UserServices(this);
47 } 47 }
48 } 48 }
49} 49} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 3719c97..d9af95b 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -35,14 +35,12 @@ using System.Runtime.Remoting;
35using System.Runtime.Remoting.Channels; 35using System.Runtime.Remoting.Channels;
36using System.Runtime.Remoting.Channels.Tcp; 36using System.Runtime.Remoting.Channels.Tcp;
37using System.Security.Authentication; 37using System.Security.Authentication;
38
39using libsecondlife; 38using libsecondlife;
40using Nwc.XmlRpc; 39using Nwc.XmlRpc;
41using OpenSim.Framework; 40using OpenSim.Framework;
42using OpenSim.Framework.Communications; 41using OpenSim.Framework.Communications;
43using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
44using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
45using OpenSim.Framework;
46using OpenSim.Region.Communications.Local; 44using OpenSim.Region.Communications.Local;
47 45
48namespace OpenSim.Region.Communications.OGS1 46namespace OpenSim.Region.Communications.OGS1
@@ -65,10 +63,10 @@ namespace OpenSim.Region.Communications.OGS1
65 { 63 {
66 serversInfo = servers_info; 64 serversInfo = servers_info;
67 httpServer = httpServe; 65 httpServer = httpServe;
68 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); 66 httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
69 httpServer.AddXmlRPCHandler("check", this.PingCheckReply); 67 httpServer.AddXmlRPCHandler("check", PingCheckReply);
70 68
71 this.StartRemoting(); 69 StartRemoting();
72 } 70 }
73 71
74 /// <summary> 72 /// <summary>
@@ -99,14 +97,14 @@ namespace OpenSim.Region.Communications.OGS1
99 // Send Request 97 // Send Request
100 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); 98 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
101 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000); 99 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 10000);
102 Hashtable GridRespData = (Hashtable)GridResp.Value; 100 Hashtable GridRespData = (Hashtable) GridResp.Value;
103 101
104 Hashtable griddatahash = GridRespData; 102 Hashtable griddatahash = GridRespData;
105 103
106 // Process Response 104 // Process Response
107 if (GridRespData.ContainsKey("error")) 105 if (GridRespData.ContainsKey("error"))
108 { 106 {
109 string errorstring = (string)GridRespData["error"]; 107 string errorstring = (string) GridRespData["error"];
110 MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 108 MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
111 return null; 109 return null;
112 } 110 }
@@ -121,8 +119,7 @@ namespace OpenSim.Region.Communications.OGS1
121 /// <returns></returns> 119 /// <returns></returns>
122 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) 120 public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y)
123 { 121 {
124 122 Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1);
125 Hashtable respData = MapBlockQuery((int)x - 1, (int)y - 1, (int)x + 1, (int)y + 1);
126 123
127 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 124 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
128 125
@@ -134,16 +131,15 @@ namespace OpenSim.Region.Communications.OGS1
134 uint regY = Convert.ToUInt32(neighbourData["y"]); 131 uint regY = Convert.ToUInt32(neighbourData["y"]);
135 if ((x != regX) || (y != regY)) 132 if ((x != regX) || (y != regY))
136 { 133 {
137 134 string simIp = (string) neighbourData["sim_ip"];
138 string simIp = (string)neighbourData["sim_ip"];
139 135
140 int port = Convert.ToInt32(neighbourData["sim_port"]); 136 int port = Convert.ToInt32(neighbourData["sim_port"]);
141 string externalUri = (string)neighbourData["sim_uri"]; 137 string externalUri = (string) neighbourData["sim_uri"];
142 138
143 string externalIpStr = OpenSim.Framework.Util.GetHostFromDNS(simIp).ToString(); 139 string externalIpStr = Util.GetHostFromDNS(simIp).ToString();
144 SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); 140 SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
145 sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); 141 sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
146 sri.RegionID = new LLUUID((string)neighbourData["uuid"]); 142 sri.RegionID = new LLUUID((string) neighbourData["uuid"]);
147 143
148 neighbours.Add(sri); 144 neighbours.Add(sri);
149 } 145 }
@@ -175,11 +171,11 @@ namespace OpenSim.Region.Communications.OGS1
175 { 171 {
176 Hashtable requestData = new Hashtable(); 172 Hashtable requestData = new Hashtable();
177 requestData["region_handle"] = regionHandle.ToString(); 173 requestData["region_handle"] = regionHandle.ToString();
178 requestData["authkey"] = this.serversInfo.GridSendKey; 174 requestData["authkey"] = serversInfo.GridSendKey;
179 ArrayList SendParams = new ArrayList(); 175 ArrayList SendParams = new ArrayList();
180 SendParams.Add(requestData); 176 SendParams.Add(requestData);
181 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 177 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
182 XmlRpcResponse GridResp = GridReq.Send(this.serversInfo.GridURL, 3000); 178 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
183 179
184 Hashtable responseData = (Hashtable) GridResp.Value; 180 Hashtable responseData = (Hashtable) GridResp.Value;
185 181
@@ -205,7 +201,7 @@ namespace OpenSim.Region.Communications.OGS1
205 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); 201 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
206 regionInfo.RegionName = (string) responseData["region_name"]; 202 regionInfo.RegionName = (string) responseData["region_name"];
207 203
208 m_remoteRegionInfoCache.Add( regionHandle, regionInfo ); 204 m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
209 } 205 }
210 206
211 return regionInfo; 207 return regionInfo;
@@ -234,11 +230,11 @@ namespace OpenSim.Region.Communications.OGS1
234 neighbour.X = Convert.ToUInt16(n["x"]); 230 neighbour.X = Convert.ToUInt16(n["x"]);
235 neighbour.Y = Convert.ToUInt16(n["y"]); 231 neighbour.Y = Convert.ToUInt16(n["y"]);
236 232
237 neighbour.Name = (string)n["name"]; 233 neighbour.Name = (string) n["name"];
238 neighbour.Access = Convert.ToByte(n["access"]); 234 neighbour.Access = Convert.ToByte(n["access"]);
239 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]); 235 neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
240 neighbour.WaterHeight = Convert.ToByte(n["water-height"]); 236 neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
241 neighbour.MapImageId = new LLUUID((string)n["map-image-id"]); 237 neighbour.MapImageId = new LLUUID((string) n["map-image-id"]);
242 238
243 neighbours.Add(neighbour); 239 neighbours.Add(neighbour);
244 } 240 }
@@ -267,7 +263,7 @@ namespace OpenSim.Region.Communications.OGS1
267 parameters.Add(param); 263 parameters.Add(param);
268 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); 264 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
269 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000); 265 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000);
270 Hashtable respData = (Hashtable)resp.Value; 266 Hashtable respData = (Hashtable) resp.Value;
271 return respData; 267 return respData;
272 } 268 }
273 269
@@ -300,15 +296,15 @@ namespace OpenSim.Region.Communications.OGS1
300 public XmlRpcResponse ExpectUser(XmlRpcRequest request) 296 public XmlRpcResponse ExpectUser(XmlRpcRequest request)
301 { 297 {
302 Console.WriteLine("Expecting User..."); 298 Console.WriteLine("Expecting User...");
303 Hashtable requestData = (Hashtable)request.Params[0]; 299 Hashtable requestData = (Hashtable) request.Params[0];
304 AgentCircuitData agentData = new AgentCircuitData(); 300 AgentCircuitData agentData = new AgentCircuitData();
305 agentData.SessionID = new LLUUID((string)requestData["session_id"]); 301 agentData.SessionID = new LLUUID((string) requestData["session_id"]);
306 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 302 agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]);
307 agentData.firstname = (string)requestData["firstname"]; 303 agentData.firstname = (string) requestData["firstname"];
308 agentData.lastname = (string)requestData["lastname"]; 304 agentData.lastname = (string) requestData["lastname"];
309 agentData.AgentID = new LLUUID((string)requestData["agent_id"]); 305 agentData.AgentID = new LLUUID((string) requestData["agent_id"]);
310 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 306 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
311 agentData.CapsPath = (string)requestData["caps_path"]; 307 agentData.CapsPath = (string) requestData["caps_path"];
312 308
313 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 309 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
314 { 310 {
@@ -316,12 +312,14 @@ namespace OpenSim.Region.Communications.OGS1
316 } 312 }
317 else 313 else
318 { 314 {
319 agentData.startpos = new LLVector3(Convert.ToUInt32(requestData["startpos_x"]), Convert.ToUInt32(requestData["startpos_y"]), Convert.ToUInt32(requestData["startpos_z"])); 315 agentData.startpos =
316 new LLVector3(Convert.ToUInt32(requestData["startpos_x"]),
317 Convert.ToUInt32(requestData["startpos_y"]),
318 Convert.ToUInt32(requestData["startpos_z"]));
320 agentData.child = false; 319 agentData.child = false;
321
322 } 320 }
323 321
324 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 322 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
325 323
326 m_localBackend.TriggerExpectUser(regionHandle, agentData); 324 m_localBackend.TriggerExpectUser(regionHandle, agentData);
327 325
@@ -331,6 +329,7 @@ namespace OpenSim.Region.Communications.OGS1
331 } 329 }
332 330
333 #region m_interRegion Comms 331 #region m_interRegion Comms
332
334 /// <summary> 333 /// <summary>
335 /// 334 ///
336 /// </summary> 335 /// </summary>
@@ -339,13 +338,16 @@ namespace OpenSim.Region.Communications.OGS1
339 TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort); 338 TcpChannel ch = new TcpChannel(NetworkServersInfo.RemotingListenerPort);
340 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this. 339 ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesnt support this.
341 340
342 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); 341 WellKnownServiceTypeEntry wellType =
342 new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions",
343 WellKnownObjectMode.Singleton);
343 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 344 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
344 InterRegionSingleton.Instance.OnArrival += this.TriggerExpectAvatarCrossing; 345 InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing;
345 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; 346 InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
346 } 347 }
347 348
348 #region Methods called by regions in this instance 349 #region Methods called by regions in this instance
350
349 /// <summary> 351 /// <summary>
350 /// 352 ///
351 /// </summary> 353 /// </summary>
@@ -361,17 +363,19 @@ namespace OpenSim.Region.Communications.OGS1
361 return true; 363 return true;
362 } 364 }
363 365
364 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 366 RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
365 if (regInfo != null) 367 if (regInfo != null)
366 { 368 {
367 //don't want to be creating a new link to the remote instance every time like we are here 369 //don't want to be creating a new link to the remote instance every time like we are here
368 bool retValue = false; 370 bool retValue = false;
369 371
370 372
371 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 373 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
372 typeof(OGS1InterRegionRemoting), 374 typeof (OGS1InterRegionRemoting),
373 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 375 "tcp://" + regInfo.RemotingAddress +
374 376 ":" + regInfo.RemotingPort +
377 "/InterRegions");
378
375 if (remObject != null) 379 if (remObject != null)
376 { 380 {
377 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); 381 retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
@@ -388,7 +392,7 @@ namespace OpenSim.Region.Communications.OGS1
388 392
389 return false; 393 return false;
390 } 394 }
391 catch (System.Runtime.Remoting.RemotingException e) 395 catch (RemotingException e)
392 { 396 {
393 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 397 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
394 return false; 398 return false;
@@ -432,13 +436,15 @@ namespace OpenSim.Region.Communications.OGS1
432 return true; 436 return true;
433 } 437 }
434 438
435 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 439 RegionInfo regInfo = RequestNeighbourInfo(regionHandle);
436 if (regInfo != null) 440 if (regInfo != null)
437 { 441 {
438 bool retValue = false; 442 bool retValue = false;
439 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 443 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
440 typeof(OGS1InterRegionRemoting), 444 typeof (OGS1InterRegionRemoting),
441 "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); 445 "tcp://" + regInfo.RemotingAddress +
446 ":" + regInfo.RemotingPort +
447 "/InterRegions");
442 if (remObject != null) 448 if (remObject != null)
443 { 449 {
444 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 450 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
@@ -455,7 +461,7 @@ namespace OpenSim.Region.Communications.OGS1
455 // to inform it. 461 // to inform it.
456 return false; 462 return false;
457 } 463 }
458 catch (System.Runtime.Remoting.RemotingException e) 464 catch (RemotingException e)
459 { 465 {
460 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 466 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
461 return false; 467 return false;
@@ -474,6 +480,7 @@ namespace OpenSim.Region.Communications.OGS1
474 #endregion 480 #endregion
475 481
476 #region Methods triggered by calls from external instances 482 #region Methods triggered by calls from external instances
483
477 /// <summary> 484 /// <summary>
478 /// 485 ///
479 /// </summary> 486 /// </summary>
@@ -486,7 +493,7 @@ namespace OpenSim.Region.Communications.OGS1
486 { 493 {
487 return m_localBackend.IncomingChildAgent(regionHandle, agentData); 494 return m_localBackend.IncomingChildAgent(regionHandle, agentData);
488 } 495 }
489 catch (System.Runtime.Remoting.RemotingException e) 496 catch (RemotingException e)
490 { 497 {
491 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 498 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
492 return false; 499 return false;
@@ -502,18 +509,19 @@ namespace OpenSim.Region.Communications.OGS1
502 /// <returns></returns> 509 /// <returns></returns>
503 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 510 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
504 { 511 {
505
506 try 512 try
507 { 513 {
508 return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 514 return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
509 } 515 }
510 catch (System.Runtime.Remoting.RemotingException e) 516 catch (RemotingException e)
511 { 517 {
512 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 518 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
513 return false; 519 return false;
514 } 520 }
515 } 521 }
522
516 #endregion 523 #endregion
524
517 #endregion 525 #endregion
518 } 526 }
519} 527} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index 0b7bd82..a127010 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -27,17 +27,19 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Runtime.Remoting;
30using libsecondlife; 31using libsecondlife;
31using OpenSim.Framework; 32using OpenSim.Framework;
32 33
33namespace OpenSim.Region.Communications.OGS1 34namespace OpenSim.Region.Communications.OGS1
34{ 35{
35 public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); 36 public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
37
36 public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 38 public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
37 39
38 public sealed class InterRegionSingleton 40 public sealed class InterRegionSingleton
39 { 41 {
40 static readonly InterRegionSingleton instance = new InterRegionSingleton(); 42 private static readonly InterRegionSingleton instance = new InterRegionSingleton();
41 43
42 public event InformRegionChild OnChildAgent; 44 public event InformRegionChild OnChildAgent;
43 public event ExpectArrival OnArrival; 45 public event ExpectArrival OnArrival;
@@ -46,16 +48,13 @@ namespace OpenSim.Region.Communications.OGS1
46 { 48 {
47 } 49 }
48 50
49 InterRegionSingleton() 51 private InterRegionSingleton()
50 { 52 {
51 } 53 }
52 54
53 public static InterRegionSingleton Instance 55 public static InterRegionSingleton Instance
54 { 56 {
55 get 57 get { return instance; }
56 {
57 return instance;
58 }
59 } 58 }
60 59
61 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 60 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
@@ -79,7 +78,6 @@ namespace OpenSim.Region.Communications.OGS1
79 78
80 public class OGS1InterRegionRemoting : MarshalByRefObject 79 public class OGS1InterRegionRemoting : MarshalByRefObject
81 { 80 {
82
83 public OGS1InterRegionRemoting() 81 public OGS1InterRegionRemoting()
84 { 82 {
85 } 83 }
@@ -90,7 +88,7 @@ namespace OpenSim.Region.Communications.OGS1
90 { 88 {
91 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); 89 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData);
92 } 90 }
93 catch (System.Runtime.Remoting.RemotingException e) 91 catch (RemotingException e)
94 { 92 {
95 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 93 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
96 return false; 94 return false;
@@ -103,11 +101,11 @@ namespace OpenSim.Region.Communications.OGS1
103 { 101 {
104 return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 102 return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
105 } 103 }
106 catch (System.Runtime.Remoting.RemotingException e) 104 catch (RemotingException e)
107 { 105 {
108 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 106 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
109 return false; 107 return false;
110 } 108 }
111 } 109 }
112 } 110 }
113} 111} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 11dee2d..49fdee9 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -28,46 +28,39 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
32using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework;
34
35 34
36namespace OpenSim.Region.Communications.OGS1 35namespace OpenSim.Region.Communications.OGS1
37{ 36{
38 public class OGS1InventoryService : IInventoryServices 37 public class OGS1InventoryService : IInventoryServices
39 { 38 {
40
41 public OGS1InventoryService() 39 public OGS1InventoryService()
42 { 40 {
43
44 } 41 }
45 42
46 #region IInventoryServices Members 43 #region IInventoryServices Members
47 44
48 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) 45 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
46 InventoryItemInfo itemCallBack)
49 { 47 {
50
51 } 48 }
52 49
53 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) 50 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
54 { 51 {
55
56 } 52 }
57 53
58 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 54 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
59 { 55 {
60
61 } 56 }
62 57
63 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 58 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
64 { 59 {
65
66 } 60 }
67 61
68 public void CreateNewUserInventory(LLUUID user) 62 public void CreateNewUserInventory(LLUUID user)
69 { 63 {
70
71 } 64 }
72 65
73 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) 66 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
@@ -77,4 +70,4 @@ namespace OpenSim.Region.Communications.OGS1
77 70
78 #endregion 71 #endregion
79 } 72 }
80} 73} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 19a3c3b..d00a813 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -28,16 +28,19 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Net;
31using libsecondlife; 32using libsecondlife;
32using Nwc.XmlRpc; 33using Nwc.XmlRpc;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Interfaces;
35 37
36namespace OpenSim.Region.Communications.OGS1 38namespace OpenSim.Region.Communications.OGS1
37{ 39{
38 public class OGS1UserServices :IUserService 40 public class OGS1UserServices : IUserService
39 { 41 {
40 CommunicationsOGS1 m_parent; 42 private CommunicationsOGS1 m_parent;
43
41 public OGS1UserServices(CommunicationsOGS1 parent) 44 public OGS1UserServices(CommunicationsOGS1 parent)
42 { 45 {
43 m_parent = parent; 46 m_parent = parent;
@@ -47,32 +50,41 @@ namespace OpenSim.Region.Communications.OGS1
47 { 50 {
48 if (data.Contains("error_type")) 51 if (data.Contains("error_type"))
49 { 52 {
50 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] + "): " + data["error_desc"]); 53 Console.WriteLine("Error sent by user server when trying to get user profile: (" + data["error_type"] +
54 "): " + data["error_desc"]);
51 return null; 55 return null;
52 } 56 }
53 57
54 UserProfileData userData = new UserProfileData(); 58 UserProfileData userData = new UserProfileData();
55 userData.username = (string)data["firstname"]; 59 userData.username = (string) data["firstname"];
56 userData.surname = (string)data["lastname"]; 60 userData.surname = (string) data["lastname"];
57 userData.UUID = new LLUUID((string)data["uuid"]); 61 userData.UUID = new LLUUID((string) data["uuid"]);
58 userData.userInventoryURI = (string)data["server_inventory"]; 62 userData.userInventoryURI = (string) data["server_inventory"];
59 userData.userAssetURI = (string)data["server_asset"]; 63 userData.userAssetURI = (string) data["server_asset"];
60 userData.profileFirstText = (string)data["profile_firstlife_about"]; 64 userData.profileFirstText = (string) data["profile_firstlife_about"];
61 userData.profileFirstImage = new LLUUID((string)data["profile_firstlife_image"]); 65 userData.profileFirstImage = new LLUUID((string) data["profile_firstlife_image"]);
62 userData.profileCanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); 66 userData.profileCanDoMask = Convert.ToUInt32((string) data["profile_can_do"]);
63 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]); 67 userData.profileWantDoMask = Convert.ToUInt32(data["profile_want_do"]);
64 userData.profileImage = new LLUUID((string)data["profile_image"]); 68 userData.profileImage = new LLUUID((string) data["profile_image"]);
65 userData.lastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); 69 userData.lastLogin = Convert.ToInt32((string) data["profile_lastlogin"]);
66 userData.homeRegion = Convert.ToUInt64((string)data["home_region"]); 70 userData.homeRegion = Convert.ToUInt64((string) data["home_region"]);
67 userData.homeLocation = new LLVector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), (float)Convert.ToDecimal((string)data["home_coordinates_y"]), (float)Convert.ToDecimal((string)data["home_coordinates_z"])); 71 userData.homeLocation =
68 userData.homeLookAt = new LLVector3((float)Convert.ToDecimal((string)data["home_look_x"]), (float)Convert.ToDecimal((string)data["home_look_y"]), (float)Convert.ToDecimal((string)data["home_look_z"])); 72 new LLVector3((float) Convert.ToDecimal((string) data["home_coordinates_x"]),
73 (float) Convert.ToDecimal((string) data["home_coordinates_y"]),
74 (float) Convert.ToDecimal((string) data["home_coordinates_z"]));
75 userData.homeLookAt =
76 new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
77 (float) Convert.ToDecimal((string) data["home_look_y"]),
78 (float) Convert.ToDecimal((string) data["home_look_z"]));
69 79
70 return userData; 80 return userData;
71 } 81 }
82
72 public UserProfileData GetUserProfile(string firstName, string lastName) 83 public UserProfileData GetUserProfile(string firstName, string lastName)
73 { 84 {
74 return GetUserProfile(firstName + " " + lastName); 85 return GetUserProfile(firstName + " " + lastName);
75 } 86 }
87
76 public UserProfileData GetUserProfile(string name) 88 public UserProfileData GetUserProfile(string name)
77 { 89 {
78 try 90 try
@@ -83,16 +95,18 @@ namespace OpenSim.Region.Communications.OGS1
83 parameters.Add(param); 95 parameters.Add(param);
84 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); 96 XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters);
85 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 97 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
86 Hashtable respData = (Hashtable)resp.Value; 98 Hashtable respData = (Hashtable) resp.Value;
87 99
88 return ConvertXMLRPCDataToUserProfile(respData); 100 return ConvertXMLRPCDataToUserProfile(respData);
89 } 101 }
90 catch (System.Net.WebException e) 102 catch (WebException e)
91 { 103 {
92 OpenSim.Framework.Console.MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " + e.Message); 104 MainLog.Instance.Warn("Error when trying to fetch profile data by name from remote user server: " +
105 e.Message);
93 } 106 }
94 return null; 107 return null;
95 } 108 }
109
96 public UserProfileData GetUserProfile(LLUUID avatarID) 110 public UserProfileData GetUserProfile(LLUUID avatarID)
97 { 111 {
98 try 112 try
@@ -103,18 +117,19 @@ namespace OpenSim.Region.Communications.OGS1
103 parameters.Add(param); 117 parameters.Add(param);
104 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); 118 XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters);
105 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 119 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
106 Hashtable respData = (Hashtable)resp.Value; 120 Hashtable respData = (Hashtable) resp.Value;
107 121
108 return ConvertXMLRPCDataToUserProfile(respData); 122 return ConvertXMLRPCDataToUserProfile(respData);
109 } 123 }
110 catch (Exception e) 124 catch (Exception e)
111 { 125 {
112 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " + e.Message); 126 Console.WriteLine("Error when trying to fetch profile data by uuid from remote user server: " +
127 e.Message);
113 } 128 }
114 return null; 129 return null;
115 } 130 }
116 131
117 public void clearUserAgent(LLUUID avatarID) 132 public void clearUserAgent(LLUUID avatarID)
118 { 133 {
119 // TODO: implement 134 // TODO: implement
120 } 135 }
@@ -135,4 +150,4 @@ namespace OpenSim.Region.Communications.OGS1
135 throw new Exception("The method or operation is not implemented."); 150 throw new Exception("The method or operation is not implemented.");
136 } 151 }
137 } 152 }
138} 153} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
index 2bebf9f..631cfd0 100644
--- a/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Communications/OGS1/Properties/AssemblyInfo.cs
@@ -1,24 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] 24
25[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 41d14f0..9e32b35 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -30,12 +30,10 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
37 36
38
39namespace OpenSim.Region.Environment 37namespace OpenSim.Region.Environment
40{ 38{
41 /// <summary> 39 /// <summary>
@@ -216,14 +214,14 @@ namespace OpenSim.Region.Environment
216 214
217 int tempMaxAgents = 215 int tempMaxAgents =
218 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); 216 Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
219 m_regInfo.EstateSettings.maxAgents = (byte)tempMaxAgents; 217 m_regInfo.EstateSettings.maxAgents = (byte) tempMaxAgents;
220 218
221 float tempObjectBonusFactor = 219 float tempObjectBonusFactor =
222 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 220 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
223 m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor; 221 m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor;
224 222
225 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); 223 int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
226 m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel; 224 m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel;
227 225
228 226
229 if (convertParamStringToBool(packet.ParamList[7].Parameter)) 227 if (convertParamStringToBool(packet.ParamList[7].Parameter))
@@ -250,13 +248,13 @@ namespace OpenSim.Region.Environment
250 } 248 }
251 else 249 else
252 { 250 {
253 float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); 251 float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
254 float TerrainRaiseLimit = 252 float TerrainRaiseLimit =
255 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); 253 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
256 float TerrainLowerLimit = 254 float TerrainLowerLimit =
257 (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); 255 (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
258 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); 256 bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
259 float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); 257 float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
260 258
261 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); 259 setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
262 260
@@ -273,8 +271,8 @@ namespace OpenSim.Region.Environment
273 if (splitField.Length == 3) 271 if (splitField.Length == 3)
274 { 272 {
275 Int16 corner = Convert.ToInt16(splitField[0]); 273 Int16 corner = Convert.ToInt16(splitField[0]);
276 float lowValue = (float)Convert.ToDecimal(splitField[1]); 274 float lowValue = (float) Convert.ToDecimal(splitField[1]);
277 float highValue = (float)Convert.ToDecimal(splitField[2]); 275 float highValue = (float) Convert.ToDecimal(splitField[2]);
278 276
279 setEstateTextureRange(corner, lowValue, highValue); 277 setEstateTextureRange(corner, lowValue, highValue);
280 } 278 }
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Environment
343 { 341 {
344 m_scene.Broadcast( 342 m_scene.Broadcast(
345 sendRegionHandshake 343 sendRegionHandshake
346 ); 344 );
347 } 345 }
348 346
349 public void sendRegionInfoPacket(IClientAPI remote_client) 347 public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -363,8 +361,8 @@ namespace OpenSim.Region.Environment
363 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter; 361 regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter;
364 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX; 362 regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX;
365 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY; 363 regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY;
366 regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.EstateSettings.regionFlags; 364 regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.EstateSettings.regionFlags;
367 regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.EstateSettings.simAccess; 365 regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.EstateSettings.simAccess;
368 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); 366 regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
369 regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour; 367 regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour;
370 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit; 368 regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit;
diff --git a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
index 90c3730..e7ce957 100644
--- a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
@@ -1,6 +1,3 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife; 1using libsecondlife;
5using OpenSim.Framework; 2using OpenSim.Framework;
6 3
@@ -10,4 +7,4 @@ namespace OpenSim.Region.Environment.Interfaces
10 { 7 {
11 bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams); 8 bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams);
12 } 9 }
13} 10} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
index 8a31d87..daecf86 100644
--- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs
@@ -53,4 +53,4 @@ namespace OpenSim.Region.Environment.Interfaces
53 bool AsyncConvertUrl(LLUUID id, string url, string extraParams); 53 bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
54 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); 54 bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
55 } 55 }
56} 56} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index 19cf131..0357139 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -34,4 +34,4 @@ namespace OpenSim.Region.Environment.Interfaces
34 { 34 {
35 LLUUID MakeHttpRequest(string url, string type, string body); 35 LLUUID MakeHttpRequest(string url, string type, string body);
36 } 36 }
37} 37} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
index 808b94a..e5d0b26 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs
@@ -26,8 +26,8 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Region.Environment.Scenes;
30using Nini.Config; 29using Nini.Config;
30using OpenSim.Region.Environment.Scenes;
31 31
32namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
33{ 33{
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces
39 string Name { get; } 39 string Name { get; }
40 bool IsSharedModule { get; } 40 bool IsSharedModule { get; }
41 } 41 }
42} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
index 7dc3e0b..fb491cc 100644
--- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
@@ -26,12 +26,13 @@
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using System;
30using OpenSim.Framework;
30 31
31namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
32{ 33{
33 public interface ISimChat 34 public interface ISimChat
34 { 35 {
35 void SimChat(System.Object sender, OpenSim.Framework.ChatFromViewerArgs e); 36 void SimChat(Object sender, ChatFromViewerArgs e);
36 } 37 }
37} 38} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
index 77ec2dd..9171d09 100644
--- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces;
30using OpenSim.Framework; 29using OpenSim.Framework;
31 30
32namespace OpenSim.Region.Environment.Interfaces 31namespace OpenSim.Region.Environment.Interfaces
@@ -72,4 +71,4 @@ namespace OpenSim.Region.Environment.Interfaces
72 void ExportImage(string filename, string gradientmap); 71 void ExportImage(string filename, string gradientmap);
73 byte[] ExportJpegImage(string gradientmap); 72 byte[] ExportJpegImage(string gradientmap);
74 } 73 }
75} 74} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
index 9d8c259..27b5466 100644
--- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
@@ -40,4 +40,4 @@ namespace OpenSim.Region.Environment.Interfaces
40 void ListenControl(int handle, int active); 40 void ListenControl(int handle, int active);
41 void ListenRemove(int handle); 41 void ListenRemove(int handle);
42 } 42 }
43} 43} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
index d888a36..6786b8c 100644
--- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs
@@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces
39 RPCRequestInfo GetNextRequest(); 39 RPCRequestInfo GetNextRequest();
40 void RemoteDataReply(string channel, string message_id, string sdata, int idata); 40 void RemoteDataReply(string channel, string message_id, string sdata, int idata);
41 } 41 }
42} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IXfer.cs b/OpenSim/Region/Environment/Interfaces/IXfer.cs
index 3cbd549..5e5ff1b 100644
--- a/OpenSim/Region/Environment/Interfaces/IXfer.cs
+++ b/OpenSim/Region/Environment/Interfaces/IXfer.cs
@@ -32,4 +32,4 @@ namespace OpenSim.Region.Environment.Interfaces
32 { 32 {
33 bool AddNewFile(string fileName, byte[] data); 33 bool AddNewFile(string fileName, byte[] data);
34 } 34 }
35} 35} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 3962e5f..e9837c0 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -30,7 +30,6 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
36 35
@@ -652,4 +651,4 @@ namespace OpenSim.Region.Environment.LandManagement
652 } 651 }
653 652
654 #endregion 653 #endregion
655} 654} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index ae89d85..785aafa 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
35 34
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index c0dd52a..cb72638 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -27,15 +27,14 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
31using System.Collections.Generic; 30using System.Collections.Generic;
32using System.IO; 31using System.IO;
33using System.Reflection; 32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Modules; 36using OpenSim.Region.Environment.Modules;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38using Nini.Config;
39 38
40namespace OpenSim.Region.Environment 39namespace OpenSim.Region.Environment
41{ 40{
@@ -58,8 +57,8 @@ namespace OpenSim.Region.Environment
58 { 57 {
59 get 58 get
60 { 59 {
61 IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ]; 60 IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count];
62 m_loadedSharedModules.Values.CopyTo( regionModules, 0 ); 61 m_loadedSharedModules.Values.CopyTo(regionModules, 0);
63 return regionModules; 62 return regionModules;
64 } 63 }
65 } 64 }
@@ -132,7 +131,7 @@ namespace OpenSim.Region.Environment
132 131
133 if (modules.Length > 0) 132 if (modules.Length > 0)
134 { 133 {
135 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName ); 134 m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName);
136 foreach (IRegionModule module in modules) 135 foreach (IRegionModule module in modules)
137 { 136 {
138 if (!module.IsSharedModule) 137 if (!module.IsSharedModule)
@@ -179,16 +178,16 @@ namespace OpenSim.Region.Environment
179 List<IRegionModule> modules = new List<IRegionModule>(); 178 List<IRegionModule> modules = new List<IRegionModule>();
180 179
181 Assembly pluginAssembly; 180 Assembly pluginAssembly;
182 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly )) 181 if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly))
183 { 182 {
184 try 183 try
185 { 184 {
186 pluginAssembly = Assembly.LoadFrom(dllName); 185 pluginAssembly = Assembly.LoadFrom(dllName);
187 LoadedAssemblys.Add(dllName, pluginAssembly); 186 LoadedAssemblys.Add(dllName, pluginAssembly);
188 } 187 }
189 catch( BadImageFormatException e ) 188 catch (BadImageFormatException e)
190 { 189 {
191 m_log.Verbose( "MODULES", "The file [{0}] is not a module assembly.", e.FileName ); 190 m_log.Verbose("MODULES", "The file [{0}] is not a module assembly.", e.FileName);
192 } 191 }
193 } 192 }
194 193
@@ -201,7 +200,7 @@ namespace OpenSim.Region.Environment
201 { 200 {
202 if (!pluginType.IsAbstract) 201 if (!pluginType.IsAbstract)
203 { 202 {
204 if( pluginType.GetInterface("IRegionModule") != null ) 203 if (pluginType.GetInterface("IRegionModule") != null)
205 { 204 {
206 modules.Add((IRegionModule) Activator.CreateInstance(pluginType)); 205 modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
207 } 206 }
@@ -231,4 +230,4 @@ namespace OpenSim.Region.Environment
231 LoadedAssemblys.Clear(); 230 LoadedAssemblys.Clear();
232 } 231 }
233 } 232 }
234} 233} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
index e414713..54d5ad8 100644
--- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs
@@ -26,11 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Interfaces; 29using Nini.Config;
30using OpenSim.Framework;
30using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework;
33using Nini.Config;
34 33
35namespace OpenSim.Region.Environment.Modules 34namespace OpenSim.Region.Environment.Modules
36{ 35{
@@ -70,4 +69,4 @@ namespace OpenSim.Region.Environment.Modules
70 { 69 {
71 } 70 }
72 } 71 }
73} 72} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 456d838..4bb0638 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -1,6 +1,3 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife; 1using libsecondlife;
5using Nini.Config; 2using Nini.Config;
6using OpenSim.Framework; 3using OpenSim.Framework;
@@ -11,7 +8,8 @@ namespace OpenSim.Region.Environment.Modules
11{ 8{
12 public class AvatarFactoryModule : IAvatarFactory 9 public class AvatarFactoryModule : IAvatarFactory
13 { 10 {
14 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams) 11 public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
12 out byte[] visualParams)
15 { 13 {
16 GetDefaultAvatarAppearance(out wearables, out visualParams); 14 GetDefaultAvatarAppearance(out wearables, out visualParams);
17 return true; 15 return true;
@@ -51,7 +49,4 @@ namespace OpenSim.Region.Environment.Modules
51 wearables = AvatarWearable.DefaultWearables; 49 wearables = AvatarWearable.DefaultWearables;
52 } 50 }
53 } 51 }
54 52} \ No newline at end of file
55
56
57}
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
index 802655f..1b7e2a4 100644
--- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs
@@ -27,11 +27,10 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces; 30using Nini.Config;
31using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
33using OpenSim.Framework;
34using Nini.Config;
35 34
36namespace OpenSim.Region.Environment.Modules 35namespace OpenSim.Region.Environment.Modules
37{ 36{
@@ -92,4 +91,4 @@ namespace OpenSim.Region.Environment.Modules
92 partner); 91 partner);
93 } 92 }
94 } 93 }
95} 94} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index bdb8ee5..9d4187a 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -27,13 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net.Sockets; 32using System.Net.Sockets;
32using System.Threading;
33using System.Collections.Generic;
34using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using System.Threading;
35using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework.Interfaces; 36using Nini.Config;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
@@ -54,18 +54,22 @@ namespace OpenSim.Region.Environment.Modules
54 54
55 public ChatModule() 55 public ChatModule()
56 { 56 {
57 m_log = OpenSim.Framework.Console.MainLog.Instance; 57 m_log = MainLog.Instance;
58 } 58 }
59 59
60 public void Initialise(Scene scene, Nini.Config.IConfigSource config) 60 public void Initialise(Scene scene, IConfigSource config)
61 { 61 {
62 // wrap this in a try block so that defaults will work if 62 // wrap this in a try block so that defaults will work if
63 // the config file doesn't specify otherwise. 63 // the config file doesn't specify otherwise.
64 try { 64 try
65 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); 65 {
66 m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
66 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); 67 m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
67 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); 68 m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
68 } catch (Exception e) {} 69 }
70 catch (Exception e)
71 {
72 }
69 73
70 if (!m_scenes.Contains(scene)) 74 if (!m_scenes.Contains(scene))
71 { 75 {
@@ -73,20 +77,20 @@ namespace OpenSim.Region.Environment.Modules
73 scene.EventManager.OnNewClient += NewClient; 77 scene.EventManager.OnNewClient += NewClient;
74 scene.RegisterModuleInterface<ISimChat>(this); 78 scene.RegisterModuleInterface<ISimChat>(this);
75 } 79 }
76 80
77 // setup IRC Relay 81 // setup IRC Relay
78 m_irc = new IRCChatModule(config); 82 m_irc = new IRCChatModule(config);
79 } 83 }
80 84
81 public void PostInitialise() 85 public void PostInitialise()
82 { 86 {
83 87 if (m_irc.Enabled)
84 if (m_irc.Enabled) { 88 {
85 m_irc.Connect(m_scenes); 89 m_irc.Connect(m_scenes);
86 } 90 }
87 } 91 }
88 92
89 public void Close() 93 public void Close()
90 { 94 {
91 m_irc.Close(); 95 m_irc.Close();
92 } 96 }
@@ -111,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules
111 ScenePresence avatar = null; 115 ScenePresence avatar = null;
112 116
113 //TODO: Move ForEachScenePresence and others into IScene. 117 //TODO: Move ForEachScenePresence and others into IScene.
114 Scene scene = (Scene)e.Scene; 118 Scene scene = (Scene) e.Scene;
115 119
116 //TODO: Remove the need for this check 120 //TODO: Remove the need for this check
117 if (scene == null) 121 if (scene == null)
@@ -119,10 +123,12 @@ namespace OpenSim.Region.Environment.Modules
119 123
120 // Filled in since it's easier than rewriting right now. 124 // Filled in since it's easier than rewriting right now.
121 LLVector3 fromPos = e.Position; 125 LLVector3 fromPos = e.Position;
122 LLVector3 fromRegionPos = e.Position + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); 126 LLVector3 fromRegionPos = e.Position +
127 new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256,
128 0);
123 string fromName = e.From; 129 string fromName = e.From;
124 string message = e.Message; 130 string message = e.Message;
125 byte type = (byte)e.Type; 131 byte type = (byte) e.Type;
126 LLUUID fromAgentID = LLUUID.Zero; 132 LLUUID fromAgentID = LLUUID.Zero;
127 133
128 if (e.Sender != null) 134 if (e.Sender != null)
@@ -133,7 +139,8 @@ namespace OpenSim.Region.Environment.Modules
133 if (avatar != null) 139 if (avatar != null)
134 { 140 {
135 fromPos = avatar.AbsolutePosition; 141 fromPos = avatar.AbsolutePosition;
136 fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); 142 fromRegionPos = fromPos +
143 new LLVector3(e.Scene.RegionInfo.RegionLocX*256, e.Scene.RegionInfo.RegionLocY*256, 0);
137 fromName = avatar.Firstname + " " + avatar.Lastname; 144 fromName = avatar.Firstname + " " + avatar.Lastname;
138 fromAgentID = e.Sender.AgentId; 145 fromAgentID = e.Sender.AgentId;
139 avatar = null; 146 avatar = null;
@@ -159,75 +166,84 @@ namespace OpenSim.Region.Environment.Modules
159 break; 166 break;
160 } 167 }
161 168
162 m_log.Verbose("CHAT", fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + e.Message); 169 m_log.Verbose("CHAT",
163 170 fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
164 if (m_irc.Connected) 171 e.Message);
165 { 172
166 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); 173 if (m_irc.Connected)
167 } 174 {
168 175 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
169 if (e.Channel == 0) 176 }
170 { 177
171 foreach (Scene m_scene in m_scenes) 178 if (e.Channel == 0)
172 { 179 {
173 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 180 foreach (Scene m_scene in m_scenes)
174 { 181 {
175 int dis = -100000; 182 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
176 183 {
177 LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); 184 int dis = -100000;
178 dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); 185
179 186 LLVector3 avatarRegionPos = presence.AbsolutePosition +
180 switch (e.Type) 187 new LLVector3(
181 { 188 scene.RegionInfo.RegionLocX*256,
182 case ChatTypeEnum.Whisper: 189 scene.RegionInfo.RegionLocY*256,
183 if (dis < m_whisperdistance) 190 0);
184 { 191 dis =
185 //should change so the message is sent through the avatar rather than direct to the ClientView 192 Math.Abs((int) avatarRegionPos.GetDistanceTo(fromRegionPos));
186 presence.ControllingClient.SendChatMessage(message, 193
187 type, 194 switch (e.Type)
188 fromPos, 195 {
189 fromName, 196 case ChatTypeEnum.Whisper:
190 fromAgentID); 197 if (dis < m_whisperdistance)
191 } 198 {
192 break; 199 //should change so the message is sent through the avatar rather than direct to the ClientView
193 case ChatTypeEnum.Say: 200 presence.ControllingClient.SendChatMessage(message,
194 if (dis < m_saydistance) 201 type,
195 { 202 fromPos,
196 //Console.WriteLine("sending chat"); 203 fromName,
197 presence.ControllingClient.SendChatMessage(message, 204 fromAgentID);
198 type, 205 }
199 fromPos, 206 break;
200 fromName, 207 case ChatTypeEnum.Say:
201 fromAgentID); 208 if (dis < m_saydistance)
202 } 209 {
203 break; 210 //Console.WriteLine("sending chat");
204 case ChatTypeEnum.Shout: 211 presence.ControllingClient.SendChatMessage(message,
205 if (dis < m_shoutdistance) 212 type,
206 { 213 fromPos,
207 presence.ControllingClient.SendChatMessage(message, 214 fromName,
208 type, 215 fromAgentID);
209 fromPos, 216 }
210 fromName, 217 break;
211 fromAgentID); 218 case ChatTypeEnum.Shout:
212 } 219 if (dis < m_shoutdistance)
213 break; 220 {
214 221 presence.ControllingClient.SendChatMessage(message,
215 case ChatTypeEnum.Broadcast: 222 type,
216 presence.ControllingClient.SendChatMessage(message, type, 223 fromPos,
217 fromPos, 224 fromName,
218 fromName, 225 fromAgentID);
219 fromAgentID); 226 }
220 break; 227 break;
221 default: 228
222 break; 229 case ChatTypeEnum.Broadcast:
223 } 230 presence.ControllingClient.SendChatMessage(message,
224 }); 231 type,
232 fromPos,
233 fromName,
234 fromAgentID);
235 break;
236 default:
237 break;
238 }
239 });
225 } 240 }
226 } 241 }
227 } 242 }
228 } 243 }
229 244
230 class IRCChatModule { 245 internal class IRCChatModule
246 {
231 private string m_server = null; 247 private string m_server = null;
232 private int m_port = 6668; 248 private int m_port = 6668;
233 private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; 249 private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
@@ -238,7 +254,7 @@ namespace OpenSim.Region.Environment.Modules
238 private TcpClient m_tcp; 254 private TcpClient m_tcp;
239 private StreamWriter m_writer; 255 private StreamWriter m_writer;
240 private StreamReader m_reader; 256 private StreamReader m_reader;
241 257
242 private Thread pingSender; 258 private Thread pingSender;
243 private Thread listener; 259 private Thread listener;
244 260
@@ -248,29 +264,36 @@ namespace OpenSim.Region.Environment.Modules
248 private List<Scene> m_scenes = null; 264 private List<Scene> m_scenes = null;
249 private LogBase m_log; 265 private LogBase m_log;
250 266
251 public IRCChatModule(Nini.Config.IConfigSource config) { 267 public IRCChatModule(IConfigSource config)
268 {
252 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); 269 m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
253 m_tcp = null; 270 m_tcp = null;
254 m_writer = null; 271 m_writer = null;
255 m_reader = null; 272 m_reader = null;
256 273
257 try { 274 try
275 {
258 m_server = config.Configs["IRC"].GetString("server"); 276 m_server = config.Configs["IRC"].GetString("server");
259 m_nick = config.Configs["IRC"].GetString("nick"); 277 m_nick = config.Configs["IRC"].GetString("nick");
260 m_channel = config.Configs["IRC"].GetString("channel"); 278 m_channel = config.Configs["IRC"].GetString("channel");
261 m_port = config.Configs["IRC"].GetInt("port", m_port); 279 m_port = config.Configs["IRC"].GetInt("port", m_port);
262 m_user = config.Configs["IRC"].GetString("username", m_user); 280 m_user = config.Configs["IRC"].GetString("username", m_user);
263 if (m_server != null && m_nick != null && m_channel != null) { 281 if (m_server != null && m_nick != null && m_channel != null)
282 {
264 m_enabled = true; 283 m_enabled = true;
265 } 284 }
266 } catch (Exception e) { 285 }
286 catch (Exception e)
287 {
267 Console.WriteLine("No IRC config information, skipping IRC bridge configuration"); 288 Console.WriteLine("No IRC config information, skipping IRC bridge configuration");
268 } 289 }
269 m_log = OpenSim.Framework.Console.MainLog.Instance; 290 m_log = MainLog.Instance;
270 } 291 }
271 292
272 public bool Connect(List<Scene> scenes) { 293 public bool Connect(List<Scene> scenes)
273 try { 294 {
295 try
296 {
274 m_scenes = scenes; 297 m_scenes = scenes;
275 298
276 m_tcp = new TcpClient(m_server, m_port); 299 m_tcp = new TcpClient(m_server, m_port);
@@ -279,13 +302,13 @@ namespace OpenSim.Region.Environment.Modules
279 m_log.Verbose("IRC", "Connected to " + m_server); 302 m_log.Verbose("IRC", "Connected to " + m_server);
280 m_reader = new StreamReader(m_stream); 303 m_reader = new StreamReader(m_stream);
281 m_writer = new StreamWriter(m_stream); 304 m_writer = new StreamWriter(m_stream);
282 305
283 pingSender = new Thread(new ThreadStart(this.PingRun)); 306 pingSender = new Thread(new ThreadStart(PingRun));
284 pingSender.Start(); 307 pingSender.Start();
285 308
286 listener = new Thread(new ThreadStart(this.ListenerRun)); 309 listener = new Thread(new ThreadStart(ListenerRun));
287 listener.Start(); 310 listener.Start();
288 311
289 m_writer.WriteLine(m_user); 312 m_writer.WriteLine(m_user);
290 m_writer.Flush(); 313 m_writer.Flush();
291 m_writer.WriteLine("NICK " + m_nick); 314 m_writer.WriteLine("NICK " + m_nick);
@@ -294,50 +317,61 @@ namespace OpenSim.Region.Environment.Modules
294 m_writer.Flush(); 317 m_writer.Flush();
295 m_log.Verbose("IRC", "Connection fully established"); 318 m_log.Verbose("IRC", "Connection fully established");
296 m_connected = true; 319 m_connected = true;
297 } catch (Exception e) { 320 }
321 catch (Exception e)
322 {
298 Console.WriteLine(e.ToString()); 323 Console.WriteLine(e.ToString());
299 } 324 }
300 return m_connected; 325 return m_connected;
301 } 326 }
302 327
303 public bool Enabled 328 public bool Enabled
304 { 329 {
305 get { return m_enabled; } 330 get { return m_enabled; }
306 } 331 }
307 332
308 public bool Connected 333 public bool Connected
309 { 334 {
310 get { return m_connected; } 335 get { return m_connected; }
311 } 336 }
312 337
313 public void PrivMsg(string from, string region, string msg) { 338 public void PrivMsg(string from, string region, string msg)
314 try { 339 {
340 try
341 {
315 m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); 342 m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg);
316 m_writer.Flush(); 343 m_writer.Flush();
317 } catch (IOException) { 344 }
318 m_log.Error("IRC","Disconnected from IRC server."); 345 catch (IOException)
346 {
347 m_log.Error("IRC", "Disconnected from IRC server.");
319 listener.Abort(); 348 listener.Abort();
320 pingSender.Abort(); 349 pingSender.Abort();
321 m_connected = false; 350 m_connected = false;
322 } 351 }
323 } 352 }
324 353
325 private Dictionary<string, string> ExtractMsg(string input) { 354 private Dictionary<string, string> ExtractMsg(string input)
355 {
326 Dictionary<string, string> result = null; 356 Dictionary<string, string> result = null;
327 string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; 357 string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
328 Regex RE = new Regex(regex, RegexOptions.Multiline); 358 Regex RE = new Regex(regex, RegexOptions.Multiline);
329 MatchCollection matches = RE.Matches(input); 359 MatchCollection matches = RE.Matches(input);
330 // Get some direct matches $1 $4 is a 360 // Get some direct matches $1 $4 is a
331 if ((matches.Count == 1) && (matches[0].Groups.Count == 5)) { 361 if ((matches.Count == 1) && (matches[0].Groups.Count == 5))
362 {
332 result = new Dictionary<string, string>(); 363 result = new Dictionary<string, string>();
333 result.Add("nick", matches[0].Groups[1].Value); 364 result.Add("nick", matches[0].Groups[1].Value);
334 result.Add("user", matches[0].Groups[2].Value); 365 result.Add("user", matches[0].Groups[2].Value);
335 result.Add("channel", matches[0].Groups[3].Value); 366 result.Add("channel", matches[0].Groups[3].Value);
336 result.Add("msg", matches[0].Groups[4].Value); 367 result.Add("msg", matches[0].Groups[4].Value);
337 } else { 368 }
369 else
370 {
338 m_log.Verbose("IRC", "Number of matches: " + matches.Count); 371 m_log.Verbose("IRC", "Number of matches: " + matches.Count);
339 if (matches.Count > 0) { 372 if (matches.Count > 0)
340 m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count); 373 {
374 m_log.Verbose("IRC", "Number of groups: " + matches[0].Groups.Count);
341 } 375 }
342 } 376 }
343 return result; 377 return result;
@@ -365,19 +399,20 @@ namespace OpenSim.Region.Environment.Modules
365 if (inputLine.Contains(m_channel)) 399 if (inputLine.Contains(m_channel))
366 { 400 {
367 Dictionary<string, string> data = ExtractMsg(inputLine); 401 Dictionary<string, string> data = ExtractMsg(inputLine);
368 if (data != null ) 402 if (data != null)
369 { 403 {
370 foreach (Scene m_scene in m_scenes) 404 foreach (Scene m_scene in m_scenes)
371 { 405 {
372 m_scene.ForEachScenePresence(delegate(ScenePresence avatar) 406 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
373 {
374 if (!avatar.IsChildAgent)
375 { 407 {
376 avatar.ControllingClient.SendChatMessage( 408 if (!avatar.IsChildAgent)
377 Helpers.StringToField(data["msg"]), 255, pos, data["nick"], 409 {
378 LLUUID.Zero); 410 avatar.ControllingClient.SendChatMessage(
379 } 411 Helpers.StringToField(data["msg"]), 255,
380 }); 412 pos, data["nick"],
413 LLUUID.Zero);
414 }
415 });
381 } 416 }
382 } 417 }
383 } 418 }
@@ -387,7 +422,8 @@ namespace OpenSim.Region.Environment.Modules
387 } 422 }
388 423
389 424
390 public void Close() { 425 public void Close()
426 {
391 listener.Abort(); 427 listener.Abort();
392 pingSender.Abort(); 428 pingSender.Abort();
393 m_writer.Close(); 429 m_writer.Close();
@@ -395,4 +431,4 @@ namespace OpenSim.Region.Environment.Modules
395 m_tcp.Close(); 431 m_tcp.Close();
396 } 432 }
397 } 433 }
398} 434} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index 7c852dc..2bc3db8 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -29,10 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using Nini.Config;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using Nini.Config;
36 36
37namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
38{ 38{
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules
99 if (RenderPlugins.ContainsKey(contentType)) 99 if (RenderPlugins.ContainsKey(contentType))
100 { 100 {
101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); 101 //Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
102 102
103 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 103 DynamicTextureUpdater updater = new DynamicTextureUpdater();
104 updater.SimUUID = simID; 104 updater.SimUUID = simID;
105 updater.PrimID = primID; 105 updater.PrimID = primID;
@@ -187,4 +187,4 @@ namespace OpenSim.Region.Environment.Modules
187 } 187 }
188 } 188 }
189 } 189 }
190} 190} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/EmailModule.cs b/OpenSim/Region/Environment/Modules/EmailModule.cs
index 00ea07a..046a46c 100644
--- a/OpenSim/Region/Environment/Modules/EmailModule.cs
+++ b/OpenSim/Region/Environment/Modules/EmailModule.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class EmailModule 31 internal class EmailModule
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs
index 9144bee..d9f09f7 100644
--- a/OpenSim/Region/Environment/Modules/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs
index 150f294..50e9a39 100644
--- a/OpenSim/Region/Environment/Modules/GroupsModule.cs
+++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
index 9ac1d76..2ad027a 100644
--- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs
@@ -27,11 +27,12 @@
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife;
31using Nini.Config;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Console;
33using OpenSim.Framework;
34using Nini.Config;
35 36
36namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
37{ 38{
@@ -42,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules
42 43
43 public InstantMessageModule() 44 public InstantMessageModule()
44 { 45 {
45 m_log = OpenSim.Framework.Console.MainLog.Instance; 46 m_log = MainLog.Instance;
46 } 47 }
47 48
48 public void Initialise(Scene scene, IConfigSource config) 49 public void Initialise(Scene scene, IConfigSource config)
@@ -50,33 +51,34 @@ namespace OpenSim.Region.Environment.Modules
50 if (!m_scenes.Contains(scene)) 51 if (!m_scenes.Contains(scene))
51 { 52 {
52 m_scenes.Add(scene); 53 m_scenes.Add(scene);
53 scene.EventManager.OnNewClient += OnNewClient; 54 scene.EventManager.OnNewClient += OnNewClient;
54 } 55 }
55 } 56 }
56 57
57 void OnNewClient(OpenSim.Framework.IClientAPI client) 58 private void OnNewClient(IClientAPI client)
58 { 59 {
59 client.OnInstantMessage += OnInstantMessage; 60 client.OnInstantMessage += OnInstantMessage;
60 } 61 }
61 62
62 void OnInstantMessage(libsecondlife.LLUUID fromAgentID, 63 private void OnInstantMessage(LLUUID fromAgentID,
63 libsecondlife.LLUUID fromAgentSession, libsecondlife.LLUUID toAgentID, 64 LLUUID fromAgentSession, LLUUID toAgentID,
64 libsecondlife.LLUUID imSessionID, uint timestamp, string fromAgentName, 65 LLUUID imSessionID, uint timestamp, string fromAgentName,
65 string message, byte dialog) 66 string message, byte dialog)
66 { 67 {
67 // TODO: Remove after debugging. Privacy implications. 68 // TODO: Remove after debugging. Privacy implications.
68 m_log.Verbose("IM",fromAgentName + ": " + message); 69 m_log.Verbose("IM", fromAgentName + ": " + message);
69 70
70 foreach (Scene m_scene in m_scenes) 71 foreach (Scene m_scene in m_scenes)
71 { 72 {
72 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 73 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence)
73 { 74 {
74 // Local Message 75 // Local Message
75 ScenePresence user = (ScenePresence)m_scene.Entities[toAgentID]; 76 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID];
76 if (!user.IsChildAgent) 77 if (!user.IsChildAgent)
77 { 78 {
78 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, 79 user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message,
79 toAgentID, imSessionID, fromAgentName, dialog, timestamp); 80 toAgentID, imSessionID, fromAgentName, dialog,
81 timestamp);
80 } 82 }
81 // Message sent 83 // Message sent
82 return; 84 return;
@@ -104,4 +106,4 @@ namespace OpenSim.Region.Environment.Modules
104 get { return true; } 106 get { return true; }
105 } 107 }
106 } 108 }
107} 109} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs
index 3f8cd6e..e2ad0d5 100644
--- a/OpenSim/Region/Environment/Modules/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using Nini.Config;
29using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31using Nini.Config;
32 32
33namespace OpenSim.Region.Environment.Modules 33namespace OpenSim.Region.Environment.Modules
34{ 34{
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules
59 get { return false; } 59 get { return false; }
60 } 60 }
61 } 61 }
62} 62} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
index 8b8b386..9d10fc3 100644
--- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
@@ -1,18 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.IO;
6using System.Drawing; 2using System.Drawing;
3using System.IO;
4using System.Net;
7using libsecondlife; 5using libsecondlife;
6using Nini.Config;
8using OpenJPEGNet; 7using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
11using Nini.Config; 9using OpenSim.Region.Environment.Scenes;
12 10
13namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
14{ 12{
15 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender 13 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
16 { 14 {
17 private string m_name = "LoadImageURL"; 15 private string m_name = "LoadImageURL";
18 private IDynamicTextureManager m_textureManager; 16 private IDynamicTextureManager m_textureManager;
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules
85 private void MakeHttpRequest(string url, LLUUID requestID) 83 private void MakeHttpRequest(string url, LLUUID requestID)
86 { 84 {
87 WebRequest request = HttpWebRequest.Create(url); 85 WebRequest request = HttpWebRequest.Create(url);
88 RequestState state = new RequestState((HttpWebRequest)request, requestID); 86 RequestState state = new RequestState((HttpWebRequest) request, requestID);
89 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 87 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
90 88
91 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 89 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
92 state.TimeOfRequest = (int)t.TotalSeconds; 90 state.TimeOfRequest = (int) t.TotalSeconds;
93 } 91 }
94 92
95 private void HttpRequestReturn(IAsyncResult result) 93 private void HttpRequestReturn(IAsyncResult result)
96 { 94 {
97 RequestState state = (RequestState)result.AsyncState; 95 RequestState state = (RequestState) result.AsyncState;
98 WebRequest request = (WebRequest)state.Request; 96 WebRequest request = (WebRequest) state.Request;
99 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 97 HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
100 if (response.StatusCode == HttpStatusCode.OK) 98 if (response.StatusCode == HttpStatusCode.OK)
101 { 99 {
102 Bitmap image = new Bitmap(response.GetResponseStream()); 100 Bitmap image = new Bitmap(response.GetResponseStream());
103 Bitmap resize = new Bitmap(image, new Size(512, 512)); 101 Bitmap resize = new Bitmap(image, new Size(512, 512));
104 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 102 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
105 103
106 m_textureManager.ReturnData(state.RequestID, imageJ2000); 104 m_textureManager.ReturnData(state.RequestID, imageJ2000);
107 } 105 }
108 } 106 }
109 107
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules
119 RequestID = requestID; 117 RequestID = requestID;
120 } 118 }
121 } 119 }
122
123 } 120 }
124} 121} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index 9412089..5ac0b39 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class ScriptsHttpRequests 31 internal class ScriptsHttpRequests
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TeleportModule.cs b/OpenSim/Region/Environment/Modules/TeleportModule.cs
index d22a722..77f8db2 100644
--- a/OpenSim/Region/Environment/Modules/TeleportModule.cs
+++ b/OpenSim/Region/Environment/Modules/TeleportModule.cs
@@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Modules
31 internal class TeleportModule 31 internal class TeleportModule
32 { 32 {
33 } 33 }
34} 34} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 5eeeca6..66c499b 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -27,14 +27,12 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31using libsecondlife; 30using libsecondlife;
32using libsecondlife.Packets; 31using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces; 32using Nini.Config;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
37using Nini.Config;
38 36
39namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
40{ 38{
@@ -42,17 +40,19 @@ namespace OpenSim.Region.Environment.Modules
42 { 40 {
43 private Scene m_scene; 41 private Scene m_scene;
44 private List<Scene> m_scenes = new List<Scene>(); 42 private List<Scene> m_scenes = new List<Scene>();
45 private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests = new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>(); 43
44 private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> ClientRequests =
45 new Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>>();
46 46
47 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); 47 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>();
48 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>(); 48 private Dictionary<LLUUID, List<LLUUID>> InProcess = new Dictionary<LLUUID, List<LLUUID>>();
49 // private Thread m_thread; 49 // private Thread m_thread;
50 50
51 public TextureDownloadModule() 51 public TextureDownloadModule()
52 { 52 {
53 // m_thread = new Thread(new ThreadStart(ProcessTextureSenders)); 53 // m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
54 // m_thread.IsBackground = true; 54 // m_thread.IsBackground = true;
55 // m_thread.Start(); 55 // m_thread.Start();
56 } 56 }
57 57
58 public void Initialise(Scene scene, IConfigSource config) 58 public void Initialise(Scene scene, IConfigSource config)
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
85 85
86 public void NewClient(IClientAPI client) 86 public void NewClient(IClientAPI client)
87 { 87 {
88 /* lock (ClientRequests) 88 /* lock (ClientRequests)
89 { 89 {
90 if (!ClientRequests.ContainsKey(client.AgentId)) 90 if (!ClientRequests.ContainsKey(client.AgentId))
91 { 91 {
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules
120 120
121 public void TextureRequest(Object sender, TextureRequestArgs e) 121 public void TextureRequest(Object sender, TextureRequestArgs e)
122 { 122 {
123 IClientAPI client = (IClientAPI)sender; 123 IClientAPI client = (IClientAPI) sender;
124 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID)) 124 if (!ClientRequests[client.AgentId].ContainsKey(e.RequestedAssetID))
125 { 125 {
126 lock (ClientRequests) 126 lock (ClientRequests)
@@ -136,15 +136,15 @@ namespace OpenSim.Region.Environment.Modules
136 { 136 {
137 while (true) 137 while (true)
138 { 138 {
139 TextureSender sender = this.QueueSenders.Dequeue(); 139 TextureSender sender = QueueSenders.Dequeue();
140 bool finished = sender.SendTexture(); 140 bool finished = sender.SendTexture();
141 if (finished) 141 if (finished)
142 { 142 {
143 this.TextureSent(sender); 143 TextureSent(sender);
144 } 144 }
145 else 145 else
146 { 146 {
147 this.QueueSenders.Enqueue(sender); 147 QueueSenders.Enqueue(sender);
148 } 148 }
149 } 149 }
150 } 150 }
@@ -173,13 +173,13 @@ namespace OpenSim.Region.Environment.Modules
173 173
174 if (asset.Data.LongLength > 600) 174 if (asset.Data.LongLength > 600)
175 { 175 {
176 NumPackets = 2 + (int)(asset.Data.Length - 601) / 1000; 176 NumPackets = 2 + (int) (asset.Data.Length - 601)/1000;
177 } 177 }
178 else 178 else
179 { 179 {
180 NumPackets = 1; 180 NumPackets = 1;
181 } 181 }
182 182
183 PacketCounter = (int) req.PacketNumber; 183 PacketCounter = (int) req.PacketNumber;
184 } 184 }
185 185
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules
205 im.Header.Reliable = false; 205 im.Header.Reliable = false;
206 im.ImageID.Packets = 1; 206 im.ImageID.Packets = 1;
207 im.ImageID.ID = m_asset.FullID; 207 im.ImageID.ID = m_asset.FullID;
208 im.ImageID.Size = (uint)m_asset.Data.Length; 208 im.ImageID.Size = (uint) m_asset.Data.Length;
209 im.ImageData.Data = m_asset.Data; 209 im.ImageData.Data = m_asset.Data;
210 im.ImageID.Codec = 2; 210 im.ImageID.Codec = 2;
211 req.RequestUser.OutPacket(im); 211 req.RequestUser.OutPacket(im);
@@ -215,9 +215,9 @@ namespace OpenSim.Region.Environment.Modules
215 { 215 {
216 ImageDataPacket im = new ImageDataPacket(); 216 ImageDataPacket im = new ImageDataPacket();
217 im.Header.Reliable = false; 217 im.Header.Reliable = false;
218 im.ImageID.Packets = (ushort)(NumPackets); 218 im.ImageID.Packets = (ushort) (NumPackets);
219 im.ImageID.ID = m_asset.FullID; 219 im.ImageID.ID = m_asset.FullID;
220 im.ImageID.Size = (uint)m_asset.Data.Length; 220 im.ImageID.Size = (uint) m_asset.Data.Length;
221 im.ImageData.Data = new byte[600]; 221 im.ImageData.Data = new byte[600];
222 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); 222 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
223 im.ImageID.Codec = 2; 223 im.ImageID.Codec = 2;
@@ -229,18 +229,16 @@ namespace OpenSim.Region.Environment.Modules
229 { 229 {
230 ImagePacketPacket im = new ImagePacketPacket(); 230 ImagePacketPacket im = new ImagePacketPacket();
231 im.Header.Reliable = false; 231 im.Header.Reliable = false;
232 im.ImageID.Packet = (ushort)(PacketCounter); 232 im.ImageID.Packet = (ushort) (PacketCounter);
233 im.ImageID.ID = m_asset.FullID; 233 im.ImageID.ID = m_asset.FullID;
234 int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); 234 int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1));
235 if (size > 1000) size = 1000; 235 if (size > 1000) size = 1000;
236 im.ImageData.Data = new byte[size]; 236 im.ImageData.Data = new byte[size];
237 Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); 237 Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size);
238 req.RequestUser.OutPacket(im); 238 req.RequestUser.OutPacket(im);
239 PacketCounter++; 239 PacketCounter++;
240 } 240 }
241
242 } 241 }
243
244 } 242 }
245 243
246 public class AssetRequest 244 public class AssetRequest
@@ -258,6 +256,5 @@ namespace OpenSim.Region.Environment.Modules
258 PacketNumber = packetNumber; 256 PacketNumber = packetNumber;
259 } 257 }
260 } 258 }
261
262 } 259 }
263} 260} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index a697162..7a631d7 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -27,20 +27,12 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO; 30using System.Collections.Generic;
31using System.Net.Sockets;
32using System.Text;
33using System.Threading;
34using libsecondlife; 31using libsecondlife;
35using OpenSim.Framework.Interfaces; 32using Nini.Config;
36using OpenSim.Framework; 33using OpenSim.Framework;
37using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
39using OpenSim.Framework.Servers;
40using Nwc.XmlRpc;
41using System.Collections;
42using System.Collections.Generic;
43using Nini.Config;
44 36
45/***************************************************** 37/*****************************************************
46 * 38 *
@@ -71,6 +63,7 @@ using Nini.Config;
71 * thats the way it works. 63 * thats the way it works.
72 * 64 *
73 * **************************************************/ 65 * **************************************************/
66
74namespace OpenSim.Region.Environment.Modules 67namespace OpenSim.Region.Environment.Modules
75{ 68{
76 public class WorldCommModule : IRegionModule, IWorldComm 69 public class WorldCommModule : IRegionModule, IWorldComm
@@ -120,9 +113,9 @@ namespace OpenSim.Region.Environment.Modules
120 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) 113 private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
121 { 114 {
122 DeliverMessage(e.Sender.AgentId.ToString(), 115 DeliverMessage(e.Sender.AgentId.ToString(),
123 (int)e.Type, e.Channel, 116 (int) e.Type, e.Channel,
124 e.Sender.FirstName + " " + e.Sender.LastName, 117 e.Sender.FirstName + " " + e.Sender.LastName,
125 e.Message); 118 e.Message);
126 } 119 }
127 120
128 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 121 public int Listen(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@@ -132,11 +125,10 @@ namespace OpenSim.Region.Environment.Modules
132 125
133 public void ListenControl(int handle, int active) 126 public void ListenControl(int handle, int active)
134 { 127 {
135 if ( active == 1 ) 128 if (active == 1)
136 m_listenerManager.Activate(handle); 129 m_listenerManager.Activate(handle);
137 else if ( active == 0 ) 130 else if (active == 0)
138 m_listenerManager.Dectivate(handle); 131 m_listenerManager.Dectivate(handle);
139
140 } 132 }
141 133
142 public void ListenRemove(int handle) 134 public void ListenRemove(int handle)
@@ -151,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules
151 // nearby avatards, the SimChat function is used. 143 // nearby avatards, the SimChat function is used.
152 public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) 144 public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg)
153 { 145 {
154
155 SceneObjectPart source = null; 146 SceneObjectPart source = null;
156 ScenePresence avatar = null; 147 ScenePresence avatar = null;
157 148
@@ -160,7 +151,7 @@ namespace OpenSim.Region.Environment.Modules
160 { 151 {
161 avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID)); 152 avatar = m_scene.GetScenePresence(new LLUUID(sourceItemID));
162 } 153 }
163 if( (avatar != null) || (source != null) ) 154 if ((avatar != null) || (source != null))
164 { 155 {
165 // Loop through the objects in the scene 156 // Loop through the objects in the scene
166 // If they are in proximity, then if they are 157 // If they are in proximity, then if they are
@@ -169,12 +160,12 @@ namespace OpenSim.Region.Environment.Modules
169 foreach (LLUUID eb in m_scene.Entities.Keys) 160 foreach (LLUUID eb in m_scene.Entities.Keys)
170 { 161 {
171 EntityBase sPart; 162 EntityBase sPart;
172 163
173 m_scene.Entities.TryGetValue(eb, out sPart); 164 m_scene.Entities.TryGetValue(eb, out sPart);
174 165
175 // Dont process if this message is from itself! 166 // Dont process if this message is from itself!
176 if (eb.ToString().Equals(sourceItemID) || 167 if (eb.ToString().Equals(sourceItemID) ||
177 sPart.UUID.ToString().Equals(sourceItemID) ) 168 sPart.UUID.ToString().Equals(sourceItemID))
178 continue; 169 continue;
179 170
180 double dis = 0; 171 double dis = 0;
@@ -192,12 +183,11 @@ namespace OpenSim.Region.Environment.Modules
192 { 183 {
193 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 184 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
194 sourceItemID, sPart.UUID, channel, name, msg 185 sourceItemID, sPart.UUID, channel, name, msg
195 ); 186 );
196 if (isListener != null) 187 if (isListener != null)
197 { 188 {
198 m_pending.Enqueue(isListener); 189 m_pending.Enqueue(isListener);
199 } 190 }
200
201 } 191 }
202 break; 192 break;
203 193
@@ -207,12 +197,11 @@ namespace OpenSim.Region.Environment.Modules
207 { 197 {
208 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 198 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
209 sourceItemID, sPart.UUID, channel, name, msg 199 sourceItemID, sPart.UUID, channel, name, msg
210 ); 200 );
211 if (isListener != null) 201 if (isListener != null)
212 { 202 {
213 m_pending.Enqueue(isListener); 203 m_pending.Enqueue(isListener);
214 } 204 }
215
216 } 205 }
217 break; 206 break;
218 207
@@ -221,22 +210,22 @@ namespace OpenSim.Region.Environment.Modules
221 { 210 {
222 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 211 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
223 sourceItemID, sPart.UUID, channel, name, msg 212 sourceItemID, sPart.UUID, channel, name, msg
224 ); 213 );
225 if (isListener != null) 214 if (isListener != null)
226 { 215 {
227 m_pending.Enqueue(isListener); 216 m_pending.Enqueue(isListener);
228 } 217 }
229
230 } 218 }
231 break; 219 break;
232 220
233 case 0xff: // Broadcast 221 case 0xff: // Broadcast
234 ListenerInfo isListen = m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); 222 ListenerInfo isListen =
223 m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg);
235 if (isListen != null) 224 if (isListen != null)
236 { 225 {
237 ListenerInfo isListener = m_listenerManager.IsListenerMatch( 226 ListenerInfo isListener = m_listenerManager.IsListenerMatch(
238 sourceItemID, sPart.UUID, channel, name, msg 227 sourceItemID, sPart.UUID, channel, name, msg
239 ); 228 );
240 if (isListener != null) 229 if (isListener != null)
241 { 230 {
242 m_pending.Enqueue(isListener); 231 m_pending.Enqueue(isListener);
@@ -244,10 +233,9 @@ namespace OpenSim.Region.Environment.Modules
244 } 233 }
245 break; 234 break;
246 } 235 }
247 }; 236 }
248 237 ;
249 } 238 }
250
251 } 239 }
252 240
253 public bool HasMessages() 241 public bool HasMessages()
@@ -257,18 +245,15 @@ namespace OpenSim.Region.Environment.Modules
257 245
258 public ListenerInfo GetNextMessage() 246 public ListenerInfo GetNextMessage()
259 { 247 {
260
261 ListenerInfo li = null; 248 ListenerInfo li = null;
262 249
263 lock (CommListLock) 250 lock (CommListLock)
264 { 251 {
265 li = m_pending.Dequeue(); 252 li = m_pending.Dequeue();
266 } 253 }
267 254
268 return li; 255 return li;
269
270 } 256 }
271
272 } 257 }
273 258
274 // hostID: the ID of the ScenePart 259 // hostID: the ID of the ScenePart
@@ -285,20 +270,19 @@ namespace OpenSim.Region.Environment.Modules
285 m_listeners = new Dictionary<int, ListenerInfo>(); 270 m_listeners = new Dictionary<int, ListenerInfo>();
286 } 271 }
287 272
288 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg) 273 public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id,
274 string msg)
289 { 275 {
290 276 if (m_listeners.Count < m_MaxListeners)
291 if ( m_listeners.Count < m_MaxListeners )
292 { 277 {
293 ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg); 278 ListenerInfo isListener = IsListenerMatch(LLUUID.Zero.ToString(), itemID, channel, name, msg);
294 279
295 if(isListener == null) 280 if (isListener == null)
296 { 281 {
297 int newHandle = GetNewHandle(); 282 int newHandle = GetNewHandle();
298 283
299 if (newHandle > -1) 284 if (newHandle > -1)
300 { 285 {
301
302 ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg); 286 ListenerInfo li = new ListenerInfo(localID, newHandle, itemID, hostID, channel, name, id, msg);
303 287
304 lock (ListenersLock) 288 lock (ListenersLock)
@@ -308,13 +292,10 @@ namespace OpenSim.Region.Environment.Modules
308 292
309 return newHandle; 293 return newHandle;
310 } 294 }
311
312 } 295 }
313
314 } 296 }
315 297
316 return -1; 298 return -1;
317
318 } 299 }
319 300
320 public void Remove(int handle) 301 public void Remove(int handle)
@@ -324,7 +305,6 @@ namespace OpenSim.Region.Environment.Modules
324 305
325 private int GetNewHandle() 306 private int GetNewHandle()
326 { 307 {
327
328 for (int i = 0; i < int.MaxValue - 1; i++) 308 for (int i = 0; i < int.MaxValue - 1; i++)
329 { 309 {
330 if (!m_listeners.ContainsKey(i)) 310 if (!m_listeners.ContainsKey(i))
@@ -332,12 +312,10 @@ namespace OpenSim.Region.Environment.Modules
332 } 312 }
333 313
334 return -1; 314 return -1;
335
336 } 315 }
337 316
338 public bool IsListener(LLUUID hostID) 317 public bool IsListener(LLUUID hostID)
339 { 318 {
340
341 foreach (ListenerInfo li in m_listeners.Values) 319 foreach (ListenerInfo li in m_listeners.Values)
342 { 320 {
343 if (li.GetHostID().Equals(hostID)) 321 if (li.GetHostID().Equals(hostID))
@@ -345,15 +323,13 @@ namespace OpenSim.Region.Environment.Modules
345 } 323 }
346 324
347 return false; 325 return false;
348
349 } 326 }
350 327
351 public void Activate(int handle) 328 public void Activate(int handle)
352 { 329 {
353
354 ListenerInfo li; 330 ListenerInfo li;
355 331
356 if( m_listeners.TryGetValue(handle, out li) ) 332 if (m_listeners.TryGetValue(handle, out li))
357 { 333 {
358 li.Activate(); 334 li.Activate();
359 } 335 }
@@ -361,10 +337,9 @@ namespace OpenSim.Region.Environment.Modules
361 337
362 public void Dectivate(int handle) 338 public void Dectivate(int handle)
363 { 339 {
364
365 ListenerInfo li; 340 ListenerInfo li;
366 341
367 if( m_listeners.TryGetValue(handle, out li) ) 342 if (m_listeners.TryGetValue(handle, out li))
368 { 343 {
369 li.Deactivate(); 344 li.Deactivate();
370 } 345 }
@@ -372,40 +347,40 @@ namespace OpenSim.Region.Environment.Modules
372 347
373 // Theres probably a more clever and efficient way to 348 // Theres probably a more clever and efficient way to
374 // do this, maybe with regex. 349 // do this, maybe with regex.
375 public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name, string msg) 350 public ListenerInfo IsListenerMatch(string sourceItemID, LLUUID listenerKey, int channel, string name,
351 string msg)
376 { 352 {
377
378 bool isMatch = true; 353 bool isMatch = true;
379 354
380 foreach (ListenerInfo li in m_listeners.Values) 355 foreach (ListenerInfo li in m_listeners.Values)
381 { 356 {
382 if (li.GetHostID().Equals(listenerKey)) 357 if (li.GetHostID().Equals(listenerKey))
383 { 358 {
384 if ( li.IsActive() ) 359 if (li.IsActive())
385 { 360 {
386 if ( channel == li.GetChannel() ) 361 if (channel == li.GetChannel())
387 { 362 {
388 if ( (li.GetID().ToString().Length > 0) && 363 if ((li.GetID().ToString().Length > 0) &&
389 (!li.GetID().Equals(LLUUID.Zero)) ) 364 (!li.GetID().Equals(LLUUID.Zero)))
390 { 365 {
391 if (!li.GetID().ToString().Equals(sourceItemID)) 366 if (!li.GetID().ToString().Equals(sourceItemID))
392 { 367 {
393 isMatch = false; 368 isMatch = false;
394 } 369 }
395 } 370 }
396 if ( isMatch && (li.GetName().Length > 0) ) 371 if (isMatch && (li.GetName().Length > 0))
397 { 372 {
398 if ( li.GetName().Equals(name) ) 373 if (li.GetName().Equals(name))
399 { 374 {
400 isMatch = false; 375 isMatch = false;
401 } 376 }
402 } 377 }
403 if ( isMatch ) 378 if (isMatch)
404 { 379 {
405 return new ListenerInfo( 380 return new ListenerInfo(
406 li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(), 381 li.GetLocalID(), li.GetHandle(), li.GetItemID(), li.GetHostID(),
407 li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID) 382 li.GetChannel(), name, li.GetID(), msg, new LLUUID(sourceItemID)
408 ); 383 );
409 } 384 }
410 } 385 }
411 } 386 }
@@ -413,35 +388,36 @@ namespace OpenSim.Region.Environment.Modules
413 } 388 }
414 return null; 389 return null;
415 } 390 }
416
417 } 391 }
418 392
419 public class ListenerInfo 393 public class ListenerInfo
420 { 394 {
421 395 private LLUUID m_itemID; // ID of the host script engine
422 private LLUUID m_itemID; // ID of the host script engine 396 private LLUUID m_hostID; // ID of the host/scene part
423 private LLUUID m_hostID; // ID of the host/scene part 397 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
424 private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message 398 private int m_channel; // Channel
425 private int m_channel; // Channel 399 private int m_handle; // Assigned handle of this listener
426 private int m_handle; // Assigned handle of this listener 400 private uint m_localID; // Local ID from script engine
427 private uint m_localID; // Local ID from script engine 401 private string m_name; // Object name to filter messages from
428 private string m_name; // Object name to filter messages from 402 private LLUUID m_id; // ID to filter messages from
429 private LLUUID m_id; // ID to filter messages from 403 private string m_message; // The message
430 private string m_message; // The message 404 private bool m_active; // Listener is active or not
431 private bool m_active; // Listener is active or not 405
432 406 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id,
433 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) 407 string message)
434 { 408 {
435 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 409 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
436 } 410 }
437 411
438 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message, LLUUID sourceItemID) 412 public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id,
413 string message, LLUUID sourceItemID)
439 { 414 {
440 Initialise(localID, handle, ItemID, hostID, channel, name, id, message); 415 Initialise(localID, handle, ItemID, hostID, channel, name, id, message);
441 m_sourceItemID = sourceItemID; 416 m_sourceItemID = sourceItemID;
442 } 417 }
443 418
444 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message) 419 private void Initialise(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name,
420 LLUUID id, string message)
445 { 421 {
446 m_handle = handle; 422 m_handle = handle;
447 m_channel = channel; 423 m_channel = channel;
@@ -453,55 +429,65 @@ namespace OpenSim.Region.Environment.Modules
453 m_active = true; 429 m_active = true;
454 m_localID = localID; 430 m_localID = localID;
455 } 431 }
432
456 public LLUUID GetItemID() 433 public LLUUID GetItemID()
457 { 434 {
458 return m_itemID; 435 return m_itemID;
459 } 436 }
437
460 public LLUUID GetHostID() 438 public LLUUID GetHostID()
461 { 439 {
462 return m_hostID; 440 return m_hostID;
463 } 441 }
442
464 public LLUUID GetSourceItemID() 443 public LLUUID GetSourceItemID()
465 { 444 {
466 return m_sourceItemID; 445 return m_sourceItemID;
467 } 446 }
447
468 public int GetChannel() 448 public int GetChannel()
469 { 449 {
470 return m_channel; 450 return m_channel;
471 } 451 }
452
472 public uint GetLocalID() 453 public uint GetLocalID()
473 { 454 {
474 return m_localID; 455 return m_localID;
475 } 456 }
457
476 public int GetHandle() 458 public int GetHandle()
477 { 459 {
478 return m_handle; 460 return m_handle;
479 } 461 }
462
480 public string GetMessage() 463 public string GetMessage()
481 { 464 {
482 return m_message; 465 return m_message;
483 } 466 }
467
484 public string GetName() 468 public string GetName()
485 { 469 {
486 return m_name; 470 return m_name;
487 } 471 }
472
488 public bool IsActive() 473 public bool IsActive()
489 { 474 {
490 return m_active; 475 return m_active;
491 } 476 }
477
492 public void Deactivate() 478 public void Deactivate()
493 { 479 {
494 m_active = false; 480 m_active = false;
495 } 481 }
482
496 public void Activate() 483 public void Activate()
497 { 484 {
498 m_active = true; 485 m_active = true;
499 } 486 }
487
500 public LLUUID GetID() 488 public LLUUID GetID()
501 { 489 {
502 return m_id; 490 return m_id;
503 } 491 }
504
505 } 492 }
506 493} \ No newline at end of file
507}
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index dd84778..434c92f 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -26,20 +26,15 @@
26* 26*
27*/ 27*/
28 28
29using System; 29using System.Collections;
30using System.IO; 30using System.Collections.Generic;
31using System.Net.Sockets;
32using System.Threading; 31using System.Threading;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework.Interfaces; 33using Nini.Config;
35using OpenSim.Framework; 34using Nwc.XmlRpc;
35using OpenSim.Framework.Servers;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
38using OpenSim.Framework.Servers;
39using Nwc.XmlRpc;
40using System.Collections;
41using System.Collections.Generic;
42using Nini.Config;
43 38
44/***************************************************** 39/*****************************************************
45 * 40 *
@@ -73,6 +68,7 @@ using Nini.Config;
73 * llCloseRemoteDataChannel 68 * llCloseRemoteDataChannel
74 * 69 *
75 * **************************************************/ 70 * **************************************************/
71
76namespace OpenSim.Region.Environment.Modules 72namespace OpenSim.Region.Environment.Modules
77{ 73{
78 public class XMLRPCModule : IRegionModule, IXMLRPC 74 public class XMLRPCModule : IRegionModule, IXMLRPC
@@ -83,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules
83 private string m_name = "XMLRPCModule"; 79 private string m_name = "XMLRPCModule";
84 private int RemoteReplyScriptWait = 100; 80 private int RemoteReplyScriptWait = 100;
85 private int RemoteReplyScriptTimeout = 300; 81 private int RemoteReplyScriptTimeout = 300;
86 82
87 // <channel id, RPCChannelInfo> 83 // <channel id, RPCChannelInfo>
88 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels; 84 private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
89 85
@@ -106,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules
106 // Start http server 102 // Start http server
107 // Attach xmlrpc handlers 103 // Attach xmlrpc handlers
108 BaseHttpServer httpServer = new BaseHttpServer(20800); 104 BaseHttpServer httpServer = new BaseHttpServer(20800);
109 httpServer.AddXmlRPCHandler("llRemoteData", this.XmlRpcRemoteData); 105 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
110 httpServer.Start(); 106 httpServer.Start();
111 } 107 }
112 108
@@ -141,6 +137,7 @@ namespace OpenSim.Region.Environment.Modules
141 * current channel and assign a new one. 137 * current channel and assign a new one.
142 * 138 *
143 * ********************************************/ 139 * ********************************************/
140
144 public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) 141 public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID)
145 { 142 {
146 LLUUID channel = null; 143 LLUUID channel = null;
@@ -156,7 +153,7 @@ namespace OpenSim.Region.Environment.Modules
156 } 153 }
157 } 154 }
158 155
159 if ( (channel == null) || (channel.Equals(LLUUID.Zero)) ) 156 if ((channel == null) || (channel.Equals(LLUUID.Zero)))
160 { 157 {
161 channel = LLUUID.Random(); 158 channel = LLUUID.Random();
162 RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); 159 RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel);
@@ -164,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules
164 { 161 {
165 m_openChannels.Add(channel, rpcChanInfo); 162 m_openChannels.Add(channel, rpcChanInfo);
166 } 163 }
167
168 } 164 }
169 165
170 return channel; 166 return channel;
@@ -176,6 +172,7 @@ namespace OpenSim.Region.Environment.Modules
176 * Response to RPC message 172 * Response to RPC message
177 * 173 *
178 *********************************************/ 174 *********************************************/
175
179 public void RemoteDataReply(string channel, string message_id, string sdata, int idata) 176 public void RemoteDataReply(string channel, string message_id, string sdata, int idata)
180 { 177 {
181 RPCRequestInfo rpcInfo; 178 RPCRequestInfo rpcInfo;
@@ -191,7 +188,6 @@ namespace OpenSim.Region.Environment.Modules
191 m_pendingResponse.Remove(message_key); 188 m_pendingResponse.Remove(message_key);
192 } 189 }
193 } 190 }
194
195 } 191 }
196 192
197 /********************************************** 193 /**********************************************
@@ -200,41 +196,44 @@ namespace OpenSim.Region.Environment.Modules
200 * Remove channel from dictionary 196 * Remove channel from dictionary
201 * 197 *
202 *********************************************/ 198 *********************************************/
199
203 public void CloseXMLRPCChannel(LLUUID channelKey) 200 public void CloseXMLRPCChannel(LLUUID channelKey)
204 { 201 {
205 if(m_openChannels.ContainsKey(channelKey)) 202 if (m_openChannels.ContainsKey(channelKey))
206 m_openChannels.Remove(channelKey); 203 m_openChannels.Remove(channelKey);
207 } 204 }
208 205
209 206
210 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request) 207 public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request)
211 { 208 {
212
213 XmlRpcResponse response = new XmlRpcResponse(); 209 XmlRpcResponse response = new XmlRpcResponse();
214 210
215 Hashtable requestData = (Hashtable)request.Params[0]; 211 Hashtable requestData = (Hashtable) request.Params[0];
216 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") && requestData.Contains("StringValue")); 212 bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") &&
213 requestData.Contains("StringValue"));
217 214
218 if (GoodXML) 215 if (GoodXML)
219 { 216 {
220 LLUUID channel = new LLUUID((string)requestData["Channel"]); 217 LLUUID channel = new LLUUID((string) requestData["Channel"]);
221 RPCChannelInfo rpcChanInfo; 218 RPCChannelInfo rpcChanInfo;
222 if (m_openChannels.TryGetValue(channel, out rpcChanInfo)) 219 if (m_openChannels.TryGetValue(channel, out rpcChanInfo))
223 { 220 {
224 string intVal = (string)requestData["IntValue"]; 221 string intVal = (string) requestData["IntValue"];
225 string strVal = (string)requestData["StringValue"]; 222 string strVal = (string) requestData["StringValue"];
226 223
227 RPCRequestInfo rpcInfo; 224 RPCRequestInfo rpcInfo;
228 225
229 lock (XMLRPCListLock) 226 lock (XMLRPCListLock)
230 { 227 {
231 rpcInfo = new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal, intVal); 228 rpcInfo =
229 new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal,
230 intVal);
232 rpcQueue.Enqueue(rpcInfo); 231 rpcQueue.Enqueue(rpcInfo);
233 } 232 }
234 233
235 int timeoutCtr = 0; 234 int timeoutCtr = 0;
236 235
237 while(!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout)) 236 while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout))
238 { 237 {
239 Thread.Sleep(RemoteReplyScriptWait); 238 Thread.Sleep(RemoteReplyScriptWait);
240 timeoutCtr += RemoteReplyScriptWait; 239 timeoutCtr += RemoteReplyScriptWait;
@@ -252,13 +251,11 @@ namespace OpenSim.Region.Environment.Modules
252 m_pendingResponse.Remove(rpcInfo.GetMessageID()); 251 m_pendingResponse.Remove(rpcInfo.GetMessageID());
253 } 252 }
254 } 253 }
255
256 } 254 }
257 else 255 else
258 { 256 {
259 response.SetFault(-1, "Invalid channel"); 257 response.SetFault(-1, "Invalid channel");
260 } 258 }
261
262 } 259 }
263 260
264 return response; 261 return response;
@@ -278,7 +275,6 @@ namespace OpenSim.Region.Environment.Modules
278 return rpcInfo; 275 return rpcInfo;
279 } 276 }
280 } 277 }
281
282 } 278 }
283 279
284 /************************************************************** 280 /**************************************************************
@@ -288,6 +284,7 @@ namespace OpenSim.Region.Environment.Modules
288 * Holds details about incoming requests until they are picked 284 * Holds details about incoming requests until they are picked
289 * from the queue by LSLLongCmdHandler 285 * from the queue by LSLLongCmdHandler
290 * ***********************************************************/ 286 * ***********************************************************/
287
291 public class RPCRequestInfo 288 public class RPCRequestInfo
292 { 289 {
293 private string m_StrVal; 290 private string m_StrVal;
@@ -315,6 +312,7 @@ namespace OpenSim.Region.Environment.Modules
315 { 312 {
316 return m_processed; 313 return m_processed;
317 } 314 }
315
318 public LLUUID GetChannelKey() 316 public LLUUID GetChannelKey()
319 { 317 {
320 return m_ChannelKey; 318 return m_ChannelKey;
@@ -324,36 +322,41 @@ namespace OpenSim.Region.Environment.Modules
324 { 322 {
325 m_processed = processed; 323 m_processed = processed;
326 } 324 }
325
327 public void SetRetval(string resp) 326 public void SetRetval(string resp)
328 { 327 {
329 m_resp = resp; 328 m_resp = resp;
330 } 329 }
330
331 public string GetRetval() 331 public string GetRetval()
332 { 332 {
333 return m_resp; 333 return m_resp;
334 } 334 }
335
335 public uint GetLocalID() 336 public uint GetLocalID()
336 { 337 {
337 return m_localID; 338 return m_localID;
338 } 339 }
340
339 public LLUUID GetItemID() 341 public LLUUID GetItemID()
340 { 342 {
341 return m_ItemID; 343 return m_ItemID;
342 } 344 }
345
343 public string GetStrVal() 346 public string GetStrVal()
344 { 347 {
345 return m_StrVal; 348 return m_StrVal;
346 } 349 }
350
347 public int GetIntValue() 351 public int GetIntValue()
348 { 352 {
349 return int.Parse(m_IntVal); 353 return int.Parse(m_IntVal);
350 } 354 }
355
351 public LLUUID GetMessageID() 356 public LLUUID GetMessageID()
352 { 357 {
353 return m_MessageID; 358 return m_MessageID;
354 } 359 }
355
356
357 } 360 }
358 361
359 public class RPCChannelInfo 362 public class RPCChannelInfo
@@ -383,7 +386,5 @@ namespace OpenSim.Region.Environment.Modules
383 { 386 {
384 return m_localID; 387 return m_localID;
385 } 388 }
386
387 } 389 }
388 390} \ No newline at end of file
389}
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs
index e555475..807b46c 100644
--- a/OpenSim/Region/Environment/Modules/XferModule.cs
+++ b/OpenSim/Region/Environment/Modules/XferModule.cs
@@ -29,11 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using Nini.Config;
33using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using OpenSim.Framework;
36using Nini.Config;
37 36
38namespace OpenSim.Region.Environment.Modules 37namespace OpenSim.Region.Environment.Modules
39{ 38{
@@ -200,4 +199,4 @@ namespace OpenSim.Region.Environment.Modules
200 } 199 }
201 } 200 }
202 } 201 }
203} 202} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 63285dc..fd55833 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -29,7 +29,6 @@
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Region.Environment.LandManagement; 30using OpenSim.Region.Environment.LandManagement;
31using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework;
33 32
34namespace OpenSim.Region.Environment 33namespace OpenSim.Region.Environment
35{ 34{
@@ -337,4 +336,4 @@ namespace OpenSim.Region.Environment
337 336
338 #endregion 337 #endregion
339 } 338 }
340} 339} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 767a740..b8bae57 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -146,4 +146,4 @@ namespace OpenSim.Region.Environment.Scenes
146 146
147 public abstract void SetText(string text, Vector3 color, double alpha); 147 public abstract void SetText(string text, Vector3 color, double alpha);
148 } 148 }
149} 149} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index 14a1c7e..0f3bca1 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -29,7 +29,6 @@
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Interfaces;
33 32
34namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
35{ 34{
@@ -40,4 +39,4 @@ namespace OpenSim.Region.Environment.Scenes
40 void SendOurAppearance(IClientAPI OurClient); 39 void SendOurAppearance(IClientAPI OurClient);
41 void SendAppearanceToOtherAgent(ScenePresence avatarInfo); 40 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
42 } 41 }
43} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 68591d4..a0c9a50 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -29,9 +29,8 @@
29using Axiom.Math; 29using Axiom.Math;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Communications.Cache;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache;
35using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
36 35
37namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
@@ -45,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes
45 { 44 {
46 ScenePresence avatar; 45 ScenePresence avatar;
47 46
48 if ( TryGetAvatar( avatarId, out avatar )) 47 if (TryGetAvatar(avatarId, out avatar))
49 { 48 {
50 AddInventoryItem(avatar.ControllingClient, item); 49 AddInventoryItem(avatar.ControllingClient, item);
51 } 50 }
@@ -392,7 +391,7 @@ namespace OpenSim.Region.Environment.Scenes
392 remoteClient.SendInventoryItemUpdate(item); 391 remoteClient.SendInventoryItemUpdate(item);
393 } 392 }
394 393
395 DeleteSceneObjectGroup((SceneObjectGroup)selectedEnt); 394 DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt);
396 } 395 }
397 } 396 }
398 } 397 }
@@ -471,4 +470,4 @@ namespace OpenSim.Region.Environment.Scenes
471 } 470 }
472 } 471 }
473 } 472 }
474} 473} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 3a35e21..69bd310 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -28,9 +28,8 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework.Console;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Console;
34 33
35namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
36{ 35{
@@ -73,12 +72,12 @@ namespace OpenSim.Region.Environment.Scenes
73 { 72 {
74 ChatFromViewerArgs args = new ChatFromViewerArgs(); 73 ChatFromViewerArgs args = new ChatFromViewerArgs();
75 74
76 args.Message = OpenSim.Framework.Util.FieldToString(message); 75 args.Message = Util.FieldToString(message);
77 args.Channel = channel; 76 args.Channel = channel;
78 args.Type = (ChatTypeEnum)type; 77 args.Type = (ChatTypeEnum) type;
79 args.Position = fromPos; 78 args.Position = fromPos;
80 79
81 ScenePresence user = this.GetScenePresence(fromAgentID); 80 ScenePresence user = GetScenePresence(fromAgentID);
82 if (user != null) 81 if (user != null)
83 args.Sender = user.ControllingClient; 82 args.Sender = user.ControllingClient;
84 else 83 else
@@ -488,10 +487,7 @@ namespace OpenSim.Region.Environment.Scenes
488 487
489 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) 488 public void StartAnimation(LLUUID animID, int seq, LLUUID agentId)
490 { 489 {
491 Broadcast(delegate(IClientAPI client) 490 Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); });
492 {
493 client.SendAnimation(animID, seq, agentId);
494 });
495 } 491 }
496 492
497 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 493 public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
@@ -503,14 +499,14 @@ namespace OpenSim.Region.Environment.Scenes
503 if (ent is SceneObjectGroup) 499 if (ent is SceneObjectGroup)
504 { 500 {
505 SceneObjectGroup obj = ent as SceneObjectGroup; 501 SceneObjectGroup obj = ent as SceneObjectGroup;
506 502
507 if( obj.HasChildPrim( localID ) ) 503 if (obj.HasChildPrim(localID))
508 { 504 {
509 obj.ObjectGrabHandler(localID, offsetPos, remoteClient); 505 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
510 return; 506 return;
511 } 507 }
512 } 508 }
513 } 509 }
514 } 510 }
515 } 511 }
516} 512} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b54c25b..db4d230 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Net;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.IO; 30using System.IO;
31using System.Net;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using System.Xml; 34using System.Xml;
@@ -38,17 +38,16 @@ using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Interfaces;
42using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
43using OpenSim.Region.Capabilities; 42using OpenSim.Region.Capabilities;
44using OpenSim.Region.Environment.Interfaces; 43using OpenSim.Region.Environment.Interfaces;
45using OpenSim.Region.Environment.LandManagement; 44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment.Modules;
46using OpenSim.Region.Environment.Scenes.Scripting; 46using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Environment.Types; 47using OpenSim.Region.Environment.Types;
48using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.Physics.Manager;
49using OpenSim.Region.Terrain; 49using OpenSim.Region.Terrain;
50using Timer = System.Timers.Timer; 50using Timer=System.Timers.Timer;
51using OpenSim.Region.Environment.Modules;
52 51
53namespace OpenSim.Region.Environment.Scenes 52namespace OpenSim.Region.Environment.Scenes
54{ 53{
@@ -130,6 +129,7 @@ namespace OpenSim.Region.Environment.Scenes
130 private readonly EstateManager m_estateManager; 129 private readonly EstateManager m_estateManager;
131 130
132 private PhysicsScene phyScene; 131 private PhysicsScene phyScene;
132
133 public PhysicsScene PhysScene 133 public PhysicsScene PhysScene
134 { 134 {
135 set { phyScene = value; } 135 set { phyScene = value; }
@@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
199 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 199 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
200 200
201 MainLog.Instance.Verbose("Creating LandMap"); 201 MainLog.Instance.Verbose("Creating LandMap");
202 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); 202 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
203 203
204 ScenePresence.LoadAnims(); 204 ScenePresence.LoadAnims();
205 205
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes
233 public void StartTimer() 233 public void StartTimer()
234 { 234 {
235 m_heartbeatTimer.Enabled = true; 235 m_heartbeatTimer.Enabled = true;
236 m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 236 m_heartbeatTimer.Interval = (int) (m_timespan*1000);
237 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 237 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
238 } 238 }
239 239
@@ -267,33 +267,33 @@ namespace OpenSim.Region.Environment.Scenes
267 if (m_frame == Int32.MaxValue) 267 if (m_frame == Int32.MaxValue)
268 m_frame = 0; 268 m_frame = 0;
269 269
270 if (m_frame % m_update_physics == 0) 270 if (m_frame%m_update_physics == 0)
271 UpdatePreparePhysics(); 271 UpdatePreparePhysics();
272 272
273 if (m_frame % m_update_entitymovement == 0) 273 if (m_frame%m_update_entitymovement == 0)
274 UpdateEntityMovement(); 274 UpdateEntityMovement();
275 275
276 if (m_frame % m_update_physics == 0) 276 if (m_frame%m_update_physics == 0)
277 UpdatePhysics( 277 UpdatePhysics(
278 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 278 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
279 ); 279 );
280 280
281 if (m_frame % m_update_entities == 0) 281 if (m_frame%m_update_entities == 0)
282 UpdateEntities(); 282 UpdateEntities();
283 283
284 if (m_frame % m_update_events == 0) 284 if (m_frame%m_update_events == 0)
285 UpdateEvents(); 285 UpdateEvents();
286 286
287 if (m_frame % m_update_backup == 0) 287 if (m_frame%m_update_backup == 0)
288 UpdateStorageBackup(); 288 UpdateStorageBackup();
289 289
290 if (m_frame % m_update_terrain == 0) 290 if (m_frame%m_update_terrain == 0)
291 UpdateTerrain(); 291 UpdateTerrain();
292 292
293 if (m_frame % m_update_land == 0) 293 if (m_frame%m_update_land == 0)
294 UpdateLand(); 294 UpdateLand();
295 295
296 if (m_frame % m_update_avatars == 0) 296 if (m_frame%m_update_avatars == 0)
297 UpdateInWorldTime(); 297 UpdateInWorldTime();
298 } 298 }
299 catch (NotImplementedException) 299 catch (NotImplementedException)
@@ -308,7 +308,7 @@ namespace OpenSim.Region.Environment.Scenes
308 { 308 {
309 updateLock.ReleaseMutex(); 309 updateLock.ReleaseMutex();
310 310
311 m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; 311 m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds;
312 m_lastupdate = DateTime.Now; 312 m_lastupdate = DateTime.Now;
313 } 313 }
314 } 314 }
@@ -369,24 +369,23 @@ namespace OpenSim.Region.Environment.Scenes
369 phyScene.SetTerrain(Terrain.GetHeights1D()); 369 phyScene.SetTerrain(Terrain.GetHeights1D());
370 } 370 }
371 371
372 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); 372 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
373 373
374 float[] terData = Terrain.GetHeights1D(); 374 float[] terData = Terrain.GetHeights1D();
375 375
376 Broadcast(delegate(IClientAPI client) 376 Broadcast(delegate(IClientAPI client)
377 { 377 {
378 for (int x = 0; x < 16; x++) 378 for (int x = 0; x < 16; x++)
379 { 379 {
380 for (int y = 0; y < 16; y++) 380 for (int y = 0; y < 16; y++)
381 { 381 {
382 if (Terrain.Tainted(x * 16, y * 16)) 382 if (Terrain.Tainted(x*16, y*16))
383 { 383 {
384 client.SendLayerData(x, y, terData); 384 client.SendLayerData(x, y, terData);
385 } 385 }
386 } 386 }
387 } 387 }
388 }); 388 });
389
390 389
391 390
392 Terrain.ResetTaint(); 391 Terrain.ResetTaint();
@@ -418,7 +417,7 @@ namespace OpenSim.Region.Environment.Scenes
418 { 417 {
419 lock (m_syncRoot) 418 lock (m_syncRoot)
420 { 419 {
421 phyScene.Simulate((float)elapsed); 420 phyScene.Simulate((float) elapsed);
422 } 421 }
423 } 422 }
424 423
@@ -438,11 +437,9 @@ namespace OpenSim.Region.Environment.Scenes
438 /// <returns></returns> 437 /// <returns></returns>
439 internal void Broadcast(Action<IClientAPI> whatToDo) 438 internal void Broadcast(Action<IClientAPI> whatToDo)
440 { 439 {
441 ForEachScenePresence(delegate(ScenePresence presence) 440 ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); });
442 {
443 whatToDo(presence.ControllingClient);
444 });
445 } 441 }
442
446 /// <summary> 443 /// <summary>
447 /// 444 ///
448 /// </summary> 445 /// </summary>
@@ -473,7 +470,7 @@ namespace OpenSim.Region.Environment.Scenes
473 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); 470 MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
474 Terrain.HillsGenerator(); 471 Terrain.HillsGenerator();
475 472
476 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(),RegionInfo.RegionID); 473 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
477 } 474 }
478 else 475 else
479 { 476 {
@@ -484,7 +481,8 @@ namespace OpenSim.Region.Environment.Scenes
484 } 481 }
485 catch 482 catch
486 { 483 {
487 MainLog.Instance.Verbose("TERRAIN", "No terrain found in database or default. Generating a new terrain."); 484 MainLog.Instance.Verbose("TERRAIN",
485 "No terrain found in database or default. Generating a new terrain.");
488 Terrain.HillsGenerator(); 486 Terrain.HillsGenerator();
489 } 487 }
490 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); 488 storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID);
@@ -535,7 +533,7 @@ namespace OpenSim.Region.Environment.Scenes
535 { 533 {
536 AddEntityFromStorage(prim); 534 AddEntityFromStorage(prim);
537 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 535 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
538 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 536 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
539 rootPart.PhysActor = phyScene.AddPrimShape( 537 rootPart.PhysActor = phyScene.AddPrimShape(
540 rootPart.Name, 538 rootPart.Name,
541 rootPart.Shape, 539 rootPart.Shape,
@@ -581,17 +579,17 @@ namespace OpenSim.Region.Environment.Scenes
581 // if grass or tree, make phantom 579 // if grass or tree, make phantom
582 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) 580 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
583 { 581 {
584 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 582 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom;
585 } 583 }
586 // if not phantom, add to physics 584 // if not phantom, add to physics
587 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 585 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
588 rootPart.PhysActor = 586 rootPart.PhysActor =
589 phyScene.AddPrimShape( 587 phyScene.AddPrimShape(
590 rootPart.Name, 588 rootPart.Name,
591 rootPart.Shape, 589 rootPart.Shape,
592 new PhysicsVector(pos.X, pos.Y, pos.Z), 590 new PhysicsVector(pos.X, pos.Y, pos.Z),
593 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 591 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
594 new Quaternion()); 592 new Quaternion());
595 } 593 }
596 } 594 }
597 595
@@ -601,9 +599,9 @@ namespace OpenSim.Region.Environment.Scenes
601 { 599 {
602 if (obj is SceneObjectGroup) 600 if (obj is SceneObjectGroup)
603 { 601 {
604 if (((SceneObjectGroup)obj).LocalId == localID) 602 if (((SceneObjectGroup) obj).LocalId == localID)
605 { 603 {
606 RemoveEntity((SceneObjectGroup)obj); 604 RemoveEntity((SceneObjectGroup) obj);
607 return; 605 return;
608 } 606 }
609 } 607 }
@@ -657,7 +655,6 @@ namespace OpenSim.Region.Environment.Scenes
657 int primCount = 0; 655 int primCount = 0;
658 if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) 656 if ((fileName.StartsWith("http:")) | (File.Exists(fileName)))
659 { 657 {
660
661 XmlTextReader reader = new XmlTextReader(fileName); 658 XmlTextReader reader = new XmlTextReader(fileName);
662 reader.WhitespaceHandling = WhitespaceHandling.None; 659 reader.WhitespaceHandling = WhitespaceHandling.None;
663 doc.Load(reader); 660 doc.Load(reader);
@@ -672,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes
672 AddEntity(obj); 669 AddEntity(obj);
673 670
674 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 671 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
675 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 672 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
676 rootPart.PhysActor = phyScene.AddPrimShape( 673 rootPart.PhysActor = phyScene.AddPrimShape(
677 rootPart.Name, 674 rootPart.Name,
678 rootPart.Shape, 675 rootPart.Shape,
@@ -700,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
700 { 697 {
701 if (ent is SceneObjectGroup) 698 if (ent is SceneObjectGroup)
702 { 699 {
703 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); 700 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
704 primCount++; 701 primCount++;
705 } 702 }
706 } 703 }
@@ -737,7 +734,7 @@ namespace OpenSim.Region.Environment.Scenes
737 AddEntityFromStorage(obj); 734 AddEntityFromStorage(obj);
738 735
739 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 736 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
740 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 737 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
741 rootPart.PhysActor = phyScene.AddPrimShape( 738 rootPart.PhysActor = phyScene.AddPrimShape(
742 rootPart.Name, 739 rootPart.Name,
743 rootPart.Shape, 740 rootPart.Shape,
@@ -758,7 +755,7 @@ namespace OpenSim.Region.Environment.Scenes
758 { 755 {
759 if (ent is SceneObjectGroup) 756 if (ent is SceneObjectGroup)
760 { 757 {
761 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2()); 758 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2());
762 primCount++; 759 primCount++;
763 } 760 }
764 } 761 }
@@ -857,7 +854,8 @@ namespace OpenSim.Region.Environment.Scenes
857 byte[] visualParams; 854 byte[] visualParams;
858 AvatarWearable[] wearables; 855 AvatarWearable[] wearables;
859 856
860 if( m_AvatarFactory == null || !m_AvatarFactory.TryGetIntialAvatarAppearance( client.AgentId, out wearables, out visualParams)) 857 if (m_AvatarFactory == null ||
858 !m_AvatarFactory.TryGetIntialAvatarAppearance(client.AgentId, out wearables, out visualParams))
861 { 859 {
862 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams); 860 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
863 } 861 }
@@ -916,16 +914,10 @@ namespace OpenSim.Region.Environment.Scenes
916 914
917 ScenePresence avatar = GetScenePresence(agentID); 915 ScenePresence avatar = GetScenePresence(agentID);
918 916
919 Broadcast(delegate(IClientAPI client) 917 Broadcast(delegate(IClientAPI client) { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); });
920 {
921 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
922 });
923 918
924 ForEachScenePresence( 919 ForEachScenePresence(
925 delegate(ScenePresence presence) 920 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
926 {
927 presence.CoarseLocationChange();
928 });
929 921
930 lock (m_scenePresences) 922 lock (m_scenePresences)
931 { 923 {
@@ -965,10 +957,8 @@ namespace OpenSim.Region.Environment.Scenes
965 957
966 public List<ScenePresence> GetAvatars() 958 public List<ScenePresence> GetAvatars()
967 { 959 {
968 List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence) 960 List<ScenePresence> result =
969 { 961 GetScenePresences(delegate(ScenePresence scenePresence) { return !scenePresence.IsChildAgent; });
970 return !scenePresence.IsChildAgent;
971 });
972 962
973 return result; 963 return result;
974 } 964 }
@@ -1046,18 +1036,12 @@ namespace OpenSim.Region.Environment.Scenes
1046 1036
1047 public void SendKillObject(uint localID) 1037 public void SendKillObject(uint localID)
1048 { 1038 {
1049 Broadcast(delegate(IClientAPI client) 1039 Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
1050 {
1051 client.SendKillObject(m_regionHandle, localID);
1052 });
1053 } 1040 }
1054 1041
1055 public void NotifyMyCoarseLocationChange() 1042 public void NotifyMyCoarseLocationChange()
1056 { 1043 {
1057 ForEachScenePresence(delegate(ScenePresence presence) 1044 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
1058 {
1059 presence.CoarseLocationChange();
1060 });
1061 } 1045 }
1062 1046
1063 public void SendAllSceneObjectsToClient(ScenePresence presence) 1047 public void SendAllSceneObjectsToClient(ScenePresence presence)
@@ -1067,7 +1051,7 @@ namespace OpenSim.Region.Environment.Scenes
1067 if (ent is SceneObjectGroup) 1051 if (ent is SceneObjectGroup)
1068 { 1052 {
1069 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 1053 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
1070 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 1054 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
1071 } 1055 }
1072 } 1056 }
1073 } 1057 }
@@ -1137,11 +1121,12 @@ namespace OpenSim.Region.Environment.Scenes
1137 } 1121 }
1138 } 1122 }
1139 1123
1140 delegate void InformClientOfNeighbourDelegate(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); 1124 private delegate void InformClientOfNeighbourDelegate(
1125 IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
1141 1126
1142 private void InformClientOfNeighbourCompleted(IAsyncResult iar) 1127 private void InformClientOfNeighbourCompleted(IAsyncResult iar)
1143 { 1128 {
1144 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; 1129 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
1145 1130
1146 1131
1147 icon.EndInvoke(iar); 1132 icon.EndInvoke(iar);
@@ -1157,7 +1142,8 @@ namespace OpenSim.Region.Environment.Scenes
1157 /// <param name="a"></param> 1142 /// <param name="a"></param>
1158 /// <param name="regionHandle"></param> 1143 /// <param name="regionHandle"></param>
1159 /// <param name="endPoint"></param> 1144 /// <param name="endPoint"></param>
1160 private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) 1145 private void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle,
1146 IPEndPoint endPoint)
1161 { 1147 {
1162 MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours"); 1148 MainLog.Instance.Notice("INTERGRID", "Starting to inform client about neighbours");
1163 bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); 1149 bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a);
@@ -1172,7 +1158,8 @@ namespace OpenSim.Region.Environment.Scenes
1172 /// </summary> 1158 /// </summary>
1173 public void InformClientOfNeighbours(IClientAPI remoteClient) 1159 public void InformClientOfNeighbours(IClientAPI remoteClient)
1174 { 1160 {
1175 List<SimpleRegionInfo> neighbours = commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); 1161 List<SimpleRegionInfo> neighbours =
1162 commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY);
1176 if (neighbours != null) 1163 if (neighbours != null)
1177 { 1164 {
1178 for (int i = 0; i < neighbours.Count; i++) 1165 for (int i = 0; i < neighbours.Count; i++)
@@ -1185,9 +1172,8 @@ namespace OpenSim.Region.Environment.Scenes
1185 1172
1186 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; 1173 InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
1187 d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, 1174 d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint,
1188 InformClientOfNeighbourCompleted, 1175 InformClientOfNeighbourCompleted,
1189 d); 1176 d);
1190
1191 } 1177 }
1192 } 1178 }
1193 } 1179 }
@@ -1289,17 +1275,17 @@ namespace OpenSim.Region.Environment.Scenes
1289 1275
1290 public void RegisterModuleInterface<M>(M mod) 1276 public void RegisterModuleInterface<M>(M mod)
1291 { 1277 {
1292 if (!ModuleInterfaces.ContainsKey(typeof(M))) 1278 if (!ModuleInterfaces.ContainsKey(typeof (M)))
1293 { 1279 {
1294 ModuleInterfaces.Add(typeof(M), mod); 1280 ModuleInterfaces.Add(typeof (M), mod);
1295 } 1281 }
1296 } 1282 }
1297 1283
1298 public T RequestModuleInterface<T>() 1284 public T RequestModuleInterface<T>()
1299 { 1285 {
1300 if (ModuleInterfaces.ContainsKey(typeof(T))) 1286 if (ModuleInterfaces.ContainsKey(typeof (T)))
1301 { 1287 {
1302 return (T)ModuleInterfaces[typeof(T)]; 1288 return (T) ModuleInterfaces[typeof (T)];
1303 } 1289 }
1304 else 1290 else
1305 { 1291 {
@@ -1317,7 +1303,8 @@ namespace OpenSim.Region.Environment.Scenes
1317 { 1303 {
1318 if (m_scenePresences.ContainsKey(avatarID)) 1304 if (m_scenePresences.ContainsKey(avatarID))
1319 { 1305 {
1320 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url); 1306 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned,
1307 message, url);
1321 } 1308 }
1322 } 1309 }
1323 1310
@@ -1388,7 +1375,7 @@ namespace OpenSim.Region.Environment.Scenes
1388 { 1375 {
1389 if (ent is SceneObjectGroup) 1376 if (ent is SceneObjectGroup)
1390 { 1377 {
1391 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 1378 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
1392 } 1379 }
1393 } 1380 }
1394 } 1381 }
@@ -1400,7 +1387,7 @@ namespace OpenSim.Region.Environment.Scenes
1400 { 1387 {
1401 if (ent is SceneObjectGroup) 1388 if (ent is SceneObjectGroup)
1402 { 1389 {
1403 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); 1390 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
1404 if (part != null) 1391 if (part != null)
1405 { 1392 {
1406 if (part.Name == cmmdparams[0]) 1393 if (part.Name == cmmdparams[0])
@@ -1429,14 +1416,14 @@ namespace OpenSim.Region.Environment.Scenes
1429 foreach (ScenePresence scenePrescence in GetAvatars()) 1416 foreach (ScenePresence scenePrescence in GetAvatars())
1430 { 1417 {
1431 MainLog.Instance.Error( 1418 MainLog.Instance.Error(
1432 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", 1419 String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
1433 scenePrescence.Firstname, 1420 scenePrescence.Firstname,
1434 scenePrescence.Lastname, 1421 scenePrescence.Lastname,
1435 scenePrescence.UUID, 1422 scenePrescence.UUID,
1436 scenePrescence.ControllingClient.AgentId, 1423 scenePrescence.ControllingClient.AgentId,
1437 "Unknown", 1424 "Unknown",
1438 "Unknown", 1425 "Unknown",
1439 RegionInfo.RegionName)); 1426 RegionInfo.RegionName));
1440 } 1427 }
1441 break; 1428 break;
1442 case "modules": 1429 case "modules":
@@ -1482,10 +1469,10 @@ namespace OpenSim.Region.Environment.Scenes
1482 { 1469 {
1483 if (ent is SceneObjectGroup) 1470 if (ent is SceneObjectGroup)
1484 { 1471 {
1485 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1472 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1486 if (hasPrim != false) 1473 if (hasPrim != false)
1487 { 1474 {
1488 return ((SceneObjectGroup)ent).GetPartsFullID(localID); 1475 return ((SceneObjectGroup) ent).GetPartsFullID(localID);
1489 } 1476 }
1490 } 1477 }
1491 } 1478 }
@@ -1499,10 +1486,10 @@ namespace OpenSim.Region.Environment.Scenes
1499 { 1486 {
1500 if (ent is SceneObjectGroup) 1487 if (ent is SceneObjectGroup)
1501 { 1488 {
1502 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); 1489 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
1503 if (hasPrim != false) 1490 if (hasPrim != false)
1504 { 1491 {
1505 return ((SceneObjectGroup)ent).GetChildPart(localID); 1492 return ((SceneObjectGroup) ent).GetChildPart(localID);
1506 } 1493 }
1507 } 1494 }
1508 } 1495 }
@@ -1516,10 +1503,10 @@ namespace OpenSim.Region.Environment.Scenes
1516 { 1503 {
1517 if (ent is SceneObjectGroup) 1504 if (ent is SceneObjectGroup)
1518 { 1505 {
1519 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID); 1506 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID);
1520 if (hasPrim != false) 1507 if (hasPrim != false)
1521 { 1508 {
1522 return ((SceneObjectGroup)ent).GetChildPart(fullID); 1509 return ((SceneObjectGroup) ent).GetChildPart(fullID);
1523 } 1510 }
1524 } 1511 }
1525 } 1512 }
@@ -1569,12 +1556,12 @@ namespace OpenSim.Region.Environment.Scenes
1569 return false; 1556 return false;
1570 } 1557 }
1571 1558
1572 internal void ForEachClient( Action<IClientAPI> action ) 1559 internal void ForEachClient(Action<IClientAPI> action)
1573 { 1560 {
1574 foreach (ScenePresence presence in m_scenePresences.Values ) 1561 foreach (ScenePresence presence in m_scenePresences.Values)
1575 { 1562 {
1576 action(presence.ControllingClient); 1563 action(presence.ControllingClient);
1577 } 1564 }
1578 } 1565 }
1579 } 1566 }
1580} 1567} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 0072d4e..4ad9d65 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -28,10 +28,9 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Framework.Communications.Cache; 32using OpenSim.Framework.Communications.Cache;
32using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
33using OpenSim.Framework.Interfaces;
34using OpenSim.Framework;
35using OpenSim.Region.Terrain; 34using OpenSim.Region.Terrain;
36 35
37namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
@@ -39,6 +38,7 @@ namespace OpenSim.Region.Environment.Scenes
39 public abstract class SceneBase : IScene 38 public abstract class SceneBase : IScene
40 { 39 {
41 private readonly ClientManager m_clientManager = new ClientManager(); 40 private readonly ClientManager m_clientManager = new ClientManager();
41
42 public ClientManager ClientManager 42 public ClientManager ClientManager
43 { 43 {
44 get { return m_clientManager; } 44 get { return m_clientManager; }
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index ea47713..493afd1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -27,9 +27,8 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces;
31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces;
33 32
34namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
35{ 34{
@@ -207,4 +206,4 @@ namespace OpenSim.Region.Environment.Scenes
207 } 206 }
208 } 207 }
209 } 208 }
210} 209} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index a315d02..75e2a41 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -28,9 +28,9 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Framework.Console;
32using OpenSim.Framework;
33using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
@@ -152,10 +152,7 @@ namespace OpenSim.Region.Environment.Scenes
152 152
153 public void SendGeneralMessage(string msg) 153 public void SendGeneralMessage(string msg)
154 { 154 {
155 ForEachCurrentScene(delegate(Scene scene) 155 ForEachCurrentScene(delegate(Scene scene) { scene.SendGeneralAlert(msg); });
156 {
157 scene.SendGeneralAlert(msg);
158 });
159 } 156 }
160 157
161 public bool TrySetCurrentScene(string regionName) 158 public bool TrySetCurrentScene(string regionName)
@@ -185,23 +182,24 @@ namespace OpenSim.Region.Environment.Scenes
185 public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) 182 public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
186 { 183 {
187 ForEachCurrentScene(delegate(Scene scene) 184 ForEachCurrentScene(delegate(Scene scene)
188 {
189 foreach (EntityBase entity in scene.Entities.Values)
190 {
191 if (entity is ScenePresence)
192 {
193 ScenePresence scenePrescence = entity as ScenePresence;
194 if (!scenePrescence.IsChildAgent)
195 { 185 {
196 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 186 foreach (EntityBase entity in scene.Entities.Values)
197 scenePrescence.Firstname, scenePrescence.Lastname, 187 {
198 newDebug)); 188 if (entity is ScenePresence)
199 189 {
200 scenePrescence.ControllingClient.SetDebug(newDebug); 190 ScenePresence scenePrescence = entity as ScenePresence;
201 } 191 if (!scenePrescence.IsChildAgent)
202 } 192 {
203 } 193 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
204 }); 194 scenePrescence.Firstname,
195 scenePrescence.Lastname,
196 newDebug));
197
198 scenePrescence.ControllingClient.SetDebug(newDebug);
199 }
200 }
201 }
202 });
205 } 203 }
206 204
207 public List<ScenePresence> GetCurrentSceneAvatars() 205 public List<ScenePresence> GetCurrentSceneAvatars()
@@ -209,19 +207,19 @@ namespace OpenSim.Region.Environment.Scenes
209 List<ScenePresence> avatars = new List<ScenePresence>(); 207 List<ScenePresence> avatars = new List<ScenePresence>();
210 208
211 ForEachCurrentScene(delegate(Scene scene) 209 ForEachCurrentScene(delegate(Scene scene)
212 {
213 foreach (EntityBase entity in scene.Entities.Values)
214 {
215 if (entity is ScenePresence)
216 {
217 ScenePresence scenePrescence = entity as ScenePresence;
218 if (!scenePrescence.IsChildAgent)
219 { 210 {
220 avatars.Add(scenePrescence); 211 foreach (EntityBase entity in scene.Entities.Values)
221 } 212 {
222 } 213 if (entity is ScenePresence)
223 } 214 {
224 }); 215 ScenePresence scenePrescence = entity as ScenePresence;
216 if (!scenePrescence.IsChildAgent)
217 {
218 avatars.Add(scenePrescence);
219 }
220 }
221 }
222 });
225 223
226 return avatars; 224 return avatars;
227 } 225 }
@@ -242,11 +240,11 @@ namespace OpenSim.Region.Environment.Scenes
242 public void SetCurrentSceneTimePhase(int timePhase) 240 public void SetCurrentSceneTimePhase(int timePhase)
243 { 241 {
244 ForEachCurrentScene(delegate(Scene scene) 242 ForEachCurrentScene(delegate(Scene scene)
245 { 243 {
246 scene.SetTimePhase( 244 scene.SetTimePhase(
247 timePhase) 245 timePhase)
248 ; 246 ;
249 }); 247 });
250 } 248 }
251 249
252 250
@@ -260,11 +258,11 @@ namespace OpenSim.Region.Environment.Scenes
260 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); 258 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
261 } 259 }
262 260
263 public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) 261 public bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
264 { 262 {
265 foreach (Scene scene in m_localScenes) 263 foreach (Scene scene in m_localScenes)
266 { 264 {
267 if( scene.TryGetAvatar( avatarId, out avatar )) 265 if (scene.TryGetAvatar(avatarId, out avatar))
268 { 266 {
269 return true; 267 return true;
270 } 268 }
@@ -311,9 +309,9 @@ namespace OpenSim.Region.Environment.Scenes
311 return false; 309 return false;
312 } 310 }
313 311
314 public void ForEachScene(Action<Scene> action ) 312 public void ForEachScene(Action<Scene> action)
315 { 313 {
316 m_localScenes.ForEach( action ); 314 m_localScenes.ForEach(action);
317 } 315 }
318 } 316 }
319} 317} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 4603902..4d439b2 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -34,7 +34,6 @@ using System.Xml;
34using Axiom.Math; 34using Axiom.Math;
35using libsecondlife; 35using libsecondlife;
36using libsecondlife.Packets; 36using libsecondlife.Packets;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework; 37using OpenSim.Framework;
39using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
@@ -270,7 +269,7 @@ namespace OpenSim.Region.Environment.Scenes
270 StringReader sr = new StringReader(xmlData); 269 StringReader sr = new StringReader(xmlData);
271 XmlTextReader reader = new XmlTextReader(sr); 270 XmlTextReader reader = new XmlTextReader(sr);
272 reader.Read(); 271 reader.Read();
273 272
274 reader.ReadStartElement("SceneObjectGroup"); 273 reader.ReadStartElement("SceneObjectGroup");
275 m_rootPart = SceneObjectPart.FromXml(reader); 274 m_rootPart = SceneObjectPart.FromXml(reader);
276 275
@@ -285,14 +284,14 @@ namespace OpenSim.Region.Environment.Scenes
285 if (reader.Name == "SceneObjectPart") 284 if (reader.Name == "SceneObjectPart")
286 { 285 {
287 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 286 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
288 AddPart(Part); 287 AddPart(Part);
289 } 288 }
290 break; 289 break;
291 case XmlNodeType.EndElement: 290 case XmlNodeType.EndElement:
292 reader.Read(); 291 reader.Read();
293 break; 292 break;
294 } 293 }
295 more = !reader.EOF; 294 more = !reader.EOF;
296 } 295 }
297 reader.Close(); 296 reader.Close();
298 sr.Close(); 297 sr.Close();
@@ -424,13 +423,13 @@ namespace OpenSim.Region.Environment.Scenes
424 PrimitiveBaseShape pbs = dupe.RootPart.Shape; 423 PrimitiveBaseShape pbs = dupe.RootPart.Shape;
425 424
426 dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape( 425 dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
427 dupe.RootPart.Name, 426 dupe.RootPart.Name,
428 pbs, 427 pbs,
429 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z), 428 new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
430 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 429 dupe.RootPart.AbsolutePosition.Z),
431 new Axiom.Math.Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 430 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
432 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z)); 431 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
433 432 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z));
434 } 433 }
435 434
436 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); 435 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
@@ -951,14 +950,15 @@ namespace OpenSim.Region.Environment.Scenes
951 } 950 }
952 if (m_rootPart.PhysActor != null) 951 if (m_rootPart.PhysActor != null)
953 { 952 {
954 this.m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor); 953 m_scene.PhysScene.RemovePrim(m_rootPart.PhysActor);
955 m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape( 954 m_rootPart.PhysActor = m_scene.PhysScene.AddPrimShape(
956 m_rootPart.Name, 955 m_rootPart.Name,
957 m_rootPart.Shape, 956 m_rootPart.Shape,
958 new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y, m_rootPart.AbsolutePosition.Z), 957 new PhysicsVector(m_rootPart.AbsolutePosition.X, m_rootPart.AbsolutePosition.Y,
959 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z), 958 m_rootPart.AbsolutePosition.Z),
960 new Axiom.Math.Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, 959 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z),
961 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z)); 960 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X,
961 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z));
962 } 962 }
963 } 963 }
964 964
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Environment.Scenes
1001 AbsolutePosition = pos; 1001 AbsolutePosition = pos;
1002 ScheduleGroupForTerseUpdate(); 1002 ScheduleGroupForTerseUpdate();
1003 1003
1004 m_scene.EventManager.TriggerGroupMove(this.UUID, pos); 1004 m_scene.EventManager.TriggerGroupMove(UUID, pos);
1005 } 1005 }
1006 1006
1007 /// <summary> 1007 /// <summary>
@@ -1350,7 +1350,7 @@ namespace OpenSim.Region.Environment.Scenes
1350 1350
1351 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) 1351 public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
1352 { 1352 {
1353 m_scene.EventManager.TriggerGroupGrab(this.UUID, offsetPos, remoteClient.AgentId); 1353 m_scene.EventManager.TriggerGroupGrab(UUID, offsetPos, remoteClient.AgentId);
1354 } 1354 }
1355 1355
1356 public void DeleteGroup() 1356 public void DeleteGroup()
@@ -1377,4 +1377,4 @@ namespace OpenSim.Region.Environment.Scenes
1377 Text = text; 1377 Text = text;
1378 } 1378 }
1379 } 1379 }
1380} 1380} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 3e104e3..387f573 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -33,12 +33,10 @@ using System.Xml.Serialization;
33using Axiom.Math; 33using Axiom.Math;
34using libsecondlife; 34using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes.Scripting; 38using OpenSim.Region.Environment.Scenes.Scripting;
40using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
41using OpenSim.Region.Environment.Types;
42 40
43namespace OpenSim.Region.Environment.Scenes 41namespace OpenSim.Region.Environment.Scenes
44{ 42{
@@ -49,8 +47,7 @@ namespace OpenSim.Region.Environment.Scenes
49 private string m_inventoryFileName = ""; 47 private string m_inventoryFileName = "";
50 private LLUUID m_folderID = LLUUID.Zero; 48 private LLUUID m_folderID = LLUUID.Zero;
51 49
52 [XmlIgnore] 50 [XmlIgnore] public PhysicsActor PhysActor = null;
53 public PhysicsActor PhysActor = null;
54 51
55 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 52 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
56 53
@@ -68,10 +65,8 @@ namespace OpenSim.Region.Environment.Scenes
68 65
69 protected byte[] m_particleSystem = new byte[0]; 66 protected byte[] m_particleSystem = new byte[0];
70 67
71 [XmlIgnore] 68 [XmlIgnore] public uint TimeStampFull = 0;
72 public uint TimeStampFull = 0; 69 [XmlIgnore] public uint TimeStampTerse = 0;
73 [XmlIgnore]
74 public uint TimeStampTerse = 0;
75 70
76 protected SceneObjectGroup m_parentGroup; 71 protected SceneObjectGroup m_parentGroup;
77 72
@@ -124,7 +119,7 @@ namespace OpenSim.Region.Environment.Scenes
124 set { m_name = value; } 119 set { m_name = value; }
125 } 120 }
126 121
127 protected LLObject.ObjectFlags m_flags =0; 122 protected LLObject.ObjectFlags m_flags = 0;
128 123
129 public uint ObjectFlags 124 public uint ObjectFlags
130 { 125 {
@@ -132,7 +127,7 @@ namespace OpenSim.Region.Environment.Scenes
132 set { m_flags = (LLObject.ObjectFlags) value; } 127 set { m_flags = (LLObject.ObjectFlags) value; }
133 } 128 }
134 129
135 protected LLObject.MaterialType m_material =0; 130 protected LLObject.MaterialType m_material = 0;
136 131
137 public byte Material 132 public byte Material
138 { 133 {
@@ -712,7 +707,7 @@ namespace OpenSim.Region.Environment.Scenes
712 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 707 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
713 for (int i = 0; i < avatars.Count; i++) 708 for (int i = 0; i < avatars.Count; i++)
714 { 709 {
715 avatars[i].QueuePartForUpdate(this); 710 avatars[i].QueuePartForUpdate(this);
716 } 711 }
717 } 712 }
718 713
@@ -774,13 +769,13 @@ namespace OpenSim.Region.Environment.Scenes
774 List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); 769 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
775 for (int i = 0; i < avatars.Count; i++) 770 for (int i = 0; i < avatars.Count; i++)
776 { 771 {
777 avatars[i].QueuePartForUpdate(this); 772 avatars[i].QueuePartForUpdate(this);
778 } 773 }
779 } 774 }
780 775
781 public void AddTerseUpdateToAvatar(ScenePresence presence) 776 public void AddTerseUpdateToAvatar(ScenePresence presence)
782 { 777 {
783 presence.QueuePartForUpdate(this); 778 presence.QueuePartForUpdate(this);
784 } 779 }
785 780
786 /// <summary> 781 /// <summary>
@@ -927,4 +922,4 @@ namespace OpenSim.Region.Environment.Scenes
927 } 922 }
928 } 923 }
929 } 924 }
930} 925} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
index 8ed4e87..f43a9fc 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
45 public void LoadAnims() 45 public void LoadAnims()
46 { 46 {
47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); 47 //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
48 using( XmlTextReader reader = new XmlTextReader("data/avataranimations.xml") ) 48 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
49 { 49 {
50 XmlDocument doc = new XmlDocument(); 50 XmlDocument doc = new XmlDocument();
51 doc.Load(reader); 51 doc.Load(reader);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 6ed50b7..527eb22 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -30,11 +30,10 @@ using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework; 33using OpenSim.Framework;
36using OpenSim.Region.Physics.Manager; 34using OpenSim.Framework.Console;
37using OpenSim.Region.Environment.Types; 35using OpenSim.Region.Environment.Types;
36using OpenSim.Region.Physics.Manager;
38 37
39namespace OpenSim.Region.Environment.Scenes 38namespace OpenSim.Region.Environment.Scenes
40{ 39{
@@ -116,18 +115,21 @@ namespace OpenSim.Region.Environment.Scenes
116 } 115 }
117 116
118 private readonly ulong m_regionHandle; 117 private readonly ulong m_regionHandle;
118
119 public ulong RegionHandle 119 public ulong RegionHandle
120 { 120 {
121 get { return m_regionHandle; } 121 get { return m_regionHandle; }
122 } 122 }
123 123
124 private readonly string m_firstname; 124 private readonly string m_firstname;
125
125 public string Firstname 126 public string Firstname
126 { 127 {
127 get { return m_firstname; } 128 get { return m_firstname; }
128 } 129 }
129 130
130 private readonly string m_lastname; 131 private readonly string m_lastname;
132
131 public string Lastname 133 public string Lastname
132 { 134 {
133 get { return m_lastname; } 135 get { return m_lastname; }
@@ -210,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
210 } 212 }
211 213
212 private bool m_isChildAgent = true; 214 private bool m_isChildAgent = true;
215
213 public bool IsChildAgent 216 public bool IsChildAgent
214 { 217 {
215 get { return m_isChildAgent; } 218 get { return m_isChildAgent; }
@@ -217,6 +220,7 @@ namespace OpenSim.Region.Environment.Scenes
217 } 220 }
218 221
219 private uint m_parentID = 0; 222 private uint m_parentID = 0;
223
220 public uint ParentID 224 public uint ParentID
221 { 225 {
222 get { return m_parentID; } 226 get { return m_parentID; }
@@ -227,7 +231,8 @@ namespace OpenSim.Region.Environment.Scenes
227 231
228 #region Constructor(s) 232 #region Constructor(s)
229 233
230 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables) 234 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
235 AvatarWearable[] wearables)
231 { 236 {
232 m_scene = world; 237 m_scene = world;
233 m_uuid = client.AgentId; 238 m_uuid = client.AgentId;
@@ -309,24 +314,24 @@ namespace OpenSim.Region.Environment.Scenes
309 if (update.LastFullUpdateTime < part.TimeStampFull) 314 if (update.LastFullUpdateTime < part.TimeStampFull)
310 { 315 {
311 //need to do a full update 316 //need to do a full update
312 part.SendFullUpdate(this.ControllingClient); 317 part.SendFullUpdate(ControllingClient);
313 update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 318 update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch();
314 updateCount++; 319 updateCount++;
315 } 320 }
316 else if (update.LastTerseUpdateTime < part.TimeStampTerse) 321 else if (update.LastTerseUpdateTime < part.TimeStampTerse)
317 { 322 {
318 part.SendTerseUpdate(this.ControllingClient); 323 part.SendTerseUpdate(ControllingClient);
319 update.LastTerseUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 324 update.LastTerseUpdateTime = (uint) Util.UnixTimeSinceEpoch();
320 updateCount++; 325 updateCount++;
321 } 326 }
322 } 327 }
323 else 328 else
324 { 329 {
325 //never been sent to client before so do full update 330 //never been sent to client before so do full update
326 part.SendFullUpdate(this.ControllingClient); 331 part.SendFullUpdate(ControllingClient);
327 ScenePartUpdate update = new ScenePartUpdate(); 332 ScenePartUpdate update = new ScenePartUpdate();
328 update.FullID = part.UUID; 333 update.FullID = part.UUID;
329 update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); 334 update.LastFullUpdateTime = (uint) Util.UnixTimeSinceEpoch();
330 m_updateTimes.Add(part.UUID, update); 335 m_updateTimes.Add(part.UUID, update);
331 updateCount++; 336 updateCount++;
332 } 337 }
@@ -339,7 +344,6 @@ namespace OpenSim.Region.Environment.Scenes
339 } 344 }
340 } 345 }
341 346
342
343 #region Status Methods 347 #region Status Methods
344 348
345 public void MakeRootAgent(LLVector3 pos, bool isFlying) 349 public void MakeRootAgent(LLVector3 pos, bool isFlying)
@@ -368,10 +372,10 @@ namespace OpenSim.Region.Environment.Scenes
368 372
369 private void RemoveFromPhysicalScene() 373 private void RemoveFromPhysicalScene()
370 { 374 {
371 if (this.PhysicsActor != null) 375 if (PhysicsActor != null)
372 { 376 {
373 m_scene.PhysScene.RemoveAvatar(this.PhysicsActor); 377 m_scene.PhysScene.RemoveAvatar(PhysicsActor);
374 this.PhysicsActor = null; 378 PhysicsActor = null;
375 } 379 }
376 } 380 }
377 381
@@ -432,7 +436,7 @@ namespace OpenSim.Region.Environment.Scenes
432 m_isChildAgent = false; 436 m_isChildAgent = false;
433 437
434 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 438 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
435 this.MakeRootAgent(this.AbsolutePosition, false); 439 MakeRootAgent(AbsolutePosition, false);
436 } 440 }
437 } 441 }
438 442
@@ -457,13 +461,13 @@ namespace OpenSim.Region.Environment.Scenes
457 Vector3 agent_control_v3 = new Vector3(0, 0, 0); 461 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
458 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 462 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
459 bool oldflying = PhysicsActor.Flying; 463 bool oldflying = PhysicsActor.Flying;
460 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 464 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
461 if (PhysicsActor.Flying != oldflying) 465 if (PhysicsActor.Flying != oldflying)
462 { 466 {
463 update_movementflag = true; 467 update_movementflag = true;
464 } 468 }
465 469
466 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 470 if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
467 { 471 {
468 StandUp(); 472 StandUp();
469 update_movementflag = true; 473 update_movementflag = true;
@@ -477,23 +481,23 @@ namespace OpenSim.Region.Environment.Scenes
477 481
478 if (m_parentID == 0) 482 if (m_parentID == 0)
479 { 483 {
480 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 484 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
481 { 485 {
482 if ((flags & (uint)DCF) != 0) 486 if ((flags & (uint) DCF) != 0)
483 { 487 {
484 DCFlagKeyPressed = true; 488 DCFlagKeyPressed = true;
485 agent_control_v3 += Dir_Vectors[i]; 489 agent_control_v3 += Dir_Vectors[i];
486 if ((m_movementflag & (uint)DCF) == 0) 490 if ((m_movementflag & (uint) DCF) == 0)
487 { 491 {
488 m_movementflag += (byte)(uint)DCF; 492 m_movementflag += (byte) (uint) DCF;
489 update_movementflag = true; 493 update_movementflag = true;
490 } 494 }
491 } 495 }
492 else 496 else
493 { 497 {
494 if ((m_movementflag & (uint)DCF) != 0) 498 if ((m_movementflag & (uint) DCF) != 0)
495 { 499 {
496 m_movementflag -= (byte)(uint)DCF; 500 m_movementflag -= (byte) (uint) DCF;
497 update_movementflag = true; 501 update_movementflag = true;
498 } 502 }
499 } 503 }
@@ -580,10 +584,10 @@ namespace OpenSim.Region.Environment.Scenes
580 } 584 }
581 585
582 NewForce newVelocity = new NewForce(); 586 NewForce newVelocity = new NewForce();
583 Vector3 direc = rotation * vec; 587 Vector3 direc = rotation*vec;
584 direc.Normalize(); 588 direc.Normalize();
585 589
586 direc = direc * ((0.03f) * 128f); 590 direc = direc*((0.03f)*128f);
587 if (m_physicsActor.Flying) 591 if (m_physicsActor.Flying)
588 direc *= 4; 592 direc *= 4;
589 593
@@ -692,8 +696,6 @@ namespace OpenSim.Region.Environment.Scenes
692 } 696 }
693 697
694 698
695
696
697 /// <summary> 699 /// <summary>
698 /// 700 ///
699 /// </summary> 701 /// </summary>
@@ -701,7 +703,8 @@ namespace OpenSim.Region.Environment.Scenes
701 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 703 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
702 { 704 {
703 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, 705 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
704 LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); 706 LocalId, AbsolutePosition, m_textureEntry.ToBytes(),
707 m_parentID);
705 } 708 }
706 709
707 public void SendFullUpdateToAllClients() 710 public void SendFullUpdateToAllClients()
@@ -784,7 +787,7 @@ namespace OpenSim.Region.Environment.Scenes
784 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) 787 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
785 { 788 {
786 avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, 789 avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
787 m_textureEntry.ToBytes()); 790 m_textureEntry.ToBytes());
788 } 791 }
789 792
790 /// <summary> 793 /// <summary>
@@ -798,10 +801,7 @@ namespace OpenSim.Region.Environment.Scenes
798 AnimationSeq = seq; 801 AnimationSeq = seq;
799 LLUUID sourceAgentId = m_controllingClient.AgentId; 802 LLUUID sourceAgentId = m_controllingClient.AgentId;
800 803
801 m_scene.Broadcast(delegate(IClientAPI client) 804 m_scene.Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, sourceAgentId); });
802 {
803 client.SendAnimation(animID, seq, sourceAgentId);
804 });
805 } 805 }
806 806
807 /// <summary> 807 /// <summary>
@@ -842,9 +842,9 @@ namespace OpenSim.Region.Environment.Scenes
842 LLVector3 vel = Velocity; 842 LLVector3 vel = Velocity;
843 843
844 float timeStep = 0.1f; 844 float timeStep = 0.1f;
845 pos2.X = pos2.X + (vel.X * timeStep); 845 pos2.X = pos2.X + (vel.X*timeStep);
846 pos2.Y = pos2.Y + (vel.Y * timeStep); 846 pos2.Y = pos2.Y + (vel.Y*timeStep);
847 pos2.Z = pos2.Z + (vel.Z * timeStep); 847 pos2.Z = pos2.Z + (vel.Z*timeStep);
848 848
849 if ((pos2.X < 0) || (pos2.X > 256)) 849 if ((pos2.X < 0) || (pos2.X > 256))
850 { 850 {
@@ -889,7 +889,7 @@ namespace OpenSim.Region.Environment.Scenes
889 } 889 }
890 890
891 LLVector3 vel = m_velocity; 891 LLVector3 vel = m_velocity;
892 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 892 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
893 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 893 RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
894 if (neighbourRegion != null) 894 if (neighbourRegion != null)
895 { 895 {
@@ -901,7 +901,7 @@ namespace OpenSim.Region.Environment.Scenes
901 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); 901 AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
902 string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); 902 string capsPath = Util.GetCapsURL(m_controllingClient.AgentId);
903 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, 903 m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
904 capsPath); 904 capsPath);
905 MakeChildAgent(); 905 MakeChildAgent();
906 m_scene.SendKillObject(m_localId); 906 m_scene.SendKillObject(m_localId);
907 m_scene.NotifyMyCoarseLocationChange(); 907 m_scene.NotifyMyCoarseLocationChange();
@@ -980,7 +980,6 @@ namespace OpenSim.Region.Environment.Scenes
980 LastFullUpdateTime = 0; 980 LastFullUpdateTime = 0;
981 LastTerseUpdateTime = 0; 981 LastTerseUpdateTime = 0;
982 } 982 }
983
984 } 983 }
985 984
986 985
@@ -997,7 +996,7 @@ namespace OpenSim.Region.Environment.Scenes
997 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 996 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
998 AbsolutePosition.Z); 997 AbsolutePosition.Z);
999 998
1000 m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec); 999 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec);
1001 } 1000 }
1002 1001
1003 internal void Close() 1002 internal void Close()
@@ -1008,7 +1007,7 @@ namespace OpenSim.Region.Environment.Scenes
1008 public void SetWearable(int wearableId, AvatarWearable wearable) 1007 public void SetWearable(int wearableId, AvatarWearable wearable)
1009 { 1008 {
1010 m_wearables[wearableId] = wearable; 1009 m_wearables[wearableId] = wearable;
1011 SendOurAppearance( m_controllingClient ); 1010 SendOurAppearance(m_controllingClient);
1012 } 1011 }
1013 } 1012 }
1014} 1013} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
index 01c1d65..cb000c4 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs
@@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
43 LLVector3 AbsolutePosition { get; } 43 LLVector3 AbsolutePosition { get; }
44 void SetText(string text, Vector3 color, double alpha); 44 void SetText(string text, Vector3 color, double alpha);
45 } 45 }
46} 46} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
index 2fb3e78..c1bf72b 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs
@@ -85,4 +85,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
85 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); 85 Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
86 } 86 }
87 } 87 }
88} 88} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs
index 42048ea..11f0ce0 100644
--- a/OpenSim/Region/Environment/StorageManager.cs
+++ b/OpenSim/Region/Environment/StorageManager.cs
@@ -78,4 +78,4 @@ namespace OpenSim.Region.Environment
78 //TODO: Add checking and warning to make sure it initialised. 78 //TODO: Add checking and warning to make sure it initialised.
79 } 79 }
80 } 80 }
81} 81} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
index 942ec4d..70b957e 100644
--- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
+++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
@@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Types
44 //private int m_quadNumber; 44 //private int m_quadNumber;
45 private string m_quadID; 45 private string m_quadID;
46 46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) 47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
48 short height)
48 { 49 {
49 m_parent = parent; 50 m_parent = parent;
50 m_quadID = quadID; 51 m_quadID = quadID;
@@ -66,9 +67,9 @@ namespace OpenSim.Region.Environment.Types
66 } 67 }
67 else 68 else
68 { 69 {
69 if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) 70 if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
70 { 71 {
71 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 72 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
72 { 73 {
73 m_childNodes[0].AddObject(obj); 74 m_childNodes[0].AddObject(obj);
74 } 75 }
@@ -79,7 +80,7 @@ namespace OpenSim.Region.Environment.Types
79 } 80 }
80 else 81 else
81 { 82 {
82 if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) 83 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
83 { 84 {
84 m_childNodes[1].AddObject(obj); 85 m_childNodes[1].AddObject(obj);
85 } 86 }
@@ -96,10 +97,18 @@ namespace OpenSim.Region.Environment.Types
96 if (m_childNodes == null) 97 if (m_childNodes == null)
97 { 98 {
98 m_childNodes = new BasicQuadTreeNode[4]; 99 m_childNodes = new BasicQuadTreeNode[4];
99 m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 100 m_childNodes[0] =
100 m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); 101 new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
101 m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 102 (short) (m_height/2));
102 m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); 103 m_childNodes[1] =
104 new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
105 (short) (m_width/2), (short) (m_height/2));
106 m_childNodes[2] =
107 new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
108 (short) (m_width/2), (short) (m_height/2));
109 m_childNodes[3] =
110 new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
111 (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
103 } 112 }
104 else 113 else
105 { 114 {
@@ -118,9 +127,9 @@ namespace OpenSim.Region.Environment.Types
118 } 127 }
119 else 128 else
120 { 129 {
121 if (x < m_leftX + (m_width / 2)) 130 if (x < m_leftX + (m_width/2))
122 { 131 {
123 if (y < m_leftY + (m_height / 2)) 132 if (y < m_leftY + (m_height/2))
124 { 133 {
125 return m_childNodes[0].GetObjectsFrom(x, y); 134 return m_childNodes[0].GetObjectsFrom(x, y);
126 } 135 }
@@ -131,7 +140,7 @@ namespace OpenSim.Region.Environment.Types
131 } 140 }
132 else 141 else
133 { 142 {
134 if (y < m_leftY + (m_height / 2)) 143 if (y < m_leftY + (m_height/2))
135 { 144 {
136 return m_childNodes[1].GetObjectsFrom(x, y); 145 return m_childNodes[1].GetObjectsFrom(x, y);
137 } 146 }
@@ -172,9 +181,9 @@ namespace OpenSim.Region.Environment.Types
172 } 181 }
173 else 182 else
174 { 183 {
175 if (x < m_leftX + (m_width / 2)) 184 if (x < m_leftX + (m_width/2))
176 { 185 {
177 if (y < m_leftY + (m_height / 2)) 186 if (y < m_leftY + (m_height/2))
178 { 187 {
179 return m_childNodes[0].GetNodeID(x, y); 188 return m_childNodes[0].GetNodeID(x, y);
180 } 189 }
@@ -185,7 +194,7 @@ namespace OpenSim.Region.Environment.Types
185 } 194 }
186 else 195 else
187 { 196 {
188 if (y < m_leftY + (m_height / 2)) 197 if (y < m_leftY + (m_height/2))
189 { 198 {
190 return m_childNodes[1].GetNodeID(x, y); 199 return m_childNodes[1].GetNodeID(x, y);
191 } 200 }
@@ -211,7 +220,8 @@ namespace OpenSim.Region.Environment.Types
211 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); 220 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
212 foreach (SceneObjectGroup group in m_objects) 221 foreach (SceneObjectGroup group in m_objects)
213 { 222 {
214 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 223 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
224 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
215 { 225 {
216 //still in bounds 226 //still in bounds
217 } 227 }
@@ -235,7 +245,8 @@ namespace OpenSim.Region.Environment.Types
235 245
236 public void PassUp(SceneObjectGroup group) 246 public void PassUp(SceneObjectGroup group)
237 { 247 {
238 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) 248 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
249 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
239 { 250 {
240 AddObject(group); 251 AddObject(group);
241 } 252 }
@@ -255,4 +266,4 @@ namespace OpenSim.Region.Environment.Types
255 return retVal; 266 return retVal;
256 } 267 }
257 } 268 }
258} 269} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs
index 442e9d5..0648476 100644
--- a/OpenSim/Region/Environment/Types/UpdateQueue.cs
+++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs
@@ -76,4 +76,4 @@ namespace OpenSim.Region.Environment.Types
76 return part; 76 return part;
77 } 77 }
78 } 78 }
79} 79} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
index f5a080f..bfd9d06 100644
--- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs
@@ -26,60 +26,69 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.Environment.Scenes;
33using Axiom.Math;
34using libsecondlife; 29using libsecondlife;
35using OpenSim.Framework; 30using OpenSim.Framework;
36using OpenSim.Framework.Interfaces; 31using OpenSim.Region.Environment.Scenes;
37 32
38namespace SimpleApp 33namespace SimpleApp
39{ 34{
40 public class ComplexObject : SceneObjectGroup 35 public class ComplexObject : SceneObjectGroup
41 { 36 {
42 private LLQuaternion m_rotationDirection; 37 private LLQuaternion m_rotationDirection;
43 38
44 private class RotatingWheel : SceneObjectPart 39 private class RotatingWheel : SceneObjectPart
45 { 40 {
46 private LLQuaternion m_rotationDirection; 41 private LLQuaternion m_rotationDirection;
47 42
48 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) 43 public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID,
49 : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) 44 LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection)
45 : base(
46 regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition
47 )
50 { 48 {
51 m_rotationDirection = rotationDirection; 49 m_rotationDirection = rotationDirection;
52 } 50 }
53 51
54 public override void UpdateMovement() 52 public override void UpdateMovement()
55 { 53 {
56 UpdateRotation(RotationOffset * m_rotationDirection); 54 UpdateRotation(RotationOffset*m_rotationDirection);
57 } 55 }
58 } 56 }
59 57
60 public override void UpdateMovement() 58 public override void UpdateMovement()
61 { 59 {
62 UpdateGroupRotation(GroupRotation * m_rotationDirection); 60 UpdateGroupRotation(GroupRotation*m_rotationDirection);
63 61
64 base.UpdateMovement(); 62 base.UpdateMovement();
65 } 63 }
66 64
67 65
68 66 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos)
69 public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) 67 : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default)
70 : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default )
71 { 68 {
72 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); 69 m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
73 70
74 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); 71 AddPart(
75 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); 72 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f),
73 new LLQuaternion(0.05f, 0, 0)));
74 AddPart(
75 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f),
76 new LLQuaternion(-0.05f, 0, 0)));
77
78 AddPart(
79 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0),
80 new LLQuaternion(0.5f, 0, 0.05f)));
81 AddPart(
82 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0),
83 new LLQuaternion(-0.5f, 0, -0.05f)));
76 84
77 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); 85 AddPart(
78 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); 86 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0),
87 new LLQuaternion(0, 0.5f, 0.05f)));
88 AddPart(
89 new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0),
90 new LLQuaternion(0, -0.5f, -0.05f)));
79 91
80 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f)));
81 AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f)));
82
83 UpdateParentIDs(); 92 UpdateParentIDs();
84 } 93 }
85 94
@@ -88,12 +97,12 @@ namespace SimpleApp
88 m_parts.Remove(part.UUID); 97 m_parts.Remove(part.UUID);
89 remoteClient.SendKillObject(m_regionHandle, part.LocalID); 98 remoteClient.SendKillObject(m_regionHandle, part.LocalID);
90 remoteClient.AddMoney(1); 99 remoteClient.AddMoney(1);
91 remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); 100 remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero);
92 } 101 }
93 102
94 public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) 103 public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
95 { 104 {
96 if( m_parts.Count == 1 ) 105 if (m_parts.Count == 1)
97 { 106 {
98 m_parts.Remove(m_rootPart.UUID); 107 m_parts.Remove(m_rootPart.UUID);
99 m_scene.RemoveEntity(this); 108 m_scene.RemoveEntity(this);
@@ -103,4 +112,4 @@ namespace SimpleApp
103 } 112 }
104 } 113 }
105 } 114 }
106} 115} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
index 0f833ea..cbc4dea 100644
--- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
@@ -27,37 +27,34 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Diagnostics;
31using System.Text;
32using OpenSim.Region.Environment.Scenes;
33using libsecondlife; 31using libsecondlife;
34using OpenSim.Framework; 32using OpenSim.Framework;
35using System.Timers; 33using OpenSim.Region.Environment.Scenes;
36using System.Diagnostics;
37 34
38namespace SimpleApp 35namespace SimpleApp
39{ 36{
40 public class CpuCounterObject : SceneObjectGroup 37 public class CpuCounterObject : SceneObjectGroup
41 { 38 {
42 private PerformanceCounter m_counter; 39 private PerformanceCounter m_counter;
43 40
44 public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) 41 public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos)
45 : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default ) 42 : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default)
46 { 43 {
47 String objectName = "Processor"; 44 String objectName = "Processor";
48 String counterName = "% Processor Time"; 45 String counterName = "% Processor Time";
49 String instanceName = "_Total"; 46 String instanceName = "_Total";
50 47
51 m_counter = new PerformanceCounter(objectName, counterName, instanceName); 48 m_counter = new PerformanceCounter(objectName, counterName, instanceName);
52 } 49 }
53 50
54 public override void UpdateMovement( ) 51 public override void UpdateMovement()
55 { 52 {
56 float cpu = m_counter.NextValue() / 40f; 53 float cpu = m_counter.NextValue()/40f;
57 LLVector3 size = new LLVector3(cpu, cpu, cpu); 54 LLVector3 size = new LLVector3(cpu, cpu, cpu);
58 //rootPrimitive.ResizeGoup( size ); 55 //rootPrimitive.ResizeGoup( size );
59 56
60 base.UpdateMovement(); 57 base.UpdateMovement();
61 } 58 }
62 } 59 }
63} 60} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
index 746340f..7b1420b 100644
--- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
@@ -27,14 +27,10 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.IO;
31using System.Text;
32using OpenSim.Region.Environment.Scenes;
33using libsecondlife; 31using libsecondlife;
34using OpenSim.Framework; 32using OpenSim.Framework;
35using System.Timers; 33using OpenSim.Region.Environment.Scenes;
36using System.Diagnostics;
37using System.IO;
38 34
39namespace SimpleApp 35namespace SimpleApp
40{ 36{
@@ -43,9 +39,7 @@ namespace SimpleApp
43 public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) 39 public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos)
44 : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) 40 : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default)
45 { 41 {
46 42 float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5;
47
48 float size = (float)Math.Pow((double)fileInfo.Length, (double)1 / 3) / 5;
49 // rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); 43 // rootPrimitive.ResizeGoup(new LLVector3(size, size, size));
50 Text = fileInfo.Name; 44 Text = fileInfo.Name;
51 ScheduleGroupForFullUpdate(); 45 ScheduleGroupForFullUpdate();
@@ -56,4 +50,4 @@ namespace SimpleApp
56 base.Update(); 50 base.Update();
57 } 51 }
58 } 52 }
59} 53} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 03e0f98..f7fdbb5 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -26,16 +26,14 @@
26* 26*
27*/ 27*/
28 28
29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Text; 32using System.Text;
32using libsecondlife; 33using libsecondlife;
33using libsecondlife.Packets; 34using libsecondlife.Packets;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
38using System;
39 37
40namespace SimpleApp 38namespace SimpleApp
41{ 39{
@@ -126,13 +124,15 @@ namespace SimpleApp
126#pragma warning restore 67 124#pragma warning restore 67
127 125
128 private LLUUID myID = LLUUID.Random(); 126 private LLUUID myID = LLUUID.Random();
129 public MyNpcCharacter( EventManager eventManager ) 127
128 public MyNpcCharacter(EventManager eventManager)
130 { 129 {
131 // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); 130 // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2);
132 eventManager.OnFrame += Update; 131 eventManager.OnFrame += Update;
133 } 132 }
134 133
135 private LLVector3 startPos = new LLVector3(128, 128,2); 134 private LLVector3 startPos = new LLVector3(128, 128, 2);
135
136 public virtual LLVector3 StartPos 136 public virtual LLVector3 StartPos
137 { 137 {
138 get { return startPos; } 138 get { return startPos; }
@@ -155,92 +155,218 @@ namespace SimpleApp
155 } 155 }
156 156
157 private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); 157 private string lastName = "NPC" + Util.RandomClass.Next(1, 1000);
158
158 public virtual string LastName 159 public virtual string LastName
159 { 160 {
160 get { return lastName; } 161 get { return lastName; }
161 } 162 }
162 163
163 public virtual void OutPacket(Packet newPack) { } 164 public virtual void OutPacket(Packet newPack)
164 public virtual void SendWearables(AvatarWearable[] wearables) { } 165 {
165 public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } 166 }
166 public virtual void SendStartPingCheck(byte seq) { } 167
167 public virtual void SendKillObject(ulong regionHandle, uint localID) { } 168 public virtual void SendWearables(AvatarWearable[] wearables)
168 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } 169 {
169 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 170 }
170 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 171
171 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) { } 172 public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
172 public virtual void SendLayerData(float[] map) { } 173 {
173 public virtual void SendLayerData(int px, int py, float[] map) { } 174 }
174 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } 175
175 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } 176 public virtual void SendStartPingCheck(byte seq)
176 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } 177 {
177 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL) { } 178 }
178 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } 179
179 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } 180 public virtual void SendKillObject(ulong regionHandle, uint localID)
180 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL) { } 181 {
181 public virtual void SendTeleportCancel() { } 182 }
182 public virtual void SendTeleportLocationStart() { } 183
183 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 184 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId)
184 185 {
185 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { } 186 }
186 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } 187
187 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) { } 188 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName,
188 189 LLUUID fromAgentID)
189 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } 190 {
190 191 }
191 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) { } 192
192 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } 193 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName,
193 194 LLUUID fromAgentID)
194 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } 195 {
195 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } 196 }
196 public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } 197
197 public virtual void SendRemoveInventoryItem(LLUUID itemID) { } 198 public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
198 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } 199 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
199 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } 200 {
200 201 }
201 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } 202
202 203 public virtual void SendLayerData(float[] map)
203 public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } 204 {
204 public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } 205 }
205 206
206 public void SendAlertMessage(string message) { } 207 public virtual void SendLayerData(int px, int py, float[] map)
207 public void SendAgentAlertMessage(string message, bool modal) { } 208 {
208 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } 209 }
210
211 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
212 {
213 }
214
215 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
216 {
217 }
218
219 public virtual AgentCircuitData RequestClientInfo()
220 {
221 return new AgentCircuitData();
222 }
223
224 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt,
225 IPEndPoint newRegionExternalEndPoint, string capsURL)
226 {
227 }
228
229 public virtual void SendMapBlock(List<MapBlockData> mapBlocks)
230 {
231 }
232
233 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
234 {
235 }
236
237 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
238 uint locationID, uint flags, string capsURL)
239 {
240 }
241
242 public virtual void SendTeleportCancel()
243 {
244 }
245
246 public virtual void SendTeleportLocationStart()
247 {
248 }
249
250 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
251 {
252 }
253
254 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
255 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
256 {
257 }
258
259 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
260 LLVector3 position, LLVector3 velocity, LLQuaternion rotation)
261 {
262 }
263
264 public virtual void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
265 {
266 }
267
268 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
269 {
270 }
271
272 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
273 PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
274 LLUUID objectID, LLUUID ownerID, string text, uint parentID,
275 byte[] particleSystem, LLQuaternion rotation)
276 {
277 }
278
279 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
280 LLVector3 position, LLQuaternion rotation)
281 {
282 }
283
284 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items)
285 {
286 }
287
288 public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item)
289 {
290 }
291
292 public virtual void SendInventoryItemUpdate(InventoryItemBase Item)
293 {
294 }
295
296 public virtual void SendRemoveInventoryItem(LLUUID itemID)
297 {
298 }
299
300 public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
301 {
302 }
303
304 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
305 {
306 }
307
308 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname)
309 {
310 }
311
312 public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
313 {
314 }
315
316 public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain,
317 byte flags)
318 {
319 }
320
321 public void SendAlertMessage(string message)
322 {
323 }
324
325 public void SendAgentAlertMessage(string message, bool modal)
326 {
327 }
328
329 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
330 string url)
331 {
332 }
209 333
210 public virtual void SendRegionHandshake(RegionInfo regionInfo) 334 public virtual void SendRegionHandshake(RegionInfo regionInfo)
211 { 335 {
212 if (OnRegionHandShakeReply != null) 336 if (OnRegionHandShakeReply != null)
213 { 337 {
214 this.OnRegionHandShakeReply(this); 338 OnRegionHandShakeReply(this);
215 } 339 }
216 340
217 if (OnCompleteMovementToRegion != null) 341 if (OnCompleteMovementToRegion != null)
218 { 342 {
219 this.OnCompleteMovementToRegion(); 343 OnCompleteMovementToRegion();
220 } 344 }
221 } 345 }
222 346
223 private void Update( ) 347 private void Update()
224 { 348 {
225 Encoding enc = Encoding.ASCII; 349 Encoding enc = Encoding.ASCII;
226 350
227 if (this.OnAgentUpdate != null) 351 if (OnAgentUpdate != null)
228 { 352 {
229 this.OnAgentUpdate(this, movementFlag, bodyDirection); 353 OnAgentUpdate(this, movementFlag, bodyDirection);
230 } 354 }
231 if (this.flyState == 0) 355 if (flyState == 0)
232 { 356 {
233 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; 357 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
358 (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
234 flyState = 1; 359 flyState = 1;
235 } 360 }
236 else if (this.flyState == 1) 361 else if (flyState == 1)
237 { 362 {
238 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; 363 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
364 (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
239 flyState = 2; 365 flyState = 2;
240 } 366 }
241 else 367 else
242 { 368 {
243 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; 369 movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
244 flyState = 0; 370 flyState = 0;
245 } 371 }
246 372
@@ -251,15 +377,14 @@ namespace SimpleApp
251 ChatFromViewerArgs args = new ChatFromViewerArgs(); 377 ChatFromViewerArgs args = new ChatFromViewerArgs();
252 args.Message = "Kinda quiet around here, isn't it?"; 378 args.Message = "Kinda quiet around here, isn't it?";
253 args.Channel = 0; 379 args.Channel = 0;
254 args.From = this.FirstName + " " + this.LastName; 380 args.From = FirstName + " " + LastName;
255 args.Position = new LLVector3(128, 128, 26); 381 args.Position = new LLVector3(128, 128, 26);
256 args.Sender = this; 382 args.Sender = this;
257 args.Type = ChatTypeEnum.Shout; 383 args.Type = ChatTypeEnum.Shout;
258 384
259 this.OnChatFromViewer(this, args); 385 OnChatFromViewer(this, args);
260 } 386 }
261 count = -1; 387 count = -1;
262
263 } 388 }
264 389
265 count++; 390 count++;
@@ -270,9 +395,19 @@ namespace SimpleApp
270 return false; 395 return false;
271 } 396 }
272 397
273 public void SendViewerTime(int phase) { } 398 public void SendViewerTime(int phase)
274 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } 399 {
275 public void SetDebug(int newDebug) { } 400 }
401
402 public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember,
403 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
404 LLUUID partnerID)
405 {
406 }
407
408 public void SetDebug(int newDebug)
409 {
410 }
276 411
277 public void InPacket(Packet NewPack) 412 public void InPacket(Packet NewPack)
278 { 413 {
@@ -281,22 +416,17 @@ namespace SimpleApp
281 public void Close() 416 public void Close()
282 { 417 {
283 } 418 }
284 419
285 private uint m_circuitCode; 420 private uint m_circuitCode;
421
286 public uint CircuitCode 422 public uint CircuitCode
287 { 423 {
288 get 424 get { return m_circuitCode; }
289 { 425 set { m_circuitCode = value; }
290 return m_circuitCode;
291 }
292 set
293 {
294 m_circuitCode = value;
295 }
296 } 426 }
297 427
298 public void SendLogoutPacket() 428 public void SendLogoutPacket()
299 { 429 {
300 } 430 }
301 } 431 }
302} 432} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index 9a7b340..c616f6a 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -31,13 +31,9 @@ using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
36using OpenSim.Framework;
37
38using OpenSim.Region.Environment.Scenes;
39using OpenSim.Region.Terrain;
40using OpenSim.Region.Environment; 35using OpenSim.Region.Environment;
36using OpenSim.Region.Environment.Scenes;
41using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; 37using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
42 38
43namespace SimpleApp 39namespace SimpleApp
@@ -46,8 +42,10 @@ namespace SimpleApp
46 { 42 {
47 private List<ScenePresence> m_avatars; 43 private List<ScenePresence> m_avatars;
48 44
49 public MyWorld( RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, ModuleLoader moduleLoader) 45 public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
50 : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false) 46 AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer,
47 ModuleLoader moduleLoader)
48 : base(regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false)
51 { 49 {
52 m_avatars = new List<Avatar>(); 50 m_avatars = new List<Avatar>();
53 } 51 }
@@ -58,32 +56,30 @@ namespace SimpleApp
58 56
59 for (int i = 0; i < 65536; i++) 57 for (int i = 0; i < 65536; i++)
60 { 58 {
61 int x = i % 256; 59 int x = i%256;
62 int y = i / 256; 60 int y = i/256;
63 61
64 map[i] = 25f; 62 map[i] = 25f;
65 } 63 }
66 64
67 this.Terrain.GetHeights1D(map); 65 Terrain.GetHeights1D(map);
68 this.CreateTerrainTexture(); 66 CreateTerrainTexture();
69 } 67 }
70 68
71 override public void AddNewClient(IClientAPI client, bool child) 69 public override void AddNewClient(IClientAPI client, bool child)
72 { 70 {
73 SubscribeToClientEvents(client); 71 SubscribeToClientEvents(client);
74 72
75 ScenePresence avatar = CreateAndAddScenePresence(client, child ); 73 ScenePresence avatar = CreateAndAddScenePresence(client, child);
76 avatar.AbsolutePosition = new LLVector3(128, 128, 26); 74 avatar.AbsolutePosition = new LLVector3(128, 128, 26);
77 75
78 LLVector3 pos = new LLVector3(128, 128, 128); 76 LLVector3 pos = new LLVector3(128, 128, 128);
79 77
80 client.OnCompleteMovementToRegion += delegate() 78 client.OnCompleteMovementToRegion +=
81 { 79 delegate() { client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); };
82 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
83 };
84 80
85 81
86 client.SendRegionHandshake(m_regInfo); 82 client.SendRegionHandshake(m_regInfo);
87 } 83 }
88 } 84 }
89} 85} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 72aaf6b..b37c2ee 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -31,23 +31,23 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Net; 32using System.Net;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config;
35using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
36using OpenSim.Framework;
37using OpenSim.Region.ClientStack; 38using OpenSim.Region.ClientStack;
38using OpenSim.Region.Communications.Local; 39using OpenSim.Region.Communications.Local;
39using OpenSim.Region.Environment; 40using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42using Nini.Config;
43 43
44namespace SimpleApp 44namespace SimpleApp
45{ 45{
46 class Program : RegionApplicationBase, conscmd_callback 46 internal class Program : RegionApplicationBase, conscmd_callback
47 { 47 {
48 private ModuleLoader m_moduleLoader; 48 private ModuleLoader m_moduleLoader;
49 private IConfigSource m_config; 49 private IConfigSource m_config;
50 50
51 protected override LogBase CreateLog() 51 protected override LogBase CreateLog()
52 { 52 {
53 return new LogBase(null, "SimpleApp", this, true); 53 return new LogBase(null, "SimpleApp", this, true);
@@ -57,45 +57,51 @@ namespace SimpleApp
57 { 57 {
58 StartLog(); 58 StartLog();
59 59
60 m_networkServersInfo = new NetworkServersInfo( 1000, 1000 ); 60 m_networkServersInfo = new NetworkServersInfo(1000, 1000);
61 61
62 LocalAssetServer assetServer = new LocalAssetServer(); 62 LocalAssetServer assetServer = new LocalAssetServer();
63 63
64 m_assetCache = new AssetCache(assetServer); 64 m_assetCache = new AssetCache(assetServer);
65 } 65 }
66 66
67 public void Run() 67 public void Run()
68 { 68 {
69 base.StartUp(); 69 base.StartUp();
70 70
71 LocalInventoryService inventoryService = new LocalInventoryService(); 71 LocalInventoryService inventoryService = new LocalInventoryService();
72 LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); 72 LocalUserServices userService =
73 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
74 m_networkServersInfo.DefaultHomeLocY, inventoryService);
73 LocalBackEndServices backendService = new LocalBackEndServices(); 75 LocalBackEndServices backendService = new LocalBackEndServices();
74 76
75 CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, false); 77 CommunicationsLocal localComms =
78 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService,
79 backendService, backendService, false);
76 m_commsManager = localComms; 80 m_commsManager = localComms;
77 81
78 LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); 82 LocalLoginService loginService =
83 new LocalLoginService(userService, "", localComms, m_networkServersInfo, false);
79 loginService.OnLoginToRegion += backendService.AddNewSession; 84 loginService.OnLoginToRegion += backendService.AddNewSession;
80 85
81 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); 86 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
82 87
83 m_log.Notice(m_log.LineInfo); 88 m_log.Notice(m_log.LineInfo);
84 89
85 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); 90 IPEndPoint internalEndPoint =
91 new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort);
86 92
87 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); 93 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost");
88 regionInfo.DataStore = "simpleapp_datastore.yap"; 94 regionInfo.DataStore = "simpleapp_datastore.yap";
89 95
90 UDPServer udpServer; 96 UDPServer udpServer;
91 97
92 m_moduleLoader = new ModuleLoader( m_log, m_config ); 98 m_moduleLoader = new ModuleLoader(m_log, m_config);
93 m_moduleLoader.LoadDefaultSharedModules(); 99 m_moduleLoader.LoadDefaultSharedModules();
94 100
95 Scene scene = SetupScene(regionInfo, out udpServer); 101 Scene scene = SetupScene(regionInfo, out udpServer);
96 102
97 m_moduleLoader.InitialiseSharedModules(scene); 103 m_moduleLoader.InitialiseSharedModules(scene);
98 104
99 scene.SetModuleInterfaces(); 105 scene.SetModuleInterfaces();
100 106
101 scene.StartTimer(); 107 scene.StartTimer();
@@ -104,18 +110,22 @@ namespace SimpleApp
104 110
105 m_moduleLoader.PostInitialise(); 111 m_moduleLoader.PostInitialise();
106 m_moduleLoader.ClearCache(); 112 m_moduleLoader.ClearCache();
107 113
108 udpServer.ServerListener(); 114 udpServer.ServerListener();
109 115
110 LLVector3 pos = new LLVector3(110, 129, 27); 116 LLVector3 pos = new LLVector3(110, 129, 27);
111 117
112 SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); 118 SceneObjectGroup sceneObject =
119 new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
120 pos + new LLVector3(1f, 1f, 1f));
113 scene.AddEntity(sceneObject); 121 scene.AddEntity(sceneObject);
114 122
115 for (int i = 0; i < 27; i++) 123 for (int i = 0; i < 27; i++)
116 { 124 {
117 LLVector3 posOffset = new LLVector3( (i%3)*4, (i%9)/3 * 4, (i/9) * 4 ); 125 LLVector3 posOffset = new LLVector3((i%3)*4, (i%9)/3*4, (i/9)*4);
118 ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); 126 ComplexObject complexObject =
127 new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
128 pos + posOffset);
119 scene.AddEntity(complexObject); 129 scene.AddEntity(complexObject);
120 } 130 }
121 131
@@ -128,45 +138,48 @@ namespace SimpleApp
128 List<ScenePresence> avatars = scene.GetAvatars(); 138 List<ScenePresence> avatars = scene.GetAvatars();
129 foreach (ScenePresence avatar in avatars) 139 foreach (ScenePresence avatar in avatars)
130 { 140 {
131 avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Util.RandomClass.Next(30, 200), 2); 141 avatar.AbsolutePosition =
142 new LLVector3((float) Util.RandomClass.Next(100, 200), (float) Util.RandomClass.Next(30, 200), 2);
132 } 143 }
133 144
134 145
135 146 DirectoryInfo dirInfo = new DirectoryInfo(".");
136 DirectoryInfo dirInfo = new DirectoryInfo( "." );
137 147
138 float x = 0; 148 float x = 0;
139 float z = 0; 149 float z = 0;
140 150
141 foreach( FileInfo fileInfo in dirInfo.GetFiles()) 151 foreach (FileInfo fileInfo in dirInfo.GetFiles())
142 { 152 {
143 LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); 153 LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z);
144 x = x + 2; 154 x = x + 2;
145 if( x > 50 ) 155 if (x > 50)
146 { 156 {
147 x = 0; 157 x = 0;
148 z = z + 2; 158 z = z + 2;
149 } 159 }
150 160
151 FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); 161 FileSystemObject fileObject = new FileSystemObject(scene, fileInfo, filePos);
152 scene.AddEntity(fileObject); 162 scene.AddEntity(fileObject);
153 } 163 }
154 164
155 m_log.Notice("Press enter to quit."); 165 m_log.Notice("Press enter to quit.");
156 m_log.ReadLine(); 166 m_log.ReadLine();
157 } 167 }
158 168
159 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) 169 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
170 AgentCircuitManager circuitManager)
160 { 171 {
161 return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config )); 172 return
173 new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer,
174 new ModuleLoader(m_log, m_config));
162 } 175 }
163 176
164 protected override StorageManager CreateStorageManager(RegionInfo regionInfo) 177 protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
165 { 178 {
166 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); 179 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
167 } 180 }
168 181
169 protected override PhysicsScene GetPhysicsScene( ) 182 protected override PhysicsScene GetPhysicsScene()
170 { 183 {
171 return GetPhysicsScene("basicphysics"); 184 return GetPhysicsScene("basicphysics");
172 } 185 }
@@ -185,11 +198,11 @@ namespace SimpleApp
185 198
186 #endregion 199 #endregion
187 200
188 static void Main(string[] args) 201 private static void Main(string[] args)
189 { 202 {
190 Program app = new Program(); 203 Program app = new Program();
191 204
192 app.Run(); 205 app.Run();
193 } 206 }
194 } 207 }
195} 208} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
index 2250613..a5c8f05 100644
--- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
@@ -1,24 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("SimpleApp")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("SimpleApp")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("Playahead AB")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("SimpleApp")] 11[assembly : AssemblyCompany("Playahead AB")]
11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] 12[assembly : AssemblyProduct("SimpleApp")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © Playahead AB 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] 24
25[assembly : Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices;
27// Build Number 31// Build Number
28// Revision 32// Revision
29// 33//
30[assembly: AssemblyVersion("1.0.0.0")] 34
31[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly : AssemblyVersion("1.0.0.0")]
36[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
index d4b27fc..176fc7b 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
40 return ".cs"; 40 return ".cs";
41 } 41 }
42 42
43 private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) 43 private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
44 { 44 {
45 CompilerParameters compilerParams = new CompilerParameters(); 45 CompilerParameters compilerParams = new CompilerParameters();
46 CompilerResults compilerResults; 46 CompilerResults compilerResults;
@@ -66,15 +66,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
66 } 66 }
67 else 67 else
68 { 68 {
69 Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); 69 Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
70 70
71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 71 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
72 { 72 {
73 Type testInterface = pluginType.GetInterface("IScript", true); 73 Type testInterface = pluginType.GetInterface("IScript", true);
74 74
75 if (testInterface != null) 75 if (testInterface != null)
76 { 76 {
77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 77 IScript script =
78 (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
78 79
79 string scriptName = "C#/" + script.Name; 80 string scriptName = "C#/" + script.Name;
80 Console.WriteLine("Script: " + scriptName + " loaded."); 81 Console.WriteLine("Script: " + scriptName + " loaded.");
@@ -94,10 +95,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
94 return null; 95 return null;
95 } 96 }
96 97
97 public Dictionary<string,IScript> compile(string filename) 98 public Dictionary<string, IScript> compile(string filename)
98 { 99 {
99 CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); 100 CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
100 return LoadDotNetScript(csharpProvider, filename); 101 return LoadDotNetScript(csharpProvider, filename);
101 } 102 }
102 } 103 }
103} 104} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
index 7ae4658..2d684d1 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
@@ -26,19 +26,13 @@
26* 26*
27*/ 27*/
28 28
29using OpenSim.Framework.Console;
30using OpenSim.Framework;
31using OpenSim.Region.Environment;
32using OpenSim.Region.Environment.Scenes; 29using OpenSim.Region.Environment.Scenes;
33 30
34using System.Collections.Generic;
35using libsecondlife;
36
37namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples 31namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
38{ 32{
39 public class LSLExportScript : IScript 33 public class LSLExportScript : IScript
40 { 34 {
41 ScriptInfo script; 35 private ScriptInfo script;
42 36
43 public string Name 37 public string Name
44 { 38 {
@@ -48,11 +42,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
48 public void Initialise(ScriptInfo scriptInfo) 42 public void Initialise(ScriptInfo scriptInfo)
49 { 43 {
50 script = scriptInfo; 44 script = scriptInfo;
51 45
52 script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg); 46 script.events.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(ProcessConsoleMsg);
53 } 47 }
54 48
55 void ProcessConsoleMsg(string[] args) 49 private void ProcessConsoleMsg(string[] args)
56 { 50 {
57 /*if (args[0].ToLower() == "lslexport") 51 /*if (args[0].ToLower() == "lslexport")
58 { 52 {
@@ -79,7 +73,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
79 }*/ 73 }*/
80 } 74 }
81 75
82 string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) 76 private string processPrimitiveToString(SceneObjectPart prim)
83 { 77 {
84 /*string desc = prim.Description; 78 /*string desc = prim.Description;
85 string name = prim.Name; 79 string name = prim.Name;
@@ -97,4 +91,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
97 return ""; 91 return "";
98 } 92 }
99 } 93 }
100} 94} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
index 4bde721..ea0e92a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
@@ -74,7 +74,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
74 74
75 if (testInterface != null) 75 if (testInterface != null)
76 { 76 {
77 IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 77 IScript script =
78 (IScript) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
78 79
79 string scriptName = "JS.NET/" + script.Name; 80 string scriptName = "JS.NET/" + script.Name;
80 Console.WriteLine("Script: " + scriptName + " loaded."); 81 Console.WriteLine("Script: " + scriptName + " loaded.");
@@ -100,4 +101,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
100 return LoadDotNetScript(jscriptProvider, filename); 101 return LoadDotNetScript(jscriptProvider, filename);
101 } 102 }
102 } 103 }
103} 104} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
index 6100c67..3f09099 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32 30
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 31namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
@@ -40,7 +38,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
40 38
41 public ClassInstance() 39 public ClassInstance()
42 { 40 {
43
44 } 41 }
45 } 42 }
46} 43} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
index 5c3629c..3bcc824 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -26,9 +26,8 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text; 30using System.IO;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
34 33
@@ -56,7 +55,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
56 55
57 public ClassRecord() 56 public ClassRecord()
58 { 57 {
59
60 } 58 }
61 59
62 public ClassInstance CreateNewInstance() 60 public ClassInstance CreateNewInstance()
@@ -72,7 +70,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
72 { 70 {
73 Console.WriteLine("loading script " + fileName); 71 Console.WriteLine("loading script " + fileName);
74 FileStream fs = File.OpenRead(fileName); 72 FileStream fs = File.OpenRead(fileName);
75 this.LoadClassFromBytes(ReadFully(fs)); 73 LoadClassFromBytes(ReadFully(fs));
76 fs.Close(); 74 fs.Close();
77 } 75 }
78 76
@@ -80,9 +78,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
80 { 78 {
81 int i = 0; 79 int i = 0;
82 i += 4; 80 i += 4;
83 m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); 81 m_minorVersion = (ushort) ((data[i++] << 8) + data[i++]);
84 m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); 82 m_majorVersion = (ushort) ((data[i++] << 8) + data[i++]);
85 m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); 83 m_constantPoolCount = (ushort) ((data[i++] << 8) + data[i++]);
86 Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); 84 Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool");
87 for (int count = 0; count < (m_constantPoolCount - 1); count++) 85 for (int count = 0; count < (m_constantPoolCount - 1); count++)
88 { 86 {
@@ -92,13 +90,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
92 //Console.WriteLine("start position is: " + i); 90 //Console.WriteLine("start position is: " + i);
93 switch (pooltype) 91 switch (pooltype)
94 { 92 {
95 case 1: //Utf8 93 case 1: //Utf8
96 ushort uLength = (ushort)((data[i++] << 8) + data[i++]); 94 ushort uLength = (ushort) ((data[i++] << 8) + data[i++]);
97 95
98 // Console.WriteLine("new utf8 type, length is " + uLength); 96 // Console.WriteLine("new utf8 type, length is " + uLength);
99 PoolUtf8 utf8 = new PoolUtf8(); 97 PoolUtf8 utf8 = new PoolUtf8();
100 utf8.readValue(data, ref i, uLength); 98 utf8.readValue(data, ref i, uLength);
101 this.m_constantsPool.Add(utf8); 99 m_constantsPool.Add(utf8);
102 break; 100 break;
103 case 3: //Int 101 case 3: //Int
104 break; 102 break;
@@ -107,53 +105,53 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
107 case 7: //Class 105 case 7: //Class
108 PoolClass pClass = new PoolClass(this); 106 PoolClass pClass = new PoolClass(this);
109 pClass.readValue(data, ref i); 107 pClass.readValue(data, ref i);
110 this.m_constantsPool.Add(pClass); 108 m_constantsPool.Add(pClass);
111 break; 109 break;
112 case 9: //FieldRef 110 case 9: //FieldRef
113 PoolFieldRef pField = new PoolFieldRef(this); 111 PoolFieldRef pField = new PoolFieldRef(this);
114 pField.readValue(data, ref i); 112 pField.readValue(data, ref i);
115 this.m_constantsPool.Add(pField); 113 m_constantsPool.Add(pField);
116 break; 114 break;
117 case 10: //Method 115 case 10: //Method
118 PoolMethodRef pMeth = new PoolMethodRef(this); 116 PoolMethodRef pMeth = new PoolMethodRef(this);
119 pMeth.readValue(data, ref i); 117 pMeth.readValue(data, ref i);
120 this.m_constantsPool.Add(pMeth); 118 m_constantsPool.Add(pMeth);
121 break; 119 break;
122 case 12: //NamedType 120 case 12: //NamedType
123 PoolNamedType pNamed = new PoolNamedType(this); 121 PoolNamedType pNamed = new PoolNamedType(this);
124 pNamed.readValue(data, ref i); 122 pNamed.readValue(data, ref i);
125 this.m_constantsPool.Add(pNamed); 123 m_constantsPool.Add(pNamed);
126 break; 124 break;
127 } 125 }
128 } 126 }
129 127
130 m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); 128 m_accessFlags = (ushort) ((data[i++] << 8) + data[i++]);
131 m_thisClass = (ushort)((data[i++] << 8) + data[i++]); 129 m_thisClass = (ushort) ((data[i++] << 8) + data[i++]);
132 m_supperClass = (ushort)((data[i++] << 8) + data[i++]); 130 m_supperClass = (ushort) ((data[i++] << 8) + data[i++]);
133 131
134 if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) 132 if (m_constantsPool[m_thisClass - 1] is PoolClass)
135 { 133 {
136 this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); 134 MClass = ((PoolClass) m_constantsPool[m_thisClass - 1]);
137 } 135 }
138 136
139 m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); 137 m_interfaceCount = (ushort) ((data[i++] << 8) + data[i++]);
140 //should now read in the info for each interface 138 //should now read in the info for each interface
141 139
142 m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); 140 m_fieldCount = (ushort) ((data[i++] << 8) + data[i++]);
143 //should now read in the info for each field 141 //should now read in the info for each field
144 for (int count = 0; count < m_fieldCount; count++) 142 for (int count = 0; count < m_fieldCount; count++)
145 { 143 {
146 FieldInfo fieldInf = new FieldInfo(this); 144 FieldInfo fieldInf = new FieldInfo(this);
147 fieldInf.ReadData(data, ref i); 145 fieldInf.ReadData(data, ref i);
148 this.m_fieldList.Add(fieldInf); 146 m_fieldList.Add(fieldInf);
149 } 147 }
150 148
151 m_methodCount = (ushort)((data[i++] << 8) + data[i++]); 149 m_methodCount = (ushort) ((data[i++] << 8) + data[i++]);
152 for (int count = 0; count < m_methodCount; count++) 150 for (int count = 0; count < m_methodCount; count++)
153 { 151 {
154 MethodInfo methInf = new MethodInfo(this); 152 MethodInfo methInf = new MethodInfo(this);
155 methInf.ReadData(data, ref i); 153 methInf.ReadData(data, ref i);
156 this.m_methodsList.Add(methInf); 154 m_methodsList.Add(methInf);
157 } 155 }
158 } 156 }
159 157
@@ -161,7 +159,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
161 { 159 {
162 for (int count = 0; count < m_methodCount; count++) 160 for (int count = 0; count < m_methodCount; count++)
163 { 161 {
164 this.m_methodsList[count].AddMethodCode(memory); 162 m_methodsList[count].AddMethodCode(memory);
165 } 163 }
166 } 164 }
167 165
@@ -169,12 +167,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
169 { 167 {
170 for (int count = 0; count < m_methodCount; count++) 168 for (int count = 0; count < m_methodCount; count++)
171 { 169 {
172 if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) 170 if (m_constantsPool[m_methodsList[count].NameIndex - 1] is PoolUtf8)
173 { 171 {
174 if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) 172 if (((PoolUtf8) m_constantsPool[m_methodsList[count].NameIndex - 1]).Value == methodName)
175 { 173 {
176 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); 174 //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
177 thread.SetPC(this.m_methodsList[count].CodePointer); 175 thread.SetPC(m_methodsList[count].CodePointer);
178 return true; 176 return true;
179 } 177 }
180 } 178 }
@@ -191,7 +189,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
191 189
192 for (int i = 0; i < m_constantsPool.Count; i++) 190 for (int i = 0; i < m_constantsPool.Count; i++)
193 { 191 {
194 this.m_constantsPool[i].Print(); 192 m_constantsPool[i].Print();
195 } 193 }
196 194
197 Console.WriteLine("Access flags: " + m_accessFlags); 195 Console.WriteLine("Access flags: " + m_accessFlags);
@@ -201,16 +199,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
201 for (int count = 0; count < m_fieldCount; count++) 199 for (int count = 0; count < m_fieldCount; count++)
202 { 200 {
203 Console.WriteLine(); 201 Console.WriteLine();
204 this.m_fieldList[count].Print(); 202 m_fieldList[count].Print();
205 } 203 }
206 204
207 for (int count = 0; count < m_methodCount; count++) 205 for (int count = 0; count < m_methodCount; count++)
208 { 206 {
209 Console.WriteLine(); 207 Console.WriteLine();
210 this.m_methodsList[count].Print(); 208 m_methodsList[count].Print();
211 } 209 }
212 210
213 Console.WriteLine("class name is " + this.MClass.Name.Value); 211 Console.WriteLine("class name is " + MClass.Name.Value);
214 } 212 }
215 213
216 public static byte[] ReadFully(Stream stream) 214 public static byte[] ReadFully(Stream stream)
@@ -229,11 +227,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
229 } 227 }
230 228
231 #region nested classes 229 #region nested classes
230
232 public class PoolItem 231 public class PoolItem
233 { 232 {
234 public virtual void Print() 233 public virtual void Print()
235 { 234 {
236
237 } 235 }
238 } 236 }
239 237
@@ -245,21 +243,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
245 { 243 {
246 for (int i = 0; i < length; i++) 244 for (int i = 0; i < length; i++)
247 { 245 {
248 int a = (int)data[pointer++]; 246 int a = (int) data[pointer++];
249 if ((a & 0x80) == 0) 247 if ((a & 0x80) == 0)
250 { 248 {
251 Value = Value + (char)a; 249 Value = Value + (char) a;
252 } 250 }
253 else if ((a & 0x20) == 0) 251 else if ((a & 0x20) == 0)
254 { 252 {
255 int b = (int)data[pointer++]; 253 int b = (int) data[pointer++];
256 Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); 254 Value = Value + (char) (((a & 0x1f) << 6) + (b & 0x3f));
257 } 255 }
258 else 256 else
259 { 257 {
260 int b = (int)data[pointer++]; 258 int b = (int) data[pointer++];
261 int c = (int)data[pointer++]; 259 int c = (int) data[pointer++];
262 Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); 260 Value = Value + (char) (((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f));
263 } 261 }
264 } 262 }
265 } 263 }
@@ -272,7 +270,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
272 270
273 private class PoolInt : PoolItem 271 private class PoolInt : PoolItem
274 { 272 {
275
276 } 273 }
277 274
278 public class PoolClass : PoolItem 275 public class PoolClass : PoolItem
@@ -289,15 +286,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
289 286
290 public void readValue(byte[] data, ref int pointer) 287 public void readValue(byte[] data, ref int pointer)
291 { 288 {
292 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 289 namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
293 } 290 }
294 291
295 public override void Print() 292 public override void Print()
296 { 293 {
297 this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); 294 Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]);
298 Console.Write("Class type: " + namePointer); 295 Console.Write("Class type: " + namePointer);
299 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); 296 Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value);
300
301 } 297 }
302 } 298 }
303 299
@@ -316,14 +312,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
316 312
317 public void readValue(byte[] data, ref int pointer) 313 public void readValue(byte[] data, ref int pointer)
318 { 314 {
319 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 315 classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
320 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 316 nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
321 } 317 }
322 318
323 public override void Print() 319 public override void Print()
324 { 320 {
325 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); 321 mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]);
326 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); 322 mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]);
327 Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); 323 Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer);
328 } 324 }
329 } 325 }
@@ -343,14 +339,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
343 339
344 public void readValue(byte[] data, ref int pointer) 340 public void readValue(byte[] data, ref int pointer)
345 { 341 {
346 classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 342 classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
347 nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 343 nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
348 } 344 }
349 345
350 public override void Print() 346 public override void Print()
351 { 347 {
352 this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); 348 mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]);
353 this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); 349 mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]);
354 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); 350 Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
355 } 351 }
356 } 352 }
@@ -370,16 +366,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
370 366
371 public void readValue(byte[] data, ref int pointer) 367 public void readValue(byte[] data, ref int pointer)
372 { 368 {
373 namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 369 namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
374 typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); 370 typePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]);
375 } 371 }
376 372
377 public override void Print() 373 public override void Print()
378 { 374 {
379 Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); 375 Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]);
380 Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); 376 Type = ((PoolUtf8) parent.m_constantsPool[typePointer - 1]);
381 Console.Write("Named type: " + namePointer + " , " + typePointer); 377 Console.Write("Named type: " + namePointer + " , " + typePointer);
382 Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); 378 Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value);
383 } 379 }
384 } 380 }
385 381
@@ -402,23 +398,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
402 398
403 public void AddMethodCode(MethodMemory memory) 399 public void AddMethodCode(MethodMemory memory)
404 { 400 {
405 Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); 401 Array.Copy(Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, Attributes[0].Code.Length);
406 memory.Methodcount++; 402 memory.Methodcount++;
407 this.CodePointer = memory.NextMethodPC; 403 CodePointer = memory.NextMethodPC;
408 memory.NextMethodPC += this.Attributes[0].Code.Length; 404 memory.NextMethodPC += Attributes[0].Code.Length;
409 } 405 }
410 406
411 public void ReadData(byte[] data, ref int pointer) 407 public void ReadData(byte[] data, ref int pointer)
412 { 408 {
413 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 409 AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]);
414 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 410 NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
415 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 411 DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
416 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 412 AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]);
417 for (int i = 0; i < AttributeCount; i++) 413 for (int i = 0; i < AttributeCount; i++)
418 { 414 {
419 MethodAttribute attri = new MethodAttribute(this.parent); 415 MethodAttribute attri = new MethodAttribute(parent);
420 attri.ReadData(data, ref pointer); 416 attri.ReadData(data, ref pointer);
421 this.Attributes.Add(attri); 417 Attributes.Add(attri);
422 } 418 }
423 } 419 }
424 420
@@ -426,12 +422,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
426 { 422 {
427 Console.WriteLine("Method Info Struct: "); 423 Console.WriteLine("Method Info Struct: ");
428 Console.WriteLine("AccessFlags: " + AccessFlags); 424 Console.WriteLine("AccessFlags: " + AccessFlags);
429 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 425 Console.WriteLine("NameIndex: " + NameIndex + " // " +
430 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); 426 ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value);
427 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " +
428 ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value);
431 Console.WriteLine("Attribute Count:" + AttributeCount); 429 Console.WriteLine("Attribute Count:" + AttributeCount);
432 for (int i = 0; i < AttributeCount; i++) 430 for (int i = 0; i < AttributeCount; i++)
433 { 431 {
434 this.Attributes[i].Print(); 432 Attributes[i].Print();
435 } 433 }
436 } 434 }
437 435
@@ -457,30 +455,35 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
457 455
458 public void ReadData(byte[] data, ref int pointer) 456 public void ReadData(byte[] data, ref int pointer)
459 { 457 {
460 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 458 NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
461 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 459 Length =
462 MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); 460 (Int32)
463 MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); 461 ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
464 CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 462 MaxStack = (ushort) ((data[pointer++] << 8) + data[pointer++]);
463 MaxLocals = (ushort) ((data[pointer++] << 8) + data[pointer++]);
464 CodeLength =
465 (Int32)
466 ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
465 Code = new byte[CodeLength]; 467 Code = new byte[CodeLength];
466 for (int i = 0; i < CodeLength; i++) 468 for (int i = 0; i < CodeLength; i++)
467 { 469 {
468 Code[i] = data[pointer++]; 470 Code[i] = data[pointer++];
469 } 471 }
470 ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); 472 ExceptionTableLength = (ushort) ((data[pointer++] << 8) + data[pointer++]);
471 SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 473 SubAttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]);
472 for (int i = 0; i < SubAttributeCount; i++) 474 for (int i = 0; i < SubAttributeCount; i++)
473 { 475 {
474 SubAttribute subAttri = new SubAttribute(this.parent); 476 SubAttribute subAttri = new SubAttribute(parent);
475 subAttri.ReadData(data, ref pointer); 477 subAttri.ReadData(data, ref pointer);
476 this.SubAttributes.Add(subAttri); 478 SubAttributes.Add(subAttri);
477 } 479 }
478 } 480 }
479 481
480 public void Print() 482 public void Print()
481 { 483 {
482 Console.WriteLine("Method Attribute: "); 484 Console.WriteLine("Method Attribute: ");
483 Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 485 Console.WriteLine("Name Index: " + NameIndex + " // " +
486 ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value);
484 Console.WriteLine("Length: " + Length); 487 Console.WriteLine("Length: " + Length);
485 Console.WriteLine("MaxStack: " + MaxStack); 488 Console.WriteLine("MaxStack: " + MaxStack);
486 Console.WriteLine("MaxLocals: " + MaxLocals); 489 Console.WriteLine("MaxLocals: " + MaxLocals);
@@ -492,7 +495,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
492 Console.WriteLine("SubAttributes: " + SubAttributeCount); 495 Console.WriteLine("SubAttributes: " + SubAttributeCount);
493 for (int i = 0; i < SubAttributeCount; i++) 496 for (int i = 0; i < SubAttributeCount; i++)
494 { 497 {
495 this.SubAttributes[i].Print(); 498 SubAttributes[i].Print();
496 } 499 }
497 } 500 }
498 501
@@ -511,8 +514,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
511 514
512 public void ReadData(byte[] data, ref int pointer) 515 public void ReadData(byte[] data, ref int pointer)
513 { 516 {
514 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 517 NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
515 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 518 Length =
519 (Int32)
520 ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) +
521 data[pointer++]);
516 Data = new byte[Length]; 522 Data = new byte[Length];
517 for (int i = 0; i < Length; i++) 523 for (int i = 0; i < Length; i++)
518 { 524 {
@@ -522,18 +528,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
522 528
523 public void Print() 529 public void Print()
524 { 530 {
525 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 531 Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " +
532 ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value);
526 } 533 }
527
528 } 534 }
529 } 535 }
530
531 } 536 }
537
532 private class InterfaceInfo 538 private class InterfaceInfo
533 { 539 {
534 public void ReadData(byte[] data, ref int i) 540 public void ReadData(byte[] data, ref int i)
535 { 541 {
536
537 } 542 }
538 } 543 }
539 544
@@ -554,15 +559,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
554 559
555 public void ReadData(byte[] data, ref int pointer) 560 public void ReadData(byte[] data, ref int pointer)
556 { 561 {
557 AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); 562 AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]);
558 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 563 NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
559 DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 564 DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
560 AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); 565 AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]);
561 for (int i = 0; i < AttributeCount; i++) 566 for (int i = 0; i < AttributeCount; i++)
562 { 567 {
563 FieldAttribute attri = new FieldAttribute(this.parent); 568 FieldAttribute attri = new FieldAttribute(parent);
564 attri.ReadData(data, ref pointer); 569 attri.ReadData(data, ref pointer);
565 this.Attributes.Add(attri); 570 Attributes.Add(attri);
566 } 571 }
567 } 572 }
568 573
@@ -570,29 +575,30 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
570 { 575 {
571 Console.WriteLine("Field Info Struct: "); 576 Console.WriteLine("Field Info Struct: ");
572 Console.WriteLine("AccessFlags: " + AccessFlags); 577 Console.WriteLine("AccessFlags: " + AccessFlags);
573 Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 578 Console.WriteLine("NameIndex: " + NameIndex + " // " +
574 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); 579 ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value);
580 Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " +
581 ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value);
575 Console.WriteLine("Attribute Count:" + AttributeCount); 582 Console.WriteLine("Attribute Count:" + AttributeCount);
576 //if static, add to static field list 583 //if static, add to static field list
577 // if (this.AccessFlags == 9) //public and static 584 // if (this.AccessFlags == 9) //public and static
578 if ((this.AccessFlags & 0x08) != 0) 585 if ((AccessFlags & 0x08) != 0)
579 { 586 {
580 switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) 587 switch (((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value)
581 { 588 {
582 case "I": 589 case "I":
583 Int newin = new Int(); 590 Int newin = new Int();
584 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); 591 parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newin);
585 break; 592 break;
586 case "F": 593 case "F":
587 Float newfl = new Float(); 594 Float newfl = new Float();
588 this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); 595 parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newfl);
589 break; 596 break;
590 } 597 }
591
592 } 598 }
593 for (int i = 0; i < AttributeCount; i++) 599 for (int i = 0; i < AttributeCount; i++)
594 { 600 {
595 this.Attributes[i].Print(); 601 Attributes[i].Print();
596 } 602 }
597 } 603 }
598 604
@@ -611,8 +617,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
611 617
612 public void ReadData(byte[] data, ref int pointer) 618 public void ReadData(byte[] data, ref int pointer)
613 { 619 {
614 NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); 620 NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]);
615 Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); 621 Length =
622 (Int32)
623 ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]);
616 Data = new byte[Length]; 624 Data = new byte[Length];
617 for (int i = 0; i < Length; i++) 625 for (int i = 0; i < Length; i++)
618 { 626 {
@@ -622,7 +630,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
622 630
623 public void Print() 631 public void Print()
624 { 632 {
625 Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); 633 Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " +
634 ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value);
626 } 635 }
627 } 636 }
628 } 637 }
@@ -631,10 +640,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
631 { 640 {
632 public void ReadData(byte[] data, ref int i) 641 public void ReadData(byte[] data, ref int i)
633 { 642 {
634
635 } 643 }
636 } 644 }
637 #endregion
638 645
646 #endregion
639 } 647 }
640} \ No newline at end of file 648} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
index c76767a..9876caa 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31 29
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 30namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 31{
@@ -37,7 +35,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
37 35
38 public Heap() 36 public Heap()
39 { 37 {
40
41 } 38 }
42 } 39 }
43} 40} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index 6b8930e..b172562 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -25,9 +25,6 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 28using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 30
@@ -42,304 +39,313 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
42 bool result = false; 39 bool result = false;
43 switch (opcode) 40 switch (opcode)
44 { 41 {
45 case (byte)(byte)OpCode.iconst_m1: 42 case (byte) (byte) OpCode.iconst_m1:
46 Int m_int = new Int(); 43 Int m_int = new Int();
47 m_int.mValue = -1; 44 m_int.mValue = -1;
48 this.m_thread.m_currentFrame.OpStack.Push(m_int); 45 m_thread.m_currentFrame.OpStack.Push(m_int);
49 result = true; 46 result = true;
50 break; 47 break;
51 case (byte)(byte)OpCode.iconst_0: 48 case (byte) (byte) OpCode.iconst_0:
52 m_int = new Int(); 49 m_int = new Int();
53 m_int.mValue = 0; 50 m_int.mValue = 0;
54 this.m_thread.m_currentFrame.OpStack.Push(m_int); 51 m_thread.m_currentFrame.OpStack.Push(m_int);
55 result = true; 52 result = true;
56 break; 53 break;
57 case (byte)(byte)OpCode.iconst_1: 54 case (byte) (byte) OpCode.iconst_1:
58 m_int = new Int(); 55 m_int = new Int();
59 m_int.mValue = 1; 56 m_int.mValue = 1;
60 this.m_thread.m_currentFrame.OpStack.Push(m_int); 57 m_thread.m_currentFrame.OpStack.Push(m_int);
61 result = true; 58 result = true;
62 break; 59 break;
63 case (byte)(byte)OpCode.iconst_2: 60 case (byte) (byte) OpCode.iconst_2:
64 m_int = new Int(); 61 m_int = new Int();
65 m_int.mValue = 2; 62 m_int.mValue = 2;
66 this.m_thread.m_currentFrame.OpStack.Push(m_int); 63 m_thread.m_currentFrame.OpStack.Push(m_int);
67 result = true; 64 result = true;
68 break; 65 break;
69 case (byte)(byte)OpCode.iconst_3: 66 case (byte) (byte) OpCode.iconst_3:
70 m_int = new Int(); 67 m_int = new Int();
71 m_int.mValue = 3; 68 m_int.mValue = 3;
72 this.m_thread.m_currentFrame.OpStack.Push(m_int); 69 m_thread.m_currentFrame.OpStack.Push(m_int);
73 break; 70 break;
74 case (byte)(byte)OpCode.iconst_4: 71 case (byte) (byte) OpCode.iconst_4:
75 m_int = new Int(); 72 m_int = new Int();
76 m_int.mValue = 4; 73 m_int.mValue = 4;
77 this.m_thread.m_currentFrame.OpStack.Push(m_int); 74 m_thread.m_currentFrame.OpStack.Push(m_int);
78 result = true; 75 result = true;
79 break; 76 break;
80 case (byte)OpCode.iconst_5: 77 case (byte) OpCode.iconst_5:
81 m_int = new Int(); 78 m_int = new Int();
82 m_int.mValue = 5; 79 m_int.mValue = 5;
83 this.m_thread.m_currentFrame.OpStack.Push(m_int); 80 m_thread.m_currentFrame.OpStack.Push(m_int);
84 result = true; 81 result = true;
85 break; 82 break;
86 case (byte)OpCode.fconst_0: 83 case (byte) OpCode.fconst_0:
87 Float m_float = new Float(); 84 Float m_float = new Float();
88 m_float.mValue = 0.0f; 85 m_float.mValue = 0.0f;
89 this.m_thread.m_currentFrame.OpStack.Push(m_float); 86 m_thread.m_currentFrame.OpStack.Push(m_float);
90 result = true; 87 result = true;
91 break; 88 break;
92 case (byte)OpCode.fconst_1: 89 case (byte) OpCode.fconst_1:
93 m_float = new Float(); 90 m_float = new Float();
94 m_float.mValue = 1.0f; 91 m_float.mValue = 1.0f;
95 this.m_thread.m_currentFrame.OpStack.Push(m_float); 92 m_thread.m_currentFrame.OpStack.Push(m_float);
96 result = true; 93 result = true;
97 break; 94 break;
98 case (byte)OpCode.fconst_2: 95 case (byte) OpCode.fconst_2:
99 m_float = new Float(); 96 m_float = new Float();
100 m_float.mValue = 2.0f; 97 m_float.mValue = 2.0f;
101 this.m_thread.m_currentFrame.OpStack.Push(m_float); 98 m_thread.m_currentFrame.OpStack.Push(m_float);
102 result = true; 99 result = true;
103 break; 100 break;
104 case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? 101 case (byte) OpCode.bipush: //is this right? this should be pushing a byte onto stack not int?
105 int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; 102 int pushvalue = (int) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC];
106 Int pushInt = new Int(); 103 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 104 pushInt.mValue = pushvalue;
108 this.m_thread.m_currentFrame.OpStack.Push(pushInt); 105 m_thread.m_currentFrame.OpStack.Push(pushInt);
109 this.m_thread.PC++; 106 m_thread.PC++;
110 result = true; 107 result = true;
111 break; 108 break;
112 case (byte)OpCode.sipush: 109 case (byte) OpCode.sipush:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 110 short pushvalue2 =
111 (short)
112 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
113 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
116 this.m_thread.m_currentFrame.OpStack.Push(pushInt2); 116 m_thread.m_currentFrame.OpStack.Push(pushInt2);
117 this.m_thread.PC += 2; 117 m_thread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case (byte)OpCode.fload: 120 case (byte) OpCode.fload:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 121 short findex1 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) 123 if (m_thread.m_currentFrame.LocalVariables[findex1] != null)
124 { 124 {
125 if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) 125 if (m_thread.m_currentFrame.LocalVariables[findex1] is Float)
126 { 126 {
127 fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; 127 fload.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[findex1]).mValue;
128 this.m_thread.m_currentFrame.OpStack.Push(fload); 128 m_thread.m_currentFrame.OpStack.Push(fload);
129 } 129 }
130 } 130 }
131 this.m_thread.PC++; 131 m_thread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case (byte)OpCode.iload_0: 134 case (byte) OpCode.iload_0:
135 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 135 if (m_thread.m_currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) 137 if (m_thread.m_currentFrame.LocalVariables[0] is Int)
138 { 138 {
139 Int newInt = new Int(); 139 Int newInt = new Int();
140 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 140 newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[0]).mValue;
141 this.m_thread.m_currentFrame.OpStack.Push(newInt); 141 m_thread.m_currentFrame.OpStack.Push(newInt);
142 } 142 }
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case (byte)OpCode.iload_1: 146 case (byte) OpCode.iload_1:
147 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 147 if (m_thread.m_currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) 149 if (m_thread.m_currentFrame.LocalVariables[1] is Int)
150 { 150 {
151 Int newInt = new Int(); 151 Int newInt = new Int();
152 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 152 newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[1]).mValue;
153 this.m_thread.m_currentFrame.OpStack.Push(newInt); 153 m_thread.m_currentFrame.OpStack.Push(newInt);
154 } 154 }
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case (byte)OpCode.fload_0: 158 case (byte) OpCode.fload_0:
159 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 159 if (m_thread.m_currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) 161 if (m_thread.m_currentFrame.LocalVariables[0] is Float)
162 { 162 {
163 Float newfloat = new Float(); 163 Float newfloat = new Float();
164 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 164 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[0]).mValue;
165 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 165 m_thread.m_currentFrame.OpStack.Push(newfloat);
166 } 166 }
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case (byte)OpCode.fload_1: 170 case (byte) OpCode.fload_1:
171 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 171 if (m_thread.m_currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) 173 if (m_thread.m_currentFrame.LocalVariables[1] is Float)
174 { 174 {
175 Float newfloat = new Float(); 175 Float newfloat = new Float();
176 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 176 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[1]).mValue;
177 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 177 m_thread.m_currentFrame.OpStack.Push(newfloat);
178 } 178 }
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case (byte)OpCode.fload_2: 182 case (byte) OpCode.fload_2:
183 if (this.m_thread.m_currentFrame.LocalVariables[2] != null) 183 if (m_thread.m_currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) 185 if (m_thread.m_currentFrame.LocalVariables[2] is Float)
186 { 186 {
187 Float newfloat = new Float(); 187 Float newfloat = new Float();
188 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; 188 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[2]).mValue;
189 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 189 m_thread.m_currentFrame.OpStack.Push(newfloat);
190 } 190 }
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case (byte)OpCode.fload_3: 194 case (byte) OpCode.fload_3:
195 if (this.m_thread.m_currentFrame.LocalVariables[3] != null) 195 if (m_thread.m_currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) 197 if (m_thread.m_currentFrame.LocalVariables[3] is Float)
198 { 198 {
199 Float newfloat = new Float(); 199 Float newfloat = new Float();
200 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; 200 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[3]).mValue;
201 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 201 m_thread.m_currentFrame.OpStack.Push(newfloat);
202 } 202 }
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case (byte)OpCode.istore: 206 case (byte) OpCode.istore:
207 short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 207 short findex3 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
208 BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); 208 BaseType istor = m_thread.m_currentFrame.OpStack.Pop();
209 if (istor is Int) 209 if (istor is Int)
210 { 210 {
211 this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; 211 m_thread.m_currentFrame.LocalVariables[findex3] = (Int) istor;
212 } 212 }
213 this.m_thread.PC++; 213 m_thread.PC++;
214 result = true; 214 result = true;
215 break; 215 break;
216 case (byte)OpCode.fstore: 216 case (byte) OpCode.fstore:
217 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 217 short findex = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
218 BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); 218 BaseType fstor = m_thread.m_currentFrame.OpStack.Pop();
219 if (fstor is Float) 219 if (fstor is Float)
220 { 220 {
221 this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; 221 m_thread.m_currentFrame.LocalVariables[findex] = (Float) fstor;
222 } 222 }
223 this.m_thread.PC++; 223 m_thread.PC++;
224 result = true; 224 result = true;
225 break; 225 break;
226 case (byte)OpCode.istore_0: 226 case (byte) OpCode.istore_0:
227 BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); 227 BaseType baset = m_thread.m_currentFrame.OpStack.Pop();
228 if (baset is Int) 228 if (baset is Int)
229 { 229 {
230 this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; 230 m_thread.m_currentFrame.LocalVariables[0] = (Int) baset;
231 } 231 }
232 result = true; 232 result = true;
233 break; 233 break;
234 case (byte)OpCode.istore_1: 234 case (byte) OpCode.istore_1:
235 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 235 baset = m_thread.m_currentFrame.OpStack.Pop();
236 if (baset is Int) 236 if (baset is Int)
237 { 237 {
238 this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; 238 m_thread.m_currentFrame.LocalVariables[1] = (Int) baset;
239 } 239 }
240 result = true; 240 result = true;
241 break; 241 break;
242 case (byte)OpCode.fstore_0: 242 case (byte) OpCode.fstore_0:
243 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 243 baset = m_thread.m_currentFrame.OpStack.Pop();
244 if (baset is Float) 244 if (baset is Float)
245 { 245 {
246 this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; 246 m_thread.m_currentFrame.LocalVariables[0] = (Float) baset;
247 } 247 }
248 result = true; 248 result = true;
249 break; 249 break;
250 case (byte)OpCode.fstore_1: 250 case (byte) OpCode.fstore_1:
251 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 251 baset = m_thread.m_currentFrame.OpStack.Pop();
252 if (baset is Float) 252 if (baset is Float)
253 { 253 {
254 this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; 254 m_thread.m_currentFrame.LocalVariables[1] = (Float) baset;
255 } 255 }
256 result = true; 256 result = true;
257 break; 257 break;
258 case (byte)OpCode.fstore_2: 258 case (byte) OpCode.fstore_2:
259 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 259 baset = m_thread.m_currentFrame.OpStack.Pop();
260 if (baset is Float) 260 if (baset is Float)
261 { 261 {
262 this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; 262 m_thread.m_currentFrame.LocalVariables[2] = (Float) baset;
263 } 263 }
264 result = true; 264 result = true;
265 break; 265 break;
266 case (byte)OpCode.fstore_3: 266 case (byte) OpCode.fstore_3:
267 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 267 baset = m_thread.m_currentFrame.OpStack.Pop();
268 if (baset is Float) 268 if (baset is Float)
269 { 269 {
270 this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; 270 m_thread.m_currentFrame.LocalVariables[3] = (Float) baset;
271 } 271 }
272 result = true; 272 result = true;
273 break; 273 break;
274 case (byte)OpCode.pop: 274 case (byte) OpCode.pop:
275 this.m_thread.m_currentFrame.OpStack.Pop(); 275 m_thread.m_currentFrame.OpStack.Pop();
276 result = true; 276 result = true;
277 break; 277 break;
278 case (byte)OpCode.fadd: 278 case (byte) OpCode.fadd:
279 BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 279 BaseType bf2 = m_thread.m_currentFrame.OpStack.Pop();
280 BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 280 BaseType bf1 = m_thread.m_currentFrame.OpStack.Pop();
281 if (bf1 is Float && bf2 is Float) 281 if (bf1 is Float && bf2 is Float)
282 { 282 {
283 Float nflt = new Float(); 283 Float nflt = new Float();
284 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; 284 nflt.mValue = ((Float) bf1).mValue + ((Float) bf2).mValue;
285 this.m_thread.m_currentFrame.OpStack.Push(nflt); 285 m_thread.m_currentFrame.OpStack.Push(nflt);
286 } 286 }
287 result = true; 287 result = true;
288 break; 288 break;
289 case (byte)OpCode.fsub: 289 case (byte) OpCode.fsub:
290 BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 290 BaseType bsf2 = m_thread.m_currentFrame.OpStack.Pop();
291 BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 291 BaseType bsf1 = m_thread.m_currentFrame.OpStack.Pop();
292 if (bsf1 is Float && bsf2 is Float) 292 if (bsf1 is Float && bsf2 is Float)
293 { 293 {
294 Float resf = new Float(); 294 Float resf = new Float();
295 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; 295 resf.mValue = ((Float) bsf1).mValue - ((Float) bsf2).mValue;
296 this.m_thread.m_currentFrame.OpStack.Push(resf); 296 m_thread.m_currentFrame.OpStack.Push(resf);
297 } 297 }
298 result = true; 298 result = true;
299 break; 299 break;
300 case (byte)OpCode.imul: //check the order of the two values off the stack is correct 300 case (byte) OpCode.imul: //check the order of the two values off the stack is correct
301 BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); 301 BaseType bs2 = m_thread.m_currentFrame.OpStack.Pop();
302 BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); 302 BaseType bs1 = m_thread.m_currentFrame.OpStack.Pop();
303 if (bs1 is Int && bs2 is Int) 303 if (bs1 is Int && bs2 is Int)
304 { 304 {
305 Int nInt = new Int(); 305 Int nInt = new Int();
306 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; 306 nInt.mValue = ((Int) bs1).mValue*((Int) bs2).mValue;
307 this.m_thread.m_currentFrame.OpStack.Push(nInt); 307 m_thread.m_currentFrame.OpStack.Push(nInt);
308 } 308 }
309 result = true; 309 result = true;
310 break; 310 break;
311 case (byte)OpCode.iinc: 311 case (byte) OpCode.iinc:
312 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) 312 if (m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]] !=
313 null)
313 { 314 {
314 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) 315 if (
316 m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]
317 ] is Int)
315 { 318 {
316 ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; 319 ((Int)
320 m_thread.m_currentFrame.LocalVariables[
321 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]]).mValue +=
322 (sbyte) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1];
317 } 323 }
318 } 324 }
319 this.m_thread.PC += 2; 325 m_thread.PC += 2;
320 result = true; 326 result = true;
321 break; 327 break;
322 case (byte)OpCode.f2i: 328 case (byte) OpCode.f2i:
323 BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); 329 BaseType conv1 = m_thread.m_currentFrame.OpStack.Pop();
324 if (conv1 is Float) 330 if (conv1 is Float)
325 { 331 {
326 Int newconv = new Int(); 332 Int newconv = new Int();
327 newconv.mValue = (int)((Float)conv1).mValue; 333 newconv.mValue = (int) ((Float) conv1).mValue;
328 this.m_thread.m_currentFrame.OpStack.Push(newconv); 334 m_thread.m_currentFrame.OpStack.Push(newconv);
329 } 335 }
330 result = true; 336 result = true;
331 break; 337 break;
332 case (byte)OpCode.fcmpl: 338 case (byte) OpCode.fcmpl:
333 BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 339 BaseType flcom2 = m_thread.m_currentFrame.OpStack.Pop();
334 BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 340 BaseType flcom1 = m_thread.m_currentFrame.OpStack.Pop();
335 if (flcom1 is Float && flcom2 is Float) 341 if (flcom1 is Float && flcom2 is Float)
336 { 342 {
337 Int compres = new Int(); 343 Int compres = new Int();
338 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 344 if (((Float) flcom1).mValue < ((Float) flcom2).mValue)
339 { 345 {
340 compres.mValue = -1; 346 compres.mValue = -1;
341 } 347 }
342 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 348 else if (((Float) flcom1).mValue > ((Float) flcom2).mValue)
343 { 349 {
344 compres.mValue = 1; 350 compres.mValue = 1;
345 } 351 }
@@ -347,21 +353,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
347 { 353 {
348 compres.mValue = 0; 354 compres.mValue = 0;
349 } 355 }
350 this.m_thread.m_currentFrame.OpStack.Push(compres); 356 m_thread.m_currentFrame.OpStack.Push(compres);
351 } 357 }
352 result = true; 358 result = true;
353 break; 359 break;
354 case (byte)OpCode.fcmpg: 360 case (byte) OpCode.fcmpg:
355 flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 361 flcom2 = m_thread.m_currentFrame.OpStack.Pop();
356 flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 362 flcom1 = m_thread.m_currentFrame.OpStack.Pop();
357 if (flcom1 is Float && flcom2 is Float) 363 if (flcom1 is Float && flcom2 is Float)
358 { 364 {
359 Int compres = new Int(); 365 Int compres = new Int();
360 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 366 if (((Float) flcom1).mValue < ((Float) flcom2).mValue)
361 { 367 {
362 compres.mValue = -1; 368 compres.mValue = -1;
363 } 369 }
364 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 370 else if (((Float) flcom1).mValue > ((Float) flcom2).mValue)
365 { 371 {
366 compres.mValue = 1; 372 compres.mValue = 1;
367 } 373 }
@@ -369,128 +375,169 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
369 { 375 {
370 compres.mValue = 0; 376 compres.mValue = 0;
371 } 377 }
372 this.m_thread.m_currentFrame.OpStack.Push(compres); 378 m_thread.m_currentFrame.OpStack.Push(compres);
373 } 379 }
374 result = true; 380 result = true;
375 break; 381 break;
376 case (byte)OpCode.ifge: 382 case (byte) OpCode.ifge:
377 short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 383 short compareoffset2 =
378 BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); 384 (short)
385 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
386 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
387 BaseType compe1 = m_thread.m_currentFrame.OpStack.Pop();
379 if (compe1 is Int) 388 if (compe1 is Int)
380 { 389 {
381 if (((Int)compe1).mValue >= 0) 390 if (((Int) compe1).mValue >= 0)
382 { 391 {
383 this.m_thread.PC += -1 + compareoffset2; 392 m_thread.PC += -1 + compareoffset2;
384 } 393 }
385 else 394 else
386 { 395 {
387 this.m_thread.PC += 2; 396 m_thread.PC += 2;
388 } 397 }
389 } 398 }
390 else 399 else
391 { 400 {
392 this.m_thread.PC += 2; 401 m_thread.PC += 2;
393 } 402 }
394 result = true; 403 result = true;
395 break; 404 break;
396 case (byte)OpCode.ifle: 405 case (byte) OpCode.ifle:
397 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 406 short compareoffset1 =
398 BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); 407 (short)
408 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
409 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
410 BaseType comp1 = m_thread.m_currentFrame.OpStack.Pop();
399 if (comp1 is Int) 411 if (comp1 is Int)
400 { 412 {
401 if (((Int)comp1).mValue <= 0) 413 if (((Int) comp1).mValue <= 0)
402 { 414 {
403 this.m_thread.PC += -1 + compareoffset1; 415 m_thread.PC += -1 + compareoffset1;
404 } 416 }
405 else 417 else
406 { 418 {
407 this.m_thread.PC += 2; 419 m_thread.PC += 2;
408 } 420 }
409 } 421 }
410 else 422 else
411 { 423 {
412 this.m_thread.PC += 2; 424 m_thread.PC += 2;
413 } 425 }
414 result = true; 426 result = true;
415 break; 427 break;
416 case (byte)OpCode.if_icmpge: 428 case (byte) OpCode.if_icmpge:
417 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 429 short compareoffset =
418 BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); 430 (short)
419 BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); 431 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
432 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
433 BaseType bc2 = m_thread.m_currentFrame.OpStack.Pop();
434 BaseType bc1 = m_thread.m_currentFrame.OpStack.Pop();
420 if (bc1 is Int && bc2 is Int) 435 if (bc1 is Int && bc2 is Int)
421 { 436 {
422 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 437 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
423 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 438 if (((Int) bc1).mValue >= ((Int) bc2).mValue)
424 { 439 {
425 // Console.WriteLine("branch compare true , offset is " +compareoffset); 440 // Console.WriteLine("branch compare true , offset is " +compareoffset);
426 // Console.WriteLine("current PC is " + this._mThread.PC); 441 // Console.WriteLine("current PC is " + this._mThread.PC);
427 this.m_thread.PC += -1 + compareoffset; 442 m_thread.PC += -1 + compareoffset;
428 //Console.WriteLine("new PC is " + this._mThread.PC); 443 //Console.WriteLine("new PC is " + this._mThread.PC);
429 } 444 }
430 else 445 else
431 { 446 {
432 //Console.WriteLine("branch compare false"); 447 //Console.WriteLine("branch compare false");
433 this.m_thread.PC += 2; 448 m_thread.PC += 2;
434 } 449 }
435 } 450 }
436 else 451 else
437 { 452 {
438 this.m_thread.PC += 2; 453 m_thread.PC += 2;
439 } 454 }
440 result = true; 455 result = true;
441 break; 456 break;
442 case (byte)OpCode.if_icmple: 457 case (byte) OpCode.if_icmple:
443 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 458 short compareloffset =
444 BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); 459 (short)
445 BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); 460 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
461 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
462 BaseType bcl2 = m_thread.m_currentFrame.OpStack.Pop();
463 BaseType bcl1 = m_thread.m_currentFrame.OpStack.Pop();
446 if (bcl1 is Int && bcl2 is Int) 464 if (bcl1 is Int && bcl2 is Int)
447 { 465 {
448 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 466 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
449 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 467 if (((Int) bcl1).mValue <= ((Int) bcl2).mValue)
450 { 468 {
451 // Console.WriteLine("branch compare true , offset is " + compareloffset); 469 // Console.WriteLine("branch compare true , offset is " + compareloffset);
452 // Console.WriteLine("current PC is " + this._mThread.PC); 470 // Console.WriteLine("current PC is " + this._mThread.PC);
453 this.m_thread.PC += -1 + compareloffset; 471 m_thread.PC += -1 + compareloffset;
454 // Console.WriteLine("new PC is " + this._mThread.PC); 472 // Console.WriteLine("new PC is " + this._mThread.PC);
455 } 473 }
456 else 474 else
457 { 475 {
458 //Console.WriteLine("branch compare false"); 476 //Console.WriteLine("branch compare false");
459 this.m_thread.PC += 2; 477 m_thread.PC += 2;
460 } 478 }
461 } 479 }
462 else 480 else
463 { 481 {
464 this.m_thread.PC += 2; 482 m_thread.PC += 2;
465 } 483 }
466 result = true; 484 result = true;
467 break; 485 break;
468 case (byte)OpCode._goto: 486 case (byte) OpCode._goto:
469 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 487 short offset =
470 this.m_thread.PC += -1 + offset; 488 (short)
489 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
490 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
491 m_thread.PC += -1 + offset;
471 result = true; 492 result = true;
472 break; 493 break;
473 case (byte)OpCode.getstatic: 494 case (byte) OpCode.getstatic:
474 short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 495 short fieldrefIndex =
475 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 496 (short)
497 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
498 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
499 if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
476 { 500 {
477 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 501 if (
502 ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
503 mClass.Name.Value == m_thread.currentClass.MClass.Name.Value)
478 { 504 {
479 //from this class 505 //from this class
480 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 506 if (
507 m_thread.currentClass.StaticFields.ContainsKey(
508 ((ClassRecord.PoolFieldRef)
509 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
481 { 510 {
482 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 511 if (
512 m_thread.currentClass.StaticFields[
513 ((ClassRecord.PoolFieldRef)
514 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.
515 Value] is Float)
483 { 516 {
484 Float retFloat = new Float(); 517 Float retFloat = new Float();
485 retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 518 retFloat.mValue =
486 this.m_thread.m_currentFrame.OpStack.Push(retFloat); 519 ((Float)
520 m_thread.currentClass.StaticFields[
521 ((ClassRecord.PoolFieldRef)
522 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
523 Name.Value]).mValue;
524 m_thread.m_currentFrame.OpStack.Push(retFloat);
487 } 525 }
488 else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 526 else if (
527 m_thread.currentClass.StaticFields[
528 ((ClassRecord.PoolFieldRef)
529 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
530 Name.Value] is Int)
489 { 531 {
490 Int retInt = new Int(); 532 Int retInt = new Int();
491 retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 533 retInt.mValue =
534 ((Int)
535 m_thread.currentClass.StaticFields[
536 ((ClassRecord.PoolFieldRef)
537 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
538 mNameType.Name.Value]).mValue;
492 // Console.WriteLine("getting static field, " + retInt.mValue); 539 // Console.WriteLine("getting static field, " + retInt.mValue);
493 this.m_thread.m_currentFrame.OpStack.Push(retInt); 540 m_thread.m_currentFrame.OpStack.Push(retInt);
494 } 541 }
495 } 542 }
496 } 543 }
@@ -499,36 +546,58 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
499 //get from a different class 546 //get from a different class
500 } 547 }
501 } 548 }
502 this.m_thread.PC += 2; 549 m_thread.PC += 2;
503 result = true; 550 result = true;
504 break; 551 break;
505 case (byte)OpCode.putstatic: 552 case (byte) OpCode.putstatic:
506 fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 553 fieldrefIndex =
507 BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); 554 (short)
508 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 555 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
556 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
557 BaseType addstatic = m_thread.m_currentFrame.OpStack.Pop();
558 if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
509 { 559 {
510 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 560 if (
561 ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
562 mClass.Name.Value == m_thread.currentClass.MClass.Name.Value)
511 { 563 {
512 // this class 564 // this class
513 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 565 if (
566 m_thread.currentClass.StaticFields.ContainsKey(
567 ((ClassRecord.PoolFieldRef)
568 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
514 { 569 {
515 if (addstatic is Float) 570 if (addstatic is Float)
516 { 571 {
517 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 572 if (
573 m_thread.currentClass.StaticFields[
574 ((ClassRecord.PoolFieldRef)
575 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
576 Name.Value] is Float)
518 { 577 {
519 Float newf = new Float(); 578 Float newf = new Float();
520 newf.mValue = ((Float)addstatic).mValue; 579 newf.mValue = ((Float) addstatic).mValue;
521 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; 580 m_thread.currentClass.StaticFields[
581 ((ClassRecord.PoolFieldRef)
582 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
583 Name.Value] = newf;
522 } 584 }
523 } 585 }
524 else if (addstatic is Int) 586 else if (addstatic is Int)
525 { 587 {
526 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 588 if (
589 m_thread.currentClass.StaticFields[
590 ((ClassRecord.PoolFieldRef)
591 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
592 Name.Value] is Int)
527 { 593 {
528 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); 594 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
529 Int newi = new Int(); 595 Int newi = new Int();
530 newi.mValue = ((Int)addstatic).mValue; 596 newi.mValue = ((Int) addstatic).mValue;
531 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; 597 m_thread.currentClass.StaticFields[
598 ((ClassRecord.PoolFieldRef)
599 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
600 Name.Value] = newi;
532 } 601 }
533 } 602 }
534 } 603 }
@@ -538,10 +607,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
538 // a different class 607 // a different class
539 } 608 }
540 } 609 }
541 this.m_thread.PC += 2; 610 m_thread.PC += 2;
542 result = true; 611 result = true;
543 break; 612 break;
544
545 } 613 }
546 614
547 return result; 615 return result;
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
index a5bd48b..b27630a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
@@ -25,15 +25,6 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework;
33using OpenSim.Framework;
34using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
35using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
36
37namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 28namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
38{ 29{
39 partial class Thread 30 partial class Thread
@@ -46,10 +37,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
46 switch (opcode) 37 switch (opcode)
47 { 38 {
48 case 184: 39 case 184:
49 short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); 40 short refIndex =
50 if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) 41 (short)
42 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
43 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
44 if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
51 { 45 {
52 string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; 46 string typ =
47 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
48 mNameType.Type.Value;
53 string typeparam = ""; 49 string typeparam = "";
54 string typereturn = ""; 50 string typereturn = "";
55 int firstbrak = 0; 51 int firstbrak = 0;
@@ -58,16 +54,22 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
58 secondbrak = typ.LastIndexOf(')'); 54 secondbrak = typ.LastIndexOf(')');
59 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); 55 typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
60 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); 56 typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
61 if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 57 if (
58 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass
59 .Name.Value == m_thread.currentClass.MClass.Name.Value)
62 { 60 {
63 //calling a method in this class 61 //calling a method in this class
64 if (typeparam.Length == 0) 62 if (typeparam.Length == 0)
65 { 63 {
66 this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); 64 m_thread.JumpToStaticVoidMethod(
65 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
66 .mNameType.Name.Value, (m_thread.PC + 2));
67 } 67 }
68 else 68 else
69 { 69 {
70 this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); 70 m_thread.JumpToStaticParamMethod(
71 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
72 .mNameType.Name.Value, typeparam, (m_thread.PC + 2));
71 } 73 }
72 } 74 }
73 else 75 else
@@ -75,15 +77,19 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
75 //calling a method of a different class 77 //calling a method of a different class
76 78
77 // OpenSimAPI Class 79 // OpenSimAPI Class
78 if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") 80 if (
81 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).
82 mClass.Name.Value == "OpenSimAPI")
79 { 83 {
80 this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); 84 m_thread.scriptInfo.api.CallMethod(
85 ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1])
86 .mNameType.Name.Value, null);
81 } 87 }
82 } 88 }
83 } 89 }
84 else 90 else
85 { 91 {
86 this.m_thread.PC += 2; 92 m_thread.PC += 2;
87 } 93 }
88 result = true; 94 result = true;
89 break; 95 break;
@@ -93,4 +99,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
93 } 99 }
94 } 100 }
95 } 101 }
96} 102} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
index 5a42285..2814720 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
@@ -25,10 +25,6 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 28namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 29{
34 partial class Thread 30 partial class Thread
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
37 { 33 {
38 } 34 }
39 } 35 }
40} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
index 698a518..4e7351e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
@@ -26,8 +26,6 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 30using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 31
@@ -47,77 +45,77 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
47 public bool Excute() 45 public bool Excute()
48 { 46 {
49 bool run = true; 47 bool run = true;
50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; 48 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[m_thread.PC++];
51 // Console.WriteLine("opCode is: " + currentOpCode); 49 // Console.WriteLine("opCode is: " + currentOpCode);
52 bool handled = false; 50 bool handled = false;
53 51
54 handled = this.IsLogicOpCode(currentOpCode); 52 handled = IsLogicOpCode(currentOpCode);
55 if (!handled) 53 if (!handled)
56 { 54 {
57 handled = this.IsMethodOpCode(currentOpCode); 55 handled = IsMethodOpCode(currentOpCode);
58 } 56 }
59 if (!handled) 57 if (!handled)
60 { 58 {
61 if (currentOpCode == 172) 59 if (currentOpCode == 172)
62 { 60 {
63 if (this.m_thread.stack.StackFrames.Count > 1) 61 if (m_thread.stack.StackFrames.Count > 1)
64 { 62 {
65 Console.WriteLine("returning int from function"); 63 Console.WriteLine("returning int from function");
66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 64 int retPC1 = m_thread.m_currentFrame.ReturnPC;
67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 65 BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop();
68 this.m_thread.stack.StackFrames.Pop(); 66 m_thread.stack.StackFrames.Pop();
69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 67 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
70 this.m_thread.PC = retPC1; 68 m_thread.PC = retPC1;
71 if (bas1 is Int) 69 if (bas1 is Int)
72 { 70 {
73 this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); 71 m_thread.m_currentFrame.OpStack.Push((Int) bas1);
74 } 72 }
75 } 73 }
76 else 74 else
77 { 75 {
78 // Console.WriteLine("No parent function so ending program"); 76 // Console.WriteLine("No parent function so ending program");
79 this.m_thread.stack.StackFrames.Pop(); 77 m_thread.stack.StackFrames.Pop();
80 run = false; 78 run = false;
81 } 79 }
82 handled = true; 80 handled = true;
83 } 81 }
84 if (currentOpCode == 174) 82 if (currentOpCode == 174)
85 { 83 {
86 if (this.m_thread.stack.StackFrames.Count > 1) 84 if (m_thread.stack.StackFrames.Count > 1)
87 { 85 {
88 Console.WriteLine("returning float from function"); 86 Console.WriteLine("returning float from function");
89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 87 int retPC1 = m_thread.m_currentFrame.ReturnPC;
90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 88 BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop();
91 this.m_thread.stack.StackFrames.Pop(); 89 m_thread.stack.StackFrames.Pop();
92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 90 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
93 this.m_thread.PC = retPC1; 91 m_thread.PC = retPC1;
94 if (bas1 is Float) 92 if (bas1 is Float)
95 { 93 {
96 this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); 94 m_thread.m_currentFrame.OpStack.Push((Float) bas1);
97 } 95 }
98 } 96 }
99 else 97 else
100 { 98 {
101 // Console.WriteLine("No parent function so ending program"); 99 // Console.WriteLine("No parent function so ending program");
102 this.m_thread.stack.StackFrames.Pop(); 100 m_thread.stack.StackFrames.Pop();
103 run = false; 101 run = false;
104 } 102 }
105 handled = true; 103 handled = true;
106 } 104 }
107 if (currentOpCode == 177) 105 if (currentOpCode == 177)
108 { 106 {
109 if (this.m_thread.stack.StackFrames.Count > 1) 107 if (m_thread.stack.StackFrames.Count > 1)
110 { 108 {
111 Console.WriteLine("returning from function"); 109 Console.WriteLine("returning from function");
112 int retPC = this.m_thread.m_currentFrame.ReturnPC; 110 int retPC = m_thread.m_currentFrame.ReturnPC;
113 this.m_thread.stack.StackFrames.Pop(); 111 m_thread.stack.StackFrames.Pop();
114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 112 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
115 this.m_thread.PC = retPC; 113 m_thread.PC = retPC;
116 } 114 }
117 else 115 else
118 { 116 {
119 // Console.WriteLine("No parent function so ending program"); 117 // Console.WriteLine("No parent function so ending program");
120 this.m_thread.stack.StackFrames.Pop(); 118 m_thread.stack.StackFrames.Pop();
121 run = false; 119 run = false;
122 } 120 }
123 handled = true; 121 handled = true;
@@ -128,8 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
128 Console.WriteLine("opcode " + currentOpCode + " not been handled "); 126 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
129 } 127 }
130 return run; 128 return run;
131
132 } 129 }
133 } 130 }
134 } 131 }
135} 132} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
index 34d4fc5..adad1a8 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
@@ -25,21 +25,17 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 28namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 29{
34 public class MainMemory 30 public class MainMemory
35 { 31 {
36 public Heap HeapArea; 32 public Heap HeapArea;
37 public MethodMemory MethodArea; 33 public MethodMemory MethodArea;
38 34
39 public MainMemory() 35 public MainMemory()
40 { 36 {
41 MethodArea = new MethodMemory(); 37 MethodArea = new MethodMemory();
42 HeapArea = new Heap(); 38 HeapArea = new Heap();
43 } 39 }
44 } 40 }
45} 41} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
index f470583..86df4c2 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31 29
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 30namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 31{
@@ -43,4 +41,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
43 MethodBuffer = new byte[20000]; 41 MethodBuffer = new byte[20000];
44 } 42 }
45 } 43 }
46} 44} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
index 21e467a..1d9cabb 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
@@ -25,13 +25,9 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 28namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 29{
34 public class Object 30 public class Object
35 { 31 {
36 } 32 }
37} 33} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
index 9fcec49..616b64e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
34{ 30{
35 public enum OpCode : byte 31 public enum OpCode : byte
@@ -81,4 +77,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
81 getstatic = 178, 77 getstatic = 178,
82 putstatic = 179 78 putstatic = 179
83 } 79 }
84} 80} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
index 56e02ff..4f6c1e7 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31 29
32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 30namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33{ 31{
@@ -39,4 +37,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
39 { 37 {
40 } 38 }
41 } 39 }
42} 40} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
index a5f9029..306a70d 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
@@ -25,9 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32 30
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 31namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
@@ -44,6 +42,5 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
44 { 42 {
45 LocalVariables = new BaseType[20]; 43 LocalVariables = new BaseType[20];
46 } 44 }
47
48 } 45 }
49} 46} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
index b810676..64093ef 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
@@ -25,15 +25,9 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using OpenSim.Region.Environment.Scenes;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 30using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes;
36using OpenSim.Region.ExtensionsScriptModule;
37 31
38namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 32namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
39{ 33{
@@ -55,8 +49,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
55 49
56 public Thread() 50 public Thread()
57 { 51 {
58 this.m_Interpreter = new Interpreter(this); 52 m_Interpreter = new Interpreter(this);
59 this.stack = new Stack(); 53 stack = new Stack();
60 } 54 }
61 55
62 public void SetPC(int methodpointer) 56 public void SetPC(int methodpointer)
@@ -68,15 +62,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
68 public void StartMethod(ClassRecord rec, string methName) 62 public void StartMethod(ClassRecord rec, string methName)
69 { 63 {
70 m_currentFrame = new StackFrame(); 64 m_currentFrame = new StackFrame();
71 this.stack.StackFrames.Push(m_currentFrame); 65 stack.StackFrames.Push(m_currentFrame);
72 this.currentClass = rec; 66 currentClass = rec;
73 currentClass.StartMethod(this, methName); 67 currentClass.StartMethod(this, methName);
74 } 68 }
75 69
76 public void StartMethod( string methName) 70 public void StartMethod(string methName)
77 { 71 {
78 m_currentFrame = new StackFrame(); 72 m_currentFrame = new StackFrame();
79 this.stack.StackFrames.Push(m_currentFrame); 73 stack.StackFrames.Push(m_currentFrame);
80 currentClass.StartMethod(this, methName); 74 currentClass.StartMethod(this, methName);
81 } 75 }
82 76
@@ -84,7 +78,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
84 { 78 {
85 m_currentFrame = new StackFrame(); 79 m_currentFrame = new StackFrame();
86 m_currentFrame.ReturnPC = returnPC; 80 m_currentFrame.ReturnPC = returnPC;
87 this.stack.StackFrames.Push(m_currentFrame); 81 stack.StackFrames.Push(m_currentFrame);
88 currentClass.StartMethod(this, methName); 82 currentClass.StartMethod(this, methName);
89 } 83 }
90 84
@@ -95,25 +89,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
95 BaseType bs1 = m_currentFrame.OpStack.Pop(); 89 BaseType bs1 = m_currentFrame.OpStack.Pop();
96 m_currentFrame = new StackFrame(); 90 m_currentFrame = new StackFrame();
97 m_currentFrame.ReturnPC = returnPC; 91 m_currentFrame.ReturnPC = returnPC;
98 this.stack.StackFrames.Push(m_currentFrame); 92 stack.StackFrames.Push(m_currentFrame);
99 m_currentFrame.LocalVariables[0] = ((Int)bs1); 93 m_currentFrame.LocalVariables[0] = ((Int) bs1);
100 currentClass.StartMethod(this, methName); 94 currentClass.StartMethod(this, methName);
101 } 95 }
102 if (param == "F") 96 if (param == "F")
103 { 97 {
104
105 } 98 }
106 } 99 }
107 100
108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) 101 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
109 { 102 {
110
111 } 103 }
112 104
113 public bool Excute() 105 public bool Excute()
114 { 106 {
115 excutionCounter++; 107 excutionCounter++;
116 return this.m_Interpreter.Excute(); 108 return m_Interpreter.Excute();
117 } 109 }
118 } 110 }
119} 111} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
index 0f0ff16..ea99626 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs
@@ -26,11 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Region.ExtensionsScriptModule;
34 30
35namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine 31namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
36{ 32{
@@ -53,4 +49,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
53 return returns; 49 return returns;
54 } 50 }
55 } 51 }
56} 52} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
index b1258f6..274932a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
@@ -27,15 +27,11 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Diagnostics;
31using System.IO; 31using System.IO;
32using System.Threading;
33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework; 32using OpenSim.Framework;
36using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
37using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; 34using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM;
38using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread;
39 35
40namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine 36namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
41{ 37{
@@ -45,14 +41,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
45 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); 41 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
46 private MainMemory _mainMemory; 42 private MainMemory _mainMemory;
47 43
48 ScriptInfo scriptInfo; 44 private ScriptInfo scriptInfo;
49 45
50 public void Initialise(ScriptInfo info) 46 public void Initialise(ScriptInfo info)
51 { 47 {
52 scriptInfo = info; 48 scriptInfo = info;
53 49
54 _mainMemory = new MainMemory(); 50 _mainMemory = new MainMemory();
55 Thread.GlobalMemory = this._mainMemory; 51 Thread.GlobalMemory = _mainMemory;
56 Thread.World = info.world; 52 Thread.World = info.world;
57 CompileScript(); 53 CompileScript();
58 54
@@ -60,33 +56,33 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
60 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); 56 scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
61 } 57 }
62 58
63 void events_OnNewPresence(ScenePresence presence) 59 private void events_OnNewPresence(ScenePresence presence)
64 { 60 {
65 for (int i = 0; i < this._threads.Count; i++) 61 for (int i = 0; i < _threads.Count; i++)
66 { 62 {
67 if (!this._threads[i].running) 63 if (!_threads[i].running)
68 { 64 {
69 this._threads[i].StartMethod("OnNewPresence"); 65 _threads[i].StartMethod("OnNewPresence");
70 bool run = true; 66 bool run = true;
71 while (run) 67 while (run)
72 { 68 {
73 run = this._threads[i].Excute(); 69 run = _threads[i].Excute();
74 } 70 }
75 } 71 }
76 } 72 }
77 } 73 }
78 74
79 void events_OnFrame() 75 private void events_OnFrame()
80 { 76 {
81 for (int i = 0; i < this._threads.Count; i++) 77 for (int i = 0; i < _threads.Count; i++)
82 { 78 {
83 if (!this._threads[i].running) 79 if (!_threads[i].running)
84 { 80 {
85 this._threads[i].StartMethod("OnFrame"); 81 _threads[i].StartMethod("OnFrame");
86 bool run = true; 82 bool run = true;
87 while (run) 83 while (run)
88 { 84 {
89 run = this._threads[i].Excute(); 85 run = _threads[i].Excute();
90 } 86 }
91 } 87 }
92 } 88 }
@@ -103,12 +99,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
103 CompileInfo comp = new CompileInfo(); 99 CompileInfo comp = new CompileInfo();
104 comp.script = script; 100 comp.script = script;
105 comp.scriptName = script; 101 comp.scriptName = script;
106 this.CompileScripts.Enqueue(comp); 102 CompileScripts.Enqueue(comp);
107 } 103 }
108 104
109 public void CompileScript() 105 public void CompileScript()
110 { 106 {
111 CompileInfo comp = this.CompileScripts.Dequeue(); 107 CompileInfo comp = CompileScripts.Dequeue();
112 string script = comp.script; 108 string script = comp.script;
113 string scriptName = comp.scriptName; 109 string scriptName = comp.scriptName;
114 try 110 try
@@ -121,13 +117,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
121 tw.Close(); 117 tw.Close();
122 118
123 //now compile 119 //now compile
124 System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); 120 ProcessStartInfo psi = new ProcessStartInfo("javac.exe", "*.java");
125 // psi.RedirectStandardOutput = true; 121 // psi.RedirectStandardOutput = true;
126 psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 122 psi.WindowStyle = ProcessWindowStyle.Hidden;
127 psi.UseShellExecute = false; 123 psi.UseShellExecute = false;
128 124
129 System.Diagnostics.Process javacomp; 125 Process javacomp;
130 javacomp = System.Diagnostics.Process.Start(psi); 126 javacomp = Process.Start(psi);
131 javacomp.WaitForExit(); 127 javacomp.WaitForExit();
132 128
133 129
@@ -136,17 +132,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
136 class1.LoadClassFromFile(scriptName + ".class"); 132 class1.LoadClassFromFile(scriptName + ".class");
137 class1.PrintToConsole(); 133 class1.PrintToConsole();
138 //Console.WriteLine(); 134 //Console.WriteLine();
139 this._mainMemory.MethodArea.Classes.Add(class1); 135 _mainMemory.MethodArea.Classes.Add(class1);
140 class1.AddMethodsToMemory(this._mainMemory.MethodArea); 136 class1.AddMethodsToMemory(_mainMemory.MethodArea);
141 137
142 Thread newThread = new Thread(); 138 Thread newThread = new Thread();
143 this._threads.Add(newThread); 139 _threads.Add(newThread);
144 newThread.currentClass = class1; 140 newThread.currentClass = class1;
145 newThread.scriptInfo = scriptInfo; 141 newThread.scriptInfo = scriptInfo;
146 142
147 //now delete the created files 143 //now delete the created files
148 System.IO.File.Delete(scriptName + ".java"); 144 File.Delete(scriptName + ".java");
149 System.IO.File.Delete(scriptName + ".class"); 145 File.Delete(scriptName + ".class");
150 //this.OnFrame(); 146 //this.OnFrame();
151 } 147 }
152 catch (Exception e) 148 catch (Exception e)
@@ -164,8 +160,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
164 160
165 public CompileInfo() 161 public CompileInfo()
166 { 162 {
167
168 } 163 }
169 } 164 }
170 } 165 }
171} 166} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs
index a36ad77..3c82952 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs
@@ -26,13 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
34{ 30{
35 public class ArrayReference :BaseType 31 public class ArrayReference : BaseType
36 { 32 {
37 } 33 }
38} 34} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs
index 5921446..4026c10 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
34{ 30{
35 public class ObjectReference : BaseType 31 public class ObjectReference : BaseType
@@ -38,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
38 34
39 public ObjectReference() 35 public ObjectReference()
40 { 36 {
41
42 } 37 }
43 } 38 }
44} 39} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
index aa59681..de1aa87 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs
@@ -26,14 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
35{ 30{
36 public class Byte : BaseType 31 public class Byte : BaseType
37 { 32 {
38 } 33 }
39} 34} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
index 1cef150..0e17057 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs
@@ -26,14 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
35{ 30{
36 public class Char : BaseType 31 public class Char : BaseType
37 { 32 {
38 } 33 }
39} 34} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
index 0614dfd..ce8648c 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs
@@ -26,11 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
35{ 30{
36 public class Float : BaseType 31 public class Float : BaseType
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
39 34
40 public Float() 35 public Float()
41 { 36 {
42
43 } 37 }
44 } 38 }
45} 39} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
index 35f9822..251b736 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs
@@ -26,11 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes 29namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
35{ 30{
36 public class Int : BaseType 31 public class Int : BaseType
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
39 34
40 public Int() 35 public Int()
41 { 36 {
42
43 } 37 }
44 } 38 }
45} 39} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs
index 251b8c3..5f85799 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Script.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
37 37
38 public class TestScript : IScript 38 public class TestScript : IScript
39 { 39 {
40 ScriptInfo script; 40 private ScriptInfo script;
41 41
42 public string Name 42 public string Name
43 { 43 {
@@ -51,14 +51,14 @@ namespace OpenSim.Region.ExtensionsScriptModule
51 script.events.OnNewPresence += events_OnNewPresence; 51 script.events.OnNewPresence += events_OnNewPresence;
52 } 52 }
53 53
54 void events_OnNewPresence(ScenePresence presence) 54 private void events_OnNewPresence(ScenePresence presence)
55 { 55 {
56 script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!"); 56 script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
57 } 57 }
58 58
59 void events_OnFrame() 59 private void events_OnFrame()
60 { 60 {
61 //script.logger.Verbose("Hello World!"); 61 //script.logger.Verbose("Hello World!");
62 } 62 }
63 } 63 }
64} 64} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs
index 39dc878..9384efa 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptAPI.cs
@@ -27,24 +27,21 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using OpenSim.Region.Environment.Scenes;
31using System.Text;
32using Key = libsecondlife.LLUUID; 31using Key = libsecondlife.LLUUID;
33using Rotation = libsecondlife.LLQuaternion; 32using Rotation = libsecondlife.LLQuaternion;
34using Vector = libsecondlife.LLVector3; 33using Vector = libsecondlife.LLVector3;
35using LSLList = System.Collections.Generic.List<string>; 34using LSLList = System.Collections.Generic.List<string>;
36 35
37 36
38using OpenSim.Region.Environment.Scenes;
39
40namespace OpenSim.Region.ExtensionsScriptModule 37namespace OpenSim.Region.ExtensionsScriptModule
41{ 38{
42 // This class is to be used for engines which may not be able to access the Scene directly. 39 // This class is to be used for engines which may not be able to access the Scene directly.
43 // Scene access is preffered, but obviously not possible on some non-.NET languages. 40 // Scene access is preffered, but obviously not possible on some non-.NET languages.
44 public class ScriptAPI 41 public class ScriptAPI
45 { 42 {
46 Scene scene; 43 private Scene scene;
47 ScriptInterpretedAPI interpretedAPI; 44 private ScriptInterpretedAPI interpretedAPI;
48 45
49 public ScriptAPI(Scene world, Key taskID) 46 public ScriptAPI(Scene world, Key taskID)
50 { 47 {
@@ -57,4 +54,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
57 return null; 54 return null;
58 } 55 }
59 } 56 }
60} 57} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
index aaadd1f..cfa3c8e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
@@ -25,6 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
28using OpenSim.Framework.Console; 29using OpenSim.Framework.Console;
29using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
30 31
@@ -52,12 +53,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
52 world = scene; 53 world = scene;
53 events = world.EventManager; 54 events = world.EventManager;
54 logger = MainLog.Instance; 55 logger = MainLog.Instance;
55 api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); 56 api = new ScriptAPI(world, LLUUID.Zero);
56 } 57 }
57 58
58 public void CreateTaskAPI(libsecondlife.LLUUID task) 59 public void CreateTaskAPI(LLUUID task)
59 { 60 {
60 api = new ScriptAPI(world, task); 61 api = new ScriptAPI(world, task);
61 } 62 }
62 } 63 }
63} 64} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
index eb85dbe..2895c4e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
@@ -27,26 +27,25 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text; 30using System.Text;
31using Axiom.Math;
32using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.LandManagement;
34using OpenSim.Region.Environment.Scenes;
32using Key = libsecondlife.LLUUID; 35using Key = libsecondlife.LLUUID;
33using Rotation = libsecondlife.LLQuaternion; 36using Rotation = libsecondlife.LLQuaternion;
34using Vector = libsecondlife.LLVector3; 37using Vector = libsecondlife.LLVector3;
35using LSLList = System.Collections.Generic.List<string>; 38using LSLList = System.Collections.Generic.List<string>;
36 39
37using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.Environment.LandManagement;
39using libsecondlife;
40
41namespace OpenSim.Region.ExtensionsScriptModule 40namespace OpenSim.Region.ExtensionsScriptModule
42{ 41{
43 /// <summary> 42 /// <summary>
44 /// A class inteded to act as an API for LSL-styled interpreted languages 43 /// A class inteded to act as an API for LSL-styled interpreted languages
45 /// </summary> 44 /// </summary>
46 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 45 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
47 class ScriptInterpretedAPI 46 internal class ScriptInterpretedAPI
48 { 47 {
49 protected LLUUID m_object; 48 protected Key m_object;
50 protected Scene m_scene; 49 protected Scene m_scene;
51 50
52 /// <summary> 51 /// <summary>
@@ -78,7 +77,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
78 /// </summary> 77 /// </summary>
79 /// <param name="world">The scene the object is located in</param> 78 /// <param name="world">The scene the object is located in</param>
80 /// <param name="member">The specific member being 'occupied' by the script</param> 79 /// <param name="member">The specific member being 'occupied' by the script</param>
81 public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) 80 public ScriptInterpretedAPI(Scene world, Key member)
82 { 81 {
83 m_scene = world; 82 m_scene = world;
84 m_object = member; 83 m_object = member;
@@ -96,7 +95,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
96 95
97 public float osAcos(float val) 96 public float osAcos(float val)
98 { 97 {
99 return (float)Math.Acos(val); 98 return (float) Math.Acos(val);
100 } 99 }
101 100
102 [Obsolete("Unimplemented")] 101 [Obsolete("Unimplemented")]
@@ -105,14 +104,15 @@ namespace OpenSim.Region.ExtensionsScriptModule
105 Vector myPosition = Task.AbsolutePosition; 104 Vector myPosition = Task.AbsolutePosition;
106 Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); 105 Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
107 106
108 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 107 MainLog.Instance.Warn("script",
108 "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
109 return; 109 return;
110 } 110 }
111 111
112 [Obsolete("Unimplemented")] 112 [Obsolete("Unimplemented")]
113 public void osAdjustSoundVolume(float volume) 113 public void osAdjustSoundVolume(float volume)
114 { 114 {
115 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); 115 MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
116 return; 116 return;
117 } 117 }
118 118
@@ -125,8 +125,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
125 [Obsolete("Unimplemented")] 125 [Obsolete("Unimplemented")]
126 public float osAngleBetween(Rotation a, Rotation b) 126 public float osAngleBetween(Rotation a, Rotation b)
127 { 127 {
128 Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); 128 Quaternion axA = new Quaternion(a.W, a.X, a.Y, a.Z);
129 Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); 129 Quaternion axB = new Quaternion(b.W, b.X, b.Y, b.Z);
130 130
131 return 0; 131 return 0;
132 } 132 }
@@ -145,12 +145,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
145 145
146 public float osAsin(float val) 146 public float osAsin(float val)
147 { 147 {
148 return (float)Math.Asin(val); 148 return (float) Math.Asin(val);
149 } 149 }
150 150
151 public float osAtan2(float x, float y) 151 public float osAtan2(float x, float y)
152 { 152 {
153 return (float)Math.Atan2(x, y); 153 return (float) Math.Atan2(x, y);
154 } 154 }
155 155
156 [Obsolete("Unimplemented")] 156 [Obsolete("Unimplemented")]
@@ -178,10 +178,10 @@ namespace OpenSim.Region.ExtensionsScriptModule
178 178
179 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) 179 public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
180 { 180 {
181 Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); 181 Quaternion axQ = new Quaternion();
182 Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); 182 Vector3 axFwd = new Vector3(fwd.X, fwd.Y, fwd.Z);
183 Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); 183 Vector3 axLeft = new Vector3(left.X, left.Y, left.Z);
184 Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); 184 Vector3 axUp = new Vector3(up.X, up.Y, up.Z);
185 185
186 axQ.FromAxes(axFwd, axLeft, axUp); 186 axQ.FromAxes(axFwd, axLeft, axUp);
187 187
@@ -190,14 +190,14 @@ namespace OpenSim.Region.ExtensionsScriptModule
190 190
191 public Rotation osAxisAngle2Rot(Vector axis, float angle) 191 public Rotation osAxisAngle2Rot(Vector axis, float angle)
192 { 192 {
193 Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); 193 Quaternion axQ = Quaternion.FromAngleAxis(angle, new Vector3(axis.X, axis.Y, axis.Z));
194 194
195 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); 195 return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
196 } 196 }
197 197
198 public string osBase64ToString(string str) 198 public string osBase64ToString(string str)
199 { 199 {
200 Encoding enc = System.Text.Encoding.UTF8; 200 Encoding enc = Encoding.UTF8;
201 return enc.GetString(Convert.FromBase64String(str)); 201 return enc.GetString(Convert.FromBase64String(str));
202 } 202 }
203 203
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
223 223
224 public int osCeil(float val) 224 public int osCeil(float val)
225 { 225 {
226 return (int)Math.Ceiling(val); 226 return (int) Math.Ceiling(val);
227 } 227 }
228 228
229 [Obsolete("Unimplemented")] 229 [Obsolete("Unimplemented")]
@@ -252,13 +252,13 @@ namespace OpenSim.Region.ExtensionsScriptModule
252 252
253 public float osCos(float theta) 253 public float osCos(float theta)
254 { 254 {
255 return (float)Math.Cos(theta); 255 return (float) Math.Cos(theta);
256 } 256 }
257 257
258 public void osCreateLink(Key target, int parent) 258 public void osCreateLink(Key target, int parent)
259 { 259 {
260 if(Scene.Entities[target] is SceneObjectGroup) 260 if (Scene.Entities[target] is SceneObjectGroup)
261 Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); 261 Task.LinkToGroup((SceneObjectGroup) Scene.Entities[target]);
262 262
263 return; 263 return;
264 } 264 }
@@ -292,4 +292,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
292 return; 292 return;
293 } 293 }
294 } 294 }
295} 295} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
index 068df33..44feaff 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedEvents.cs
@@ -26,19 +26,14 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.Environment.Scenes;
33using libsecondlife;
34using Key = libsecondlife.LLUUID; 29using Key = libsecondlife.LLUUID;
35 30
36namespace OpenSim.Region.ExtensionsScriptModule 31namespace OpenSim.Region.ExtensionsScriptModule
37{ 32{
38
39 public class ScriptInterpretedEvents 33 public class ScriptInterpretedEvents
40 { 34 {
41 public delegate void OnTouchStartDelegate(Key user); 35 public delegate void OnTouchStartDelegate(Key user);
36
42 public event OnTouchStartDelegate OnTouchStart; 37 public event OnTouchStartDelegate OnTouchStart;
43 38
44 39
@@ -48,4 +43,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
48 OnTouchStart(user); 43 OnTouchStart(user);
49 } 44 }
50 } 45 }
51} 46} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index 95ab2ca..2778e9c 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -26,27 +26,28 @@
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using Nini.Config;
29using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
30using OpenSim.Region.Environment.Interfaces; 31using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.ExtensionsScriptModule.CSharp; 33using OpenSim.Region.ExtensionsScriptModule.CSharp;
33using OpenSim.Region.ExtensionsScriptModule.JScript; 34using OpenSim.Region.ExtensionsScriptModule.JScript;
34using OpenSim.Region.ExtensionsScriptModule.JVMEngine; 35using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
35using Nini.Config;
36 36
37namespace OpenSim.Region.ExtensionsScriptModule 37namespace OpenSim.Region.ExtensionsScriptModule
38{ 38{
39 public class ScriptManager : IRegionModule, IExtensionScriptModule 39 public class ScriptManager : IRegionModule, IExtensionScriptModule
40 { 40 {
41 readonly List<IScript> scripts = new List<IScript>(); 41 private readonly List<IScript> scripts = new List<IScript>();
42 Scene m_scene; 42 private Scene m_scene;
43 readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 43 private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
44 44
45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) 45 private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
46 { 46 {
47 foreach (KeyValuePair<string, IScript> script in compiledscripts) 47 foreach (KeyValuePair<string, IScript> script in compiledscripts)
48 { 48 {
49 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 49 ScriptInfo scriptInfo = new ScriptInfo(m_scene);
50 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
50 MainLog.Instance.Verbose("Loading " + script.Key); 51 MainLog.Instance.Verbose("Loading " + script.Key);
51 script.Value.Initialise(scriptInfo); 52 script.Value.Initialise(scriptInfo);
52 scripts.Add(script.Value); 53 scripts.Add(script.Value);
@@ -70,7 +71,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
70 71
71 public void Initialise(Scene scene, IConfigSource config) 72 public void Initialise(Scene scene, IConfigSource config)
72 { 73 {
73 OpenSim.Framework.Console.MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module"); 74 MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module");
74 m_scene = scene; 75 m_scene = scene;
75 76
76 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); 77 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
@@ -78,12 +79,10 @@ namespace OpenSim.Region.ExtensionsScriptModule
78 79
79 public void PostInitialise() 80 public void PostInitialise()
80 { 81 {
81
82 } 82 }
83 83
84 public void Close() 84 public void Close()
85 { 85 {
86
87 } 86 }
88 87
89 public string Name 88 public string Name
@@ -92,8 +91,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
92 } 91 }
93 92
94 public bool IsSharedModule 93 public bool IsSharedModule
95{ 94 {
96 get { return false; } 95 get { return false; }
97 } 96 }
98 97
99 public bool Compile(string filename) 98 public bool Compile(string filename)
@@ -127,7 +126,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
127 public bool AddPreCompiledScript(IScript script) 126 public bool AddPreCompiledScript(IScript script)
128 { 127 {
129 MainLog.Instance.Verbose("Loading script " + script.Name); 128 MainLog.Instance.Verbose("Loading script " + script.Name);
130 ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 129 ScriptInfo scriptInfo = new ScriptInfo(m_scene);
130 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
131 script.Initialise(scriptInfo); 131 script.Initialise(scriptInfo);
132 scripts.Add(script); 132 scripts.Add(script);
133 133
@@ -141,9 +141,9 @@ namespace OpenSim.Region.ExtensionsScriptModule
141 bool AddPreCompiledScript(IScript script); 141 bool AddPreCompiledScript(IScript script);
142 } 142 }
143 143
144 interface IScriptCompiler 144 internal interface IScriptCompiler
145 { 145 {
146 Dictionary<string, IScript> compile(string filename); 146 Dictionary<string, IScript> compile(string filename);
147 string FileExt(); 147 string FileExt();
148 } 148 }
149} 149} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index 2d4d898..a8f1de1 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -27,24 +27,26 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("PhysXplugin")] 37[assembly : AssemblyTitle("PhysXplugin")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysXplugin")] 41[assembly : AssemblyProduct("PhysXplugin")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 95e6095..b412818 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
39 { 39 {
40 public BasicPhysicsPlugin() 40 public BasicPhysicsPlugin()
41 { 41 {
42
43 } 42 }
44 43
45 public bool Init() 44 public bool Init()
@@ -59,7 +58,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
59 58
60 public void Dispose() 59 public void Dispose()
61 { 60 {
62
63 } 61 }
64 } 62 }
65 63
@@ -70,7 +68,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
70 68
71 public BasicScene() 69 public BasicScene()
72 { 70 {
73
74 } 71 }
75 72
76 public override PhysicsActor AddAvatar(string avName, PhysicsVector position) 73 public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
@@ -83,17 +80,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
83 80
84 public override void RemovePrim(PhysicsActor prim) 81 public override void RemovePrim(PhysicsActor prim)
85 { 82 {
86
87 } 83 }
88 84
89 public override void RemoveAvatar(PhysicsActor actor) 85 public override void RemoveAvatar(PhysicsActor actor)
90 { 86 {
91 BasicActor act = (BasicActor)actor; 87 BasicActor act = (BasicActor) actor;
92 if (_actors.Contains(act)) 88 if (_actors.Contains(act))
93 { 89 {
94 _actors.Remove(act); 90 _actors.Remove(act);
95 } 91 }
96
97 } 92 }
98 93
99/* 94/*
@@ -102,7 +97,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
102 return null; 97 return null;
103 } 98 }
104*/ 99*/
105 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) 100
101 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
102 PhysicsVector size, Quaternion rotation)
106 { 103 {
107 return null; 104 return null;
108 } 105 }
@@ -112,8 +109,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
112 { 109 {
113 foreach (BasicActor actor in _actors) 110 foreach (BasicActor actor in _actors)
114 { 111 {
115 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); 112 actor.Position.X = actor.Position.X + (actor.Velocity.X*timeStep);
116 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); 113 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y*timeStep);
117 if (actor.Position.Y < 0) 114 if (actor.Position.Y < 0)
118 { 115 {
119 actor.Position.Y = 0.1F; 116 actor.Position.Y = 0.1F;
@@ -132,17 +129,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
132 actor.Position.X = 255.9F; 129 actor.Position.X = 255.9F;
133 } 130 }
134 131
135 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.0f; 132 float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f;
136 if (actor.Flying) 133 if (actor.Flying)
137 { 134 {
138 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) 135 if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
136 _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2)
139 { 137 {
140 actor.Position.Z = height; 138 actor.Position.Z = height;
141 actor.Velocity.Z = 0; 139 actor.Velocity.Z = 0;
142 } 140 }
143 else 141 else
144 { 142 {
145 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); 143 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z*timeStep);
146 } 144 }
147 } 145 }
148 else 146 else
@@ -150,32 +148,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
150 actor.Position.Z = height; 148 actor.Position.Z = height;
151 actor.Velocity.Z = 0; 149 actor.Velocity.Z = 0;
152 } 150 }
153
154
155 } 151 }
156 } 152 }
157 153
158 public override void GetResults() 154 public override void GetResults()
159 { 155 {
160
161 } 156 }
162 157
163 public override bool IsThreaded 158 public override bool IsThreaded
164 { 159 {
165 get 160 get { return (false); // for now we won't be multithreaded
166 {
167 return (false); // for now we won't be multithreaded
168 } 161 }
169 } 162 }
170 163
171 public override void SetTerrain(float[] heightMap) 164 public override void SetTerrain(float[] heightMap)
172 { 165 {
173 this._heightMap = heightMap; 166 _heightMap = heightMap;
174 } 167 }
175 168
176 public override void DeleteTerrain() 169 public override void DeleteTerrain()
177 { 170 {
178
179 } 171 }
180 } 172 }
181 173
@@ -185,6 +177,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
185 private PhysicsVector _velocity; 177 private PhysicsVector _velocity;
186 private PhysicsVector _acceleration; 178 private PhysicsVector _acceleration;
187 private bool flying; 179 private bool flying;
180
188 public BasicActor() 181 public BasicActor()
189 { 182 {
190 _velocity = new PhysicsVector(); 183 _velocity = new PhysicsVector();
@@ -194,97 +187,56 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
194 187
195 public override bool Flying 188 public override bool Flying
196 { 189 {
197 get 190 get { return flying; }
198 { 191 set { flying = value; }
199 return flying;
200 }
201 set
202 {
203 flying = value;
204 }
205 } 192 }
206 193
207 public override PhysicsVector Position 194 public override PhysicsVector Position
208 { 195 {
209 get 196 get { return _position; }
210 { 197 set { _position = value; }
211 return _position;
212 }
213 set
214 {
215 _position = value;
216 }
217 } 198 }
218 199
219 public override PhysicsVector Size 200 public override PhysicsVector Size
220 { 201 {
221 get 202 get { return new PhysicsVector(0, 0, 0); }
222 { 203 set { }
223 return new PhysicsVector(0, 0, 0);
224 }
225 set
226 {
227 }
228 } 204 }
229 205
230 public override PhysicsVector Velocity 206 public override PhysicsVector Velocity
231 { 207 {
232 get 208 get { return _velocity; }
233 { 209 set { _velocity = value; }
234 return _velocity;
235 }
236 set
237 {
238 _velocity = value;
239 }
240 } 210 }
241 211
242 public override Quaternion Orientation 212 public override Quaternion Orientation
243 { 213 {
244 get 214 get { return Quaternion.Identity; }
245 { 215 set { }
246 return Quaternion.Identity;
247 }
248 set
249 {
250
251 }
252 } 216 }
253 217
254 public override PhysicsVector Acceleration 218 public override PhysicsVector Acceleration
255 { 219 {
256 get 220 get { return _acceleration; }
257 {
258 return _acceleration;
259 }
260
261 } 221 }
262 222
263 public override bool Kinematic 223 public override bool Kinematic
264 { 224 {
265 get 225 get { return true; }
266 { 226 set { }
267 return true;
268 }
269 set
270 {
271
272 }
273 } 227 }
228
274 public void SetAcceleration(PhysicsVector accel) 229 public void SetAcceleration(PhysicsVector accel)
275 { 230 {
276 this._acceleration = accel; 231 _acceleration = accel;
277 } 232 }
278 233
279 public override void AddForce(PhysicsVector force) 234 public override void AddForce(PhysicsVector force)
280 { 235 {
281
282 } 236 }
283 237
284 public override void SetMomentum(PhysicsVector momentum) 238 public override void SetMomentum(PhysicsVector momentum)
285 { 239 {
286
287 } 240 }
288 } 241 }
289 242} \ No newline at end of file
290}
diff --git a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
index 0180917..c8596f7 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -27,24 +27,26 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("BulletXPlugin")] 37[assembly : AssemblyTitle("BulletXPlugin")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("BulletXPlugin")] 41[assembly : AssemblyProduct("BulletXPlugin")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.0.0")] 58[assembly : AssemblyVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 9fdc017..1658e2d 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29#region Copyright 29#region Copyright
30
30/* 31/*
31* Copyright (c) Contributors, http://www.openmetaverse.org/ 32* Copyright (c) Contributors, http://www.openmetaverse.org/
32* See CONTRIBUTORS.TXT for a full list of copyright holders. 33* See CONTRIBUTORS.TXT for a full list of copyright holders.
@@ -54,18 +55,21 @@
54* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55* 56*
56*/ 57*/
58
57#endregion 59#endregion
60
58#region References 61#region References
62
59using System; 63using System;
60using System.Collections.Generic; 64using System.Collections.Generic;
61using OpenSim.Region.Physics.Manager;
62using OpenSim.Framework;
63using Axiom.Math;
64using AxiomQuaternion = Axiom.Math.Quaternion;
65//Specific References for BulletXPlugin
66using MonoXnaCompactMaths; 65using MonoXnaCompactMaths;
66using OpenSim.Framework;
67using OpenSim.Region.Physics.Manager;
67using XnaDevRu.BulletX; 68using XnaDevRu.BulletX;
68using XnaDevRu.BulletX.Dynamics; 69using XnaDevRu.BulletX.Dynamics;
70using AxiomQuaternion = Axiom.Math.Quaternion;
71using BoxShape=XnaDevRu.BulletX.BoxShape;
72//Specific References for BulletXPlugin
69 73
70#endregion 74#endregion
71 75
@@ -80,27 +84,31 @@ namespace OpenSim.Region.Physics.BulletXPlugin
80 { 84 {
81 } 85 }
82 } 86 }
87
83 /// <summary> 88 /// <summary>
84 /// BulletXConversions are called now BulletXMaths 89 /// BulletXConversions are called now BulletXMaths
85 /// This Class converts objects and types for BulletX and give some operations 90 /// This Class converts objects and types for BulletX and give some operations
86 /// </summary> 91 /// </summary>
87 public class BulletXMaths 92 public class BulletXMaths
88 { 93 {
89 //Vector3 94 //Vector3
90 public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) 95 public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector)
91 { 96 {
92 return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); 97 return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
93 } 98 }
94 public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3) 99
100 public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3)
95 { 101 {
96 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); 102 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
97 } 103 }
104
98 //Quaternion 105 //Quaternion
99 public static MonoXnaCompactMaths.Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion) 106 public static Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion)
100 { 107 {
101 return new MonoXnaCompactMaths.Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w); 108 return new Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w);
102 } 109 }
103 public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(MonoXnaCompactMaths.Quaternion xnaQuaternion) 110
111 public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(Quaternion xnaQuaternion)
104 { 112 {
105 return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z); 113 return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z);
106 } 114 }
@@ -110,70 +118,79 @@ namespace OpenSim.Region.Physics.BulletXPlugin
110 //- GetRotation (class MatrixOperations) 118 //- GetRotation (class MatrixOperations)
111 //- GetElement (class MathHelper) 119 //- GetElement (class MathHelper)
112 //- SetElement (class MathHelper) 120 //- SetElement (class MathHelper)
113 internal static void SetRotation(ref Matrix m, MonoXnaCompactMaths.Quaternion q) 121 internal static void SetRotation(ref Matrix m, Quaternion q)
114 { 122 {
115 float d = q.LengthSquared(); 123 float d = q.LengthSquared();
116 float s = 2f / d; 124 float s = 2f/d;
117 float xs = q.X * s, ys = q.Y * s, zs = q.Z * s; 125 float xs = q.X*s, ys = q.Y*s, zs = q.Z*s;
118 float wx = q.W * xs, wy = q.W * ys, wz = q.W * zs; 126 float wx = q.W*xs, wy = q.W*ys, wz = q.W*zs;
119 float xx = q.X * xs, xy = q.X * ys, xz = q.X * zs; 127 float xx = q.X*xs, xy = q.X*ys, xz = q.X*zs;
120 float yy = q.Y * ys, yz = q.Y * zs, zz = q.Z * zs; 128 float yy = q.Y*ys, yz = q.Y*zs, zz = q.Z*zs;
121 m = new Matrix(1 - (yy + zz), xy - wz, xz + wy, 0, 129 m = new Matrix(1 - (yy + zz), xy - wz, xz + wy, 0,
122 xy + wz, 1 - (xx + zz), yz - wx, 0, 130 xy + wz, 1 - (xx + zz), yz - wx, 0,
123 xz - wy, yz + wx, 1 - (xx + yy), 0, 131 xz - wy, yz + wx, 1 - (xx + yy), 0,
124 m.M41, m.M42, m.M43, 1); 132 m.M41, m.M42, m.M43, 1);
125 } 133 }
126 internal static MonoXnaCompactMaths.Quaternion GetRotation(Matrix m) 134
135 internal static Quaternion GetRotation(Matrix m)
127 { 136 {
128 MonoXnaCompactMaths.Quaternion q = new MonoXnaCompactMaths.Quaternion(); 137 Quaternion q = new Quaternion();
129 138
130 float trace = m.M11 + m.M22 + m.M33; 139 float trace = m.M11 + m.M22 + m.M33;
131 140
132 if (trace > 0) 141 if (trace > 0)
133 { 142 {
134 float s = (float)Math.Sqrt(trace + 1); 143 float s = (float) Math.Sqrt(trace + 1);
135 q.W = s * 0.5f; 144 q.W = s*0.5f;
136 s = 0.5f / s; 145 s = 0.5f/s;
137 146
138 q.X = (m.M32 - m.M23) * s; 147 q.X = (m.M32 - m.M23)*s;
139 q.Y = (m.M13 - m.M31) * s; 148 q.Y = (m.M13 - m.M31)*s;
140 q.Z = (m.M21 - m.M12) * s; 149 q.Z = (m.M21 - m.M12)*s;
141 } 150 }
142 else 151 else
143 { 152 {
144 int i = m.M11 < m.M22 ? 153 int i = m.M11 < m.M22
145 (m.M22 < m.M33 ? 2 : 1) : 154 ?
146 (m.M11 < m.M33 ? 2 : 0); 155 (m.M22 < m.M33 ? 2 : 1)
147 int j = (i + 1) % 3; 156 :
148 int k = (i + 2) % 3; 157 (m.M11 < m.M33 ? 2 : 0);
149 158 int j = (i + 1)%3;
150 float s = (float)Math.Sqrt(GetElement(m, i, i) - GetElement(m, j, j) - GetElement(m, k, k) + 1); 159 int k = (i + 2)%3;
151 SetElement(ref q, i, s * 0.5f); 160
152 s = 0.5f / s; 161 float s = (float) Math.Sqrt(GetElement(m, i, i) - GetElement(m, j, j) - GetElement(m, k, k) + 1);
153 162 SetElement(ref q, i, s*0.5f);
154 q.W = (GetElement(m, k, j) - GetElement(m, j, k)) * s; 163 s = 0.5f/s;
155 SetElement(ref q, j, (GetElement(m, j, i) + GetElement(m, i, j)) * s); 164
156 SetElement(ref q, k, (GetElement(m, k, i) + GetElement(m, i, k)) * s); 165 q.W = (GetElement(m, k, j) - GetElement(m, j, k))*s;
166 SetElement(ref q, j, (GetElement(m, j, i) + GetElement(m, i, j))*s);
167 SetElement(ref q, k, (GetElement(m, k, i) + GetElement(m, i, k))*s);
157 } 168 }
158 169
159 return q; 170 return q;
160 } 171 }
161 internal static float SetElement(ref MonoXnaCompactMaths.Quaternion q, int index, float value) 172
173 internal static float SetElement(ref Quaternion q, int index, float value)
162 { 174 {
163 switch (index) 175 switch (index)
164 { 176 {
165 case 0: 177 case 0:
166 q.X = value; break; 178 q.X = value;
179 break;
167 case 1: 180 case 1:
168 q.Y = value; break; 181 q.Y = value;
182 break;
169 case 2: 183 case 2:
170 q.Z = value; break; 184 q.Z = value;
185 break;
171 case 3: 186 case 3:
172 q.W = value; break; 187 q.W = value;
188 break;
173 } 189 }
174 190
175 return 0; 191 return 0;
176 } 192 }
193
177 internal static float GetElement(Matrix mat, int row, int col) 194 internal static float GetElement(Matrix mat, int row, int col)
178 { 195 {
179 switch (row) 196 switch (row)
@@ -187,7 +204,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
187 return mat.M12; 204 return mat.M12;
188 case 2: 205 case 2:
189 return mat.M13; 206 return mat.M13;
190 } break; 207 }
208 break;
191 case 1: 209 case 1:
192 switch (col) 210 switch (col)
193 { 211 {
@@ -197,7 +215,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
197 return mat.M22; 215 return mat.M22;
198 case 2: 216 case 2:
199 return mat.M23; 217 return mat.M23;
200 } break; 218 }
219 break;
201 case 2: 220 case 2:
202 switch (col) 221 switch (col)
203 { 222 {
@@ -207,12 +226,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
207 return mat.M32; 226 return mat.M32;
208 case 2: 227 case 2:
209 return mat.M33; 228 return mat.M33;
210 } break; 229 }
230 break;
211 } 231 }
212 232
213 return 0; 233 return 0;
214 } 234 }
215 } 235 }
236
216 /// <summary> 237 /// <summary>
217 /// PhysicsPlugin Class for BulletX 238 /// PhysicsPlugin Class for BulletX
218 /// </summary> 239 /// </summary>
@@ -223,10 +244,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
223 public BulletXPlugin() 244 public BulletXPlugin()
224 { 245 {
225 } 246 }
247
226 public bool Init() 248 public bool Init()
227 { 249 {
228 return true; 250 return true;
229 } 251 }
252
230 public PhysicsScene GetScene() 253 public PhysicsScene GetScene()
231 { 254 {
232 if (_mScene == null) 255 if (_mScene == null)
@@ -235,20 +258,24 @@ namespace OpenSim.Region.Physics.BulletXPlugin
235 } 258 }
236 return (_mScene); 259 return (_mScene);
237 } 260 }
261
238 public string GetName() 262 public string GetName()
239 { 263 {
240 return ("modified_BulletX");//Changed!! "BulletXEngine" To "modified_BulletX" 264 return ("modified_BulletX"); //Changed!! "BulletXEngine" To "modified_BulletX"
241 } 265 }
266
242 public void Dispose() 267 public void Dispose()
243 { 268 {
244 } 269 }
245 } 270 }
271
246 /// <summary> 272 /// <summary>
247 /// PhysicsScene Class for BulletX 273 /// PhysicsScene Class for BulletX
248 /// </summary> 274 /// </summary>
249 public class BulletXScene : PhysicsScene 275 public class BulletXScene : PhysicsScene
250 { 276 {
251 #region BulletXScene Fields 277 #region BulletXScene Fields
278
252 public DiscreteDynamicsWorld ddWorld; 279 public DiscreteDynamicsWorld ddWorld;
253 private CollisionDispatcher cDispatcher; 280 private CollisionDispatcher cDispatcher;
254 private OverlappingPairCache opCache; 281 private OverlappingPairCache opCache;
@@ -271,33 +298,58 @@ namespace OpenSim.Region.Physics.BulletXPlugin
271 private List<BulletXCharacter> _characters = new List<BulletXCharacter>(); 298 private List<BulletXCharacter> _characters = new List<BulletXCharacter>();
272 private List<BulletXPrim> _prims = new List<BulletXPrim>(); 299 private List<BulletXPrim> _prims = new List<BulletXPrim>();
273 300
274 public static float Gravity { get { return gravity; } } 301 public static float Gravity
275 public static float HeightLevel0 { get { return heightLevel0; } } 302 {
276 public static float HeightLevel1 { get { return heightLevel1; } } 303 get { return gravity; }
277 public static float LowGravityFactor { get { return lowGravityFactor; } } 304 }
278 public static int MaxXY { get { return maxXY; } } 305
279 public static int MaxZ { get { return maxZ; } } 306 public static float HeightLevel0
307 {
308 get { return heightLevel0; }
309 }
310
311 public static float HeightLevel1
312 {
313 get { return heightLevel1; }
314 }
315
316 public static float LowGravityFactor
317 {
318 get { return lowGravityFactor; }
319 }
320
321 public static int MaxXY
322 {
323 get { return maxXY; }
324 }
325
326 public static int MaxZ
327 {
328 get { return maxZ; }
329 }
280 330
281 private List<RigidBody> _forgottenRigidBodies = new List<RigidBody>(); 331 private List<RigidBody> _forgottenRigidBodies = new List<RigidBody>();
282 internal string is_ex_message = "Can't remove rigidBody!: "; 332 internal string is_ex_message = "Can't remove rigidBody!: ";
333
283 #endregion 334 #endregion
284 335
285 public BulletXScene() 336 public BulletXScene()
286 { 337 {
287 cDispatcher = new CollisionDispatcher(); 338 cDispatcher = new CollisionDispatcher();
288 MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ); 339 Vector3 worldMinDim = new Vector3((float) minXY, (float) minXY, (float) minZ);
289 MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ); 340 Vector3 worldMaxDim = new Vector3((float) maxXY, (float) maxXY, (float) maxZ);
290 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); 341 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles);
291 sicSolver = new SequentialImpulseConstraintSolver(); 342 sicSolver = new SequentialImpulseConstraintSolver();
292 343
293 lock (BulletXLock) 344 lock (BulletXLock)
294 { 345 {
295 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); 346 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver);
296 ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity); 347 ddWorld.Gravity = new Vector3(0, 0, -gravity);
297 } 348 }
298 //this._heightmap = new float[65536]; 349 //this._heightmap = new float[65536];
299 } 350 }
300 public override PhysicsActor AddAvatar(string avName, PhysicsVector position) 351
352 public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
301 { 353 {
302 PhysicsVector pos = new PhysicsVector(); 354 PhysicsVector pos = new PhysicsVector();
303 pos.X = position.X; 355 pos.X = position.X;
@@ -311,6 +363,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
311 } 363 }
312 return newAv; 364 return newAv;
313 } 365 }
366
314 public override void RemoveAvatar(PhysicsActor actor) 367 public override void RemoveAvatar(PhysicsActor actor)
315 { 368 {
316 if (actor is BulletXCharacter) 369 if (actor is BulletXCharacter)
@@ -319,20 +372,22 @@ namespace OpenSim.Region.Physics.BulletXPlugin
319 { 372 {
320 try 373 try
321 { 374 {
322 ddWorld.RemoveRigidBody(((BulletXCharacter)actor).RigidBody); 375 ddWorld.RemoveRigidBody(((BulletXCharacter) actor).RigidBody);
323 } 376 }
324 catch (Exception ex) 377 catch (Exception ex)
325 { 378 {
326 BulletXMessage(is_ex_message + ex.Message, true); 379 BulletXMessage(is_ex_message + ex.Message, true);
327 ((BulletXCharacter)actor).RigidBody.ActivationState = ActivationState.DisableSimulation; 380 ((BulletXCharacter) actor).RigidBody.ActivationState = ActivationState.DisableSimulation;
328 AddForgottenRigidBody(((BulletXCharacter)actor).RigidBody); 381 AddForgottenRigidBody(((BulletXCharacter) actor).RigidBody);
329 } 382 }
330 _characters.Remove((BulletXCharacter)actor); 383 _characters.Remove((BulletXCharacter) actor);
331 } 384 }
332 GC.Collect(); 385 GC.Collect();
333 } 386 }
334 } 387 }
335 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation) 388
389 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
390 PhysicsVector size, AxiomQuaternion rotation)
336 { 391 {
337 PhysicsActor result; 392 PhysicsActor result;
338 393
@@ -358,11 +413,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
358 413
359 return result; 414 return result;
360 } 415 }
361 public PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Axiom.Math.Quaternion rotation) 416
417 public PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation)
362 { 418 {
363 return AddPrim("", position, size, rotation, null, null); 419 return AddPrim("", position, size, rotation, null, null);
364 } 420 }
365 public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) 421
422 public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation,
423 Mesh mesh, PrimitiveBaseShape pbs)
366 { 424 {
367 BulletXPrim newPrim = null; 425 BulletXPrim newPrim = null;
368 lock (BulletXLock) 426 lock (BulletXLock)
@@ -372,6 +430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
372 } 430 }
373 return newPrim; 431 return newPrim;
374 } 432 }
433
375 public override void RemovePrim(PhysicsActor prim) 434 public override void RemovePrim(PhysicsActor prim)
376 { 435 {
377 if (prim is BulletXPrim) 436 if (prim is BulletXPrim)
@@ -380,19 +439,20 @@ namespace OpenSim.Region.Physics.BulletXPlugin
380 { 439 {
381 try 440 try
382 { 441 {
383 ddWorld.RemoveRigidBody(((BulletXPrim)prim).RigidBody); 442 ddWorld.RemoveRigidBody(((BulletXPrim) prim).RigidBody);
384 } 443 }
385 catch (Exception ex) 444 catch (Exception ex)
386 { 445 {
387 BulletXMessage(is_ex_message + ex.Message, true); 446 BulletXMessage(is_ex_message + ex.Message, true);
388 ((BulletXPrim)prim).RigidBody.ActivationState = ActivationState.DisableSimulation; 447 ((BulletXPrim) prim).RigidBody.ActivationState = ActivationState.DisableSimulation;
389 AddForgottenRigidBody(((BulletXPrim)prim).RigidBody); 448 AddForgottenRigidBody(((BulletXPrim) prim).RigidBody);
390 } 449 }
391 _prims.Remove((BulletXPrim)prim); 450 _prims.Remove((BulletXPrim) prim);
392 } 451 }
393 GC.Collect(); 452 GC.Collect();
394 } 453 }
395 } 454 }
455
396 public override void Simulate(float timeStep) 456 public override void Simulate(float timeStep)
397 { 457 {
398 lock (BulletXLock) 458 lock (BulletXLock)
@@ -408,6 +468,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
408 UpdateKineticsForAll(); 468 UpdateKineticsForAll();
409 } 469 }
410 } 470 }
471
411 private void MoveAllObjects(float timeStep) 472 private void MoveAllObjects(float timeStep)
412 { 473 {
413 foreach (BulletXCharacter actor in _characters) 474 foreach (BulletXCharacter actor in _characters)
@@ -418,6 +479,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
418 { 479 {
419 } 480 }
420 } 481 }
482
421 private void ValidateHeightForAll() 483 private void ValidateHeightForAll()
422 { 484 {
423 float _height; 485 float _height;
@@ -431,7 +493,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
431 foreach (BulletXPrim prim in _prims) 493 foreach (BulletXPrim prim in _prims)
432 { 494 {
433 //_height = HeightValue(prim.RigidBodyPosition); 495 //_height = HeightValue(prim.RigidBodyPosition);
434 _height = _simFlatPlanet.HeightValue(prim.RigidBodyPosition); 496 _height = _simFlatPlanet.HeightValue(prim.RigidBodyPosition);
435 prim.ValidateHeight(_height); 497 prim.ValidateHeight(_height);
436 //if (_simFlatPlanet.heightIsNotValid(prim.RigidBodyPosition, out _height)) prim.ValidateHeight(_height); 498 //if (_simFlatPlanet.heightIsNotValid(prim.RigidBodyPosition, out _height)) prim.ValidateHeight(_height);
437 } 499 }
@@ -444,6 +506,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
444 // prim.ValidateHeight(0); 506 // prim.ValidateHeight(0);
445 //} 507 //}
446 } 508 }
509
447 private void UpdateKineticsForAll() 510 private void UpdateKineticsForAll()
448 { 511 {
449 //UpdatePosition > UpdateKinetics. 512 //UpdatePosition > UpdateKinetics.
@@ -458,17 +521,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
458 } 521 }
459 //if(this._simFlatPlanet!=null) this._simFlatPlanet.Restore(); 522 //if(this._simFlatPlanet!=null) this._simFlatPlanet.Restore();
460 } 523 }
524
461 public override void GetResults() 525 public override void GetResults()
462 { 526 {
463
464 } 527 }
528
465 public override bool IsThreaded 529 public override bool IsThreaded
466 { 530 {
467 get 531 get { return (false); // for now we won't be multithreaded
468 {
469 return (false); // for now we won't be multithreaded
470 } 532 }
471 } 533 }
534
472 public override void SetTerrain(float[] heightMap) 535 public override void SetTerrain(float[] heightMap)
473 { 536 {
474 ////As the same as ODE, heightmap (x,y) must be swapped for BulletX 537 ////As the same as ODE, heightmap (x,y) must be swapped for BulletX
@@ -494,41 +557,44 @@ namespace OpenSim.Region.Physics.BulletXPlugin
494 DeleteTerrain(); 557 DeleteTerrain();
495 //There is a BulletXLock inside the constructor of BulletXPlanet 558 //There is a BulletXLock inside the constructor of BulletXPlanet
496 //this._simFlatPlanet = new BulletXPlanet(this, swappedHeightMap); 559 //this._simFlatPlanet = new BulletXPlanet(this, swappedHeightMap);
497 this._simFlatPlanet = new BulletXPlanet(this, heightMap); 560 _simFlatPlanet = new BulletXPlanet(this, heightMap);
498 //this._heightmap = heightMap; 561 //this._heightmap = heightMap;
499 } 562 }
563
500 public override void DeleteTerrain() 564 public override void DeleteTerrain()
501 { 565 {
502 if (this._simFlatPlanet != null) 566 if (_simFlatPlanet != null)
503 { 567 {
504 lock (BulletXLock) 568 lock (BulletXLock)
505 { 569 {
506 try 570 try
507 { 571 {
508 ddWorld.RemoveRigidBody(this._simFlatPlanet.RigidBody); 572 ddWorld.RemoveRigidBody(_simFlatPlanet.RigidBody);
509 } 573 }
510 catch (Exception ex) 574 catch (Exception ex)
511 { 575 {
512 BulletXMessage(is_ex_message + ex.Message, true); 576 BulletXMessage(is_ex_message + ex.Message, true);
513 this._simFlatPlanet.RigidBody.ActivationState = ActivationState.DisableSimulation; 577 _simFlatPlanet.RigidBody.ActivationState = ActivationState.DisableSimulation;
514 AddForgottenRigidBody(this._simFlatPlanet.RigidBody); 578 AddForgottenRigidBody(_simFlatPlanet.RigidBody);
515 } 579 }
516 } 580 }
517 this._simFlatPlanet = null; 581 _simFlatPlanet = null;
518 GC.Collect(); 582 GC.Collect();
519 BulletXMessage("Terrain erased!", false); 583 BulletXMessage("Terrain erased!", false);
520 } 584 }
521 //this._heightmap = null; 585 //this._heightmap = null;
522 } 586 }
587
523 internal void AddForgottenRigidBody(RigidBody forgottenRigidBody) 588 internal void AddForgottenRigidBody(RigidBody forgottenRigidBody)
524 { 589 {
525 _forgottenRigidBodies.Add(forgottenRigidBody); 590 _forgottenRigidBodies.Add(forgottenRigidBody);
526 } 591 }
592
527 private void RemoveForgottenRigidBodies() 593 private void RemoveForgottenRigidBodies()
528 { 594 {
529 RigidBody forgottenRigidBody; 595 RigidBody forgottenRigidBody;
530 int nRigidBodies = _forgottenRigidBodies.Count; 596 int nRigidBodies = _forgottenRigidBodies.Count;
531 for(int i = nRigidBodies - 1; i >= 0; i--) 597 for (int i = nRigidBodies - 1; i >= 0; i--)
532 { 598 {
533 forgottenRigidBody = _forgottenRigidBodies[i]; 599 forgottenRigidBody = _forgottenRigidBodies[i];
534 try 600 try
@@ -544,10 +610,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
544 } 610 }
545 GC.Collect(); 611 GC.Collect();
546 } 612 }
613
547 internal void BulletXMessage(string message, bool isWarning) 614 internal void BulletXMessage(string message, bool isWarning)
548 { 615 {
549 PhysicsPluginManager.PhysicsPluginMessage("[Modified BulletX]:\t" + message, isWarning); 616 PhysicsPluginManager.PhysicsPluginMessage("[Modified BulletX]:\t" + message, isWarning);
550 } 617 }
618
551 //temp 619 //temp
552 //private float HeightValue(MonoXnaCompactMaths.Vector3 position) 620 //private float HeightValue(MonoXnaCompactMaths.Vector3 position)
553 //{ 621 //{
@@ -559,10 +627,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
559 // height = this._heightmap[li_y * 256 + li_x]; 627 // height = this._heightmap[li_y * 256 + li_x];
560 // if (height < 0) height = 0; 628 // if (height < 0) height = 0;
561 // else if (height > maxZ) height = maxZ; 629 // else if (height > maxZ) height = maxZ;
562 630
563 // return height; 631 // return height;
564 //} 632 //}
565 } 633 }
634
566 /// <summary> 635 /// <summary>
567 /// PhysicsActor Character Class for BulletX 636 /// PhysicsActor Character Class for BulletX
568 /// </summary> 637 /// </summary>
@@ -576,21 +645,24 @@ namespace OpenSim.Region.Physics.BulletXPlugin
576 private bool flying; 645 private bool flying;
577 private RigidBody rigidBody; 646 private RigidBody rigidBody;
578 647
579 public MonoXnaCompactMaths.Vector3 RigidBodyPosition 648 public Vector3 RigidBodyPosition
580 { 649 {
581 get { return this.rigidBody.CenterOfMassPosition; } 650 get { return rigidBody.CenterOfMassPosition; }
582 } 651 }
652
583 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) 653 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos)
584 : this("", parent_scene, pos) 654 : this("", parent_scene, pos)
585 { 655 {
586 } 656 }
657
587 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) 658 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos)
588 : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), 659 : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(),
589 AxiomQuaternion.Identity) 660 AxiomQuaternion.Identity)
590 { 661 {
591 } 662 }
663
592 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, 664 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
593 PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation) 665 PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation)
594 { 666 {
595 //This fields will be removed. They're temporal 667 //This fields will be removed. They're temporal
596 float _sizeX = 0.5f; 668 float _sizeX = 0.5f;
@@ -622,23 +694,23 @@ namespace OpenSim.Region.Physics.BulletXPlugin
622 //For now, like ODE, collisionShape = sphere of radious = 1.0 694 //For now, like ODE, collisionShape = sphere of radious = 1.0
623 CollisionShape _collisionShape = new SphereShape(1.0f); 695 CollisionShape _collisionShape = new SphereShape(1.0f);
624 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 696 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
625 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 697 Vector3 _localInertia = new Vector3();
626 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 698 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0
627 rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 699 rigidBody =
700 new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping,
701 _friction, _restitution);
628 //rigidBody.ActivationState = ActivationState.DisableDeactivation; 702 //rigidBody.ActivationState = ActivationState.DisableDeactivation;
629 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition 703 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition
630 MonoXnaCompactMaths.Vector3 _vDebugTranslation; 704 Vector3 _vDebugTranslation;
631 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; 705 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition;
632 rigidBody.Translate(_vDebugTranslation); 706 rigidBody.Translate(_vDebugTranslation);
633 parent_scene.ddWorld.AddRigidBody(rigidBody); 707 parent_scene.ddWorld.AddRigidBody(rigidBody);
634 } 708 }
635 } 709 }
710
636 public override PhysicsVector Position 711 public override PhysicsVector Position
637 { 712 {
638 get 713 get { return _position; }
639 {
640 return _position;
641 }
642 set 714 set
643 { 715 {
644 lock (BulletXScene.BulletXLock) 716 lock (BulletXScene.BulletXLock)
@@ -648,12 +720,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
648 } 720 }
649 } 721 }
650 } 722 }
723
651 public override PhysicsVector Velocity 724 public override PhysicsVector Velocity
652 { 725 {
653 get 726 get { return _velocity; }
654 {
655 return _velocity;
656 }
657 set 727 set
658 { 728 {
659 lock (BulletXScene.BulletXLock) 729 lock (BulletXScene.BulletXLock)
@@ -663,12 +733,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
663 } 733 }
664 } 734 }
665 } 735 }
736
666 public override PhysicsVector Size 737 public override PhysicsVector Size
667 { 738 {
668 get 739 get { return _size; }
669 {
670 return _size;
671 }
672 set 740 set
673 { 741 {
674 lock (BulletXScene.BulletXLock) 742 lock (BulletXScene.BulletXLock)
@@ -677,19 +745,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin
677 } 745 }
678 } 746 }
679 } 747 }
748
680 public override PhysicsVector Acceleration 749 public override PhysicsVector Acceleration
681 { 750 {
682 get 751 get { return _acceleration; }
683 {
684 return _acceleration;
685 }
686 } 752 }
753
687 public override AxiomQuaternion Orientation 754 public override AxiomQuaternion Orientation
688 { 755 {
689 get 756 get { return _orientation; }
690 {
691 return _orientation;
692 }
693 set 757 set
694 { 758 {
695 lock (BulletXScene.BulletXLock) 759 lock (BulletXScene.BulletXLock)
@@ -698,24 +762,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin
698 } 762 }
699 } 763 }
700 } 764 }
765
701 public RigidBody RigidBody 766 public RigidBody RigidBody
702 { 767 {
703 get 768 get { return rigidBody; }
704 {
705 return rigidBody;
706 }
707 } 769 }
770
708 public override bool Flying 771 public override bool Flying
709 { 772 {
710 get 773 get { return flying; }
711 { 774 set { flying = value; }
712 return flying;
713 }
714 set
715 {
716 flying = value;
717 }
718 } 775 }
776
719 public void SetAcceleration(PhysicsVector accel) 777 public void SetAcceleration(PhysicsVector accel)
720 { 778 {
721 lock (BulletXScene.BulletXLock) 779 lock (BulletXScene.BulletXLock)
@@ -723,116 +781,121 @@ namespace OpenSim.Region.Physics.BulletXPlugin
723 _acceleration = accel; 781 _acceleration = accel;
724 } 782 }
725 } 783 }
784
726 public override bool Kinematic 785 public override bool Kinematic
727 { 786 {
728 get 787 get { return false; }
729 { 788 set { }
730 return false;
731 }
732 set
733 {
734
735 }
736 } 789 }
790
737 public override void AddForce(PhysicsVector force) 791 public override void AddForce(PhysicsVector force)
738 { 792 {
739
740 } 793 }
794
741 public override void SetMomentum(PhysicsVector momentum) 795 public override void SetMomentum(PhysicsVector momentum)
742 { 796 {
743
744 } 797 }
798
745 internal void Move(float timeStep) 799 internal void Move(float timeStep)
746 { 800 {
747 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3(); 801 Vector3 vec = new Vector3();
748 //At this point it's supossed that: 802 //At this point it's supossed that:
749 //_velocity == rigidBody.LinearVelocity 803 //_velocity == rigidBody.LinearVelocity
750 vec.X = this._velocity.X; 804 vec.X = _velocity.X;
751 vec.Y = this._velocity.Y; 805 vec.Y = _velocity.Y;
752 vec.Z = this._velocity.Z; 806 vec.Z = _velocity.Z;
753 if ((vec.X != 0.0f) || (vec.Y != 0.0f) || (vec.Z != 0.0f)) rigidBody.Activate(); 807 if ((vec.X != 0.0f) || (vec.Y != 0.0f) || (vec.Z != 0.0f)) rigidBody.Activate();
754 if (flying) 808 if (flying)
755 { 809 {
756 //Antigravity with movement 810 //Antigravity with movement
757 if (this._position.Z <= BulletXScene.HeightLevel0) 811 if (_position.Z <= BulletXScene.HeightLevel0)
758 { 812 {
759 vec.Z += BulletXScene.Gravity * timeStep; 813 vec.Z += BulletXScene.Gravity*timeStep;
760 } 814 }
761 //Lowgravity with movement 815 //Lowgravity with movement
762 else if ((this._position.Z > BulletXScene.HeightLevel0) 816 else if ((_position.Z > BulletXScene.HeightLevel0)
763 && (this._position.Z <= BulletXScene.HeightLevel1)) 817 && (_position.Z <= BulletXScene.HeightLevel1))
764 { 818 {
765 vec.Z += BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 819 vec.Z += BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor);
766 } 820 }
767 //Lowgravity with... 821 //Lowgravity with...
768 else if (this._position.Z > BulletXScene.HeightLevel1) 822 else if (_position.Z > BulletXScene.HeightLevel1)
769 { 823 {
770 if (vec.Z > 0) //no movement 824 if (vec.Z > 0) //no movement
771 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 825 vec.Z = BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor);
772 else 826 else
773 vec.Z += BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 827 vec.Z += BulletXScene.Gravity*timeStep*(1.0f - BulletXScene.LowGravityFactor);
774
775 } 828 }
776 } 829 }
777 rigidBody.LinearVelocity = vec; 830 rigidBody.LinearVelocity = vec;
778 } 831 }
832
779 //This validation is very basic 833 //This validation is very basic
780 internal void ValidateHeight(float heighmapPositionValue) 834 internal void ValidateHeight(float heighmapPositionValue)
781 { 835 {
782 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z / 2.0f) 836 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z/2.0f)
783 { 837 {
784 Matrix m = rigidBody.WorldTransform; 838 Matrix m = rigidBody.WorldTransform;
785 MonoXnaCompactMaths.Vector3 v3 = m.Translation; 839 Vector3 v3 = m.Translation;
786 v3.Z = heighmapPositionValue + _size.Z / 2.0f; 840 v3.Z = heighmapPositionValue + _size.Z/2.0f;
787 m.Translation = v3; 841 m.Translation = v3;
788 rigidBody.WorldTransform = m; 842 rigidBody.WorldTransform = m;
789 //When an Avie touch the ground it's vertical velocity it's reduced to ZERO 843 //When an Avie touch the ground it's vertical velocity it's reduced to ZERO
790 Speed(new PhysicsVector(this.rigidBody.LinearVelocity.X, this.rigidBody.LinearVelocity.Y, 0.0f)); 844 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
791 } 845 }
792 } 846 }
847
793 internal void UpdateKinetics() 848 internal void UpdateKinetics()
794 { 849 {
795 this._position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); 850 _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
796 this._velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); 851 _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity);
797 //Orientation it seems that it will be the default. 852 //Orientation it seems that it will be the default.
798 ReOrient(); 853 ReOrient();
799 } 854 }
800 855
801 #region Methods for updating values of RigidBody 856 #region Methods for updating values of RigidBody
857
802 private void Translate() 858 private void Translate()
803 { 859 {
804 Translate(this._position); 860 Translate(_position);
805 } 861 }
862
806 private void Translate(PhysicsVector _newPos) 863 private void Translate(PhysicsVector _newPos)
807 { 864 {
808 MonoXnaCompactMaths.Vector3 _translation; 865 Vector3 _translation;
809 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; 866 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
810 rigidBody.Translate(_translation); 867 rigidBody.Translate(_translation);
811 } 868 }
869
812 private void Speed() 870 private void Speed()
813 { 871 {
814 Speed(this._velocity); 872 Speed(_velocity);
815 } 873 }
874
816 private void Speed(PhysicsVector _newSpeed) 875 private void Speed(PhysicsVector _newSpeed)
817 { 876 {
818 MonoXnaCompactMaths.Vector3 _speed; 877 Vector3 _speed;
819 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); 878 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
820 rigidBody.LinearVelocity = _speed; 879 rigidBody.LinearVelocity = _speed;
821 } 880 }
881
822 private void ReOrient() 882 private void ReOrient()
823 { 883 {
824 ReOrient(this._orientation); 884 ReOrient(_orientation);
825 } 885 }
886
826 private void ReOrient(AxiomQuaternion _newOrient) 887 private void ReOrient(AxiomQuaternion _newOrient)
827 { 888 {
828 MonoXnaCompactMaths.Quaternion _newOrientation; 889 Quaternion _newOrientation;
829 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); 890 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient);
830 Matrix _comTransform = rigidBody.CenterOfMassTransform; 891 Matrix _comTransform = rigidBody.CenterOfMassTransform;
831 BulletXMaths.SetRotation(ref _comTransform, _newOrientation); 892 BulletXMaths.SetRotation(ref _comTransform, _newOrientation);
832 rigidBody.CenterOfMassTransform = _comTransform; 893 rigidBody.CenterOfMassTransform = _comTransform;
833 } 894 }
895
834 #endregion 896 #endregion
835 } 897 }
898
836 /// <summary> 899 /// <summary>
837 /// PhysicsActor Prim Class for BulletX 900 /// PhysicsActor Prim Class for BulletX
838 /// </summary> 901 /// </summary>
@@ -851,27 +914,32 @@ namespace OpenSim.Region.Physics.BulletXPlugin
851 //_physical value will be linked with the prim object value 914 //_physical value will be linked with the prim object value
852 private Boolean _physical = false; 915 private Boolean _physical = false;
853 916
854 public MonoXnaCompactMaths.Vector3 RigidBodyPosition 917 public Vector3 RigidBodyPosition
855 { 918 {
856 get { return this.rigidBody.CenterOfMassPosition; } 919 get { return rigidBody.CenterOfMassPosition; }
857 } 920 }
921
858 public BulletXPrim(BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, AxiomQuaternion rotation) 922 public BulletXPrim(BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, AxiomQuaternion rotation)
859 : this("", parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, null, null) 923 : this("", parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, null, null)
860 { 924 {
861 } 925 }
862 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, 926
863 AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) 927 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
928 AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs)
864 : this(primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs) 929 : this(primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs)
865 { 930 {
866 } 931 }
867 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, PhysicsVector size, 932
868 PhysicsVector aceleration, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) 933 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
934 PhysicsVector size,
935 PhysicsVector aceleration, AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs)
869 { 936 {
870 if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0"); 937 if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0");
871 if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity; 938 if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity;
872 939
873 _position = pos; 940 _position = pos;
874 if (_physical) _velocity = velocity; else _velocity = new PhysicsVector(); 941 if (_physical) _velocity = velocity;
942 else _velocity = new PhysicsVector();
875 _size = size; 943 _size = size;
876 _acceleration = aceleration; 944 _acceleration = aceleration;
877 _orientation = rotation; 945 _orientation = rotation;
@@ -889,26 +957,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin
889 { 957 {
890 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(pos); 958 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(pos);
891 //For now all prims are boxes 959 //For now all prims are boxes
892 CollisionShape _collisionShape = new XnaDevRu.BulletX.BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_size) / 2.0f); 960 CollisionShape _collisionShape = new BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_size)/2.0f);
893 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 961 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
894 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 962 Vector3 _localInertia = new Vector3();
895 if(_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 963 if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0
896 rigidBody = new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 964 rigidBody =
965 new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping,
966 _friction, _restitution);
897 //rigidBody.ActivationState = ActivationState.DisableDeactivation; 967 //rigidBody.ActivationState = ActivationState.DisableDeactivation;
898 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition 968 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition
899 MonoXnaCompactMaths.Vector3 _vDebugTranslation; 969 Vector3 _vDebugTranslation;
900 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; 970 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition;
901 rigidBody.Translate(_vDebugTranslation); 971 rigidBody.Translate(_vDebugTranslation);
902 //--- 972 //---
903 parent_scene.ddWorld.AddRigidBody(rigidBody); 973 parent_scene.ddWorld.AddRigidBody(rigidBody);
904 } 974 }
905 } 975 }
976
906 public override PhysicsVector Position 977 public override PhysicsVector Position
907 { 978 {
908 get 979 get { return _position; }
909 {
910 return _position;
911 }
912 set 980 set
913 { 981 {
914 lock (BulletXScene.BulletXLock) 982 lock (BulletXScene.BulletXLock)
@@ -918,12 +986,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
918 } 986 }
919 } 987 }
920 } 988 }
989
921 public override PhysicsVector Velocity 990 public override PhysicsVector Velocity
922 { 991 {
923 get 992 get { return _velocity; }
924 {
925 return _velocity;
926 }
927 set 993 set
928 { 994 {
929 lock (BulletXScene.BulletXLock) 995 lock (BulletXScene.BulletXLock)
@@ -941,12 +1007,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
941 } 1007 }
942 } 1008 }
943 } 1009 }
1010
944 public override PhysicsVector Size 1011 public override PhysicsVector Size
945 { 1012 {
946 get 1013 get { return _size; }
947 {
948 return _size;
949 }
950 set 1014 set
951 { 1015 {
952 lock (BulletXScene.BulletXLock) 1016 lock (BulletXScene.BulletXLock)
@@ -956,19 +1020,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin
956 } 1020 }
957 } 1021 }
958 } 1022 }
1023
959 public override PhysicsVector Acceleration 1024 public override PhysicsVector Acceleration
960 { 1025 {
961 get 1026 get { return _acceleration; }
962 {
963 return _acceleration;
964 }
965 } 1027 }
1028
966 public override AxiomQuaternion Orientation 1029 public override AxiomQuaternion Orientation
967 { 1030 {
968 get 1031 get { return _orientation; }
969 {
970 return _orientation;
971 }
972 set 1032 set
973 { 1033 {
974 lock (BulletXScene.BulletXLock) 1034 lock (BulletXScene.BulletXLock)
@@ -978,43 +1038,34 @@ namespace OpenSim.Region.Physics.BulletXPlugin
978 } 1038 }
979 } 1039 }
980 } 1040 }
1041
981 public float Mass 1042 public float Mass
982 { 1043 {
983 get 1044 get
984 { 1045 {
985 //For now all prims are boxes 1046 //For now all prims are boxes
986 return (_physical ? 1 : 0) * _density * _size.X * _size.Y * _size.Z; 1047 return (_physical ? 1 : 0)*_density*_size.X*_size.Y*_size.Z;
987 } 1048 }
988 } 1049 }
1050
989 public RigidBody RigidBody 1051 public RigidBody RigidBody
990 { 1052 {
991 get 1053 get { return rigidBody; }
992 {
993 return rigidBody;
994 }
995 } 1054 }
1055
996 public override bool Flying 1056 public override bool Flying
997 { 1057 {
998 get 1058 get { return false; //no flying prims for you
999 {
1000 return false; //no flying prims for you
1001 }
1002 set
1003 {
1004
1005 } 1059 }
1060 set { }
1006 } 1061 }
1062
1007 public Boolean Physical 1063 public Boolean Physical
1008 { 1064 {
1009 get 1065 get { return _physical; }
1010 { 1066 set { _physical = value; }
1011 return _physical;
1012 }
1013 set
1014 {
1015 _physical = value;
1016 }
1017 } 1067 }
1068
1018 public void SetAcceleration(PhysicsVector accel) 1069 public void SetAcceleration(PhysicsVector accel)
1019 { 1070 {
1020 lock (BulletXScene.BulletXLock) 1071 lock (BulletXScene.BulletXLock)
@@ -1022,6 +1073,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1022 _acceleration = accel; 1073 _acceleration = accel;
1023 } 1074 }
1024 } 1075 }
1076
1025 public override bool Kinematic 1077 public override bool Kinematic
1026 { 1078 {
1027 get 1079 get
@@ -1034,36 +1086,38 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1034 //this._prim.Kinematic = value; 1086 //this._prim.Kinematic = value;
1035 } 1087 }
1036 } 1088 }
1089
1037 public override void AddForce(PhysicsVector force) 1090 public override void AddForce(PhysicsVector force)
1038 { 1091 {
1039
1040 } 1092 }
1093
1041 public override void SetMomentum(PhysicsVector momentum) 1094 public override void SetMomentum(PhysicsVector momentum)
1042 { 1095 {
1043
1044 } 1096 }
1097
1045 internal void ValidateHeight(float heighmapPositionValue) 1098 internal void ValidateHeight(float heighmapPositionValue)
1046 { 1099 {
1047 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z / 2.0f) 1100 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue + _size.Z/2.0f)
1048 { 1101 {
1049 Matrix m = rigidBody.WorldTransform; 1102 Matrix m = rigidBody.WorldTransform;
1050 MonoXnaCompactMaths.Vector3 v3 = m.Translation; 1103 Vector3 v3 = m.Translation;
1051 v3.Z = heighmapPositionValue + _size.Z / 2.0f; 1104 v3.Z = heighmapPositionValue + _size.Z/2.0f;
1052 m.Translation = v3; 1105 m.Translation = v3;
1053 rigidBody.WorldTransform = m; 1106 rigidBody.WorldTransform = m;
1054 //When a Prim touch the ground it's vertical velocity it's reduced to ZERO 1107 //When a Prim touch the ground it's vertical velocity it's reduced to ZERO
1055 //Static objects don't have linear velocity 1108 //Static objects don't have linear velocity
1056 if(_physical) 1109 if (_physical)
1057 Speed(new PhysicsVector(this.rigidBody.LinearVelocity.X, this.rigidBody.LinearVelocity.Y, 0.0f)); 1110 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
1058 } 1111 }
1059 } 1112 }
1113
1060 internal void UpdateKinetics() 1114 internal void UpdateKinetics()
1061 { 1115 {
1062 if (_physical) //Updates properties. Prim updates its properties physically 1116 if (_physical) //Updates properties. Prim updates its properties physically
1063 { 1117 {
1064 this._position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); 1118 _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
1065 this._velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); 1119 _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity);
1066 this._orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); 1120 _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation);
1067 } 1121 }
1068 else //Doesn't updates properties. That's a cancel 1122 else //Doesn't updates properties. That's a cancel
1069 { 1123 {
@@ -1074,35 +1128,41 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1074 } 1128 }
1075 1129
1076 #region Methods for updating values of RigidBody 1130 #region Methods for updating values of RigidBody
1131
1077 private void Translate() 1132 private void Translate()
1078 { 1133 {
1079 Translate(this._position); 1134 Translate(_position);
1080 } 1135 }
1136
1081 private void Translate(PhysicsVector _newPos) 1137 private void Translate(PhysicsVector _newPos)
1082 { 1138 {
1083 MonoXnaCompactMaths.Vector3 _translation; 1139 Vector3 _translation;
1084 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; 1140 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
1085 rigidBody.Translate(_translation); 1141 rigidBody.Translate(_translation);
1086 } 1142 }
1143
1087 private void Speed() 1144 private void Speed()
1088 { 1145 {
1089 Speed(this._velocity); 1146 Speed(_velocity);
1090 } 1147 }
1148
1091 private void Speed(PhysicsVector _newSpeed) 1149 private void Speed(PhysicsVector _newSpeed)
1092 { 1150 {
1093 MonoXnaCompactMaths.Vector3 _speed; 1151 Vector3 _speed;
1094 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); 1152 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
1095 rigidBody.LinearVelocity = _speed; 1153 rigidBody.LinearVelocity = _speed;
1096 } 1154 }
1155
1097 private void ReSize() 1156 private void ReSize()
1098 { 1157 {
1099 ReSize(this._size); 1158 ReSize(_size);
1100 } 1159 }
1160
1101 private void ReSize(PhysicsVector _newSize) 1161 private void ReSize(PhysicsVector _newSize)
1102 { 1162 {
1103 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't 1163 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
1104 //so i have to do it manually. That's recreating rigidbody 1164 //so i have to do it manually. That's recreating rigidbody
1105 MonoXnaCompactMaths.Vector3 _newsize; 1165 Vector3 _newsize;
1106 _newsize = BulletXMaths.PhysicsVectorToXnaVector3(_newSize); 1166 _newsize = BulletXMaths.PhysicsVectorToXnaVector3(_newSize);
1107 if ((_newsize.X == 0) || (_newsize.Y == 0) || (_newsize.Z == 0)) throw new Exception("Size 0"); 1167 if ((_newsize.X == 0) || (_newsize.Y == 0) || (_newsize.Z == 0)) throw new Exception("Size 0");
1108 1168
@@ -1114,67 +1174,77 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1114 Matrix _startTransform = Matrix.Identity; 1174 Matrix _startTransform = Matrix.Identity;
1115 Matrix _centerOfMassOffset = Matrix.Identity; 1175 Matrix _centerOfMassOffset = Matrix.Identity;
1116 RigidBody _tmpRigidBody; 1176 RigidBody _tmpRigidBody;
1117 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(this._position); 1177 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_position);
1118 //For now all prims are boxes 1178 //For now all prims are boxes
1119 CollisionShape _collisionShape = new XnaDevRu.BulletX.BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_newSize) / 2.0f); 1179 CollisionShape _collisionShape = new BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(_newSize)/2.0f);
1120 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 1180 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
1121 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 1181 Vector3 _localInertia = new Vector3();
1122 if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 1182 if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0
1123 _tmpRigidBody = new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 1183 _tmpRigidBody =
1184 new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping,
1185 _friction, _restitution);
1124 //rigidBody.ActivationState = ActivationState.DisableDeactivation; 1186 //rigidBody.ActivationState = ActivationState.DisableDeactivation;
1125 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition 1187 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition
1126 MonoXnaCompactMaths.Vector3 _vDebugTranslation; 1188 Vector3 _vDebugTranslation;
1127 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition; 1189 _vDebugTranslation = _startTransform.Translation - rigidBody.CenterOfMassPosition;
1128 _tmpRigidBody.Translate(_vDebugTranslation); 1190 _tmpRigidBody.Translate(_vDebugTranslation);
1129 //--- 1191 //---
1130 //There is a bug when trying to remove a rigidBody that is colliding with something.. 1192 //There is a bug when trying to remove a rigidBody that is colliding with something..
1131 try 1193 try
1132 { 1194 {
1133 this._parent_scene.ddWorld.RemoveRigidBody(rigidBody); 1195 _parent_scene.ddWorld.RemoveRigidBody(rigidBody);
1134 } 1196 }
1135 catch(Exception ex) 1197 catch (Exception ex)
1136 { 1198 {
1137 this._parent_scene.BulletXMessage(this._parent_scene.is_ex_message + ex.Message, true); 1199 _parent_scene.BulletXMessage(_parent_scene.is_ex_message + ex.Message, true);
1138 rigidBody.ActivationState = ActivationState.DisableSimulation; 1200 rigidBody.ActivationState = ActivationState.DisableSimulation;
1139 this._parent_scene.AddForgottenRigidBody(rigidBody); 1201 _parent_scene.AddForgottenRigidBody(rigidBody);
1140 } 1202 }
1141 rigidBody = _tmpRigidBody; 1203 rigidBody = _tmpRigidBody;
1142 this._parent_scene.ddWorld.AddRigidBody(rigidBody); 1204 _parent_scene.ddWorld.AddRigidBody(rigidBody);
1143 if (_physical) Speed();//Static objects don't have linear velocity 1205 if (_physical) Speed(); //Static objects don't have linear velocity
1144 ReOrient(); 1206 ReOrient();
1145 GC.Collect(); 1207 GC.Collect();
1146 } 1208 }
1209
1147 private void ReOrient() 1210 private void ReOrient()
1148 { 1211 {
1149 ReOrient(this._orientation); 1212 ReOrient(_orientation);
1150 } 1213 }
1214
1151 private void ReOrient(AxiomQuaternion _newOrient) 1215 private void ReOrient(AxiomQuaternion _newOrient)
1152 { 1216 {
1153 MonoXnaCompactMaths.Quaternion _newOrientation; 1217 Quaternion _newOrientation;
1154 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); 1218 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient);
1155 Matrix _comTransform = rigidBody.CenterOfMassTransform; 1219 Matrix _comTransform = rigidBody.CenterOfMassTransform;
1156 BulletXMaths.SetRotation(ref _comTransform, _newOrientation); 1220 BulletXMaths.SetRotation(ref _comTransform, _newOrientation);
1157 rigidBody.CenterOfMassTransform = _comTransform; 1221 rigidBody.CenterOfMassTransform = _comTransform;
1158 } 1222 }
1159 #endregion
1160 1223
1224 #endregion
1161 } 1225 }
1226
1162 /// <summary> 1227 /// <summary>
1163 /// This Class manage a HeighField as a RigidBody. This is for to be added in the BulletXScene 1228 /// This Class manage a HeighField as a RigidBody. This is for to be added in the BulletXScene
1164 /// </summary> 1229 /// </summary>
1165 internal class BulletXPlanet 1230 internal class BulletXPlanet
1166 { 1231 {
1167 private PhysicsVector _staticPosition; 1232 private PhysicsVector _staticPosition;
1168 private PhysicsVector _staticVelocity; 1233 private PhysicsVector _staticVelocity;
1169 private AxiomQuaternion _staticOrientation; 1234 private AxiomQuaternion _staticOrientation;
1170 private float _mass; 1235 private float _mass;
1171 private BulletXScene _parentscene; 1236 private BulletXScene _parentscene;
1172 internal float[] _heightField; 1237 internal float[] _heightField;
1173 private RigidBody _flatPlanet; 1238 private RigidBody _flatPlanet;
1174 internal RigidBody RigidBody { get { return _flatPlanet; } } 1239
1240 internal RigidBody RigidBody
1241 {
1242 get { return _flatPlanet; }
1243 }
1244
1175 internal BulletXPlanet(BulletXScene parent_scene, float[] heightField) 1245 internal BulletXPlanet(BulletXScene parent_scene, float[] heightField)
1176 { 1246 {
1177 _staticPosition = new PhysicsVector(BulletXScene.MaxXY / 2, BulletXScene.MaxXY/2, 0); 1247 _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0);
1178 _staticVelocity = new PhysicsVector(); 1248 _staticVelocity = new PhysicsVector();
1179 _staticOrientation = AxiomQuaternion.Identity; 1249 _staticOrientation = AxiomQuaternion.Identity;
1180 _mass = 0; //No active 1250 _mass = 0; //No active
@@ -1193,40 +1263,45 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1193 try 1263 try
1194 { 1264 {
1195 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_staticPosition); 1265 _startTransform.Translation = BulletXMaths.PhysicsVectorToXnaVector3(_staticPosition);
1196 CollisionShape _collisionShape = new HeightfieldTerrainShape(BulletXScene.MaxXY, BulletXScene.MaxXY, _heightField, (float)BulletXScene.MaxZ, 2, true, false); 1266 CollisionShape _collisionShape =
1267 new HeightfieldTerrainShape(BulletXScene.MaxXY, BulletXScene.MaxXY, _heightField,
1268 (float) BulletXScene.MaxZ, 2, true, false);
1197 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 1269 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
1198 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 1270 Vector3 _localInertia = new Vector3();
1199 //_collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 1271 //_collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0
1200 _flatPlanet = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 1272 _flatPlanet =
1273 new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping,
1274 _angularDamping, _friction, _restitution);
1201 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition 1275 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition
1202 MonoXnaCompactMaths.Vector3 _vDebugTranslation; 1276 Vector3 _vDebugTranslation;
1203 _vDebugTranslation = _startTransform.Translation - _flatPlanet.CenterOfMassPosition; 1277 _vDebugTranslation = _startTransform.Translation - _flatPlanet.CenterOfMassPosition;
1204 _flatPlanet.Translate(_vDebugTranslation); 1278 _flatPlanet.Translate(_vDebugTranslation);
1205 parent_scene.ddWorld.AddRigidBody(_flatPlanet); 1279 parent_scene.ddWorld.AddRigidBody(_flatPlanet);
1206 } 1280 }
1207 catch (Exception ex) 1281 catch (Exception ex)
1208 { 1282 {
1209 this._parentscene.BulletXMessage(ex.Message, true); 1283 _parentscene.BulletXMessage(ex.Message, true);
1210 } 1284 }
1211 } 1285 }
1212 this._parentscene.BulletXMessage("BulletXPlanet created.", false); 1286 _parentscene.BulletXMessage("BulletXPlanet created.", false);
1213 } 1287 }
1214 internal float HeightValue(MonoXnaCompactMaths.Vector3 position) 1288
1289 internal float HeightValue(Vector3 position)
1215 { 1290 {
1216 int li_x, li_y; 1291 int li_x, li_y;
1217 float height; 1292 float height;
1218 li_x = (int)Math.Round(position.X); 1293 li_x = (int) Math.Round(position.X);
1219 if (li_x < 0) li_x = 0; 1294 if (li_x < 0) li_x = 0;
1220 if (li_x >= BulletXScene.MaxXY) li_x = BulletXScene.MaxXY - 1; 1295 if (li_x >= BulletXScene.MaxXY) li_x = BulletXScene.MaxXY - 1;
1221 li_y = (int)Math.Round(position.Y); 1296 li_y = (int) Math.Round(position.Y);
1222 if (li_y < 0) li_y = 0; 1297 if (li_y < 0) li_y = 0;
1223 if (li_y >= BulletXScene.MaxXY) li_y = BulletXScene.MaxXY - 1; 1298 if (li_y >= BulletXScene.MaxXY) li_y = BulletXScene.MaxXY - 1;
1224 1299
1225 height = ((HeightfieldTerrainShape)this._flatPlanet.CollisionShape).getHeightFieldValue(li_x, li_y); 1300 height = ((HeightfieldTerrainShape) _flatPlanet.CollisionShape).getHeightFieldValue(li_x, li_y);
1226 if (height < 0) height = 0; 1301 if (height < 0) height = 0;
1227 else if (height > BulletXScene.MaxZ) height = BulletXScene.MaxZ; 1302 else if (height > BulletXScene.MaxZ) height = BulletXScene.MaxZ;
1228 1303
1229 return height; 1304 return height;
1230 } 1305 }
1231 } 1306 }
1232} 1307} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 2355e91..c213b64 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -27,24 +27,26 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("PhysicsManager")] 37[assembly : AssemblyTitle("PhysicsManager")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysicsManager")] 41[assembly : AssemblyProduct("PhysicsManager")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 0fa7455..b59c13a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -30,7 +30,9 @@ using Axiom.Math;
30namespace OpenSim.Region.Physics.Manager 30namespace OpenSim.Region.Physics.Manager
31{ 31{
32 public delegate void PositionUpdate(PhysicsVector position); 32 public delegate void PositionUpdate(PhysicsVector position);
33
33 public delegate void VelocityUpdate(PhysicsVector velocity); 34 public delegate void VelocityUpdate(PhysicsVector velocity);
35
34 public delegate void OrientationUpdate(Quaternion orientation); 36 public delegate void OrientationUpdate(Quaternion orientation);
35 37
36 public abstract class PhysicsActor 38 public abstract class PhysicsActor
@@ -43,52 +45,22 @@ namespace OpenSim.Region.Physics.Manager
43 45
44 public static PhysicsActor Null 46 public static PhysicsActor Null
45 { 47 {
46 get 48 get { return new NullPhysicsActor(); }
47 {
48 return new NullPhysicsActor();
49 }
50 } 49 }
51 50
52 public abstract PhysicsVector Size 51 public abstract PhysicsVector Size { get; set; }
53 {
54 get;
55 set;
56 }
57 52
58 public abstract PhysicsVector Position 53 public abstract PhysicsVector Position { get; set; }
59 {
60 get;
61 set;
62 }
63 54
64 public abstract PhysicsVector Velocity 55 public abstract PhysicsVector Velocity { get; set; }
65 {
66 get;
67 set;
68 }
69 56
70 public abstract PhysicsVector Acceleration 57 public abstract PhysicsVector Acceleration { get; }
71 {
72 get;
73 }
74 58
75 public abstract Quaternion Orientation 59 public abstract Quaternion Orientation { get; set; }
76 {
77 get;
78 set;
79 }
80 60
81 public abstract bool Flying 61 public abstract bool Flying { get; set; }
82 {
83 get;
84 set;
85 }
86 62
87 public abstract bool Kinematic 63 public abstract bool Kinematic { get; set; }
88 {
89 get;
90 set;
91 }
92 64
93 public abstract void AddForce(PhysicsVector force); 65 public abstract void AddForce(PhysicsVector force);
94 66
@@ -99,50 +71,26 @@ namespace OpenSim.Region.Physics.Manager
99 { 71 {
100 public override PhysicsVector Position 72 public override PhysicsVector Position
101 { 73 {
102 get 74 get { return PhysicsVector.Zero; }
103 { 75 set { return; }
104 return PhysicsVector.Zero;
105 }
106 set
107 {
108 return;
109 }
110 } 76 }
111 77
112 public override PhysicsVector Size 78 public override PhysicsVector Size
113 { 79 {
114 get 80 get { return PhysicsVector.Zero; }
115 { 81 set { return; }
116 return PhysicsVector.Zero;
117 }
118 set
119 {
120 return;
121 }
122 } 82 }
123 83
124 public override PhysicsVector Velocity 84 public override PhysicsVector Velocity
125 { 85 {
126 get 86 get { return PhysicsVector.Zero; }
127 { 87 set { return; }
128 return PhysicsVector.Zero;
129 }
130 set
131 {
132 return;
133 }
134 } 88 }
135 89
136 public override Quaternion Orientation 90 public override Quaternion Orientation
137 { 91 {
138 get 92 get { return Quaternion.Identity; }
139 { 93 set { }
140 return Quaternion.Identity;
141 }
142 set
143 {
144
145 }
146 } 94 }
147 95
148 public override PhysicsVector Acceleration 96 public override PhysicsVector Acceleration
@@ -152,26 +100,14 @@ namespace OpenSim.Region.Physics.Manager
152 100
153 public override bool Flying 101 public override bool Flying
154 { 102 {
155 get 103 get { return false; }
156 { 104 set { return; }
157 return false;
158 }
159 set
160 {
161 return;
162 }
163 } 105 }
164 106
165 public override bool Kinematic 107 public override bool Kinematic
166 { 108 {
167 get 109 get { return true; }
168 { 110 set { return; }
169 return true;
170 }
171 set
172 {
173 return;
174 }
175 } 111 }
176 112
177 public override void AddForce(PhysicsVector force) 113 public override void AddForce(PhysicsVector force)
@@ -184,4 +120,4 @@ namespace OpenSim.Region.Physics.Manager
184 return; 120 return;
185 } 121 }
186 } 122 }
187} 123} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 81bc938..09ebf29 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -33,77 +33,77 @@ using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Region.Physics.Manager 34namespace OpenSim.Region.Physics.Manager
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Description of MyClass. 37 /// Description of MyClass.
38 /// </summary> 38 /// </summary>
39 public class PhysicsPluginManager 39 public class PhysicsPluginManager
40 { 40 {
41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); 41 private Dictionary<string, IPhysicsPlugin> _plugins = new Dictionary<string, IPhysicsPlugin>();
42 42
43 public PhysicsPluginManager() 43 public PhysicsPluginManager()
44 { 44 {
45 45 }
46 } 46
47 47 public PhysicsScene GetPhysicsScene(string engineName)
48 public PhysicsScene GetPhysicsScene(string engineName) 48 {
49 {
50 if (String.IsNullOrEmpty(engineName)) 49 if (String.IsNullOrEmpty(engineName))
51 { 50 {
52 return PhysicsScene.Null; 51 return PhysicsScene.Null;
53 } 52 }
54 53
55 if(_plugins.ContainsKey(engineName)) 54 if (_plugins.ContainsKey(engineName))
56 { 55 {
57 MainLog.Instance.Verbose("PHYSICS","creating "+engineName); 56 MainLog.Instance.Verbose("PHYSICS", "creating " + engineName);
58 return _plugins[engineName].GetScene(); 57 return _plugins[engineName].GetScene();
59 } 58 }
60 else 59 else
61 { 60 {
62 MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName); 61 MainLog.Instance.Warn("PHYSICS", "couldn't find physicsEngine: {0}", engineName);
63 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); 62 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", engineName));
64 } 63 }
65 } 64 }
66 65
67 public void LoadPlugins() 66 public void LoadPlugins()
68 { 67 {
69 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics"); 68 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics");
70 string[] pluginFiles = Directory.GetFiles(path, "*.dll"); 69 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
71 70
72 71
73 for(int i= 0; i<pluginFiles.Length; i++) 72 for (int i = 0; i < pluginFiles.Length; i++)
74 { 73 {
75 this.AddPlugin(pluginFiles[i]); 74 AddPlugin(pluginFiles[i]);
76 } 75 }
77 } 76 }
78 77
79 private void AddPlugin(string FileName) 78 private void AddPlugin(string FileName)
80 { 79 {
81 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 80 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
82 81
83 foreach (Type pluginType in pluginAssembly.GetTypes()) 82 foreach (Type pluginType in pluginAssembly.GetTypes())
84 { 83 {
85 if (pluginType.IsPublic) 84 if (pluginType.IsPublic)
86 { 85 {
87 if (!pluginType.IsAbstract) 86 if (!pluginType.IsAbstract)
88 { 87 {
89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); 88 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
90 89
91 if (typeInterface != null) 90 if (typeInterface != null)
92 { 91 {
93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 92 IPhysicsPlugin plug =
94 plug.Init(); 93 (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
95 this._plugins.Add(plug.GetName(),plug); 94 plug.Init();
96 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS","Added physics engine: " + plug.GetName()); 95 _plugins.Add(plug.GetName(), plug);
97 96 MainLog.Instance.Verbose("PHYSICS", "Added physics engine: " + plug.GetName());
98 } 97 }
99 98
100 typeInterface = null; 99 typeInterface = null;
101 } 100 }
102 } 101 }
103 } 102 }
104 103
105 pluginAssembly = null; 104 pluginAssembly = null;
106 } 105 }
106
107 //--- 107 //---
108 public static void PhysicsPluginMessage(string message, bool isWarning) 108 public static void PhysicsPluginMessage(string message, bool isWarning)
109 { 109 {
@@ -116,14 +116,15 @@ namespace OpenSim.Region.Physics.Manager
116 MainLog.Instance.Verbose("PHYSICS", message); 116 MainLog.Instance.Verbose("PHYSICS", message);
117 } 117 }
118 } 118 }
119
119 //--- 120 //---
120 } 121 }
121 122
122 public interface IPhysicsPlugin 123 public interface IPhysicsPlugin
123 { 124 {
124 bool Init(); 125 bool Init();
125 PhysicsScene GetScene(); 126 PhysicsScene GetScene();
126 string GetName(); 127 string GetName();
127 void Dispose(); 128 void Dispose();
128 } 129 }
129} 130} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 9ab2997..3f08234 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -25,9 +25,9 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Axiom.Math;
28using OpenSim.Framework; 29using OpenSim.Framework;
29using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
30using Axiom.Math;
31 31
32namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.Physics.Manager
33{ 33{
@@ -35,10 +35,7 @@ namespace OpenSim.Region.Physics.Manager
35 { 35 {
36 public static PhysicsScene Null 36 public static PhysicsScene Null
37 { 37 {
38 get 38 get { return new NullPhysicsScene(); }
39 {
40 return new NullPhysicsScene();
41 }
42 } 39 }
43 40
44 public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position); 41 public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position);
@@ -47,7 +44,8 @@ namespace OpenSim.Region.Physics.Manager
47 44
48 public abstract void RemovePrim(PhysicsActor prim); 45 public abstract void RemovePrim(PhysicsActor prim);
49 46
50 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation); 47 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
48 PhysicsVector size, Quaternion rotation);
51 49
52 public abstract void Simulate(float timeStep); 50 public abstract void Simulate(float timeStep);
53 51
@@ -57,10 +55,7 @@ namespace OpenSim.Region.Physics.Manager
57 55
58 public abstract void DeleteTerrain(); 56 public abstract void DeleteTerrain();
59 57
60 public abstract bool IsThreaded 58 public abstract bool IsThreaded { get; }
61 {
62 get;
63 }
64 59
65 private class NullPhysicsScene : PhysicsScene 60 private class NullPhysicsScene : PhysicsScene
66 { 61 {
@@ -74,12 +69,10 @@ namespace OpenSim.Region.Physics.Manager
74 69
75 public override void RemoveAvatar(PhysicsActor actor) 70 public override void RemoveAvatar(PhysicsActor actor)
76 { 71 {
77
78 } 72 }
79 73
80 public override void RemovePrim(PhysicsActor prim) 74 public override void RemovePrim(PhysicsActor prim)
81 { 75 {
82
83 } 76 }
84 77
85/* 78/*
@@ -89,7 +82,9 @@ namespace OpenSim.Region.Physics.Manager
89 return PhysicsActor.Null; 82 return PhysicsActor.Null;
90 } 83 }
91*/ 84*/
92 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) 85
86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
87 PhysicsVector size, Quaternion rotation)
93 { 88 {
94 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); 89 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
95 return PhysicsActor.Null; 90 return PhysicsActor.Null;
@@ -97,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager
97 92
98 public override void Simulate(float timeStep) 93 public override void Simulate(float timeStep)
99 { 94 {
100 m_workIndicator = (m_workIndicator + 1) % 10; 95 m_workIndicator = (m_workIndicator + 1)%10;
101 96
102 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); 97 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString());
103 } 98 }
@@ -114,7 +109,6 @@ namespace OpenSim.Region.Physics.Manager
114 109
115 public override void DeleteTerrain() 110 public override void DeleteTerrain()
116 { 111 {
117
118 } 112 }
119 113
120 public override bool IsThreaded 114 public override bool IsThreaded
@@ -123,4 +117,4 @@ namespace OpenSim.Region.Physics.Manager
123 } 117 }
124 } 118 }
125 } 119 }
126} 120} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index 722c5dd..7de37e4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Physics.Manager
35 35
36 public PhysicsVector() 36 public PhysicsVector()
37 { 37 {
38
39 } 38 }
40 39
41 public PhysicsVector(float x, float y, float z) 40 public PhysicsVector(float x, float y, float z)
@@ -49,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager
49 48
50 public override string ToString() 49 public override string ToString()
51 { 50 {
52 return "<" + this.X + "," + this.Y + "," + this.Z + ">"; 51 return "<" + X + "," + Y + "," + Z + ">";
53 } 52 }
54 } 53 }
55} 54} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
index 3f840cc..d110a17 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
@@ -27,24 +27,26 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("RealPhysXplugin")] 37[assembly : AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 41[assembly : AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs
index 2ace097..13184e2 100644
--- a/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Meshing/HelperTypes.cs
@@ -27,10 +27,9 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Globalization;
31using System.Diagnostics;
32using System.Collections.Generic; 30using System.Collections.Generic;
33 31using System.Diagnostics;
32using System.Globalization;
34using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
35 34
36public class Vertex : IComparable<Vertex> 35public class Vertex : IComparable<Vertex>
@@ -76,8 +75,6 @@ public class Vertex : IComparable<Vertex>
76 { 75 {
77 return me.CompareTo(other) < 0; 76 return me.CompareTo(other) < 0;
78 } 77 }
79
80
81} 78}
82 79
83public class Simplex : IComparable<Simplex> 80public class Simplex : IComparable<Simplex>
@@ -122,8 +119,7 @@ public class Simplex : IComparable<Simplex>
122 119
123 return 0; 120 return 0;
124 } 121 }
125 122} ;
126};
127 123
128public class Triangle 124public class Triangle
129{ 125{
@@ -131,9 +127,9 @@ public class Triangle
131 public Vertex v2; 127 public Vertex v2;
132 public Vertex v3; 128 public Vertex v3;
133 129
134 float radius_square; 130 private float radius_square;
135 float cx; 131 private float cx;
136 float cy; 132 private float cy;
137 133
138 public Triangle(Vertex _v1, Vertex _v2, Vertex _v3) 134 public Triangle(Vertex _v1, Vertex _v2, Vertex _v3)
139 { 135 {
@@ -149,18 +145,18 @@ public class Triangle
149 float dx, dy; 145 float dx, dy;
150 float dd; 146 float dd;
151 147
152 dx = x - this.cx; 148 dx = x - cx;
153 dy = y - this.cy; 149 dy = y - cy;
154 150
155 dd = dx * dx + dy * dy; 151 dd = dx*dx + dy*dy;
156 if (dd < this.radius_square) 152 if (dd < radius_square)
157 return true; 153 return true;
158 else 154 else
159 return false; 155 return false;
160 } 156 }
161 157
162 158
163 void CalcCircle() 159 private void CalcCircle()
164 { 160 {
165 // Calculate the center and the radius of a circle given by three points p1, p2, p3 161 // Calculate the center and the radius of a circle given by three points p1, p2, p3
166 // It is assumed, that the triangles vertices are already set correctly 162 // It is assumed, that the triangles vertices are already set correctly
@@ -198,8 +194,8 @@ public class Triangle
198 p3y = v3.point.Y; 194 p3y = v3.point.Y;
199 195
200 /* calc helping values first */ 196 /* calc helping values first */
201 c1 = (p1x * p1x + p1y * p1y - p2x * p2x - p2y * p2y) / 2; 197 c1 = (p1x*p1x + p1y*p1y - p2x*p2x - p2y*p2y)/2;
202 c2 = (p1x * p1x + p1y * p1y - p3x * p3x - p3y * p3y) / 2; 198 c2 = (p1x*p1x + p1y*p1y - p3x*p3x - p3y*p3y)/2;
203 199
204 v1x = p1x - p2x; 200 v1x = p1x - p2x;
205 v1y = p1y - p2y; 201 v1y = p1y - p2y;
@@ -207,35 +203,34 @@ public class Triangle
207 v2x = p1x - p3x; 203 v2x = p1x - p3x;
208 v2y = p1y - p3y; 204 v2y = p1y - p3y;
209 205
210 z = (c1 * v2x - c2 * v1x); 206 z = (c1*v2x - c2*v1x);
211 n = (v1y * v2x - v2y * v1x); 207 n = (v1y*v2x - v2y*v1x);
212 208
213 if (n == 0.0) // This is no triangle, i.e there are (at least) two points at the same location 209 if (n == 0.0) // This is no triangle, i.e there are (at least) two points at the same location
214 { 210 {
215 radius_square = 0.0f; 211 radius_square = 0.0f;
216 return; 212 return;
217 } 213 }
218 214
219 this.cy = (float)(z / n); 215 cy = (float) (z/n);
220 216
221 if (v2x != 0.0) 217 if (v2x != 0.0)
222 { 218 {
223 this.cx = (float)((c2 - v2y * this.cy) / v2x); 219 cx = (float) ((c2 - v2y*cy)/v2x);
224 } 220 }
225 else if (v1x != 0.0) 221 else if (v1x != 0.0)
226 { 222 {
227 this.cx = (float)((c1 - v1y * this.cy) / v1x); 223 cx = (float) ((c1 - v1y*cy)/v1x);
228 } 224 }
229 else 225 else
230 { 226 {
231 Debug.Assert(false, "Malformed triangle"); /* Both terms zero means nothing good */ 227 Debug.Assert(false, "Malformed triangle"); /* Both terms zero means nothing good */
232 } 228 }
233 229
234 rx = (p1x - this.cx); 230 rx = (p1x - cx);
235 ry = (p1y - this.cy); 231 ry = (p1y - cy);
236
237 this.radius_square = (float)(rx * rx + ry * ry);
238 232
233 radius_square = (float) (rx*rx + ry*ry);
239 } 234 }
240 235
241 public List<Simplex> GetSimplices() 236 public List<Simplex> GetSimplices()
@@ -254,17 +249,18 @@ public class Triangle
254 249
255 public override String ToString() 250 public override String ToString()
256 { 251 {
257
258 NumberFormatInfo nfi = new NumberFormatInfo(); 252 NumberFormatInfo nfi = new NumberFormatInfo();
259 nfi.CurrencyDecimalDigits = 2; 253 nfi.CurrencyDecimalDigits = 2;
260 nfi.CurrencyDecimalSeparator = "."; 254 nfi.CurrencyDecimalSeparator = ".";
261 255
262 String s1 = "<" + v1.point.X.ToString(nfi) + "," + v1.point.Y.ToString(nfi) + "," + v1.point.Z.ToString(nfi) + ">"; 256 String s1 = "<" + v1.point.X.ToString(nfi) + "," + v1.point.Y.ToString(nfi) + "," + v1.point.Z.ToString(nfi) +
263 String s2 = "<" + v2.point.X.ToString(nfi) + "," + v2.point.Y.ToString(nfi) + "," + v2.point.Z.ToString(nfi) + ">"; 257 ">";
264 String s3 = "<" + v3.point.X.ToString(nfi) + "," + v3.point.Y.ToString(nfi) + "," + v3.point.Z.ToString(nfi) + ">"; 258 String s2 = "<" + v2.point.X.ToString(nfi) + "," + v2.point.Y.ToString(nfi) + "," + v2.point.Z.ToString(nfi) +
259 ">";
260 String s3 = "<" + v3.point.X.ToString(nfi) + "," + v3.point.Y.ToString(nfi) + "," + v3.point.Z.ToString(nfi) +
261 ">";
265 262
266 return s1 + ";" + s2 + ";" + s3; 263 return s1 + ";" + s2 + ";" + s3;
267
268 } 264 }
269 265
270 public PhysicsVector getNormal() 266 public PhysicsVector getNormal()
@@ -281,12 +277,12 @@ public class Triangle
281 // Cross product for normal 277 // Cross product for normal
282 PhysicsVector n = new PhysicsVector(); 278 PhysicsVector n = new PhysicsVector();
283 float nx, ny, nz; 279 float nx, ny, nz;
284 n.X = e1.Y * e2.Z - e1.Z * e2.Y; 280 n.X = e1.Y*e2.Z - e1.Z*e2.Y;
285 n.Y = e1.Z * e2.X - e1.X * e2.Z; 281 n.Y = e1.Z*e2.X - e1.X*e2.Z;
286 n.Z = e1.X * e2.Y - e1.Y * e2.X; 282 n.Z = e1.X*e2.Y - e1.Y*e2.X;
287 283
288 // Length 284 // Length
289 float l = (float)Math.Sqrt(n.X * n.X + n.Y * n.Y + n.Z * n.Z); 285 float l = (float) Math.Sqrt(n.X*n.X + n.Y*n.Y + n.Z*n.Z);
290 286
291 // Normalized "normal" 287 // Normalized "normal"
292 n.X /= l; 288 n.X /= l;
@@ -303,6 +299,4 @@ public class Triangle
303 v1 = v2; 299 v1 = v2;
304 v2 = vt; 300 v2 = vt;
305 } 301 }
306} 302} \ No newline at end of file
307
308
diff --git a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs
index dd18e24..46de15e 100644
--- a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs
@@ -27,12 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Globalization;
31using System.Diagnostics;
32using System.Collections.Generic; 30using System.Collections.Generic;
33using System.Text;
34using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
35
36using OpenSim.Framework; 32using OpenSim.Framework;
37using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
38 34
@@ -75,14 +71,14 @@ namespace OpenSim.Region.Physics.OdePlugin
75 71
76 public float[] getVertexListAsFloat() 72 public float[] getVertexListAsFloat()
77 { 73 {
78 float[] result = new float[vertices.Count * 3]; 74 float[] result = new float[vertices.Count*3];
79 for (int i = 0; i < vertices.Count; i++) 75 for (int i = 0; i < vertices.Count; i++)
80 { 76 {
81 Vertex v = vertices[i]; 77 Vertex v = vertices[i];
82 PhysicsVector point = v.point; 78 PhysicsVector point = v.point;
83 result[3 * i + 0] = point.X; 79 result[3*i + 0] = point.X;
84 result[3 * i + 1] = point.Y; 80 result[3*i + 1] = point.Y;
85 result[3 * i + 2] = point.Z; 81 result[3*i + 2] = point.Z;
86 } 82 }
87 GCHandle.Alloc(result, GCHandleType.Pinned); 83 GCHandle.Alloc(result, GCHandleType.Pinned);
88 return result; 84 return result;
@@ -90,13 +86,13 @@ namespace OpenSim.Region.Physics.OdePlugin
90 86
91 public int[] getIndexListAsInt() 87 public int[] getIndexListAsInt()
92 { 88 {
93 int[] result = new int[triangles.Count * 3]; 89 int[] result = new int[triangles.Count*3];
94 for (int i = 0; i < triangles.Count; i++) 90 for (int i = 0; i < triangles.Count; i++)
95 { 91 {
96 Triangle t = triangles[i]; 92 Triangle t = triangles[i];
97 result[3 * i + 0] = vertices.IndexOf(t.v1); 93 result[3*i + 0] = vertices.IndexOf(t.v1);
98 result[3 * i + 1] = vertices.IndexOf(t.v2); 94 result[3*i + 1] = vertices.IndexOf(t.v2);
99 result[3 * i + 2] = vertices.IndexOf(t.v3); 95 result[3*i + 2] = vertices.IndexOf(t.v3);
100 } 96 }
101 GCHandle.Alloc(result, GCHandleType.Pinned); 97 GCHandle.Alloc(result, GCHandleType.Pinned);
102 return result; 98 return result;
@@ -110,16 +106,13 @@ namespace OpenSim.Region.Physics.OdePlugin
110 106
111 foreach (Triangle t in newMesh.triangles) 107 foreach (Triangle t in newMesh.triangles)
112 Add(t); 108 Add(t);
113
114 } 109 }
115 } 110 }
116 111
117 112
118
119 public class Meshmerizer 113 public class Meshmerizer
120 { 114 {
121 115 private static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v)
122 static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v)
123 { 116 {
124 List<Triangle> influenced = new List<Triangle>(); 117 List<Triangle> influenced = new List<Triangle>();
125 foreach (Triangle t in triangles) 118 foreach (Triangle t in triangles)
@@ -133,9 +126,10 @@ namespace OpenSim.Region.Physics.OdePlugin
133 } 126 }
134 return influenced; 127 return influenced;
135 } 128 }
136 129
137 130
138 static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles, List<int> innerBorders) 131 private static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles,
132 List<int> innerBorders)
139 { 133 {
140 // This is a variant of the delaunay algorithm 134 // This is a variant of the delaunay algorithm
141 // each time a new vertex is inserted, all triangles that are influenced by it are deleted 135 // each time a new vertex is inserted, all triangles that are influenced by it are deleted
@@ -143,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
143 // It is not very time efficient but easy to implement. 137 // It is not very time efficient but easy to implement.
144 138
145 int iCurrentVertex; 139 int iCurrentVertex;
146 int iMaxVertex=vertices.Count; 140 int iMaxVertex = vertices.Count;
147 for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++) 141 for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++)
148 { 142 {
149 // Background: A triangle mesh fulfills the delaunay condition if (iff!) 143 // Background: A triangle mesh fulfills the delaunay condition if (iff!)
@@ -154,8 +148,8 @@ namespace OpenSim.Region.Physics.OdePlugin
154 // do not fulfill this condition with respect to the new triangle 148 // do not fulfill this condition with respect to the new triangle
155 149
156 // Find the triangles that are influenced by the new vertex 150 // Find the triangles that are influenced by the new vertex
157 Vertex v=vertices[iCurrentVertex]; 151 Vertex v = vertices[iCurrentVertex];
158 List<Triangle> influencedTriangles=FindInfluencedTriangles(triangles, v); 152 List<Triangle> influencedTriangles = FindInfluencedTriangles(triangles, v);
159 153
160 List<Simplex> simplices = new List<Simplex>(); 154 List<Simplex> simplices = new List<Simplex>();
161 155
@@ -175,10 +169,10 @@ namespace OpenSim.Region.Physics.OdePlugin
175 // Look for duplicate simplices here. 169 // Look for duplicate simplices here.
176 // Remember, they are directly side by side in the list right now 170 // Remember, they are directly side by side in the list right now
177 int iSimplex; 171 int iSimplex;
178 List<Simplex> innerSimplices=new List<Simplex>(); 172 List<Simplex> innerSimplices = new List<Simplex>();
179 for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards 173 for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards
180 { 174 {
181 if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex])==0) 175 if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex]) == 0)
182 { 176 {
183 innerSimplices.Add(simplices[iSimplex - 1]); 177 innerSimplices.Add(simplices[iSimplex - 1]);
184 innerSimplices.Add(simplices[iSimplex]); 178 innerSimplices.Add(simplices[iSimplex]);
@@ -187,7 +181,7 @@ namespace OpenSim.Region.Physics.OdePlugin
187 181
188 foreach (Simplex s in innerSimplices) 182 foreach (Simplex s in innerSimplices)
189 { 183 {
190 simplices.Remove(s); 184 simplices.Remove(s);
191 } 185 }
192 186
193 // each simplex still in the list belongs to the hull of the region in question 187 // each simplex still in the list belongs to the hull of the region in question
@@ -210,7 +204,7 @@ namespace OpenSim.Region.Physics.OdePlugin
210 foreach (Triangle t in triangles) 204 foreach (Triangle t in triangles)
211 { 205 {
212 if ( 206 if (
213 innerBorders.Contains(vertices.IndexOf(t.v1)) 207 innerBorders.Contains(vertices.IndexOf(t.v1))
214 && innerBorders.Contains(vertices.IndexOf(t.v2)) 208 && innerBorders.Contains(vertices.IndexOf(t.v2))
215 && innerBorders.Contains(vertices.IndexOf(t.v3)) 209 && innerBorders.Contains(vertices.IndexOf(t.v3))
216 ) 210 )
@@ -223,18 +217,18 @@ namespace OpenSim.Region.Physics.OdePlugin
223 } 217 }
224 218
225 219
226 static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size) 220 private static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size)
227 // Builds the x (+ and -) surfaces of a box shaped prim 221 // Builds the x (+ and -) surfaces of a box shaped prim
228 { 222 {
229 UInt16 hollowFactor = primShape.ProfileHollow; 223 UInt16 hollowFactor = primShape.ProfileHollow;
230 Mesh meshMX = new Mesh(); 224 Mesh meshMX = new Mesh();
231 225
232 226
233 // Surface 0, -X 227 // Surface 0, -X
234 meshMX.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 228 meshMX.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
235 meshMX.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 229 meshMX.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
236 meshMX.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); 230 meshMX.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f));
237 meshMX.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); 231 meshMX.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f));
238 232
239 meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1])); 233 meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1]));
240 meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3])); 234 meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3]));
@@ -242,10 +236,10 @@ namespace OpenSim.Region.Physics.OdePlugin
242 236
243 Mesh meshPX = new Mesh(); 237 Mesh meshPX = new Mesh();
244 // Surface 1, +X 238 // Surface 1, +X
245 meshPX.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 239 meshPX.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
246 meshPX.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 240 meshPX.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
247 meshPX.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); 241 meshPX.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f));
248 meshPX.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); 242 meshPX.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f));
249 243
250 244
251 meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2])); 245 meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2]));
@@ -254,17 +248,17 @@ namespace OpenSim.Region.Physics.OdePlugin
254 248
255 if (hollowFactor > 0) 249 if (hollowFactor > 0)
256 { 250 {
257 float hollowFactorF = (float)hollowFactor / (float)50000; 251 float hollowFactorF = (float) hollowFactor/(float) 50000;
258 252
259 Vertex IPP; 253 Vertex IPP;
260 Vertex IPM; 254 Vertex IPM;
261 Vertex IMP; 255 Vertex IMP;
262 Vertex IMM; 256 Vertex IMM;
263 257
264 IPP = new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 258 IPP = new Vertex("Inner-X+Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
265 IPM = new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 259 IPM = new Vertex("Inner-X+Y-Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
266 IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 260 IMP = new Vertex("Inner-X-Y+Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
267 IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 261 IMM = new Vertex("Inner-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
268 262
269 meshMX.Add(IPP); 263 meshMX.Add(IPP);
270 meshMX.Add(IPM); 264 meshMX.Add(IPM);
@@ -280,11 +274,10 @@ namespace OpenSim.Region.Physics.OdePlugin
280 } 274 }
281 275
282 276
283 277 IPP = new Vertex("Inner+X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
284 IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 278 IPM = new Vertex("Inner+X+Y-Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
285 IPM = new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 279 IMP = new Vertex("Inner+X-Y+Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
286 IMP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 280 IMM = new Vertex("Inner+X-Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
287 IMM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f);
288 281
289 meshPX.Add(IPP); 282 meshPX.Add(IPP);
290 meshPX.Add(IPM); 283 meshPX.Add(IPM);
@@ -308,18 +301,17 @@ namespace OpenSim.Region.Physics.OdePlugin
308 } 301 }
309 302
310 303
311 304 private static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size)
312 static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size) 305 // Builds the y (+ and -) surfaces of a box shaped prim
313 // Builds the y (+ and -) surfaces of a box shaped prim
314 { 306 {
315 UInt16 hollowFactor = primShape.ProfileHollow; 307 UInt16 hollowFactor = primShape.ProfileHollow;
316 308
317 // (M)inus Y 309 // (M)inus Y
318 Mesh MeshMY = new Mesh(); 310 Mesh MeshMY = new Mesh();
319 MeshMY.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 311 MeshMY.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
320 MeshMY.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 312 MeshMY.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
321 MeshMY.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); 313 MeshMY.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f));
322 MeshMY.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); 314 MeshMY.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, +size.Z/2.0f));
323 315
324 MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2])); 316 MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2]));
325 MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3])); 317 MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3]));
@@ -327,27 +319,27 @@ namespace OpenSim.Region.Physics.OdePlugin
327 // (P)lus Y 319 // (P)lus Y
328 Mesh MeshPY = new Mesh(); 320 Mesh MeshPY = new Mesh();
329 321
330 MeshPY.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 322 MeshPY.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
331 MeshPY.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 323 MeshPY.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
332 MeshPY.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); 324 MeshPY.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f));
333 MeshPY.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); 325 MeshPY.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, +size.Z/2.0f));
334 326
335 MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2])); 327 MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2]));
336 MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3])); 328 MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3]));
337 329
338 if (hollowFactor > 0) 330 if (hollowFactor > 0)
339 { 331 {
340 float hollowFactorF = (float)hollowFactor / (float)50000; 332 float hollowFactorF = (float) hollowFactor/(float) 50000;
341 333
342 Vertex IPP; 334 Vertex IPP;
343 Vertex IPM; 335 Vertex IPM;
344 Vertex IMP; 336 Vertex IMP;
345 Vertex IMM; 337 Vertex IMM;
346 338
347 IPP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 339 IPP = new Vertex("Inner+X-Y+Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
348 IPM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 340 IPM = new Vertex("Inner+X-Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
349 IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 341 IMP = new Vertex("Inner-X-Y+Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
350 IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 342 IMM = new Vertex("Inner-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
351 343
352 MeshMY.Add(IPP); 344 MeshMY.Add(IPP);
353 MeshMY.Add(IPM); 345 MeshMY.Add(IPM);
@@ -363,11 +355,10 @@ namespace OpenSim.Region.Physics.OdePlugin
363 } 355 }
364 356
365 357
366 358 IPP = new Vertex("Inner+X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
367 IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 359 IPM = new Vertex("Inner+X+Y-Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
368 IPM=new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); 360 IMP = new Vertex("Inner-X+Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, +size.Z/2.0f);
369 IMP=new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); 361 IMM = new Vertex("Inner-X+Y-Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, -size.Z/2.0f);
370 IMM=new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f);
371 362
372 MeshPY.Add(IPP); 363 MeshPY.Add(IPP);
373 MeshPY.Add(IPM); 364 MeshPY.Add(IPM);
@@ -381,9 +372,6 @@ namespace OpenSim.Region.Physics.OdePlugin
381 { 372 {
382 PhysicsVector n = t.getNormal(); 373 PhysicsVector n = t.getNormal();
383 } 374 }
384
385
386
387 } 375 }
388 376
389 377
@@ -393,9 +381,9 @@ namespace OpenSim.Region.Physics.OdePlugin
393 381
394 return result; 382 return result;
395 } 383 }
396 384
397 static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size) 385 private static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size)
398 // Builds the z (+ and -) surfaces of a box shaped prim 386 // Builds the z (+ and -) surfaces of a box shaped prim
399 { 387 {
400 UInt16 hollowFactor = primShape.ProfileHollow; 388 UInt16 hollowFactor = primShape.ProfileHollow;
401 389
@@ -403,10 +391,10 @@ namespace OpenSim.Region.Physics.OdePlugin
403 // (M)inus Z 391 // (M)inus Z
404 Mesh MZ = new Mesh(); 392 Mesh MZ = new Mesh();
405 393
406 MZ.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 394 MZ.Add(new Vertex("-X-Y-Z", -size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
407 MZ.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); 395 MZ.Add(new Vertex("+X-Y-Z", +size.X/2.0f, -size.Y/2.0f, -size.Z/2.0f));
408 MZ.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 396 MZ.Add(new Vertex("-X+Y-Z", -size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
409 MZ.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); 397 MZ.Add(new Vertex("+X+Y-Z", +size.X/2.0f, +size.Y/2.0f, -size.Z/2.0f));
410 398
411 399
412 MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2])); 400 MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2]));
@@ -415,10 +403,10 @@ namespace OpenSim.Region.Physics.OdePlugin
415 // (P)lus Z 403 // (P)lus Z
416 Mesh PZ = new Mesh(); 404 Mesh PZ = new Mesh();
417 405
418 PZ.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, 0.0f)); 406 PZ.Add(new Vertex("-X-Y+Z", -size.X/2.0f, -size.Y/2.0f, 0.0f));
419 PZ.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, 0.0f)); 407 PZ.Add(new Vertex("+X-Y+Z", +size.X/2.0f, -size.Y/2.0f, 0.0f));
420 PZ.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, 0.0f)); 408 PZ.Add(new Vertex("-X+Y+Z", -size.X/2.0f, +size.Y/2.0f, 0.0f));
421 PZ.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, 0.0f)); 409 PZ.Add(new Vertex("+X+Y+Z", +size.X/2.0f, +size.Y/2.0f, 0.0f));
422 410
423 // Surface 5, +Z 411 // Surface 5, +Z
424 PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2])); 412 PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2]));
@@ -426,12 +414,12 @@ namespace OpenSim.Region.Physics.OdePlugin
426 414
427 if (hollowFactor > 0) 415 if (hollowFactor > 0)
428 { 416 {
429 float hollowFactorF = (float)hollowFactor / (float)50000; 417 float hollowFactorF = (float) hollowFactor/(float) 50000;
430 418
431 MZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); 419 MZ.Add(new Vertex("-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f));
432 MZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); 420 MZ.Add(new Vertex("-X+Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f));
433 MZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); 421 MZ.Add(new Vertex("-X-Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f));
434 MZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); 422 MZ.Add(new Vertex("-X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f));
435 423
436 List<int> innerBorders = new List<int>(); 424 List<int> innerBorders = new List<int>();
437 innerBorders.Add(4); 425 innerBorders.Add(4);
@@ -441,10 +429,10 @@ namespace OpenSim.Region.Physics.OdePlugin
441 429
442 InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders); 430 InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders);
443 431
444 PZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); 432 PZ.Add(new Vertex("-X-Y-Z", -size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f));
445 PZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); 433 PZ.Add(new Vertex("-X+Y-Z", +size.X*hollowFactorF/2.0f, -size.Y*hollowFactorF/2.0f, 0.0f));
446 PZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); 434 PZ.Add(new Vertex("-X-Y+Z", -size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f));
447 PZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); 435 PZ.Add(new Vertex("-X+Y+Z", +size.X*hollowFactorF/2.0f, +size.Y*hollowFactorF/2.0f, 0.0f));
448 436
449 innerBorders = new List<int>(); 437 innerBorders = new List<int>();
450 innerBorders.Add(4); 438 innerBorders.Add(4);
@@ -453,16 +441,15 @@ namespace OpenSim.Region.Physics.OdePlugin
453 innerBorders.Add(7); 441 innerBorders.Add(7);
454 442
455 InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders); 443 InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders);
456
457 } 444 }
458 445
459 foreach (Vertex v in PZ.vertices) 446 foreach (Vertex v in PZ.vertices)
460 { 447 {
461 v.point.Z = size.Z / 2.0f; 448 v.point.Z = size.Z/2.0f;
462 } 449 }
463 foreach (Vertex v in MZ.vertices) 450 foreach (Vertex v in MZ.vertices)
464 { 451 {
465 v.point.Z = -size.Z / 2.0f; 452 v.point.Z = -size.Z/2.0f;
466 } 453 }
467 454
468 foreach (Triangle t in MZ.triangles) 455 foreach (Triangle t in MZ.triangles)
@@ -486,15 +473,14 @@ namespace OpenSim.Region.Physics.OdePlugin
486 return result; 473 return result;
487 } 474 }
488 475
489 static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size) 476 private static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size)
490 { 477 {
491 Mesh result = new Mesh(); 478 Mesh result = new Mesh();
492 479
493 480
494 481 Mesh MeshX = CreateBoxMeshX(primShape, size);
495 Mesh MeshX = Meshmerizer.CreateBoxMeshX(primShape, size); 482 Mesh MeshY = CreateBoxMeshY(primShape, size);
496 Mesh MeshY = Meshmerizer.CreateBoxMeshY(primShape, size); 483 Mesh MeshZ = CreateBoxMeshZ(primShape, size);
497 Mesh MeshZ = Meshmerizer.CreateBoxMeshZ(primShape, size);
498 484
499 result.Append(MeshX); 485 result.Append(MeshX);
500 result.Append(MeshY); 486 result.Append(MeshY);
@@ -504,64 +490,63 @@ namespace OpenSim.Region.Physics.OdePlugin
504 } 490 }
505 491
506 492
507 public static void CalcNormals(Mesh mesh) 493 public static void CalcNormals(Mesh mesh)
508 { 494 {
509 int iTriangles = mesh.triangles.Count; 495 int iTriangles = mesh.triangles.Count;
510 496
511 mesh.normals = new float[iTriangles*3]; 497 mesh.normals = new float[iTriangles*3];
512 498
513 int i=0; 499 int i = 0;
514 foreach (Triangle t in mesh.triangles) 500 foreach (Triangle t in mesh.triangles)
515 { 501 {
516
517 float ux, uy, uz; 502 float ux, uy, uz;
518 float vx, vy, vz; 503 float vx, vy, vz;
519 float wx, wy, wz; 504 float wx, wy, wz;
520 505
521 ux = t.v1.point.X; 506 ux = t.v1.point.X;
522 uy = t.v1.point.Y; 507 uy = t.v1.point.Y;
523 uz = t.v1.point.Z; 508 uz = t.v1.point.Z;
524 509
525 vx = t.v2.point.X; 510 vx = t.v2.point.X;
526 vy = t.v2.point.Y; 511 vy = t.v2.point.Y;
527 vz = t.v2.point.Z; 512 vz = t.v2.point.Z;
528 513
529 wx = t.v3.point.X; 514 wx = t.v3.point.X;
530 wy = t.v3.point.Y; 515 wy = t.v3.point.Y;
531 wz = t.v3.point.Z; 516 wz = t.v3.point.Z;
532 517
533 // Vectors for edges 518 // Vectors for edges
534 float e1x, e1y, e1z; 519 float e1x, e1y, e1z;
535 float e2x, e2y, e2z; 520 float e2x, e2y, e2z;
536 521
537 e1x = ux - vx; 522 e1x = ux - vx;
538 e1y = uy - vy; 523 e1y = uy - vy;
539 e1z = uz - vz; 524 e1z = uz - vz;
540 525
541 e2x = ux - wx; 526 e2x = ux - wx;
542 e2y = uy - wy; 527 e2y = uy - wy;
543 e2z = uz - wz; 528 e2z = uz - wz;
544 529
545 530
546 // Cross product for normal 531 // Cross product for normal
547 float nx, ny, nz; 532 float nx, ny, nz;
548 nx = e1y * e2z - e1z * e2y; 533 nx = e1y*e2z - e1z*e2y;
549 ny = e1z * e2x - e1x * e2z; 534 ny = e1z*e2x - e1x*e2z;
550 nz = e1x * e2y - e1y * e2x; 535 nz = e1x*e2y - e1y*e2x;
551 536
552 // Length 537 // Length
553 float l = (float)Math.Sqrt(nx * nx + ny * ny + nz * nz); 538 float l = (float) Math.Sqrt(nx*nx + ny*ny + nz*nz);
554 539
555 // Normalized "normal" 540 // Normalized "normal"
556 nx /= l; 541 nx /= l;
557 ny /= l; 542 ny /= l;
558 nz /= l; 543 nz /= l;
559 544
560 mesh.normals[i] = nx; 545 mesh.normals[i] = nx;
561 mesh.normals[i + 1] = ny; 546 mesh.normals[i + 1] = ny;
562 mesh.normals[i + 2] = nz; 547 mesh.normals[i + 2] = nz;
563 548
564 i+=3; 549 i += 3;
565 } 550 }
566 } 551 }
567 552
@@ -572,18 +557,15 @@ namespace OpenSim.Region.Physics.OdePlugin
572 switch (primShape.ProfileShape) 557 switch (primShape.ProfileShape)
573 { 558 {
574 case ProfileShape.Square: 559 case ProfileShape.Square:
575 mesh=CreateBoxMesh(primShape, size); 560 mesh = CreateBoxMesh(primShape, size);
576 CalcNormals(mesh); 561 CalcNormals(mesh);
577 break; 562 break;
578 default: 563 default:
579 mesh=null; 564 mesh = null;
580 break; 565 break;
581 } 566 }
582 567
583 return mesh; 568 return mesh;
584
585 } 569 }
586 } 570 }
587} 571} \ No newline at end of file
588
589
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index a20452f..c9af6dd 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -25,19 +25,14 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Threading;
30using System.Collections.Generic; 30using System.Collections.Generic;
31
32using libsecondlife;
33
34using Axiom.Math; 31using Axiom.Math;
35using Ode.NET; 32using Ode.NET;
36using OpenSim.Framework; 33using OpenSim.Framework;
37using OpenSim.Framework.Console;
38using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
39 35
40
41namespace OpenSim.Region.Physics.OdePlugin 36namespace OpenSim.Region.Physics.OdePlugin
42{ 37{
43 /// <summary> 38 /// <summary>
@@ -49,7 +44,6 @@ namespace OpenSim.Region.Physics.OdePlugin
49 44
50 public OdePlugin() 45 public OdePlugin()
51 { 46 {
52
53 } 47 }
54 48
55 public bool Init() 49 public bool Init()
@@ -73,7 +67,6 @@ namespace OpenSim.Region.Physics.OdePlugin
73 67
74 public void Dispose() 68 public void Dispose()
75 { 69 {
76
77 } 70 }
78 } 71 }
79 72
@@ -82,17 +75,17 @@ namespace OpenSim.Region.Physics.OdePlugin
82 private static float ODE_STEPSIZE = 0.004f; 75 private static float ODE_STEPSIZE = 0.004f;
83 private static bool RENDER_FLAG = false; 76 private static bool RENDER_FLAG = false;
84 private IntPtr contactgroup; 77 private IntPtr contactgroup;
85 private IntPtr LandGeom=(IntPtr)0; 78 private IntPtr LandGeom = (IntPtr) 0;
86 private double[] _heightmap; 79 private double[] _heightmap;
87 private d.NearCallback nearCallback; 80 private d.NearCallback nearCallback;
88 public d.TriCallback triCallback; 81 public d.TriCallback triCallback;
89 public d.TriArrayCallback triArrayCallback; 82 public d.TriArrayCallback triArrayCallback;
90 private List<OdeCharacter> _characters = new List<OdeCharacter>(); 83 private List<OdeCharacter> _characters = new List<OdeCharacter>();
91 private List<OdePrim> _prims = new List<OdePrim>(); 84 private List<OdePrim> _prims = new List<OdePrim>();
92 public Dictionary<IntPtr, String> geom_name_map=new Dictionary<IntPtr, String>(); 85 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
93 private d.ContactGeom[] contacts = new d.ContactGeom[30]; 86 private d.ContactGeom[] contacts = new d.ContactGeom[30];
94 private d.Contact contact; 87 private d.Contact contact;
95 private float step_time=0.0f; 88 private float step_time = 0.0f;
96 public IntPtr world; 89 public IntPtr world;
97 public IntPtr space; 90 public IntPtr space;
98 public static Object OdeLock = new Object(); 91 public static Object OdeLock = new Object();
@@ -140,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin
140 return; 133 return;
141 134
142 d.GeomClassID id = d.GeomGetClass(g1); 135 d.GeomClassID id = d.GeomGetClass(g1);
143 if (id==d.GeomClassID.TriMeshClass) 136 if (id == d.GeomClassID.TriMeshClass)
144 { 137 {
145 String name1 = null; 138 String name1 = null;
146 String name2 = null; 139 String name2 = null;
@@ -163,7 +156,6 @@ namespace OpenSim.Region.Physics.OdePlugin
163 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); 156 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact);
164 d.JointAttach(joint, b1, b2); 157 d.JointAttach(joint, b1, b2);
165 } 158 }
166
167 } 159 }
168 160
169 private void collision_optimized() 161 private void collision_optimized()
@@ -171,7 +163,8 @@ namespace OpenSim.Region.Physics.OdePlugin
171 foreach (OdeCharacter chr in _characters) 163 foreach (OdeCharacter chr in _characters)
172 { 164 {
173 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback); 165 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
174 foreach (OdeCharacter ch2 in _characters) /// should be a separate space -- lots of avatars will be N**2 slow 166 foreach (OdeCharacter ch2 in _characters)
167 /// should be a separate space -- lots of avatars will be N**2 slow
175 { 168 {
176 d.SpaceCollide2(chr.Shell, ch2.Shell, IntPtr.Zero, nearCallback); 169 d.SpaceCollide2(chr.Shell, ch2.Shell, IntPtr.Zero, nearCallback);
177 } 170 }
@@ -193,8 +186,8 @@ namespace OpenSim.Region.Physics.OdePlugin
193 { 186 {
194 lock (OdeLock) 187 lock (OdeLock)
195 { 188 {
196 ((OdeCharacter)actor).Destroy(); 189 ((OdeCharacter) actor).Destroy();
197 _characters.Remove((OdeCharacter)actor); 190 _characters.Remove((OdeCharacter) actor);
198 } 191 }
199 } 192 }
200 193
@@ -204,13 +197,14 @@ namespace OpenSim.Region.Physics.OdePlugin
204 { 197 {
205 lock (OdeLock) 198 lock (OdeLock)
206 { 199 {
207 d.GeomDestroy(((OdePrim)prim).prim_geom); 200 d.GeomDestroy(((OdePrim) prim).prim_geom);
208 _prims.Remove((OdePrim)prim); 201 _prims.Remove((OdePrim) prim);
209 } 202 }
210 } 203 }
211 } 204 }
212 205
213 PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) 206 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
207 Mesh mesh, PrimitiveBaseShape pbs)
214 { 208 {
215 PhysicsVector pos = new PhysicsVector(); 209 PhysicsVector pos = new PhysicsVector();
216 pos.X = position.X; 210 pos.X = position.X;
@@ -235,7 +229,7 @@ namespace OpenSim.Region.Physics.OdePlugin
235 } 229 }
236 230
237 231
238 public int TriArrayCallback(System.IntPtr trimesh, System.IntPtr refObject, int[] triangleIndex, int triCount) 232 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount)
239 { 233 {
240/* String name1 = null; 234/* String name1 = null;
241 String name2 = null; 235 String name2 = null;
@@ -254,15 +248,14 @@ namespace OpenSim.Region.Physics.OdePlugin
254 return 1; 248 return 1;
255 } 249 }
256 250
257 public int TriCallback(System.IntPtr trimesh, System.IntPtr refObject, int triangleIndex) 251 public int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex)
258 { 252 {
259
260 String name1 = null; 253 String name1 = null;
261 String name2 = null; 254 String name2 = null;
262 255
263 if (!geom_name_map.TryGetValue(trimesh, out name1)) 256 if (!geom_name_map.TryGetValue(trimesh, out name1))
264 { 257 {
265 name1 = "null"; 258 name1 = "null";
266 } 259 }
267 if (!geom_name_map.TryGetValue(refObject, out name2)) 260 if (!geom_name_map.TryGetValue(refObject, out name2))
268 { 261 {
@@ -282,11 +275,12 @@ namespace OpenSim.Region.Physics.OdePlugin
282 } 275 }
283 276
284 277
285 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) 278 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
279 PhysicsVector size, Quaternion rotation)
286 { 280 {
287 PhysicsActor result; 281 PhysicsActor result;
288 282
289 switch(pbs.ProfileShape) 283 switch (pbs.ProfileShape)
290 { 284 {
291 case ProfileShape.Square: 285 case ProfileShape.Square:
292 /// support simple box & hollow box now; later, more shapes 286 /// support simple box & hollow box now; later, more shapes
@@ -310,7 +304,6 @@ namespace OpenSim.Region.Physics.OdePlugin
310 } 304 }
311 305
312 306
313
314 public override void Simulate(float timeStep) 307 public override void Simulate(float timeStep)
315 { 308 {
316 step_time += timeStep; 309 step_time += timeStep;
@@ -327,11 +320,12 @@ namespace OpenSim.Region.Physics.OdePlugin
327 Vector3 rx, ry, rz; 320 Vector3 rx, ry, rz;
328 p.Orientation.ToAxes(out rx, out ry, out rz); 321 p.Orientation.ToAxes(out rx, out ry, out rz);
329 Console.WriteLine("RENDER: block; " + p.Size.X + ", " + p.Size.Y + ", " + p.Size.Z + "; " + 322 Console.WriteLine("RENDER: block; " + p.Size.X + ", " + p.Size.Y + ", " + p.Size.Z + "; " +
330 " 0, 0, 1; " + //shape, size, color 323 " 0, 0, 1; " + //shape, size, color
331 (p.Position.X - 128.0f) + ", " + (p.Position.Y - 128.0f) + ", " + (p.Position.Z - 33.0f) + "; " + // position 324 (p.Position.X - 128.0f) + ", " + (p.Position.Y - 128.0f) + ", " +
332 rx.x + "," + ry.x + "," + rz.x + ", " + // rotation 325 (p.Position.Z - 33.0f) + "; " + // position
333 rx.y + "," + ry.y + "," + rz.y + ", " + 326 rx.x + "," + ry.x + "," + rz.x + ", " + // rotation
334 rx.z + "," + ry.z + "," + rz.z); 327 rx.y + "," + ry.y + "," + rz.y + ", " +
328 rx.z + "," + ry.z + "," + rz.z);
335 } 329 }
336 } 330 }
337 int i = 0; 331 int i = 0;
@@ -357,22 +351,27 @@ namespace OpenSim.Region.Physics.OdePlugin
357 float Zoff = -33.0f; 351 float Zoff = -33.0f;
358 d.Matrix3 temp = d.BodyGetRotation(actor.Body); 352 d.Matrix3 temp = d.BodyGetRotation(actor.Body);
359 Console.WriteLine("RENDER: cylinder; " + // shape 353 Console.WriteLine("RENDER: cylinder; " + // shape
360 OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size 354 OdeCharacter.CAPSULE_RADIUS + ", " + OdeCharacter.CAPSULE_LENGTH + //size
361 "; 0, 1, 0; " + // color 355 "; 0, 1, 0; " + // color
362 (actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " + (actor.Position.Z + Zoff) + "; " + // position 356 (actor.Position.X - 128.0f) + ", " + (actor.Position.Y - 128.0f) + ", " +
363 temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation 357 (actor.Position.Z + Zoff) + "; " + // position
364 temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " + 358 temp.M00 + "," + temp.M10 + "," + temp.M20 + ", " + // rotation
365 temp.M02 + "," + temp.M12 + "," + temp.M22); 359 temp.M01 + "," + temp.M11 + "," + temp.M21 + ", " +
366 d.Vector3 caphead; d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH * .5f, out caphead); 360 temp.M02 + "," + temp.M12 + "," + temp.M22);
367 d.Vector3 capfoot; d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH * .5f, out capfoot); 361 d.Vector3 caphead;
362 d.BodyGetRelPointPos(actor.Body, 0, 0, OdeCharacter.CAPSULE_LENGTH*.5f, out caphead);
363 d.Vector3 capfoot;
364 d.BodyGetRelPointPos(actor.Body, 0, 0, -OdeCharacter.CAPSULE_LENGTH*.5f, out capfoot);
368 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size 365 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size
369 "; 1, 0, 1; " + //color 366 "; 1, 0, 1; " + //color
370 (caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) + "; " + // position 367 (caphead.X - 128.0f) + ", " + (caphead.Y - 128.0f) + ", " + (caphead.Z + Zoff) +
371 "1,0,0, 0,1,0, 0,0,1"); // rotation 368 "; " + // position
369 "1,0,0, 0,1,0, 0,0,1"); // rotation
372 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size 370 Console.WriteLine("RENDER: sphere; " + OdeCharacter.CAPSULE_RADIUS + // shape, size
373 "; 1, 0, 0; " + //color 371 "; 1, 0, 0; " + //color
374 (capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) + "; " + // position 372 (capfoot.X - 128.0f) + ", " + (capfoot.Y - 128.0f) + ", " + (capfoot.Z + Zoff) +
375 "1,0,0, 0,1,0, 0,0,1"); // rotation 373 "; " + // position
374 "1,0,0, 0,1,0, 0,0,1"); // rotation
376 } 375 }
377 } 376 }
378 } 377 }
@@ -380,14 +379,11 @@ namespace OpenSim.Region.Physics.OdePlugin
380 379
381 public override void GetResults() 380 public override void GetResults()
382 { 381 {
383
384 } 382 }
385 383
386 public override bool IsThreaded 384 public override bool IsThreaded
387 { 385 {
388 get 386 get { return (false); // for now we won't be multithreaded
389 {
390 return (false); // for now we won't be multithreaded
391 } 387 }
392 } 388 }
393 389
@@ -400,21 +396,21 @@ namespace OpenSim.Region.Physics.OdePlugin
400 { 396 {
401 for (int y = 0; y < 258; y++) 397 for (int y = 0; y < 258; y++)
402 { 398 {
403 int xx = x-1; 399 int xx = x - 1;
404 if (xx < 0) xx = 0; 400 if (xx < 0) xx = 0;
405 if (xx > 255) xx = 255; 401 if (xx > 255) xx = 255;
406 int yy = y-1; 402 int yy = y - 1;
407 if (yy < 0) yy = 0; 403 if (yy < 0) yy = 0;
408 if (yy > 255) yy = 255; 404 if (yy > 255) yy = 255;
409 405
410 double val = (double)heightMap[yy * 256 + xx]; 406 double val = (double) heightMap[yy*256 + xx];
411 _heightmap[x * 258 + y] = val; 407 _heightmap[x*258 + y] = val;
412 } 408 }
413 } 409 }
414 410
415 lock (OdeLock) 411 lock (OdeLock)
416 { 412 {
417 if (!(LandGeom == (IntPtr)0)) 413 if (!(LandGeom == (IntPtr) 0))
418 { 414 {
419 d.SpaceRemove(space, LandGeom); 415 d.SpaceRemove(space, LandGeom);
420 } 416 }
@@ -422,7 +418,7 @@ namespace OpenSim.Region.Physics.OdePlugin
422 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 258, 258, 258, 258, 1.0f, 0.0f, 2.0f, 0); 418 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 258, 258, 258, 258, 1.0f, 0.0f, 2.0f, 0);
423 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); 419 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256);
424 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 420 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
425 this.geom_name_map[LandGeom]="Terrain"; 421 geom_name_map[LandGeom] = "Terrain";
426 422
427 d.Matrix3 R = new d.Matrix3(); 423 d.Matrix3 R = new d.Matrix3();
428 424
@@ -430,7 +426,7 @@ namespace OpenSim.Region.Physics.OdePlugin
430 Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); 426 Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0));
431 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); 427 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
432 428
433 q1 = q1 * q2; 429 q1 = q1*q2;
434 //q1 = q1 * q3; 430 //q1 = q1 * q3;
435 Vector3 v3 = new Vector3(); 431 Vector3 v3 = new Vector3();
436 float angle = 0; 432 float angle = 0;
@@ -444,7 +440,6 @@ namespace OpenSim.Region.Physics.OdePlugin
444 440
445 public override void DeleteTerrain() 441 public override void DeleteTerrain()
446 { 442 {
447
448 } 443 }
449 } 444 }
450 445
@@ -452,12 +447,12 @@ namespace OpenSim.Region.Physics.OdePlugin
452 { 447 {
453 private PhysicsVector _position; 448 private PhysicsVector _position;
454 private d.Vector3 _zeroPosition; 449 private d.Vector3 _zeroPosition;
455 private bool _zeroFlag=false; 450 private bool _zeroFlag = false;
456 private PhysicsVector _velocity; 451 private PhysicsVector _velocity;
457 private PhysicsVector _target_velocity; 452 private PhysicsVector _target_velocity;
458 private PhysicsVector _acceleration; 453 private PhysicsVector _acceleration;
459 private static float PID_D=4000.0f; 454 private static float PID_D = 4000.0f;
460 private static float PID_P=7000.0f; 455 private static float PID_P = 7000.0f;
461 private static float POSTURE_SERVO = 10000.0f; 456 private static float POSTURE_SERVO = 10000.0f;
462 public static float CAPSULE_RADIUS = 0.5f; 457 public static float CAPSULE_RADIUS = 0.5f;
463 public static float CAPSULE_LENGTH = 0.9f; 458 public static float CAPSULE_LENGTH = 0.9f;
@@ -484,28 +479,18 @@ namespace OpenSim.Region.Physics.OdePlugin
484 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); 479 d.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
485 d.GeomSetBody(Shell, Body); 480 d.GeomSetBody(Shell, Body);
486 } 481 }
487 parent_scene.geom_name_map[Shell]=avName; 482 parent_scene.geom_name_map[Shell] = avName;
488
489 } 483 }
490 484
491 public override bool Flying 485 public override bool Flying
492 { 486 {
493 get 487 get { return flying; }
494 { 488 set { flying = value; }
495 return flying;
496 }
497 set
498 {
499 flying = value;
500 }
501 } 489 }
502 490
503 public override PhysicsVector Position 491 public override PhysicsVector Position
504 { 492 {
505 get 493 get { return _position; }
506 {
507 return _position;
508 }
509 set 494 set
510 { 495 {
511 lock (OdeScene.OdeLock) 496 lock (OdeScene.OdeLock)
@@ -518,60 +503,34 @@ namespace OpenSim.Region.Physics.OdePlugin
518 503
519 public override PhysicsVector Size 504 public override PhysicsVector Size
520 { 505 {
521 get 506 get { return new PhysicsVector(0, 0, 0); }
522 { 507 set { }
523 return new PhysicsVector(0,0,0);
524 }
525 set
526 {
527 }
528 } 508 }
529 509
530 510
531 public override PhysicsVector Velocity 511 public override PhysicsVector Velocity
532 { 512 {
533 get 513 get { return _velocity; }
534 { 514 set { _target_velocity = value; }
535 return _velocity;
536 }
537 set
538 {
539 _target_velocity = value;
540 }
541 } 515 }
542 516
543 public override bool Kinematic 517 public override bool Kinematic
544 { 518 {
545 get 519 get { return false; }
546 { 520 set { }
547 return false;
548 }
549 set
550 {
551
552 }
553 } 521 }
554 522
555 public override Quaternion Orientation 523 public override Quaternion Orientation
556 { 524 {
557 get 525 get { return Quaternion.Identity; }
558 { 526 set { }
559 return Quaternion.Identity;
560 }
561 set
562 {
563
564 }
565 } 527 }
566 528
567 public override PhysicsVector Acceleration 529 public override PhysicsVector Acceleration
568 { 530 {
569 get 531 get { return _acceleration; }
570 {
571 return _acceleration;
572 }
573
574 } 532 }
533
575 public void SetAcceleration(PhysicsVector accel) 534 public void SetAcceleration(PhysicsVector accel)
576 { 535 {
577 _acceleration = accel; 536 _acceleration = accel;
@@ -579,12 +538,10 @@ namespace OpenSim.Region.Physics.OdePlugin
579 538
580 public override void AddForce(PhysicsVector force) 539 public override void AddForce(PhysicsVector force)
581 { 540 {
582
583 } 541 }
584 542
585 public override void SetMomentum(PhysicsVector momentum) 543 public override void SetMomentum(PhysicsVector momentum)
586 { 544 {
587
588 } 545 }
589 546
590 public void Move(float timeStep) 547 public void Move(float timeStep)
@@ -603,28 +560,28 @@ namespace OpenSim.Region.Physics.OdePlugin
603 _zeroPosition = d.BodyGetPosition(Body); 560 _zeroPosition = d.BodyGetPosition(Body);
604 } 561 }
605 d.Vector3 pos = d.BodyGetPosition(Body); 562 d.Vector3 pos = d.BodyGetPosition(Body);
606 vec.X = (_target_velocity.X - vel.X) * PID_D + (_zeroPosition.X - pos.X) * PID_P; 563 vec.X = (_target_velocity.X - vel.X)*PID_D + (_zeroPosition.X - pos.X)*PID_P;
607 vec.Y = (_target_velocity.Y - vel.Y) * PID_D + (_zeroPosition.Y - pos.Y) * PID_P; 564 vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P;
608 if (flying) 565 if (flying)
609 { 566 {
610 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; 567 vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P;
611 } 568 }
612 } 569 }
613 else 570 else
614 { 571 {
615 _zeroFlag = false; 572 _zeroFlag = false;
616 vec.X = (_target_velocity.X - vel.X) * PID_D; 573 vec.X = (_target_velocity.X - vel.X)*PID_D;
617 vec.Y = (_target_velocity.Y - vel.Y) * PID_D; 574 vec.Y = (_target_velocity.Y - vel.Y)*PID_D;
618 if (flying) 575 if (flying)
619 { 576 {
620 vec.Z = (_target_velocity.Z - vel.Z) * PID_D; 577 vec.Z = (_target_velocity.Z - vel.Z)*PID_D;
621 } 578 }
622 } 579 }
623 if (flying) 580 if (flying)
624 { 581 {
625 vec.Z += 10.0f; 582 vec.Z += 10.0f;
626 } 583 }
627 d.BodyAddForce(this.Body, vec.X, vec.Y, vec.Z); 584 d.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
628 585
629 // ok -- let's stand up straight! 586 // ok -- let's stand up straight!
630 d.Vector3 feet; 587 d.Vector3 feet;
@@ -634,7 +591,7 @@ namespace OpenSim.Region.Physics.OdePlugin
634 float posture = head.Z - feet.Z; 591 float posture = head.Z - feet.Z;
635 592
636 // restoring force proportional to lack of posture: 593 // restoring force proportional to lack of posture:
637 float servo = (2.5f-posture) * POSTURE_SERVO; 594 float servo = (2.5f - posture)*POSTURE_SERVO;
638 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); 595 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
639 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 596 d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
640 } 597 }
@@ -650,9 +607,9 @@ namespace OpenSim.Region.Physics.OdePlugin
650 if (vec.X > 255.95f) vec.X = 255.95f; 607 if (vec.X > 255.95f) vec.X = 255.95f;
651 if (vec.Y > 255.95f) vec.Y = 255.95f; 608 if (vec.Y > 255.95f) vec.Y = 255.95f;
652 609
653 this._position.X = vec.X; 610 _position.X = vec.X;
654 this._position.Y = vec.Y; 611 _position.Y = vec.Y;
655 this._position.Z = vec.Z; 612 _position.Z = vec.Z;
656 613
657 if (_zeroFlag) 614 if (_zeroFlag)
658 { 615 {
@@ -673,9 +630,9 @@ namespace OpenSim.Region.Physics.OdePlugin
673 { 630 {
674 lock (OdeScene.OdeLock) 631 lock (OdeScene.OdeLock)
675 { 632 {
676 d.GeomDestroy(this.Shell); 633 d.GeomDestroy(Shell);
677 this._parent_scene.geom_name_map.Remove(this.Shell); 634 _parent_scene.geom_name_map.Remove(Shell);
678 d.BodyDestroy(this.Body); 635 d.BodyDestroy(Body);
679 } 636 }
680 } 637 }
681 } 638 }
@@ -693,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
693 public IntPtr prim_geom; 650 public IntPtr prim_geom;
694 public IntPtr _triMeshData; 651 public IntPtr _triMeshData;
695 652
696 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, 653 public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
697 Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs) 654 Quaternion rotation, Mesh mesh, PrimitiveBaseShape pbs)
698 { 655 {
699 _velocity = new PhysicsVector(); 656 _velocity = new PhysicsVector();
@@ -707,7 +664,7 @@ namespace OpenSim.Region.Physics.OdePlugin
707 664
708 lock (OdeScene.OdeLock) 665 lock (OdeScene.OdeLock)
709 { 666 {
710 if (mesh!=null) 667 if (mesh != null)
711 { 668 {
712 setMesh(parent_scene, mesh); 669 setMesh(parent_scene, mesh);
713 } 670 }
@@ -723,20 +680,22 @@ namespace OpenSim.Region.Physics.OdePlugin
723 myrot.Y = rotation.y; 680 myrot.Y = rotation.y;
724 myrot.Z = rotation.z; 681 myrot.Z = rotation.z;
725 d.GeomSetQuaternion(prim_geom, ref myrot); 682 d.GeomSetQuaternion(prim_geom, ref myrot);
726 parent_scene.geom_name_map[prim_geom] = primName; // don't do .add() here; old geoms get recycled with the same hash 683 parent_scene.geom_name_map[prim_geom] = primName;
684 // don't do .add() here; old geoms get recycled with the same hash
727 } 685 }
728 } 686 }
729 687
730 public void setMesh(OdeScene parent_scene, Mesh mesh) 688 public void setMesh(OdeScene parent_scene, Mesh mesh)
731 { 689 {
732 float[] vertexList = mesh.getVertexListAsFloat(); // Note, that vertextList is pinned in memory 690 float[] vertexList = mesh.getVertexListAsFloat(); // Note, that vertextList is pinned in memory
733 int[] indexList = mesh.getIndexListAsInt(); // Also pinned, needs release after usage 691 int[] indexList = mesh.getIndexListAsInt(); // Also pinned, needs release after usage
734 int VertexCount = vertexList.GetLength(0) / 3; 692 int VertexCount = vertexList.GetLength(0)/3;
735 int IndexCount = indexList.GetLength(0); 693 int IndexCount = indexList.GetLength(0);
736 694
737 _triMeshData = d.GeomTriMeshDataCreate(); 695 _triMeshData = d.GeomTriMeshDataCreate();
738 696
739 d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3 * sizeof(float), VertexCount, indexList, IndexCount, 3 * sizeof(int)); 697 d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount,
698 3*sizeof (int));
740 d.GeomTriMeshDataPreprocess(_triMeshData); 699 d.GeomTriMeshDataPreprocess(_triMeshData);
741 700
742 prim_geom = d.CreateTriMesh(parent_scene.space, _triMeshData, parent_scene.triCallback, null, null); 701 prim_geom = d.CreateTriMesh(parent_scene.space, _triMeshData, parent_scene.triCallback, null, null);
@@ -744,21 +703,14 @@ namespace OpenSim.Region.Physics.OdePlugin
744 703
745 public override bool Flying 704 public override bool Flying
746 { 705 {
747 get 706 get { return false; //no flying prims for you
748 {
749 return false; //no flying prims for you
750 }
751 set
752 {
753 } 707 }
708 set { }
754 } 709 }
755 710
756 public override PhysicsVector Position 711 public override PhysicsVector Position
757 { 712 {
758 get 713 get { return _position; }
759 {
760 return _position;
761 }
762 set 714 set
763 { 715 {
764 _position = value; 716 _position = value;
@@ -771,10 +723,7 @@ namespace OpenSim.Region.Physics.OdePlugin
771 723
772 public override PhysicsVector Size 724 public override PhysicsVector Size
773 { 725 {
774 get 726 get { return _size; }
775 {
776 return _size;
777 }
778 set 727 set
779 { 728 {
780 _size = value; 729 _size = value;
@@ -798,33 +747,19 @@ namespace OpenSim.Region.Physics.OdePlugin
798 747
799 public override PhysicsVector Velocity 748 public override PhysicsVector Velocity
800 { 749 {
801 get 750 get { return _velocity; }
802 { 751 set { _velocity = value; }
803 return _velocity;
804 }
805 set
806 {
807 _velocity = value;
808 }
809 } 752 }
810 753
811 public override bool Kinematic 754 public override bool Kinematic
812 { 755 {
813 get 756 get { return false; }
814 { 757 set { }
815 return false;
816 }
817 set
818 {
819 }
820 } 758 }
821 759
822 public override Quaternion Orientation 760 public override Quaternion Orientation
823 { 761 {
824 get 762 get { return _orientation; }
825 {
826 return _orientation;
827 }
828 set 763 set
829 { 764 {
830 _orientation = value; 765 _orientation = value;
@@ -842,15 +777,12 @@ namespace OpenSim.Region.Physics.OdePlugin
842 777
843 public override PhysicsVector Acceleration 778 public override PhysicsVector Acceleration
844 { 779 {
845 get 780 get { return _acceleration; }
846 {
847 return _acceleration;
848 }
849 } 781 }
850 782
851 public void SetAcceleration(PhysicsVector accel) 783 public void SetAcceleration(PhysicsVector accel)
852 { 784 {
853 this._acceleration = accel; 785 _acceleration = accel;
854 } 786 }
855 787
856 public override void AddForce(PhysicsVector force) 788 public override void AddForce(PhysicsVector force)
@@ -861,4 +793,4 @@ namespace OpenSim.Region.Physics.OdePlugin
861 { 793 {
862 } 794 }
863 } 795 }
864} 796} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
index 3f840cc..d110a17 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
@@ -27,24 +27,26 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("RealPhysXplugin")] 37[assembly : AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 41[assembly : AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index a7cef88..4896359 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -34,102 +34,99 @@ using Quaternion=Axiom.Math.Quaternion;
34 34
35namespace OpenSim.Region.Physics.PhysXPlugin 35namespace OpenSim.Region.Physics.PhysXPlugin
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Will be the PhysX plugin but for now will be a very basic physics engine 38 /// Will be the PhysX plugin but for now will be a very basic physics engine
39 /// </summary> 39 /// </summary>
40 public class PhysXPlugin : IPhysicsPlugin 40 public class PhysXPlugin : IPhysicsPlugin
41 { 41 {
42 private PhysXScene _mScene; 42 private PhysXScene _mScene;
43 43
44 public PhysXPlugin() 44 public PhysXPlugin()
45 { 45 {
46 46 }
47 } 47
48 48 public bool Init()
49 public bool Init() 49 {
50 { 50 return true;
51 return true; 51 }
52 } 52
53 53 public PhysicsScene GetScene()
54 public PhysicsScene GetScene() 54 {
55 { 55 if (_mScene == null)
56 if(_mScene == null) 56 {
57 { 57 _mScene = new PhysXScene();
58 _mScene = new PhysXScene(); 58 }
59 } 59 return (_mScene);
60 return(_mScene); 60 }
61 } 61
62 62 public string GetName()
63 public string GetName() 63 {
64 { 64 return ("RealPhysX");
65 return("RealPhysX"); 65 }
66 } 66
67 67 public void Dispose()
68 public void Dispose() 68 {
69 { 69 }
70 70 }
71 } 71
72 } 72 public class PhysXScene : PhysicsScene
73 73 {
74 public class PhysXScene :PhysicsScene 74 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
75 { 75 private List<PhysXPrim> _prims = new List<PhysXPrim>();
76 private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); 76 private float[] _heightMap = null;
77 private List<PhysXPrim> _prims = new List<PhysXPrim>(); 77 private NxPhysicsSDK mySdk;
78 private float[] _heightMap = null; 78 private NxScene scene;
79 private NxPhysicsSDK mySdk; 79
80 private NxScene scene; 80 public PhysXScene()
81 81 {
82 public PhysXScene() 82 mySdk = NxPhysicsSDK.CreateSDK();
83 { 83 Console.WriteLine("Sdk created - now creating scene");
84 mySdk = NxPhysicsSDK.CreateSDK(); 84 scene = mySdk.CreateScene();
85 Console.WriteLine("Sdk created - now creating scene"); 85 }
86 scene = mySdk.CreateScene(); 86
87 87 public override PhysicsActor AddAvatar(string avName, PhysicsVector position)
88 } 88 {
89 89 Vec3 pos = new Vec3();
90 public override PhysicsActor AddAvatar(string avName, PhysicsVector position) 90 pos.X = position.X;
91 { 91 pos.Y = position.Y;
92 Vec3 pos = new Vec3(); 92 pos.Z = position.Z;
93 pos.X = position.X; 93 PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
94 pos.Y = position.Y;
95 pos.Z = position.Z;
96 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos));
97 act.Position = position; 94 act.Position = position;
98 _characters.Add(act); 95 _characters.Add(act);
99 return act; 96 return act;
100 } 97 }
101 98
102 public override void RemovePrim(PhysicsActor prim) 99 public override void RemovePrim(PhysicsActor prim)
103 { 100 {
104
105 } 101 }
106 102
107 public override void RemoveAvatar(PhysicsActor actor) 103 public override void RemoveAvatar(PhysicsActor actor)
108 { 104 {
105 }
109 106
107 private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
108 {
109 Vec3 pos = new Vec3();
110 pos.X = position.X;
111 pos.Y = position.Y;
112 pos.Z = position.Z;
113 Vec3 siz = new Vec3();
114 siz.X = size.X;
115 siz.Y = size.Y;
116 siz.Z = size.Z;
117 PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
118 _prims.Add(act);
119 return act;
110 } 120 }
111 121
112 PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 122 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
113 { 123 PhysicsVector size, Quaternion rotation)
114 Vec3 pos = new Vec3();
115 pos.X = position.X;
116 pos.Y = position.Y;
117 pos.Z = position.Z;
118 Vec3 siz = new Vec3();
119 siz.X = size.X;
120 siz.Y = size.Y;
121 siz.Z = size.Z;
122 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz));
123 _prims.Add(act);
124 return act;
125 }
126 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation)
127 { 124 {
128 return AddPrim(position, size, rotation); 125 return AddPrim(position, size, rotation);
129 } 126 }
130 127
131 public override void Simulate(float timeStep) 128 public override void Simulate(float timeStep)
132 { 129 {
133 try 130 try
134 { 131 {
135 foreach (PhysXCharacter actor in _characters) 132 foreach (PhysXCharacter actor in _characters)
@@ -149,309 +146,237 @@ namespace OpenSim.Region.Physics.PhysXPlugin
149 { 146 {
150 Console.WriteLine(e.Message); 147 Console.WriteLine(e.Message);
151 } 148 }
152 149 }
153 } 150
154 151 public override void GetResults()
155 public override void GetResults() 152 {
156 { 153 }
157 154
158 } 155 public override bool IsThreaded
159 156 {
160 public override bool IsThreaded 157 get { return (false); // for now we won't be multithreaded
161 { 158 }
162 get 159 }
163 { 160
164 return(false); // for now we won't be multithreaded 161 public override void SetTerrain(float[] heightMap)
165 } 162 {
166 } 163 if (_heightMap != null)
167
168 public override void SetTerrain(float[] heightMap)
169 {
170 if (this._heightMap != null)
171 { 164 {
172 Console.WriteLine("PhysX - deleting old terrain"); 165 Console.WriteLine("PhysX - deleting old terrain");
173 this.scene.DeleteTerrain(); 166 scene.DeleteTerrain();
174 } 167 }
175 this._heightMap = heightMap; 168 _heightMap = heightMap;
176 this.scene.AddTerrain(heightMap); 169 scene.AddTerrain(heightMap);
177 } 170 }
178 171
179 public override void DeleteTerrain() 172 public override void DeleteTerrain()
180 { 173 {
181 this.scene.DeleteTerrain(); 174 scene.DeleteTerrain();
182 } 175 }
183 } 176 }
184 177
185 public class PhysXCharacter : PhysicsActor 178 public class PhysXCharacter : PhysicsActor
186 { 179 {
187 private PhysicsVector _position; 180 private PhysicsVector _position;
188 private PhysicsVector _velocity; 181 private PhysicsVector _velocity;
189 private PhysicsVector _acceleration; 182 private PhysicsVector _acceleration;
190 private NxCharacter _character; 183 private NxCharacter _character;
191 private bool flying; 184 private bool flying;
192 private float gravityAccel; 185 private float gravityAccel;
193 186
194 public PhysXCharacter(NxCharacter character) 187 public PhysXCharacter(NxCharacter character)
195 { 188 {
196 _velocity = new PhysicsVector(); 189 _velocity = new PhysicsVector();
197 _position = new PhysicsVector(); 190 _position = new PhysicsVector();
198 _acceleration = new PhysicsVector(); 191 _acceleration = new PhysicsVector();
199 _character = character; 192 _character = character;
200 } 193 }
201 194
202 public override bool Flying 195 public override bool Flying
203 { 196 {
204 get 197 get { return flying; }
205 { 198 set { flying = value; }
206 return flying; 199 }
207 } 200
208 set 201 public override PhysicsVector Position
209 { 202 {
210 flying = value; 203 get { return _position; }
211 } 204 set
212 } 205 {
213 206 _position = value;
214 public override PhysicsVector Position
215 {
216 get
217 {
218 return _position;
219 }
220 set
221 {
222 _position = value;
223 Vec3 ps = new Vec3(); 207 Vec3 ps = new Vec3();
224 ps.X = value.X; 208 ps.X = value.X;
225 ps.Y = value.Y; 209 ps.Y = value.Y;
226 ps.Z = value.Z; 210 ps.Z = value.Z;
227 this._character.Position = ps; 211 _character.Position = ps;
228 } 212 }
229 } 213 }
230 214
231 public override PhysicsVector Size 215 public override PhysicsVector Size
232 { 216 {
233 get 217 get { return new PhysicsVector(0, 0, 0); }
218 set { }
219 }
220
221 public override PhysicsVector Velocity
222 {
223 get { return _velocity; }
224 set { _velocity = value; }
225 }
226
227 public override bool Kinematic
228 {
229 get { return false; }
230 set { }
231 }
232
233 public override Quaternion Orientation
234 {
235 get { return Quaternion.Identity; }
236 set { }
237 }
238
239 public override PhysicsVector Acceleration
240 {
241 get { return _acceleration; }
242 }
243
244 public void SetAcceleration(PhysicsVector accel)
245 {
246 _acceleration = accel;
247 }
248
249 public override void AddForce(PhysicsVector force)
250 {
251 }
252
253 public override void SetMomentum(PhysicsVector momentum)
254 {
255 }
256
257 public void Move(float timeStep)
258 {
259 Vec3 vec = new Vec3();
260 vec.X = _velocity.X*timeStep;
261 vec.Y = _velocity.Y*timeStep;
262 if (flying)
234 { 263 {
235 return new PhysicsVector(0,0,0); 264 vec.Z = (_velocity.Z)*timeStep;
236 } 265 }
237 set 266 else
267 {
268 gravityAccel += -9.8f;
269 vec.Z = (gravityAccel + _velocity.Z)*timeStep;
270 }
271 int res = _character.Move(vec);
272 if (res == 1)
238 { 273 {
274 gravityAccel = 0;
239 } 275 }
240 } 276 }
241 public override PhysicsVector Velocity
242 {
243 get
244 {
245 return _velocity;
246 }
247 set
248 {
249 _velocity = value;
250 }
251 }
252
253 public override bool Kinematic
254 {
255 get
256 {
257 return false;
258 }
259 set
260 {
261
262 }
263 }
264
265 public override Quaternion Orientation
266 {
267 get
268 {
269 return Quaternion.Identity;
270 }
271 set
272 {
273
274 }
275 }
276
277 public override PhysicsVector Acceleration
278 {
279 get
280 {
281 return _acceleration;
282 }
283
284 }
285 public void SetAcceleration (PhysicsVector accel)
286 {
287 this._acceleration = accel;
288 }
289
290 public override void AddForce(PhysicsVector force)
291 {
292
293 }
294
295 public override void SetMomentum(PhysicsVector momentum)
296 {
297
298 }
299
300 public void Move(float timeStep)
301 {
302 Vec3 vec = new Vec3();
303 vec.X = this._velocity.X * timeStep;
304 vec.Y = this._velocity.Y * timeStep;
305 if(flying)
306 {
307 vec.Z = ( this._velocity.Z) * timeStep;
308 }
309 else
310 {
311 gravityAccel+= -9.8f;
312 vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
313 }
314 int res = this._character.Move(vec);
315 if(res == 1)
316 {
317 gravityAccel = 0;
318 }
319 }
320
321 public void UpdatePosition()
322 {
323 Vec3 vec = this._character.Position;
324 this._position.X = vec.X;
325 this._position.Y = vec.Y;
326 this._position.Z = vec.Z;
327 }
328 }
329
330 public class PhysXPrim : PhysicsActor
331 {
332 private PhysicsVector _position;
333 private PhysicsVector _velocity;
334 private PhysicsVector _acceleration;
335 private NxActor _prim;
336
337 public PhysXPrim(NxActor prim)
338 {
339 _velocity = new PhysicsVector();
340 _position = new PhysicsVector();
341 _acceleration = new PhysicsVector();
342 _prim = prim;
343 }
344 public override bool Flying
345 {
346 get
347 {
348 return false; //no flying prims for you
349 }
350 set
351 {
352
353 }
354 }
355 public override PhysicsVector Position
356 {
357 get
358 {
359 PhysicsVector pos = new PhysicsVector();
360 Vec3 vec = this._prim.Position;
361 pos.X = vec.X;
362 pos.Y = vec.Y;
363 pos.Z = vec.Z;
364 return pos;
365
366 }
367 set
368 {
369 PhysicsVector vec = value;
370 Vec3 pos = new Vec3();
371 pos.X = vec.X;
372 pos.Y = vec.Y;
373 pos.Z = vec.Z;
374 this._prim.Position = pos;
375 }
376 }
377 277
378 public override PhysicsVector Size 278 public void UpdatePosition()
279 {
280 Vec3 vec = _character.Position;
281 _position.X = vec.X;
282 _position.Y = vec.Y;
283 _position.Z = vec.Z;
284 }
285 }
286
287 public class PhysXPrim : PhysicsActor
288 {
289 private PhysicsVector _position;
290 private PhysicsVector _velocity;
291 private PhysicsVector _acceleration;
292 private NxActor _prim;
293
294 public PhysXPrim(NxActor prim)
295 {
296 _velocity = new PhysicsVector();
297 _position = new PhysicsVector();
298 _acceleration = new PhysicsVector();
299 _prim = prim;
300 }
301
302 public override bool Flying
303 {
304 get { return false; //no flying prims for you
305 }
306 set { }
307 }
308
309 public override PhysicsVector Position
379 { 310 {
380 get 311 get
381 { 312 {
382 return new PhysicsVector(0, 0, 0); 313 PhysicsVector pos = new PhysicsVector();
314 Vec3 vec = _prim.Position;
315 pos.X = vec.X;
316 pos.Y = vec.Y;
317 pos.Z = vec.Z;
318 return pos;
383 } 319 }
384 set 320 set
385 { 321 {
322 PhysicsVector vec = value;
323 Vec3 pos = new Vec3();
324 pos.X = vec.X;
325 pos.Y = vec.Y;
326 pos.Z = vec.Z;
327 _prim.Position = pos;
386 } 328 }
387 } 329 }
388 330
389 public override PhysicsVector Velocity 331 public override PhysicsVector Size
390 { 332 {
391 get 333 get { return new PhysicsVector(0, 0, 0); }
392 { 334 set { }
393 return _velocity; 335 }
394 } 336
395 set 337 public override PhysicsVector Velocity
396 { 338 {
397 _velocity = value; 339 get { return _velocity; }
398 } 340 set { _velocity = value; }
399 } 341 }
400 342
401 public override bool Kinematic 343 public override bool Kinematic
402 { 344 {
403 get 345 get { return _prim.Kinematic; }
404 { 346 set { _prim.Kinematic = value; }
405 return this._prim.Kinematic; 347 }
406 } 348
407 set 349 public override Quaternion Orientation
408 { 350 {
409 this._prim.Kinematic = value; 351 get
410 } 352 {
411 } 353 Quaternion res = new Quaternion();
412 354 PhysXWrapper.Quaternion quat = _prim.GetOrientation();
413 public override Quaternion Orientation 355 res.w = quat.W;
414 { 356 res.x = quat.X;
415 get 357 res.y = quat.Y;
416 { 358 res.z = quat.Z;
417 Quaternion res = new Quaternion(); 359 return res;
418 PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); 360 }
419 res.w = quat.W; 361 set { }
420 res.x = quat.X; 362 }
421 res.y = quat.Y; 363
422 res.z = quat.Z; 364 public override PhysicsVector Acceleration
423 return res; 365 {
424 } 366 get { return _acceleration; }
425 set 367 }
426 { 368
427 369 public void SetAcceleration(PhysicsVector accel)
428 } 370 {
429 } 371 _acceleration = accel;
430 372 }
431 public override PhysicsVector Acceleration 373
432 { 374 public override void AddForce(PhysicsVector force)
433 get 375 {
434 { 376 }
435 return _acceleration; 377
436 } 378 public override void SetMomentum(PhysicsVector momentum)
437 379 {
438 } 380 }
439 public void SetAcceleration (PhysicsVector accel) 381 }
440 { 382} \ No newline at end of file
441 this._acceleration = accel;
442 }
443
444 public override void AddForce(PhysicsVector force)
445 {
446
447 }
448
449 public override void SetMomentum(PhysicsVector momentum)
450 {
451
452 }
453
454
455 }
456
457}
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs
index a2148ea..c656e01 100644
--- a/OpenSim/Region/ScriptEngine/Common/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 31using System.Reflection;
33using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
34 33
@@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common
53 { 52 {
54 //Console.WriteLine("Executor: InitializeLifetimeService()"); 53 //Console.WriteLine("Executor: InitializeLifetimeService()");
55 // return null; 54 // return null;
56 ILease lease = (ILease)base.InitializeLifetimeService(); 55 ILease lease = (ILease) base.InitializeLifetimeService();
57 56
58 if (lease.CurrentState == LeaseState.Initial) 57 if (lease.CurrentState == LeaseState.Initial)
59 { 58 {
@@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common
75 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! 74 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
76 //try 75 //try
77 //{ 76 //{
78 if (m_Running == false) 77 if (m_Running == false)
79 { 78 {
80 // Script is inactive, do not execute! 79 // Script is inactive, do not execute!
81 return; 80 return;
82 } 81 }
83 82
84 string EventName = m_Script.State() + "_event_" + FunctionName; 83 string EventName = m_Script.State() + "_event_" + FunctionName;
85 84
86 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args); 85 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
87 86
88 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\""); 87 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
89 88
90 if (Events.ContainsKey(EventName) == false) 89 if (Events.ContainsKey(EventName) == false)
90 {
91 // Not found, create
92 Type type = m_Script.GetType();
93 try
91 { 94 {
92 // Not found, create 95 MethodInfo mi = type.GetMethod(EventName);
93 Type type = m_Script.GetType(); 96 Events.Add(EventName, mi);
94 try
95 {
96 MethodInfo mi = type.GetMethod(EventName);
97 Events.Add(EventName, mi);
98 }
99 catch
100 {
101 // Event name not found, cache it as not found
102 Events.Add(EventName, null);
103 }
104 } 97 }
105 98 catch
106 // Get event
107 MethodInfo ev = null;
108 Events.TryGetValue(EventName, out ev);
109
110 if (ev == null) // No event by that name!
111 { 99 {
112 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\""); 100 // Event name not found, cache it as not found
113 return; 101 Events.Add(EventName, null);
114 } 102 }
103 }
104
105 // Get event
106 MethodInfo ev = null;
107 Events.TryGetValue(EventName, out ev);
108
109 if (ev == null) // No event by that name!
110 {
111 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
112 return;
113 }
115 114
116 // Found 115 // Found
117 //try 116 //try
118 //{ 117 //{
119 // Invoke it 118 // Invoke it
120 ev.Invoke(m_Script, args); 119 ev.Invoke(m_Script, args);
121 120
122 //} 121 //}
123 //catch (Exception e) 122 //catch (Exception e)
124 //{ 123 //{
125 // // TODO: Send to correct place 124 // // TODO: Send to correct place
126 // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); 125 // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
127 //} 126 //}
128 127
129 128
130 //} 129 //}
@@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common
136 { 135 {
137 m_Running = false; 136 m_Running = false;
138 } 137 }
139
140
141 } 138 }
142 139} \ No newline at end of file
143}
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs
index df0e824..08c0e9c 100644
--- a/OpenSim/Region/ScriptEngine/Common/IScript.cs
+++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.Common 29namespace OpenSim.Region.ScriptEngine.Common
34{ 30{
35 public interface IScript 31 public interface IScript
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ScriptEngine.Common
37 string State(); 33 string State();
38 Executor Exec { get; } 34 Executor Exec { get; }
39 } 35 }
40} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index ff5c6bf..9cba882 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -26,15 +26,12 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.Common 31namespace OpenSim.Region.ScriptEngine.Common
34{ 32{
35 public interface LSL_BuiltIn_Commands_Interface 33 public interface LSL_BuiltIn_Commands_Interface
36 { 34 {
37
38 string State(); 35 string State();
39 36
40 double llSin(double f); 37 double llSin(double f);
@@ -404,7 +401,9 @@ namespace OpenSim.Region.ScriptEngine.Common
404 //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate) 401 //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate)
405 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate); 402 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate);
406 //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west) 403 //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
407 void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west); 404 void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
405 LSL_Types.Vector3 bottom_south_west);
406
408 //wiki: llEjectFromLand(key pest) 407 //wiki: llEjectFromLand(key pest)
409 void llEjectFromLand(string pest); 408 void llEjectFromLand(string pest);
410 void llParseString2List(); 409 void llParseString2List();
@@ -437,7 +436,7 @@ namespace OpenSim.Region.ScriptEngine.Common
437 //wiki: double llGetRegionFPS() 436 //wiki: double llGetRegionFPS()
438 double llGetRegionFPS(); 437 double llGetRegionFPS();
439 //wiki: llParticleSystem(List<Object> rules 438 //wiki: llParticleSystem(List<Object> rules
440 void llParticleSystem(List<Object> rules); 439 void llParticleSystem(List<object> rules);
441 //wiki: llGroundRepel(double height, integer water, double tau) 440 //wiki: llGroundRepel(double height, integer water, double tau)
442 void llGroundRepel(double height, int water, double tau); 441 void llGroundRepel(double height, int water, double tau);
443 void llGiveInventoryList(); 442 void llGiveInventoryList();
@@ -548,7 +547,9 @@ namespace OpenSim.Region.ScriptEngine.Common
548 //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) 547 //wiki: list llParseStringKeepNulls( string src, list separators, list spacers )
549 List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); 548 List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers);
550 //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) 549 //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param)
551 void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param); 550 void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
551 LSL_Types.Quaternion rot, int param);
552
552 //wiki: integer llGetObjectPermMask(integer mask) 553 //wiki: integer llGetObjectPermMask(integer mask)
553 int llGetObjectPermMask(int mask); 554 int llGetObjectPermMask(int mask);
554 //wiki: llSetObjectPermMask(integer mask, integer value) 555 //wiki: llSetObjectPermMask(integer mask, integer value)
@@ -632,4 +633,4 @@ namespace OpenSim.Region.ScriptEngine.Common
632 //OpenSim functions 633 //OpenSim functions
633 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); 634 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
634 } 635 }
635} 636} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 7d69379..df3d752 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -41,11 +41,12 @@ namespace OpenSim.Region.ScriptEngine.Common
41 public double Z; 41 public double Z;
42 42
43 public Vector3(Vector3 vector) 43 public Vector3(Vector3 vector)
44 { 44 {
45 X = (float)vector.X; 45 X = (float) vector.X;
46 Y = (float)vector.Y; 46 Y = (float) vector.Y;
47 Z = (float)vector.Z; 47 Z = (float) vector.Z;
48 } 48 }
49
49 public Vector3(double x, double y, double z) 50 public Vector3(double x, double y, double z)
50 { 51 {
51 X = x; 52 X = x;
@@ -53,6 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Common
53 Z = z; 54 Z = z;
54 } 55 }
55 } 56 }
57
56 [Serializable] 58 [Serializable]
57 public struct Quaternion 59 public struct Quaternion
58 { 60 {
@@ -62,12 +64,13 @@ namespace OpenSim.Region.ScriptEngine.Common
62 public double R; 64 public double R;
63 65
64 public Quaternion(Quaternion Quat) 66 public Quaternion(Quaternion Quat)
65 { 67 {
66 X = (float)Quat.X; 68 X = (float) Quat.X;
67 Y = (float)Quat.Y; 69 Y = (float) Quat.Y;
68 Z = (float)Quat.Z; 70 Z = (float) Quat.Z;
69 R = (float)Quat.R; 71 R = (float) Quat.R;
70 } 72 }
73
71 public Quaternion(double x, double y, double z, double r) 74 public Quaternion(double x, double y, double z, double r)
72 { 75 {
73 X = x; 76 X = x;
@@ -75,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.Common
75 Z = z; 78 Z = z;
76 R = r; 79 R = r;
77 } 80 }
78
79 } 81 }
80 } 82 }
81} 83} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
index 98704d5..48cf45a 100644
--- a/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Common/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Common")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.Common")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.Common")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.Common")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("0bf07c53-ae51-487f-a907-e9b30c251602")] 24
25[assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices;
29// Build Number 31// Build Number
30// Revision 32// Revision
31// 33//
32[assembly: AssemblyVersion("1.0.0.0")] 34
33[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly : AssemblyVersion("1.0.0.0")]
36[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 391e3aa..bc241ce 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -27,27 +27,22 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 32using System.Reflection;
33using System.Threading;
34using System.Runtime.Remoting;
35using System.IO;
36using OpenSim.Region.Environment.Scenes;
37using OpenSim.Region.Environment.Scenes.Scripting;
38using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 33using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
39using OpenSim.Region.ScriptEngine.Common;
40using libsecondlife;
41 34
42namespace OpenSim.Region.ScriptEngine.DotNetEngine 35namespace OpenSim.Region.ScriptEngine.DotNetEngine
43{ 36{
44 public class AppDomainManager 37 public class AppDomainManager
45 { 38 {
46 private int maxScriptsPerAppDomain = 1; 39 private int maxScriptsPerAppDomain = 1;
40
47 /// <summary> 41 /// <summary>
48 /// Internal list of all AppDomains 42 /// Internal list of all AppDomains
49 /// </summary> 43 /// </summary>
50 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>(); 44 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
45
51 /// <summary> 46 /// <summary>
52 /// Structure to keep track of data around AppDomain 47 /// Structure to keep track of data around AppDomain
53 /// </summary> 48 /// </summary>
@@ -57,19 +52,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
57 /// The AppDomain itself 52 /// The AppDomain itself
58 /// </summary> 53 /// </summary>
59 public AppDomain CurrentAppDomain; 54 public AppDomain CurrentAppDomain;
55
60 /// <summary> 56 /// <summary>
61 /// Number of scripts loaded into AppDomain 57 /// Number of scripts loaded into AppDomain
62 /// </summary> 58 /// </summary>
63 public int ScriptsLoaded; 59 public int ScriptsLoaded;
60
64 /// <summary> 61 /// <summary>
65 /// Number of dead scripts 62 /// Number of dead scripts
66 /// </summary> 63 /// </summary>
67 public int ScriptsWaitingUnload; 64 public int ScriptsWaitingUnload;
68 } 65 }
66
69 /// <summary> 67 /// <summary>
70 /// Current AppDomain 68 /// Current AppDomain
71 /// </summary> 69 /// </summary>
72 private AppDomainStructure currentAD; 70 private AppDomainStructure currentAD;
71
73 private object getLock = new object(); // Mutex 72 private object getLock = new object(); // Mutex
74 private object freeLock = new object(); // Mutex 73 private object freeLock = new object(); // Mutex
75 74
@@ -94,22 +93,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
94 { 93 {
95 // Add it to AppDomains list and empty current 94 // Add it to AppDomains list and empty current
96 appDomains.Add(currentAD); 95 appDomains.Add(currentAD);
97 currentAD = null; 96 currentAD = null;
98 } 97 }
99 // No current 98 // No current
100 if (currentAD == null) 99 if (currentAD == null)
101 { 100 {
102 // Create a new current AppDomain 101 // Create a new current AppDomain
103 currentAD = new AppDomainStructure(); 102 currentAD = new AppDomainStructure();
104 currentAD.CurrentAppDomain = PrepareNewAppDomain(); 103 currentAD.CurrentAppDomain = PrepareNewAppDomain();
105 } 104 }
106 105
107 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); 106 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
108 return currentAD; 107 return currentAD;
109 } // lock 108 } // lock
110 } 109 }
111 110
112 private int AppDomainNameCount; 111 private int AppDomainNameCount;
112
113 /// <summary> 113 /// <summary>
114 /// Create and prepare a new AppDomain for scripts 114 /// Create and prepare a new AppDomain for scripts
115 /// </summary> 115 /// </summary>
@@ -130,12 +130,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
130 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; 130 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
131 131
132 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); 132 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
133 Console.WriteLine("Loading: " + AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); 133 Console.WriteLine("Loading: " +
134 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
134 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); 135 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
135 136
136 // Return the new AppDomain 137 // Return the new AppDomain
137 return AD; 138 return AD;
138
139 } 139 }
140 140
141 /// <summary> 141 /// <summary>
@@ -146,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
146 lock (freeLock) 146 lock (freeLock)
147 { 147 {
148 // Go through all 148 // Go through all
149 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) 149 foreach (AppDomainStructure ads in new ArrayList(appDomains))
150 { 150 {
151 // Don't process current AppDomain 151 // Don't process current AppDomain
152 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) 152 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
@@ -164,23 +164,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
164 // Unload 164 // Unload
165 AppDomain.Unload(ads.CurrentAppDomain); 165 AppDomain.Unload(ads.CurrentAppDomain);
166#if DEBUG 166#if DEBUG
167 Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); 167 Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) +
168 " bytes of memory");
168#endif 169#endif
169 } 170 }
170 } 171 }
171 } // foreach 172 } // foreach
172 } // lock 173 } // lock
173 } 174 }
174
175 175
176 176
177 public OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName) 177 public LSL_BaseClass LoadScript(string FileName)
178 { 178 {
179 // Find next available AppDomain to put it in 179 // Find next available AppDomain to put it in
180 AppDomainStructure FreeAppDomain = GetFreeAppDomain(); 180 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
181 181
182 Console.WriteLine("Loading into AppDomain: " + FileName); 182 Console.WriteLine("Loading into AppDomain: " + FileName);
183 LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); 183 LSL_BaseClass mbrt =
184 (LSL_BaseClass)
185 FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
184 //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); 186 //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
185 FreeAppDomain.ScriptsLoaded++; 187 FreeAppDomain.ScriptsLoaded++;
186 188
@@ -207,7 +209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
207 } 209 }
208 210
209 // Lopp through all AppDomains 211 // Lopp through all AppDomains
210 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) 212 foreach (AppDomainStructure ads in new ArrayList(appDomains))
211 { 213 {
212 if (ads.CurrentAppDomain == ad) 214 if (ads.CurrentAppDomain == ad)
213 { 215 {
@@ -219,10 +221,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
219 } // lock 221 } // lock
220 222
221 UnloadAppDomains(); // Outsite lock, has its own GetLock 223 UnloadAppDomains(); // Outsite lock, has its own GetLock
222
223
224 } 224 }
225
226
227 } 225 }
228} 226} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
index 49ce8b8..e04a9ed 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
@@ -26,34 +26,30 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.DotNetEngine 29namespace OpenSim.Region.ScriptEngine.DotNetEngine
34{ 30{
35 public static class Common 31 public static class Common
36 { 32 {
37 static public bool debug = true; 33 public static bool debug = true;
38 static public ScriptEngine mySE; 34 public static ScriptEngine mySE;
39 35
40 //public delegate void SendToDebugEventDelegate(string Message); 36 //public delegate void SendToDebugEventDelegate(string Message);
41 //public delegate void SendToLogEventDelegate(string Message); 37 //public delegate void SendToLogEventDelegate(string Message);
42 //static public event SendToDebugEventDelegate SendToDebugEvent; 38 //static public event SendToDebugEventDelegate SendToDebugEvent;
43 //static public event SendToLogEventDelegate SendToLogEvent; 39 //static public event SendToLogEventDelegate SendToLogEvent;
44 40
45 static public void SendToDebug(string Message) 41 public static void SendToDebug(string Message)
46 { 42 {
47 //if (Debug == true) 43 //if (Debug == true)
48 mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); 44 mySE.Log.Verbose("ScriptEngine", "Debug: " + Message);
49 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 45 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
50 } 46 }
51 static public void SendToLog(string Message) 47
48 public static void SendToLog(string Message)
52 { 49 {
53 //if (Debug == true) 50 //if (Debug == true)
54 mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); 51 mySE.Log.Verbose("ScriptEngine", "LOG: " + Message);
55 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 52 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
56 } 53 }
57 } 54 }
58 55} \ No newline at end of file
59}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index a2eee66..7f452e0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -27,16 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using Microsoft.CSharp;
34using System.CodeDom.Compiler; 30using System.CodeDom.Compiler;
31using System.IO;
35using System.Reflection; 32using System.Reflection;
33using Microsoft.CSharp;
36 34
37namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
38{ 36{
39
40 public class Compiler 37 public class Compiler
41 { 38 {
42 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 39 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
@@ -45,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
45 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 42 //private ICodeCompiler icc = codeProvider.CreateCompiler();
46 public string CompileFromFile(string LSOFileName) 43 public string CompileFromFile(string LSOFileName)
47 { 44 {
48 switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) 45 switch (Path.GetExtension(LSOFileName).ToLower())
49 { 46 {
50 case ".txt": 47 case ".txt":
51 case ".lsl": 48 case ".lsl":
@@ -58,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
58 throw new Exception("Unknown script type."); 55 throw new Exception("Unknown script type.");
59 } 56 }
60 } 57 }
58
61 /// <summary> 59 /// <summary>
62 /// Converts script from LSL to CS and calls CompileFromCSText 60 /// Converts script from LSL to CS and calls CompileFromCSText
63 /// </summary> 61 /// </summary>
@@ -67,13 +65,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
67 { 65 {
68 if (Script.Substring(0, 4).ToLower() == "//c#") 66 if (Script.Substring(0, 4).ToLower() == "//c#")
69 { 67 {
70 return CompileFromCSText( Script ); 68 return CompileFromCSText(Script);
71 } 69 }
72 else 70 else
73 { 71 {
74 return CompileFromCSText(LSL_Converter.Convert(Script)); 72 return CompileFromCSText(LSL_Converter.Convert(Script));
75 } 73 }
76 } 74 }
75
77 /// <summary> 76 /// <summary>
78 /// Compile CS script to .Net assembly (.dll) 77 /// Compile CS script to .Net assembly (.dll)
79 /// </summary> 78 /// </summary>
@@ -81,14 +80,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
81 /// <returns>Filename to .dll assembly</returns> 80 /// <returns>Filename to .dll assembly</returns>
82 public string CompileFromCSText(string Script) 81 public string CompileFromCSText(string Script)
83 { 82 {
84
85
86 // Output assembly name 83 // Output assembly name
87 scriptCompileCounter++; 84 scriptCompileCounter++;
88 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); 85 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
89 try 86 try
90 { 87 {
91 System.IO.File.Delete(OutFile); 88 File.Delete(OutFile);
92 } 89 }
93 catch (Exception e) 90 catch (Exception e)
94 { 91 {
@@ -99,12 +96,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
99 // DEBUG - write source to disk 96 // DEBUG - write source to disk
100 try 97 try
101 { 98 {
102 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); 99 File.WriteAllText(
100 Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
101 }
102 catch
103 {
103 } 104 }
104 catch { }
105 105
106 // Do actual compile 106 // Do actual compile
107 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); 107 CompilerParameters parameters = new CompilerParameters();
108 parameters.IncludeDebugInformation = true; 108 parameters.IncludeDebugInformation = true;
109 // Add all available assemblies 109 // Add all available assemblies
110 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) 110 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
@@ -114,11 +114,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
114 } 114 }
115 115
116 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 116 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
117 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); 117 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
118 //Console.WriteLine("Assembly location: " + rootPath); 118 //Console.WriteLine("Assembly location: " + rootPath);
119 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); 119 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
120 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); 120 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
121 121
122 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 122 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
123 parameters.GenerateExecutable = false; 123 parameters.GenerateExecutable = false;
124 parameters.OutputAssembly = OutFile; 124 parameters.OutputAssembly = OutFile;
@@ -129,13 +129,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
129 // TODO: Return errors to user somehow 129 // TODO: Return errors to user somehow
130 if (results.Errors.Count > 0) 130 if (results.Errors.Count > 0)
131 { 131 {
132
133 string errtext = ""; 132 string errtext = "";
134 foreach (CompilerError CompErr in results.Errors) 133 foreach (CompilerError CompErr in results.Errors)
135 { 134 {
136 errtext += "Line number " + (CompErr.Line - 1) + 135 errtext += "Line number " + (CompErr.Line - 1) +
137 ", Error Number: " + CompErr.ErrorNumber + 136 ", Error Number: " + CompErr.ErrorNumber +
138 ", '" + CompErr.ErrorText + "'\r\n"; 137 ", '" + CompErr.ErrorText + "'\r\n";
139 } 138 }
140 throw new Exception(errtext); 139 throw new Exception(errtext);
141 } 140 }
@@ -143,6 +142,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
143 142
144 return OutFile; 143 return OutFile;
145 } 144 }
146
147 } 145 }
148} 146} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 18eeaa3..0c28617 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -26,9 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using System.Text.RegularExpressions; 30using System.Text.RegularExpressions;
33 31
34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 32namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
@@ -51,9 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
51 dataTypes.Add("rotation", "LSL_Types.Quaternion"); 49 dataTypes.Add("rotation", "LSL_Types.Quaternion");
52 dataTypes.Add("list", "list"); 50 dataTypes.Add("list", "list");
53 dataTypes.Add("null", "null"); 51 dataTypes.Add("null", "null");
54
55 } 52 }
56 53
57 public string Convert(string Script) 54 public string Convert(string Script)
58 { 55 {
59 string Return = ""; 56 string Return = "";
@@ -81,7 +78,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
81 int quote_replaced_count = 0; 78 int quote_replaced_count = 0;
82 for (int p = 0; p < Script.Length; p++) 79 for (int p = 0; p < Script.Length; p++)
83 { 80 {
84
85 C = Script.Substring(p, 1); 81 C = Script.Substring(p, 1);
86 while (true) 82 while (true)
87 { 83 {
@@ -99,10 +95,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
99 if (quote == "") 95 if (quote == "")
100 { 96 {
101 // We didn't replace quote, probably because of empty string? 97 // We didn't replace quote, probably because of empty string?
102 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); 98 _Script += quote_replacement_string +
99 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
103 } 100 }
104 // We just left a quote 101 // We just left a quote
105 quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); 102 quotes.Add(
103 quote_replacement_string +
104 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
106 quote = ""; 105 quote = "";
107 } 106 }
108 break; 107 break;
@@ -112,7 +111,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
112 { 111 {
113 // We are not inside a quote 112 // We are not inside a quote
114 quote_replaced = false; 113 quote_replaced = false;
115
116 } 114 }
117 else 115 else
118 { 116 {
@@ -120,7 +118,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
120 if (!quote_replaced) 118 if (!quote_replaced)
121 { 119 {
122 // Replace quote 120 // Replace quote
123 _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); 121 _Script += quote_replacement_string +
122 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
124 quote_replaced = true; 123 quote_replaced = true;
125 } 124 }
126 quote += C; 125 quote += C;
@@ -141,7 +140,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
141 // 140 //
142 141
143 142
144
145 // 143 //
146 // PROCESS STATES 144 // PROCESS STATES
147 // Remove state definitions and add state names to start of each event within state 145 // Remove state definitions and add state names to start of each event within state
@@ -170,7 +168,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
170 if (ilevel == 1 && lastlevel == 0) 168 if (ilevel == 1 && lastlevel == 0)
171 { 169 {
172 // 0 => 1: Get last 170 // 0 => 1: Get last
173 Match m = Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 171 Match m =
172 Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{",
173 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
174 174
175 in_state = false; 175 in_state = false;
176 if (m.Success) 176 if (m.Success)
@@ -179,7 +179,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
179 in_state = true; 179 in_state = true;
180 current_statename = m.Groups[1].Captures[0].Value; 180 current_statename = m.Groups[1].Captures[0].Value;
181 //Console.WriteLine("Current statename: " + current_statename); 181 //Console.WriteLine("Current statename: " + current_statename);
182 cache = Regex.Replace(cache, @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){", "${s1}${s2}", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 182 cache =
183 Regex.Replace(cache,
184 @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){",
185 "${s1}${s2}",
186 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
183 } 187 }
184 ret += cache; 188 ret += cache;
185 cache = ""; 189 cache = "";
@@ -196,7 +200,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
196 // void dataserver(key query_id, string data) { 200 // void dataserver(key query_id, string data) {
197 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 201 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
198 //Console.WriteLine("Replacing using statename: " + current_statename); 202 //Console.WriteLine("Replacing using statename: " + current_statename);
199 cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1public " + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 203 cache =
204 Regex.Replace(cache,
205 @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
206 @"$1public " + current_statename + "_event_$2",
207 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
200 } 208 }
201 209
202 ret += cache; 210 ret += cache;
@@ -216,32 +224,48 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
216 ret = ""; 224 ret = "";
217 225
218 226
219
220 foreach (string key in dataTypes.Keys) 227 foreach (string key in dataTypes.Keys)
221 { 228 {
222 string val; 229 string val;
223 dataTypes.TryGetValue(key, out val); 230 dataTypes.TryGetValue(key, out val);
224 231
225 // Replace CAST - (integer) with (int) 232 // Replace CAST - (integer) with (int)
226 Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); 233 Script =
234 Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")",
235 RegexOptions.Compiled | RegexOptions.Multiline);
227 // Replace return types and function variables - integer a() and f(integer a, integer a) 236 // Replace return types and function variables - integer a() and f(integer a, integer a)
228 Script = Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3", RegexOptions.Compiled | RegexOptions.Multiline); 237 Script =
238 Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3",
239 RegexOptions.Compiled | RegexOptions.Multiline);
229 } 240 }
230 241
231 // Add "void" in front of functions that needs it 242 // Add "void" in front of functions that needs it
232 Script = Regex.Replace(Script, @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 243 Script =
244 Regex.Replace(Script,
245 @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
246 @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
233 247
234 // Replace <x,y,z> and <x,y,z,r> 248 // Replace <x,y,z> and <x,y,z,r>
235 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 249 Script =
236 Script = Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 250 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)",
251 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
252 Script =
253 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)",
254 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
237 255
238 // Replace List []'s 256 // Replace List []'s
239 Script = Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 257 Script =
258 Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)",
259 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
240 260
241 261
242 // Replace (string) to .ToString() // 262 // Replace (string) to .ToString() //
243 Script = Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 263 Script =
244 Script = Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); 264 Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()",
265 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
266 Script =
267 Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)",
268 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
245 269
246 270
247 // REPLACE BACK QUOTES 271 // REPLACE BACK QUOTES
@@ -256,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
256 // Add namespace, class name and inheritance 280 // Add namespace, class name and inheritance
257 281
258 Return = "" + 282 Return = "" +
259 "using OpenSim.Region.ScriptEngine.Common;"; 283 "using OpenSim.Region.ScriptEngine.Common;";
260 //"using System; " + 284 //"using System; " +
261 //"using System.Collections.Generic; " + 285 //"using System.Collections.Generic; " +
262 //"using System.Text; " + 286 //"using System.Text; " +
@@ -278,17 +302,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
278 302
279 303
280 Return += "" + 304 Return += "" +
281 "namespace SecondLife { "; 305 "namespace SecondLife { ";
282 Return += "" + 306 Return += "" +
283 //"[Serializable] " + 307 //"[Serializable] " +
284 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { "; 308 "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { ";
285 Return += @"public Script() { } "; 309 Return += @"public Script() { } ";
286 Return += Script; 310 Return += Script;
287 Return += "} }\r\n"; 311 Return += "} }\r\n";
288 312
289 return Return; 313 return Return;
290 } 314 }
291
292
293 } 315 }
294} 316} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index ea05efc..f2774d6 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -28,12 +28,9 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
33using OpenSim.Region.ScriptEngine.Common;
34using System.Threading;
35using System.Reflection;
36using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Threading;
33using OpenSim.Region.ScriptEngine.Common;
37using integer = System.Int32; 34using integer = System.Int32;
38using key = System.String; 35using key = System.String;
39using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3; 36using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3;
@@ -44,13 +41,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
44 //[Serializable] 41 //[Serializable]
45 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript 42 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
46 { 43 {
47
48 // Object never expires 44 // Object never expires
49 public override Object InitializeLifetimeService() 45 public override Object InitializeLifetimeService()
50 { 46 {
51 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); 47 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()");
52 // return null; 48 // return null;
53 ILease lease = (ILease)base.InitializeLifetimeService(); 49 ILease lease = (ILease) base.InitializeLifetimeService();
54 50
55 if (lease.CurrentState == LeaseState.Initial) 51 if (lease.CurrentState == LeaseState.Initial)
56 { 52 {
@@ -63,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
63 59
64 60
65 private Executor m_Exec; 61 private Executor m_Exec;
62
66 public Executor Exec 63 public Executor Exec
67 { 64 {
68 get 65 get
@@ -79,6 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
79 public LSL_BaseClass() 76 public LSL_BaseClass()
80 { 77 {
81 } 78 }
79
82 public string State() 80 public string State()
83 { 81 {
84 return m_LSL_Functions.State(); 82 return m_LSL_Functions.State();
@@ -94,410 +92,1724 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
94 // Get this AppDomain's settings and display some of them. 92 // Get this AppDomain's settings and display some of them.
95 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; 93 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation;
96 Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", 94 Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}",
97 ads.ApplicationName, 95 ads.ApplicationName,
98 ads.ApplicationBase, 96 ads.ApplicationBase,
99 ads.ConfigurationFile 97 ads.ConfigurationFile
100 ); 98 );
101 99
102 // Display the name of the calling AppDomain and the name 100 // Display the name of the calling AppDomain and the name
103 // of the second domain. 101 // of the second domain.
104 // NOTE: The application's thread has transitioned between 102 // NOTE: The application's thread has transitioned between
105 // AppDomains. 103 // AppDomains.
106 Console.WriteLine("Calling to '{0}'.", 104 Console.WriteLine("Calling to '{0}'.",
107 Thread.GetDomain().FriendlyName 105 Thread.GetDomain().FriendlyName
108 ); 106 );
109 107
110 return; 108 return;
111 } 109 }
112 110
113 111
114
115 // 112 //
116 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 113 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
117 // 114 //
118 // They are only forwarders to LSL_BuiltIn_Commands.cs 115 // They are only forwarders to LSL_BuiltIn_Commands.cs
119 // 116 //
120 public double llSin(double f) { return m_LSL_Functions.llSin(f); } 117 public double llSin(double f)
121 public double llCos(double f) { return m_LSL_Functions.llCos(f); } 118 {
122 public double llTan(double f) { return m_LSL_Functions.llTan(f); } 119 return m_LSL_Functions.llSin(f);
123 public double llAtan2(double x, double y) { return m_LSL_Functions.llAtan2(x, y); } 120 }
124 public double llSqrt(double f) { return m_LSL_Functions.llSqrt(f); } 121
125 public double llPow(double fbase, double fexponent) { return m_LSL_Functions.llPow(fbase, fexponent); } 122 public double llCos(double f)
126 public int llAbs(int i) { return m_LSL_Functions.llAbs(i); } 123 {
127 public double llFabs(double f) { return m_LSL_Functions.llFabs(f); } 124 return m_LSL_Functions.llCos(f);
128 public double llFrand(double mag) { return m_LSL_Functions.llFrand(mag); } 125 }
129 public int llFloor(double f) { return m_LSL_Functions.llFloor(f); } 126
130 public int llCeil(double f) { return m_LSL_Functions.llCeil(f); } 127 public double llTan(double f)
131 public int llRound(double f) { return m_LSL_Functions.llRound(f); } 128 {
132 public double llVecMag(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecMag(v); } 129 return m_LSL_Functions.llTan(f);
133 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { return m_LSL_Functions.llVecNorm(v); } 130 }
134 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) { return m_LSL_Functions.llVecDist(a, b); } 131
135 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Euler(r); } 132 public double llAtan2(double x, double y)
136 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) { return m_LSL_Functions.llEuler2Rot(v); } 133 {
137 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return m_LSL_Functions.llAxes2Rot(fwd, left, up); } 134 return m_LSL_Functions.llAtan2(x, y);
138 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Fwd(r); } 135 }
139 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Left(r); } 136
140 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return m_LSL_Functions.llRot2Up(r); } 137 public double llSqrt(double f)
141 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return m_LSL_Functions.llRotBetween(start, end); } 138 {
142 public void llWhisper(int channelID, string text) { m_LSL_Functions.llWhisper(channelID, text); } 139 return m_LSL_Functions.llSqrt(f);
143 public void llSay(int channelID, string text) { m_LSL_Functions.llSay(channelID, text); } 140 }
141
142 public double llPow(double fbase, double fexponent)
143 {
144 return m_LSL_Functions.llPow(fbase, fexponent);
145 }
146
147 public int llAbs(int i)
148 {
149 return m_LSL_Functions.llAbs(i);
150 }
151
152 public double llFabs(double f)
153 {
154 return m_LSL_Functions.llFabs(f);
155 }
156
157 public double llFrand(double mag)
158 {
159 return m_LSL_Functions.llFrand(mag);
160 }
161
162 public int llFloor(double f)
163 {
164 return m_LSL_Functions.llFloor(f);
165 }
166
167 public int llCeil(double f)
168 {
169 return m_LSL_Functions.llCeil(f);
170 }
171
172 public int llRound(double f)
173 {
174 return m_LSL_Functions.llRound(f);
175 }
176
177 public double llVecMag(vector v)
178 {
179 return m_LSL_Functions.llVecMag(v);
180 }
181
182 public vector llVecNorm(vector v)
183 {
184 return m_LSL_Functions.llVecNorm(v);
185 }
186
187 public double llVecDist(vector a, vector b)
188 {
189 return m_LSL_Functions.llVecDist(a, b);
190 }
191
192 public vector llRot2Euler(rotation r)
193 {
194 return m_LSL_Functions.llRot2Euler(r);
195 }
196
197 public rotation llEuler2Rot(vector v)
198 {
199 return m_LSL_Functions.llEuler2Rot(v);
200 }
201
202 public rotation llAxes2Rot(vector fwd, vector left, vector up)
203 {
204 return m_LSL_Functions.llAxes2Rot(fwd, left, up);
205 }
206
207 public vector llRot2Fwd(rotation r)
208 {
209 return m_LSL_Functions.llRot2Fwd(r);
210 }
211
212 public vector llRot2Left(rotation r)
213 {
214 return m_LSL_Functions.llRot2Left(r);
215 }
216
217 public vector llRot2Up(rotation r)
218 {
219 return m_LSL_Functions.llRot2Up(r);
220 }
221
222 public rotation llRotBetween(vector start, vector end)
223 {
224 return m_LSL_Functions.llRotBetween(start, end);
225 }
226
227 public void llWhisper(int channelID, string text)
228 {
229 m_LSL_Functions.llWhisper(channelID, text);
230 }
231
232 public void llSay(int channelID, string text)
233 {
234 m_LSL_Functions.llSay(channelID, text);
235 }
236
144 // 237 //
145 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 238 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
146 // 239 //
147 public void llShout(int channelID, string text) { m_LSL_Functions.llShout(channelID, text); } 240 public void llShout(int channelID, string text)
148 public int llListen(int channelID, string name, string ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } 241 {
149 public void llListenControl(int number, int active) { m_LSL_Functions.llListenControl(number, active); } 242 m_LSL_Functions.llShout(channelID, text);
150 public void llListenRemove(int number) { m_LSL_Functions.llListenRemove(number); } 243 }
151 public void llSensor(string name, string id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } 244
152 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } 245 public int llListen(int channelID, string name, string ID, string msg)
153 public void llSensorRemove() { m_LSL_Functions.llSensorRemove(); } 246 {
154 public string llDetectedName(int number) { return m_LSL_Functions.llDetectedName(number); } 247 return m_LSL_Functions.llListen(channelID, name, ID, msg);
155 public string llDetectedKey(int number) { return m_LSL_Functions.llDetectedKey(number); } 248 }
156 public string llDetectedOwner(int number) { return m_LSL_Functions.llDetectedOwner(number); } 249
157 public int llDetectedType(int number) { return m_LSL_Functions.llDetectedType(number); } 250 public void llListenControl(int number, int active)
158 public LSL_Types.Vector3 llDetectedPos(int number) { return m_LSL_Functions.llDetectedPos(number); } 251 {
159 public LSL_Types.Vector3 llDetectedVel(int number) { return m_LSL_Functions.llDetectedVel(number); } 252 m_LSL_Functions.llListenControl(number, active);
160 public LSL_Types.Vector3 llDetectedGrab(int number) { return m_LSL_Functions.llDetectedGrab(number); } 253 }
161 public LSL_Types.Quaternion llDetectedRot(int number) { return m_LSL_Functions.llDetectedRot(number); } 254
162 public int llDetectedGroup(int number) { return m_LSL_Functions.llDetectedGroup(number); } 255 public void llListenRemove(int number)
163 public int llDetectedLinkNumber(int number) { return m_LSL_Functions.llDetectedLinkNumber(number); } 256 {
257 m_LSL_Functions.llListenRemove(number);
258 }
259
260 public void llSensor(string name, string id, int type, double range, double arc)
261 {
262 m_LSL_Functions.llSensor(name, id, type, range, arc);
263 }
264
265 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
266 {
267 m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate);
268 }
269
270 public void llSensorRemove()
271 {
272 m_LSL_Functions.llSensorRemove();
273 }
274
275 public string llDetectedName(int number)
276 {
277 return m_LSL_Functions.llDetectedName(number);
278 }
279
280 public string llDetectedKey(int number)
281 {
282 return m_LSL_Functions.llDetectedKey(number);
283 }
284
285 public string llDetectedOwner(int number)
286 {
287 return m_LSL_Functions.llDetectedOwner(number);
288 }
289
290 public int llDetectedType(int number)
291 {
292 return m_LSL_Functions.llDetectedType(number);
293 }
294
295 public vector llDetectedPos(int number)
296 {
297 return m_LSL_Functions.llDetectedPos(number);
298 }
299
300 public vector llDetectedVel(int number)
301 {
302 return m_LSL_Functions.llDetectedVel(number);
303 }
304
305 public vector llDetectedGrab(int number)
306 {
307 return m_LSL_Functions.llDetectedGrab(number);
308 }
309
310 public rotation llDetectedRot(int number)
311 {
312 return m_LSL_Functions.llDetectedRot(number);
313 }
314
315 public int llDetectedGroup(int number)
316 {
317 return m_LSL_Functions.llDetectedGroup(number);
318 }
319
320 public int llDetectedLinkNumber(int number)
321 {
322 return m_LSL_Functions.llDetectedLinkNumber(number);
323 }
324
164 // 325 //
165 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 326 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
166 // 327 //
167 public void llDie() { m_LSL_Functions.llDie(); } 328 public void llDie()
168 public double llGround(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGround(offset); } 329 {
169 public double llCloud(LSL_Types.Vector3 offset) { return m_LSL_Functions.llCloud(offset); } 330 m_LSL_Functions.llDie();
170 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWind(offset); } 331 }
171 public void llSetStatus(int status, int value) { m_LSL_Functions.llSetStatus(status, value); } 332
172 public int llGetStatus(int status) { return m_LSL_Functions.llGetStatus(status); } 333 public double llGround(vector offset)
173 public void llSetScale(LSL_Types.Vector3 scale) { m_LSL_Functions.llSetScale(scale); } 334 {
174 public LSL_Types.Vector3 llGetScale() { return m_LSL_Functions.llGetScale(); } 335 return m_LSL_Functions.llGround(offset);
175 public void llSetColor(LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetColor(color, face); } 336 }
176 public double llGetAlpha(int face) { return m_LSL_Functions.llGetAlpha(face); } 337
177 public void llSetAlpha(double alpha, int face) { m_LSL_Functions.llSetAlpha(alpha, face); } 338 public double llCloud(vector offset)
178 public LSL_Types.Vector3 llGetColor(int face) { return m_LSL_Functions.llGetColor(face); } 339 {
179 public void llSetTexture(string texture, int face) { m_LSL_Functions.llSetTexture(texture, face); } 340 return m_LSL_Functions.llCloud(offset);
180 public void llScaleTexture(double u, double v, int face) { m_LSL_Functions.llScaleTexture(u, v, face); } 341 }
181 public void llOffsetTexture(double u, double v, int face) { m_LSL_Functions.llOffsetTexture(u, v, face); } 342
182 public void llRotateTexture(double rotation, int face) { m_LSL_Functions.llRotateTexture(rotation, face); } 343 public vector llWind(vector offset)
183 public string llGetTexture(int face) { return m_LSL_Functions.llGetTexture(face); } 344 {
345 return m_LSL_Functions.llWind(offset);
346 }
347
348 public void llSetStatus(int status, int value)
349 {
350 m_LSL_Functions.llSetStatus(status, value);
351 }
352
353 public int llGetStatus(int status)
354 {
355 return m_LSL_Functions.llGetStatus(status);
356 }
357
358 public void llSetScale(vector scale)
359 {
360 m_LSL_Functions.llSetScale(scale);
361 }
362
363 public vector llGetScale()
364 {
365 return m_LSL_Functions.llGetScale();
366 }
367
368 public void llSetColor(vector color, int face)
369 {
370 m_LSL_Functions.llSetColor(color, face);
371 }
372
373 public double llGetAlpha(int face)
374 {
375 return m_LSL_Functions.llGetAlpha(face);
376 }
377
378 public void llSetAlpha(double alpha, int face)
379 {
380 m_LSL_Functions.llSetAlpha(alpha, face);
381 }
382
383 public vector llGetColor(int face)
384 {
385 return m_LSL_Functions.llGetColor(face);
386 }
387
388 public void llSetTexture(string texture, int face)
389 {
390 m_LSL_Functions.llSetTexture(texture, face);
391 }
392
393 public void llScaleTexture(double u, double v, int face)
394 {
395 m_LSL_Functions.llScaleTexture(u, v, face);
396 }
397
398 public void llOffsetTexture(double u, double v, int face)
399 {
400 m_LSL_Functions.llOffsetTexture(u, v, face);
401 }
402
403 public void llRotateTexture(double rotation, int face)
404 {
405 m_LSL_Functions.llRotateTexture(rotation, face);
406 }
407
408 public string llGetTexture(int face)
409 {
410 return m_LSL_Functions.llGetTexture(face);
411 }
412
184 // 413 //
185 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 414 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
186 // 415 //
187 public void llSetPos(LSL_Types.Vector3 pos) { m_LSL_Functions.llSetPos(pos); } 416 public void llSetPos(vector pos)
188 public LSL_Types.Vector3 llGetPos() { return m_LSL_Functions.llGetPos(); } 417 {
189 public LSL_Types.Vector3 llGetLocalPos() { return m_LSL_Functions.llGetLocalPos(); } 418 m_LSL_Functions.llSetPos(pos);
190 public void llSetRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetRot(rot); } 419 }
191 public LSL_Types.Quaternion llGetRot() { return m_LSL_Functions.llGetRot(); } 420
192 public LSL_Types.Quaternion llGetLocalRot() { return m_LSL_Functions.llGetLocalRot(); } 421 public vector llGetPos()
193 public void llSetForce(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llSetForce(force, local); } 422 {
194 public LSL_Types.Vector3 llGetForce() { return m_LSL_Functions.llGetForce(); } 423 return m_LSL_Functions.llGetPos();
195 public int llTarget(LSL_Types.Vector3 position, double range) { return m_LSL_Functions.llTarget(position, range); } 424 }
196 public void llTargetRemove(int number) { m_LSL_Functions.llTargetRemove(number); } 425
197 public int llRotTarget(LSL_Types.Quaternion rot, double error) { return m_LSL_Functions.llRotTarget(rot, error); } 426 public vector llGetLocalPos()
198 public void llRotTargetRemove(int number) { m_LSL_Functions.llRotTargetRemove(number); } 427 {
199 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { m_LSL_Functions.llMoveToTarget(target, tau); } 428 return m_LSL_Functions.llGetLocalPos();
200 public void llStopMoveToTarget() { m_LSL_Functions.llStopMoveToTarget(); } 429 }
201 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyImpulse(force, local); } 430
431 public void llSetRot(rotation rot)
432 {
433 m_LSL_Functions.llSetRot(rot);
434 }
435
436 public rotation llGetRot()
437 {
438 return m_LSL_Functions.llGetRot();
439 }
440
441 public rotation llGetLocalRot()
442 {
443 return m_LSL_Functions.llGetLocalRot();
444 }
445
446 public void llSetForce(vector force, int local)
447 {
448 m_LSL_Functions.llSetForce(force, local);
449 }
450
451 public vector llGetForce()
452 {
453 return m_LSL_Functions.llGetForce();
454 }
455
456 public int llTarget(vector position, double range)
457 {
458 return m_LSL_Functions.llTarget(position, range);
459 }
460
461 public void llTargetRemove(int number)
462 {
463 m_LSL_Functions.llTargetRemove(number);
464 }
465
466 public int llRotTarget(rotation rot, double error)
467 {
468 return m_LSL_Functions.llRotTarget(rot, error);
469 }
470
471 public void llRotTargetRemove(int number)
472 {
473 m_LSL_Functions.llRotTargetRemove(number);
474 }
475
476 public void llMoveToTarget(vector target, double tau)
477 {
478 m_LSL_Functions.llMoveToTarget(target, tau);
479 }
480
481 public void llStopMoveToTarget()
482 {
483 m_LSL_Functions.llStopMoveToTarget();
484 }
485
486 public void llApplyImpulse(vector force, int local)
487 {
488 m_LSL_Functions.llApplyImpulse(force, local);
489 }
490
202 // 491 //
203 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 492 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
204 // 493 //
205 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { m_LSL_Functions.llApplyRotationalImpulse(force, local); } 494 public void llApplyRotationalImpulse(vector force, int local)
206 public void llSetTorque(LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetTorque(torque, local); } 495 {
207 public LSL_Types.Vector3 llGetTorque() { return m_LSL_Functions.llGetTorque(); } 496 m_LSL_Functions.llApplyRotationalImpulse(force, local);
208 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { m_LSL_Functions.llSetForceAndTorque(force, torque, local); } 497 }
209 public LSL_Types.Vector3 llGetVel() { return m_LSL_Functions.llGetVel(); } 498
210 public LSL_Types.Vector3 llGetAccel() { return m_LSL_Functions.llGetAccel(); } 499 public void llSetTorque(vector torque, int local)
211 public LSL_Types.Vector3 llGetOmega() { return m_LSL_Functions.llGetOmega(); } 500 {
212 public double llGetTimeOfDay() { return m_LSL_Functions.llGetTimeOfDay(); } 501 m_LSL_Functions.llSetTorque(torque, local);
213 public double llGetWallclock() { return m_LSL_Functions.llGetWallclock(); } 502 }
214 public double llGetTime() { return m_LSL_Functions.llGetTime(); } 503
215 public void llResetTime() { m_LSL_Functions.llResetTime(); } 504 public vector llGetTorque()
216 public double llGetAndResetTime() { return m_LSL_Functions.llGetAndResetTime(); } 505 {
217 public void llSound() { m_LSL_Functions.llSound(); } 506 return m_LSL_Functions.llGetTorque();
218 public void llPlaySound(string sound, double volume) { m_LSL_Functions.llPlaySound(sound, volume); } 507 }
219 public void llLoopSound(string sound, double volume) { m_LSL_Functions.llLoopSound(sound, volume); } 508
220 public void llLoopSoundMaster(string sound, double volume) { m_LSL_Functions.llLoopSoundMaster(sound, volume); } 509 public void llSetForceAndTorque(vector force, vector torque, int local)
221 public void llLoopSoundSlave(string sound, double volume) { m_LSL_Functions.llLoopSoundSlave(sound, volume); } 510 {
222 public void llPlaySoundSlave(string sound, double volume) { m_LSL_Functions.llPlaySoundSlave(sound, volume); } 511 m_LSL_Functions.llSetForceAndTorque(force, torque, local);
512 }
513
514 public vector llGetVel()
515 {
516 return m_LSL_Functions.llGetVel();
517 }
518
519 public vector llGetAccel()
520 {
521 return m_LSL_Functions.llGetAccel();
522 }
523
524 public vector llGetOmega()
525 {
526 return m_LSL_Functions.llGetOmega();
527 }
528
529 public double llGetTimeOfDay()
530 {
531 return m_LSL_Functions.llGetTimeOfDay();
532 }
533
534 public double llGetWallclock()
535 {
536 return m_LSL_Functions.llGetWallclock();
537 }
538
539 public double llGetTime()
540 {
541 return m_LSL_Functions.llGetTime();
542 }
543
544 public void llResetTime()
545 {
546 m_LSL_Functions.llResetTime();
547 }
548
549 public double llGetAndResetTime()
550 {
551 return m_LSL_Functions.llGetAndResetTime();
552 }
553
554 public void llSound()
555 {
556 m_LSL_Functions.llSound();
557 }
558
559 public void llPlaySound(string sound, double volume)
560 {
561 m_LSL_Functions.llPlaySound(sound, volume);
562 }
563
564 public void llLoopSound(string sound, double volume)
565 {
566 m_LSL_Functions.llLoopSound(sound, volume);
567 }
568
569 public void llLoopSoundMaster(string sound, double volume)
570 {
571 m_LSL_Functions.llLoopSoundMaster(sound, volume);
572 }
573
574 public void llLoopSoundSlave(string sound, double volume)
575 {
576 m_LSL_Functions.llLoopSoundSlave(sound, volume);
577 }
578
579 public void llPlaySoundSlave(string sound, double volume)
580 {
581 m_LSL_Functions.llPlaySoundSlave(sound, volume);
582 }
583
223 // 584 //
224 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 585 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
225 // 586 //
226 public void llTriggerSound(string sound, double volume) { m_LSL_Functions.llTriggerSound(sound, volume); } 587 public void llTriggerSound(string sound, double volume)
227 public void llStopSound() { m_LSL_Functions.llStopSound(); } 588 {
228 public void llPreloadSound(string sound) { m_LSL_Functions.llPreloadSound(sound); } 589 m_LSL_Functions.llTriggerSound(sound, volume);
229 public string llGetSubString(string src, int start, int end) { return m_LSL_Functions.llGetSubString(src, start, end); } 590 }
230 public string llDeleteSubString(string src, int start, int end) { return m_LSL_Functions.llDeleteSubString(src, start, end); } 591
231 public string llInsertString(string dst, int position, string src) { return m_LSL_Functions.llInsertString(dst, position, src); } 592 public void llStopSound()
232 public string llToUpper(string source) { return m_LSL_Functions.llToUpper(source); } 593 {
233 public string llToLower(string source) { return m_LSL_Functions.llToLower(source); } 594 m_LSL_Functions.llStopSound();
234 public int llGiveMoney(string destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } 595 }
235 public void llMakeExplosion() { m_LSL_Functions.llMakeExplosion(); } 596
236 public void llMakeFountain() { m_LSL_Functions.llMakeFountain(); } 597 public void llPreloadSound(string sound)
237 public void llMakeSmoke() { m_LSL_Functions.llMakeSmoke(); } 598 {
238 public void llMakeFire() { m_LSL_Functions.llMakeFire(); } 599 m_LSL_Functions.llPreloadSound(sound);
239 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezObject(inventory, pos, rot, param); } 600 }
240 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { m_LSL_Functions.llLookAt(target, strength, damping); } 601
241 public void llStopLookAt() { m_LSL_Functions.llStopLookAt(); } 602 public string llGetSubString(string src, int start, int end)
242 public void llSetTimerEvent(double sec) { m_LSL_Functions.llSetTimerEvent(sec); } 603 {
243 public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); } 604 return m_LSL_Functions.llGetSubString(src, start, end);
605 }
606
607 public string llDeleteSubString(string src, int start, int end)
608 {
609 return m_LSL_Functions.llDeleteSubString(src, start, end);
610 }
611
612 public string llInsertString(string dst, int position, string src)
613 {
614 return m_LSL_Functions.llInsertString(dst, position, src);
615 }
616
617 public string llToUpper(string source)
618 {
619 return m_LSL_Functions.llToUpper(source);
620 }
621
622 public string llToLower(string source)
623 {
624 return m_LSL_Functions.llToLower(source);
625 }
626
627 public int llGiveMoney(string destination, int amount)
628 {
629 return m_LSL_Functions.llGiveMoney(destination, amount);
630 }
631
632 public void llMakeExplosion()
633 {
634 m_LSL_Functions.llMakeExplosion();
635 }
636
637 public void llMakeFountain()
638 {
639 m_LSL_Functions.llMakeFountain();
640 }
641
642 public void llMakeSmoke()
643 {
644 m_LSL_Functions.llMakeSmoke();
645 }
646
647 public void llMakeFire()
648 {
649 m_LSL_Functions.llMakeFire();
650 }
651
652 public void llRezObject(string inventory, vector pos, rotation rot, int param)
653 {
654 m_LSL_Functions.llRezObject(inventory, pos, rot, param);
655 }
656
657 public void llLookAt(vector target, double strength, double damping)
658 {
659 m_LSL_Functions.llLookAt(target, strength, damping);
660 }
661
662 public void llStopLookAt()
663 {
664 m_LSL_Functions.llStopLookAt();
665 }
666
667 public void llSetTimerEvent(double sec)
668 {
669 m_LSL_Functions.llSetTimerEvent(sec);
670 }
671
672 public void llSleep(double sec)
673 {
674 m_LSL_Functions.llSleep(sec);
675 }
676
244 // 677 //
245 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 678 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
246 // 679 //
247 public double llGetMass() { return m_LSL_Functions.llGetMass(); } 680 public double llGetMass()
248 public void llCollisionFilter(string name, string id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } 681 {
249 public void llTakeControls(int controls, int accept, int pass_on) { m_LSL_Functions.llTakeControls(controls, accept, pass_on); } 682 return m_LSL_Functions.llGetMass();
250 public void llReleaseControls() { m_LSL_Functions.llReleaseControls(); } 683 }
251 public void llAttachToAvatar(int attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } 684
252 public void llDetachFromAvatar() { m_LSL_Functions.llDetachFromAvatar(); } 685 public void llCollisionFilter(string name, string id, int accept)
253 public void llTakeCamera() { m_LSL_Functions.llTakeCamera(); } 686 {
254 public void llReleaseCamera() { m_LSL_Functions.llReleaseCamera(); } 687 m_LSL_Functions.llCollisionFilter(name, id, accept);
255 public string llGetOwner() { return m_LSL_Functions.llGetOwner(); } 688 }
256 public void llInstantMessage(string user, string message) { m_LSL_Functions.llInstantMessage(user, message); } 689
257 public void llEmail(string address, string subject, string message) { m_LSL_Functions.llEmail(address, subject, message); } 690 public void llTakeControls(int controls, int accept, int pass_on)
258 public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); } 691 {
259 public string llGetKey() { return m_LSL_Functions.llGetKey(); } 692 m_LSL_Functions.llTakeControls(controls, accept, pass_on);
260 public void llSetBuoyancy(double buoyancy) { m_LSL_Functions.llSetBuoyancy(buoyancy); } 693 }
261 public void llSetHoverHeight(double height, int water, double tau) { m_LSL_Functions.llSetHoverHeight(height, water, tau); } 694
262 public void llStopHover() { m_LSL_Functions.llStopHover(); } 695 public void llReleaseControls()
263 public void llMinEventDelay(double delay) { m_LSL_Functions.llMinEventDelay(delay); } 696 {
264 public void llSoundPreload() { m_LSL_Functions.llSoundPreload(); } 697 m_LSL_Functions.llReleaseControls();
265 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { m_LSL_Functions.llRotLookAt(target, strength, damping); } 698 }
699
700 public void llAttachToAvatar(int attachment)
701 {
702 m_LSL_Functions.llAttachToAvatar(attachment);
703 }
704
705 public void llDetachFromAvatar()
706 {
707 m_LSL_Functions.llDetachFromAvatar();
708 }
709
710 public void llTakeCamera()
711 {
712 m_LSL_Functions.llTakeCamera();
713 }
714
715 public void llReleaseCamera()
716 {
717 m_LSL_Functions.llReleaseCamera();
718 }
719
720 public string llGetOwner()
721 {
722 return m_LSL_Functions.llGetOwner();
723 }
724
725 public void llInstantMessage(string user, string message)
726 {
727 m_LSL_Functions.llInstantMessage(user, message);
728 }
729
730 public void llEmail(string address, string subject, string message)
731 {
732 m_LSL_Functions.llEmail(address, subject, message);
733 }
734
735 public void llGetNextEmail(string address, string subject)
736 {
737 m_LSL_Functions.llGetNextEmail(address, subject);
738 }
739
740 public string llGetKey()
741 {
742 return m_LSL_Functions.llGetKey();
743 }
744
745 public void llSetBuoyancy(double buoyancy)
746 {
747 m_LSL_Functions.llSetBuoyancy(buoyancy);
748 }
749
750 public void llSetHoverHeight(double height, int water, double tau)
751 {
752 m_LSL_Functions.llSetHoverHeight(height, water, tau);
753 }
754
755 public void llStopHover()
756 {
757 m_LSL_Functions.llStopHover();
758 }
759
760 public void llMinEventDelay(double delay)
761 {
762 m_LSL_Functions.llMinEventDelay(delay);
763 }
764
765 public void llSoundPreload()
766 {
767 m_LSL_Functions.llSoundPreload();
768 }
769
770 public void llRotLookAt(rotation target, double strength, double damping)
771 {
772 m_LSL_Functions.llRotLookAt(target, strength, damping);
773 }
774
266 // 775 //
267 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 776 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
268 // 777 //
269 public int llStringLength(string str) { return m_LSL_Functions.llStringLength(str); } 778 public int llStringLength(string str)
270 public void llStartAnimation(string anim) { m_LSL_Functions.llStartAnimation(anim); } 779 {
271 public void llStopAnimation(string anim) { m_LSL_Functions.llStopAnimation(anim); } 780 return m_LSL_Functions.llStringLength(str);
272 public void llPointAt() { m_LSL_Functions.llPointAt(); } 781 }
273 public void llStopPointAt() { m_LSL_Functions.llStopPointAt(); } 782
274 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { m_LSL_Functions.llTargetOmega(axis, spinrate, gain); } 783 public void llStartAnimation(string anim)
275 public int llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); } 784 {
276 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } 785 m_LSL_Functions.llStartAnimation(anim);
277 public void llRequestPermissions(string agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } 786 }
278 public string llGetPermissionsKey() { return m_LSL_Functions.llGetPermissionsKey(); } 787
279 public int llGetPermissions() { return m_LSL_Functions.llGetPermissions(); } 788 public void llStopAnimation(string anim)
280 public int llGetLinkNumber() { return m_LSL_Functions.llGetLinkNumber(); } 789 {
281 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { m_LSL_Functions.llSetLinkColor(linknumber, color, face); } 790 m_LSL_Functions.llStopAnimation(anim);
282 public void llCreateLink(string target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } 791 }
283 public void llBreakLink(int linknum) { m_LSL_Functions.llBreakLink(linknum); } 792
284 public void llBreakAllLinks() { m_LSL_Functions.llBreakAllLinks(); } 793 public void llPointAt()
285 public string llGetLinkKey(int linknum) { return m_LSL_Functions.llGetLinkKey(linknum); } 794 {
286 public void llGetLinkName(int linknum) { m_LSL_Functions.llGetLinkName(linknum); } 795 m_LSL_Functions.llPointAt();
287 public int llGetInventoryNumber(int type) { return m_LSL_Functions.llGetInventoryNumber(type); } 796 }
288 public string llGetInventoryName(int type, int number) { return m_LSL_Functions.llGetInventoryName(type, number); } 797
798 public void llStopPointAt()
799 {
800 m_LSL_Functions.llStopPointAt();
801 }
802
803 public void llTargetOmega(vector axis, double spinrate, double gain)
804 {
805 m_LSL_Functions.llTargetOmega(axis, spinrate, gain);
806 }
807
808 public int llGetStartParameter()
809 {
810 return m_LSL_Functions.llGetStartParameter();
811 }
812
813 public void llGodLikeRezObject(string inventory, vector pos)
814 {
815 m_LSL_Functions.llGodLikeRezObject(inventory, pos);
816 }
817
818 public void llRequestPermissions(string agent, int perm)
819 {
820 m_LSL_Functions.llRequestPermissions(agent, perm);
821 }
822
823 public string llGetPermissionsKey()
824 {
825 return m_LSL_Functions.llGetPermissionsKey();
826 }
827
828 public int llGetPermissions()
829 {
830 return m_LSL_Functions.llGetPermissions();
831 }
832
833 public int llGetLinkNumber()
834 {
835 return m_LSL_Functions.llGetLinkNumber();
836 }
837
838 public void llSetLinkColor(int linknumber, vector color, int face)
839 {
840 m_LSL_Functions.llSetLinkColor(linknumber, color, face);
841 }
842
843 public void llCreateLink(string target, int parent)
844 {
845 m_LSL_Functions.llCreateLink(target, parent);
846 }
847
848 public void llBreakLink(int linknum)
849 {
850 m_LSL_Functions.llBreakLink(linknum);
851 }
852
853 public void llBreakAllLinks()
854 {
855 m_LSL_Functions.llBreakAllLinks();
856 }
857
858 public string llGetLinkKey(int linknum)
859 {
860 return m_LSL_Functions.llGetLinkKey(linknum);
861 }
862
863 public void llGetLinkName(int linknum)
864 {
865 m_LSL_Functions.llGetLinkName(linknum);
866 }
867
868 public int llGetInventoryNumber(int type)
869 {
870 return m_LSL_Functions.llGetInventoryNumber(type);
871 }
872
873 public string llGetInventoryName(int type, int number)
874 {
875 return m_LSL_Functions.llGetInventoryName(type, number);
876 }
877
289 // 878 //
290 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 879 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
291 // 880 //
292 public void llSetScriptState(string name, int run) { m_LSL_Functions.llSetScriptState(name, run); } 881 public void llSetScriptState(string name, int run)
293 public double llGetEnergy() { return m_LSL_Functions.llGetEnergy(); } 882 {
294 public void llGiveInventory(string destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } 883 m_LSL_Functions.llSetScriptState(name, run);
295 public void llRemoveInventory(string item) { m_LSL_Functions.llRemoveInventory(item); } 884 }
296 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) { m_LSL_Functions.llSetText(text, color, alpha); } 885
297 public double llWater(LSL_Types.Vector3 offset) { return m_LSL_Functions.llWater(offset); } 886 public double llGetEnergy()
298 public void llPassTouches(int pass) { m_LSL_Functions.llPassTouches(pass); } 887 {
299 public string llRequestAgentData(string id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } 888 return m_LSL_Functions.llGetEnergy();
300 public string llRequestInventoryData(string name) { return m_LSL_Functions.llRequestInventoryData(name); } 889 }
301 public void llSetDamage(double damage) { m_LSL_Functions.llSetDamage(damage); } 890
302 public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); } 891 public void llGiveInventory(string destination, string inventory)
303 public void llModifyLand(int action, int brush) { m_LSL_Functions.llModifyLand(action, brush); } 892 {
304 public void llCollisionSound(string impact_sound, double impact_volume) { m_LSL_Functions.llCollisionSound(impact_sound, impact_volume); } 893 m_LSL_Functions.llGiveInventory(destination, inventory);
305 public void llCollisionSprite(string impact_sprite) { m_LSL_Functions.llCollisionSprite(impact_sprite); } 894 }
306 public string llGetAnimation(string id) { return m_LSL_Functions.llGetAnimation(id); } 895
307 public void llResetScript() { m_LSL_Functions.llResetScript(); } 896 public void llRemoveInventory(string item)
308 public void llMessageLinked(int linknum, int num, string str, string id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } 897 {
309 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } 898 m_LSL_Functions.llRemoveInventory(item);
310 public void llPassCollisions(int pass) { m_LSL_Functions.llPassCollisions(pass); } 899 }
311 public string llGetScriptName() { return m_LSL_Functions.llGetScriptName(); } 900
312 public int llGetNumberOfSides() { return m_LSL_Functions.llGetNumberOfSides(); } 901 public void llSetText(string text, vector color, double alpha)
902 {
903 m_LSL_Functions.llSetText(text, color, alpha);
904 }
905
906 public double llWater(vector offset)
907 {
908 return m_LSL_Functions.llWater(offset);
909 }
910
911 public void llPassTouches(int pass)
912 {
913 m_LSL_Functions.llPassTouches(pass);
914 }
915
916 public string llRequestAgentData(string id, int data)
917 {
918 return m_LSL_Functions.llRequestAgentData(id, data);
919 }
920
921 public string llRequestInventoryData(string name)
922 {
923 return m_LSL_Functions.llRequestInventoryData(name);
924 }
925
926 public void llSetDamage(double damage)
927 {
928 m_LSL_Functions.llSetDamage(damage);
929 }
930
931 public void llTeleportAgentHome(string agent)
932 {
933 m_LSL_Functions.llTeleportAgentHome(agent);
934 }
935
936 public void llModifyLand(int action, int brush)
937 {
938 m_LSL_Functions.llModifyLand(action, brush);
939 }
940
941 public void llCollisionSound(string impact_sound, double impact_volume)
942 {
943 m_LSL_Functions.llCollisionSound(impact_sound, impact_volume);
944 }
945
946 public void llCollisionSprite(string impact_sprite)
947 {
948 m_LSL_Functions.llCollisionSprite(impact_sprite);
949 }
950
951 public string llGetAnimation(string id)
952 {
953 return m_LSL_Functions.llGetAnimation(id);
954 }
955
956 public void llResetScript()
957 {
958 m_LSL_Functions.llResetScript();
959 }
960
961 public void llMessageLinked(int linknum, int num, string str, string id)
962 {
963 m_LSL_Functions.llMessageLinked(linknum, num, str, id);
964 }
965
966 public void llPushObject(string target, vector impulse, vector ang_impulse, int local)
967 {
968 m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local);
969 }
970
971 public void llPassCollisions(int pass)
972 {
973 m_LSL_Functions.llPassCollisions(pass);
974 }
975
976 public string llGetScriptName()
977 {
978 return m_LSL_Functions.llGetScriptName();
979 }
980
981 public int llGetNumberOfSides()
982 {
983 return m_LSL_Functions.llGetNumberOfSides();
984 }
985
313 // 986 //
314 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 987 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
315 // 988 //
316 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return m_LSL_Functions.llAxisAngle2Rot(axis, angle); } 989 public rotation llAxisAngle2Rot(vector axis, double angle)
317 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return m_LSL_Functions.llRot2Axis(rot); } 990 {
318 public void llRot2Angle() { m_LSL_Functions.llRot2Angle(); } 991 return m_LSL_Functions.llAxisAngle2Rot(axis, angle);
319 public double llAcos(double val) { return m_LSL_Functions.llAcos(val); } 992 }
320 public double llAsin(double val) { return m_LSL_Functions.llAsin(val); } 993
321 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return m_LSL_Functions.llAngleBetween(a, b); } 994 public vector llRot2Axis(rotation rot)
322 public string llGetInventoryKey(string name) { return m_LSL_Functions.llGetInventoryKey(name); } 995 {
323 public void llAllowInventoryDrop(int add) { m_LSL_Functions.llAllowInventoryDrop(add); } 996 return m_LSL_Functions.llRot2Axis(rot);
324 public LSL_Types.Vector3 llGetSunDirection() { return m_LSL_Functions.llGetSunDirection(); } 997 }
325 public LSL_Types.Vector3 llGetTextureOffset(int face) { return m_LSL_Functions.llGetTextureOffset(face); } 998
326 public LSL_Types.Vector3 llGetTextureScale(int side) { return m_LSL_Functions.llGetTextureScale(side); } 999 public void llRot2Angle()
327 public double llGetTextureRot(int side) { return m_LSL_Functions.llGetTextureRot(side); } 1000 {
328 public int llSubStringIndex(string source, string pattern) { return m_LSL_Functions.llSubStringIndex(source, pattern); } 1001 m_LSL_Functions.llRot2Angle();
329 public string llGetOwnerKey(string id) { return m_LSL_Functions.llGetOwnerKey(id); } 1002 }
330 public LSL_Types.Vector3 llGetCenterOfMass() { return m_LSL_Functions.llGetCenterOfMass(); } 1003
331 public List<string> llListSort(List<string> src, int stride, int ascending) { return m_LSL_Functions.llListSort(src, stride, ascending); } 1004 public double llAcos(double val)
332 public int llGetListLength(List<string> src) { return m_LSL_Functions.llGetListLength(src); } 1005 {
1006 return m_LSL_Functions.llAcos(val);
1007 }
1008
1009 public double llAsin(double val)
1010 {
1011 return m_LSL_Functions.llAsin(val);
1012 }
1013
1014 public double llAngleBetween(rotation a, rotation b)
1015 {
1016 return m_LSL_Functions.llAngleBetween(a, b);
1017 }
1018
1019 public string llGetInventoryKey(string name)
1020 {
1021 return m_LSL_Functions.llGetInventoryKey(name);
1022 }
1023
1024 public void llAllowInventoryDrop(int add)
1025 {
1026 m_LSL_Functions.llAllowInventoryDrop(add);
1027 }
1028
1029 public vector llGetSunDirection()
1030 {
1031 return m_LSL_Functions.llGetSunDirection();
1032 }
1033
1034 public vector llGetTextureOffset(int face)
1035 {
1036 return m_LSL_Functions.llGetTextureOffset(face);
1037 }
1038
1039 public vector llGetTextureScale(int side)
1040 {
1041 return m_LSL_Functions.llGetTextureScale(side);
1042 }
1043
1044 public double llGetTextureRot(int side)
1045 {
1046 return m_LSL_Functions.llGetTextureRot(side);
1047 }
1048
1049 public int llSubStringIndex(string source, string pattern)
1050 {
1051 return m_LSL_Functions.llSubStringIndex(source, pattern);
1052 }
1053
1054 public string llGetOwnerKey(string id)
1055 {
1056 return m_LSL_Functions.llGetOwnerKey(id);
1057 }
1058
1059 public vector llGetCenterOfMass()
1060 {
1061 return m_LSL_Functions.llGetCenterOfMass();
1062 }
1063
1064 public List<string> llListSort(List<string> src, int stride, int ascending)
1065 {
1066 return m_LSL_Functions.llListSort(src, stride, ascending);
1067 }
1068
1069 public int llGetListLength(List<string> src)
1070 {
1071 return m_LSL_Functions.llGetListLength(src);
1072 }
1073
333 // 1074 //
334 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1075 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
335 // 1076 //
336 public int llList2Integer(List<string> src, int index) { return m_LSL_Functions.llList2Integer(src, index); } 1077 public int llList2Integer(List<string> src, int index)
337 public double llList2double(List<string> src, int index) { return m_LSL_Functions.llList2double(src, index); } 1078 {
338 public string llList2String(List<string> src, int index) { return m_LSL_Functions.llList2String(src, index); } 1079 return m_LSL_Functions.llList2Integer(src, index);
339 public string llList2Key(List<string> src, int index) { return m_LSL_Functions.llList2Key(src, index); } 1080 }
340 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) { return m_LSL_Functions.llList2Vector(src, index); } 1081
341 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) { return m_LSL_Functions.llList2Rot(src, index); } 1082 public double llList2double(List<string> src, int index)
342 public List<string> llList2List(List<string> src, int start, int end) { return m_LSL_Functions.llList2List(src, start, end); } 1083 {
343 public List<string> llDeleteSubList(List<string> src, int start, int end) { return m_LSL_Functions.llDeleteSubList(src, start, end); } 1084 return m_LSL_Functions.llList2double(src, index);
344 public int llGetListEntryType(List<string> src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); } 1085 }
345 public string llList2CSV(List<string> src) { return m_LSL_Functions.llList2CSV(src); } 1086
346 public List<string> llCSV2List(string src) { return m_LSL_Functions.llCSV2List(src); } 1087 public string llList2String(List<string> src, int index)
347 public List<string> llListRandomize(List<string> src, int stride) { return m_LSL_Functions.llListRandomize(src, stride); } 1088 {
348 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { return m_LSL_Functions.llList2ListStrided(src, start, end, stride); } 1089 return m_LSL_Functions.llList2String(src, index);
349 public LSL_Types.Vector3 llGetRegionCorner() { return m_LSL_Functions.llGetRegionCorner(); } 1090 }
350 public List<string> llListInsertList(List<string> dest, List<string> src, int start) { return m_LSL_Functions.llListInsertList(dest, src, start); } 1091
351 public int llListFindList(List<string> src, List<string> test) { return m_LSL_Functions.llListFindList(src, test); } 1092 public string llList2Key(List<string> src, int index)
352 public string llGetObjectName() { return m_LSL_Functions.llGetObjectName(); } 1093 {
353 public void llSetObjectName(string name) { m_LSL_Functions.llSetObjectName(name); } 1094 return m_LSL_Functions.llList2Key(src, index);
354 public string llGetDate() { return m_LSL_Functions.llGetDate(); } 1095 }
355 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return m_LSL_Functions.llEdgeOfWorld(pos, dir); } 1096
356 public int llGetAgentInfo(string id) { return m_LSL_Functions.llGetAgentInfo(id); } 1097 public vector llList2Vector(List<string> src, int index)
1098 {
1099 return m_LSL_Functions.llList2Vector(src, index);
1100 }
1101
1102 public rotation llList2Rot(List<string> src, int index)
1103 {
1104 return m_LSL_Functions.llList2Rot(src, index);
1105 }
1106
1107 public List<string> llList2List(List<string> src, int start, int end)
1108 {
1109 return m_LSL_Functions.llList2List(src, start, end);
1110 }
1111
1112 public List<string> llDeleteSubList(List<string> src, int start, int end)
1113 {
1114 return m_LSL_Functions.llDeleteSubList(src, start, end);
1115 }
1116
1117 public int llGetListEntryType(List<string> src, int index)
1118 {
1119 return m_LSL_Functions.llGetListEntryType(src, index);
1120 }
1121
1122 public string llList2CSV(List<string> src)
1123 {
1124 return m_LSL_Functions.llList2CSV(src);
1125 }
1126
1127 public List<string> llCSV2List(string src)
1128 {
1129 return m_LSL_Functions.llCSV2List(src);
1130 }
1131
1132 public List<string> llListRandomize(List<string> src, int stride)
1133 {
1134 return m_LSL_Functions.llListRandomize(src, stride);
1135 }
1136
1137 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
1138 {
1139 return m_LSL_Functions.llList2ListStrided(src, start, end, stride);
1140 }
1141
1142 public vector llGetRegionCorner()
1143 {
1144 return m_LSL_Functions.llGetRegionCorner();
1145 }
1146
1147 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
1148 {
1149 return m_LSL_Functions.llListInsertList(dest, src, start);
1150 }
1151
1152 public int llListFindList(List<string> src, List<string> test)
1153 {
1154 return m_LSL_Functions.llListFindList(src, test);
1155 }
1156
1157 public string llGetObjectName()
1158 {
1159 return m_LSL_Functions.llGetObjectName();
1160 }
1161
1162 public void llSetObjectName(string name)
1163 {
1164 m_LSL_Functions.llSetObjectName(name);
1165 }
1166
1167 public string llGetDate()
1168 {
1169 return m_LSL_Functions.llGetDate();
1170 }
1171
1172 public int llEdgeOfWorld(vector pos, vector dir)
1173 {
1174 return m_LSL_Functions.llEdgeOfWorld(pos, dir);
1175 }
1176
1177 public int llGetAgentInfo(string id)
1178 {
1179 return m_LSL_Functions.llGetAgentInfo(id);
1180 }
1181
357 // 1182 //
358 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1183 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
359 // 1184 //
360 public void llAdjustSoundVolume(double volume) { m_LSL_Functions.llAdjustSoundVolume(volume); } 1185 public void llAdjustSoundVolume(double volume)
361 public void llSetSoundQueueing(int queue) { m_LSL_Functions.llSetSoundQueueing(queue); } 1186 {
362 public void llSetSoundRadius(double radius) { m_LSL_Functions.llSetSoundRadius(radius); } 1187 m_LSL_Functions.llAdjustSoundVolume(volume);
363 public string llKey2Name(string id) { return m_LSL_Functions.llKey2Name(id); } 1188 }
364 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate); } 1189
365 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west); } 1190 public void llSetSoundQueueing(int queue)
366 public void llEjectFromLand(string pest) { m_LSL_Functions.llEjectFromLand(pest); } 1191 {
367 public void llParseString2List() { m_LSL_Functions.llParseString2List(); } 1192 m_LSL_Functions.llSetSoundQueueing(queue);
368 public int llOverMyLand(string id) { return m_LSL_Functions.llOverMyLand(id); } 1193 }
369 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetLandOwnerAt(pos); } 1194
370 public string llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } 1195 public void llSetSoundRadius(double radius)
371 public LSL_Types.Vector3 llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); } 1196 {
372 public int llSameGroup(string agent) { return m_LSL_Functions.llSameGroup(agent); } 1197 m_LSL_Functions.llSetSoundRadius(radius);
373 public void llUnSit(string id) { m_LSL_Functions.llUnSit(id); } 1198 }
374 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundSlope(offset); } 1199
375 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundNormal(offset); } 1200 public string llKey2Name(string id)
376 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return m_LSL_Functions.llGroundContour(offset); } 1201 {
377 public int llGetAttached() { return m_LSL_Functions.llGetAttached(); } 1202 return m_LSL_Functions.llKey2Name(id);
378 public int llGetFreeMemory() { return m_LSL_Functions.llGetFreeMemory(); } 1203 }
379 public string llGetRegionName() { return m_LSL_Functions.llGetRegionName(); } 1204
380 public double llGetRegionTimeDilation() { return m_LSL_Functions.llGetRegionTimeDilation(); } 1205 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
381 public double llGetRegionFPS() { return m_LSL_Functions.llGetRegionFPS(); } 1206 {
1207 m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate);
1208 }
1209
1210 public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
1211 {
1212 m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west);
1213 }
1214
1215 public void llEjectFromLand(string pest)
1216 {
1217 m_LSL_Functions.llEjectFromLand(pest);
1218 }
1219
1220 public void llParseString2List()
1221 {
1222 m_LSL_Functions.llParseString2List();
1223 }
1224
1225 public int llOverMyLand(string id)
1226 {
1227 return m_LSL_Functions.llOverMyLand(id);
1228 }
1229
1230 public string llGetLandOwnerAt(vector pos)
1231 {
1232 return m_LSL_Functions.llGetLandOwnerAt(pos);
1233 }
1234
1235 public string llGetNotecardLine(string name, int line)
1236 {
1237 return m_LSL_Functions.llGetNotecardLine(name, line);
1238 }
1239
1240 public vector llGetAgentSize(string id)
1241 {
1242 return m_LSL_Functions.llGetAgentSize(id);
1243 }
1244
1245 public int llSameGroup(string agent)
1246 {
1247 return m_LSL_Functions.llSameGroup(agent);
1248 }
1249
1250 public void llUnSit(string id)
1251 {
1252 m_LSL_Functions.llUnSit(id);
1253 }
1254
1255 public vector llGroundSlope(vector offset)
1256 {
1257 return m_LSL_Functions.llGroundSlope(offset);
1258 }
1259
1260 public vector llGroundNormal(vector offset)
1261 {
1262 return m_LSL_Functions.llGroundNormal(offset);
1263 }
1264
1265 public vector llGroundContour(vector offset)
1266 {
1267 return m_LSL_Functions.llGroundContour(offset);
1268 }
1269
1270 public int llGetAttached()
1271 {
1272 return m_LSL_Functions.llGetAttached();
1273 }
1274
1275 public int llGetFreeMemory()
1276 {
1277 return m_LSL_Functions.llGetFreeMemory();
1278 }
1279
1280 public string llGetRegionName()
1281 {
1282 return m_LSL_Functions.llGetRegionName();
1283 }
1284
1285 public double llGetRegionTimeDilation()
1286 {
1287 return m_LSL_Functions.llGetRegionTimeDilation();
1288 }
1289
1290 public double llGetRegionFPS()
1291 {
1292 return m_LSL_Functions.llGetRegionFPS();
1293 }
1294
382 // 1295 //
383 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1296 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
384 // 1297 //
385 public void llParticleSystem(List<Object> rules) { m_LSL_Functions.llParticleSystem(rules); } 1298 public void llParticleSystem(List<Object> rules)
386 public void llGroundRepel(double height, int water, double tau) { m_LSL_Functions.llGroundRepel(height, water, tau); } 1299 {
387 public void llGiveInventoryList() { m_LSL_Functions.llGiveInventoryList(); } 1300 m_LSL_Functions.llParticleSystem(rules);
388 public void llSetVehicleType(int type) { m_LSL_Functions.llSetVehicleType(type); } 1301 }
389 public void llSetVehicledoubleParam(int param, double value) { m_LSL_Functions.llSetVehicledoubleParam(param, value); } 1302
390 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { m_LSL_Functions.llSetVehicleVectorParam(param, vec); } 1303 public void llGroundRepel(double height, int water, double tau)
391 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { m_LSL_Functions.llSetVehicleRotationParam(param, rot); } 1304 {
392 public void llSetVehicleFlags(int flags) { m_LSL_Functions.llSetVehicleFlags(flags); } 1305 m_LSL_Functions.llGroundRepel(height, water, tau);
393 public void llRemoveVehicleFlags(int flags) { m_LSL_Functions.llRemoveVehicleFlags(flags); } 1306 }
394 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { m_LSL_Functions.llSitTarget(offset, rot); } 1307
395 public string llAvatarOnSitTarget() { return m_LSL_Functions.llAvatarOnSitTarget(); } 1308 public void llGiveInventoryList()
396 public void llAddToLandPassList(string avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } 1309 {
397 public void llSetTouchText(string text) { m_LSL_Functions.llSetTouchText(text); } 1310 m_LSL_Functions.llGiveInventoryList();
398 public void llSetSitText(string text) { m_LSL_Functions.llSetSitText(text); } 1311 }
399 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraEyeOffset(offset); } 1312
400 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { m_LSL_Functions.llSetCameraAtOffset(offset); } 1313 public void llSetVehicleType(int type)
401 public void llDumpList2String() { m_LSL_Functions.llDumpList2String(); } 1314 {
402 public void llScriptDanger(LSL_Types.Vector3 pos) { m_LSL_Functions.llScriptDanger(pos); } 1315 m_LSL_Functions.llSetVehicleType(type);
403 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } 1316 }
404 public void llVolumeDetect(int detect) { m_LSL_Functions.llVolumeDetect(detect); } 1317
405 public void llResetOtherScript(string name) { m_LSL_Functions.llResetOtherScript(name); } 1318 public void llSetVehicledoubleParam(int param, double value)
406 public int llGetScriptState(string name) { return m_LSL_Functions.llGetScriptState(name); } 1319 {
407 public void llRemoteLoadScript() { m_LSL_Functions.llRemoteLoadScript(); } 1320 m_LSL_Functions.llSetVehicledoubleParam(param, value);
408 public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); } 1321 }
409 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } 1322
1323 public void llSetVehicleVectorParam(int param, vector vec)
1324 {
1325 m_LSL_Functions.llSetVehicleVectorParam(param, vec);
1326 }
1327
1328 public void llSetVehicleRotationParam(int param, rotation rot)
1329 {
1330 m_LSL_Functions.llSetVehicleRotationParam(param, rot);
1331 }
1332
1333 public void llSetVehicleFlags(int flags)
1334 {
1335 m_LSL_Functions.llSetVehicleFlags(flags);
1336 }
1337
1338 public void llRemoveVehicleFlags(int flags)
1339 {
1340 m_LSL_Functions.llRemoveVehicleFlags(flags);
1341 }
1342
1343 public void llSitTarget(vector offset, rotation rot)
1344 {
1345 m_LSL_Functions.llSitTarget(offset, rot);
1346 }
1347
1348 public string llAvatarOnSitTarget()
1349 {
1350 return m_LSL_Functions.llAvatarOnSitTarget();
1351 }
1352
1353 public void llAddToLandPassList(string avatar, double hours)
1354 {
1355 m_LSL_Functions.llAddToLandPassList(avatar, hours);
1356 }
1357
1358 public void llSetTouchText(string text)
1359 {
1360 m_LSL_Functions.llSetTouchText(text);
1361 }
1362
1363 public void llSetSitText(string text)
1364 {
1365 m_LSL_Functions.llSetSitText(text);
1366 }
1367
1368 public void llSetCameraEyeOffset(vector offset)
1369 {
1370 m_LSL_Functions.llSetCameraEyeOffset(offset);
1371 }
1372
1373 public void llSetCameraAtOffset(vector offset)
1374 {
1375 m_LSL_Functions.llSetCameraAtOffset(offset);
1376 }
1377
1378 public void llDumpList2String()
1379 {
1380 m_LSL_Functions.llDumpList2String();
1381 }
1382
1383 public void llScriptDanger(vector pos)
1384 {
1385 m_LSL_Functions.llScriptDanger(pos);
1386 }
1387
1388 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1389 {
1390 m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
1391 }
1392
1393 public void llVolumeDetect(int detect)
1394 {
1395 m_LSL_Functions.llVolumeDetect(detect);
1396 }
1397
1398 public void llResetOtherScript(string name)
1399 {
1400 m_LSL_Functions.llResetOtherScript(name);
1401 }
1402
1403 public int llGetScriptState(string name)
1404 {
1405 return m_LSL_Functions.llGetScriptState(name);
1406 }
1407
1408 public void llRemoteLoadScript()
1409 {
1410 m_LSL_Functions.llRemoteLoadScript();
1411 }
1412
1413 public void llSetRemoteScriptAccessPin(int pin)
1414 {
1415 m_LSL_Functions.llSetRemoteScriptAccessPin(pin);
1416 }
1417
1418 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1419 {
1420 m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param);
1421 }
1422
410 // 1423 //
411 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1424 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
412 // 1425 //
413 public void llOpenRemoteDataChannel() { m_LSL_Functions.llOpenRemoteDataChannel(); } 1426 public void llOpenRemoteDataChannel()
414 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } 1427 {
415 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata); } 1428 m_LSL_Functions.llOpenRemoteDataChannel();
416 public void llCloseRemoteDataChannel(string channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } 1429 }
417 public string llMD5String(string src, int nonce) { return m_LSL_Functions.llMD5String(src, nonce); } 1430
418 public void llSetPrimitiveParams(List<string> rules) { m_LSL_Functions.llSetPrimitiveParams(rules); } 1431 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
419 public string llStringToBase64(string str) { return m_LSL_Functions.llStringToBase64(str); } 1432 {
420 public string llBase64ToString(string str) { return m_LSL_Functions.llBase64ToString(str); } 1433 return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata);
421 public void llXorBase64Strings() { m_LSL_Functions.llXorBase64Strings(); } 1434 }
422 public void llRemoteDataSetRegion() { m_LSL_Functions.llRemoteDataSetRegion(); } 1435
423 public double llLog10(double val) { return m_LSL_Functions.llLog10(val); } 1436 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
424 public double llLog(double val) { return m_LSL_Functions.llLog(val); } 1437 {
425 public List<string> llGetAnimationList(string id) { return m_LSL_Functions.llGetAnimationList(id); } 1438 m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata);
426 public void llSetParcelMusicURL(string url) { m_LSL_Functions.llSetParcelMusicURL(url); } 1439 }
427 public LSL_Types.Vector3 llGetRootPosition() { return m_LSL_Functions.llGetRootPosition(); } 1440
428 public LSL_Types.Quaternion llGetRootRotation() { return m_LSL_Functions.llGetRootRotation(); } 1441 public void llCloseRemoteDataChannel(string channel)
429 public string llGetObjectDesc() { return m_LSL_Functions.llGetObjectDesc(); } 1442 {
430 public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); } 1443 m_LSL_Functions.llCloseRemoteDataChannel(channel);
431 public string llGetCreator() { return m_LSL_Functions.llGetCreator(); } 1444 }
432 public string llGetTimestamp() { return m_LSL_Functions.llGetTimestamp(); } 1445
433 public void llSetLinkAlpha(int linknumber, double alpha, int face) { m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face); } 1446 public string llMD5String(string src, int nonce)
434 public int llGetNumberOfPrims() { return m_LSL_Functions.llGetNumberOfPrims(); } 1447 {
435 public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } 1448 return m_LSL_Functions.llMD5String(src, nonce);
436 public List<string> llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); } 1449 }
437 public LSL_Types.Vector3 llGetGeometricCenter() { return m_LSL_Functions.llGetGeometricCenter(); } 1450
438 public void llGetPrimitiveParams() { m_LSL_Functions.llGetPrimitiveParams(); } 1451 public void llSetPrimitiveParams(List<string> rules)
1452 {
1453 m_LSL_Functions.llSetPrimitiveParams(rules);
1454 }
1455
1456 public string llStringToBase64(string str)
1457 {
1458 return m_LSL_Functions.llStringToBase64(str);
1459 }
1460
1461 public string llBase64ToString(string str)
1462 {
1463 return m_LSL_Functions.llBase64ToString(str);
1464 }
1465
1466 public void llXorBase64Strings()
1467 {
1468 m_LSL_Functions.llXorBase64Strings();
1469 }
1470
1471 public void llRemoteDataSetRegion()
1472 {
1473 m_LSL_Functions.llRemoteDataSetRegion();
1474 }
1475
1476 public double llLog10(double val)
1477 {
1478 return m_LSL_Functions.llLog10(val);
1479 }
1480
1481 public double llLog(double val)
1482 {
1483 return m_LSL_Functions.llLog(val);
1484 }
1485
1486 public List<string> llGetAnimationList(string id)
1487 {
1488 return m_LSL_Functions.llGetAnimationList(id);
1489 }
1490
1491 public void llSetParcelMusicURL(string url)
1492 {
1493 m_LSL_Functions.llSetParcelMusicURL(url);
1494 }
1495
1496 public vector llGetRootPosition()
1497 {
1498 return m_LSL_Functions.llGetRootPosition();
1499 }
1500
1501 public rotation llGetRootRotation()
1502 {
1503 return m_LSL_Functions.llGetRootRotation();
1504 }
1505
1506 public string llGetObjectDesc()
1507 {
1508 return m_LSL_Functions.llGetObjectDesc();
1509 }
1510
1511 public void llSetObjectDesc(string desc)
1512 {
1513 m_LSL_Functions.llSetObjectDesc(desc);
1514 }
1515
1516 public string llGetCreator()
1517 {
1518 return m_LSL_Functions.llGetCreator();
1519 }
1520
1521 public string llGetTimestamp()
1522 {
1523 return m_LSL_Functions.llGetTimestamp();
1524 }
1525
1526 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1527 {
1528 m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face);
1529 }
1530
1531 public int llGetNumberOfPrims()
1532 {
1533 return m_LSL_Functions.llGetNumberOfPrims();
1534 }
1535
1536 public string llGetNumberOfNotecardLines(string name)
1537 {
1538 return m_LSL_Functions.llGetNumberOfNotecardLines(name);
1539 }
1540
1541 public List<string> llGetBoundingBox(string obj)
1542 {
1543 return m_LSL_Functions.llGetBoundingBox(obj);
1544 }
1545
1546 public vector llGetGeometricCenter()
1547 {
1548 return m_LSL_Functions.llGetGeometricCenter();
1549 }
1550
1551 public void llGetPrimitiveParams()
1552 {
1553 m_LSL_Functions.llGetPrimitiveParams();
1554 }
1555
439 // 1556 //
440 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1557 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
441 // 1558 //
442 public string llIntegerToBase64(int number) { return m_LSL_Functions.llIntegerToBase64(number); } 1559 public string llIntegerToBase64(int number)
443 public int llBase64ToInteger(string str) { return m_LSL_Functions.llBase64ToInteger(str); } 1560 {
444 public double llGetGMTclock() { return m_LSL_Functions.llGetGMTclock(); } 1561 return m_LSL_Functions.llIntegerToBase64(number);
445 public string llGetSimulatorHostname() { return m_LSL_Functions.llGetSimulatorHostname(); } 1562 }
446 public void llSetLocalRot(LSL_Types.Quaternion rot) { m_LSL_Functions.llSetLocalRot(rot); } 1563
447 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers); } 1564 public int llBase64ToInteger(string str)
448 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param); } 1565 {
449 public int llGetObjectPermMask(int mask) { return m_LSL_Functions.llGetObjectPermMask(mask); } 1566 return m_LSL_Functions.llBase64ToInteger(str);
450 public void llSetObjectPermMask(int mask, int value) { m_LSL_Functions.llSetObjectPermMask(mask, value); } 1567 }
451 public void llGetInventoryPermMask(string item, int mask) { m_LSL_Functions.llGetInventoryPermMask(item, mask); } 1568
452 public void llSetInventoryPermMask(string item, int mask, int value) { m_LSL_Functions.llSetInventoryPermMask(item, mask, value); } 1569 public double llGetGMTclock()
453 public string llGetInventoryCreator(string item) { return m_LSL_Functions.llGetInventoryCreator(item); } 1570 {
454 public void llOwnerSay(string msg) { m_LSL_Functions.llOwnerSay(msg); } 1571 return m_LSL_Functions.llGetGMTclock();
455 public void llRequestSimulatorData(string simulator, int data) { m_LSL_Functions.llRequestSimulatorData(simulator, data); } 1572 }
456 public void llForceMouselook(int mouselook) { m_LSL_Functions.llForceMouselook(mouselook); } 1573
457 public double llGetObjectMass(string id) { return m_LSL_Functions.llGetObjectMass(id); } 1574 public string llGetSimulatorHostname()
458 public void llListReplaceList() { m_LSL_Functions.llListReplaceList(); } 1575 {
459 public void llLoadURL(string avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } 1576 return m_LSL_Functions.llGetSimulatorHostname();
460 public void llParcelMediaCommandList(List<string> commandList) { m_LSL_Functions.llParcelMediaCommandList(commandList); } 1577 }
461 public void llParcelMediaQuery() { m_LSL_Functions.llParcelMediaQuery(); } 1578
462 public int llModPow(int a, int b, int c) { return m_LSL_Functions.llModPow(a, b, c); } 1579 public void llSetLocalRot(rotation rot)
1580 {
1581 m_LSL_Functions.llSetLocalRot(rot);
1582 }
1583
1584 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
1585 {
1586 return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers);
1587 }
1588
1589 public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param)
1590 {
1591 m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param);
1592 }
1593
1594 public int llGetObjectPermMask(int mask)
1595 {
1596 return m_LSL_Functions.llGetObjectPermMask(mask);
1597 }
1598
1599 public void llSetObjectPermMask(int mask, int value)
1600 {
1601 m_LSL_Functions.llSetObjectPermMask(mask, value);
1602 }
1603
1604 public void llGetInventoryPermMask(string item, int mask)
1605 {
1606 m_LSL_Functions.llGetInventoryPermMask(item, mask);
1607 }
1608
1609 public void llSetInventoryPermMask(string item, int mask, int value)
1610 {
1611 m_LSL_Functions.llSetInventoryPermMask(item, mask, value);
1612 }
1613
1614 public string llGetInventoryCreator(string item)
1615 {
1616 return m_LSL_Functions.llGetInventoryCreator(item);
1617 }
1618
1619 public void llOwnerSay(string msg)
1620 {
1621 m_LSL_Functions.llOwnerSay(msg);
1622 }
1623
1624 public void llRequestSimulatorData(string simulator, int data)
1625 {
1626 m_LSL_Functions.llRequestSimulatorData(simulator, data);
1627 }
1628
1629 public void llForceMouselook(int mouselook)
1630 {
1631 m_LSL_Functions.llForceMouselook(mouselook);
1632 }
1633
1634 public double llGetObjectMass(string id)
1635 {
1636 return m_LSL_Functions.llGetObjectMass(id);
1637 }
1638
1639 public void llListReplaceList()
1640 {
1641 m_LSL_Functions.llListReplaceList();
1642 }
1643
1644 public void llLoadURL(string avatar_id, string message, string url)
1645 {
1646 m_LSL_Functions.llLoadURL(avatar_id, message, url);
1647 }
1648
1649 public void llParcelMediaCommandList(List<string> commandList)
1650 {
1651 m_LSL_Functions.llParcelMediaCommandList(commandList);
1652 }
1653
1654 public void llParcelMediaQuery()
1655 {
1656 m_LSL_Functions.llParcelMediaQuery();
1657 }
1658
1659 public int llModPow(int a, int b, int c)
1660 {
1661 return m_LSL_Functions.llModPow(a, b, c);
1662 }
1663
463 // 1664 //
464 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1665 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
465 // 1666 //
466 public int llGetInventoryType(string name) { return m_LSL_Functions.llGetInventoryType(name); } 1667 public int llGetInventoryType(string name)
467 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons); } 1668 {
468 public LSL_Types.Vector3 llGetCameraPos() { return m_LSL_Functions.llGetCameraPos(); } 1669 return m_LSL_Functions.llGetInventoryType(name);
469 public LSL_Types.Quaternion llGetCameraRot() { return m_LSL_Functions.llGetCameraRot(); } 1670 }
470 public void llSetPrimURL() { m_LSL_Functions.llSetPrimURL(); } 1671
471 public void llRefreshPrimURL() { m_LSL_Functions.llRefreshPrimURL(); } 1672 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
472 public string llEscapeURL(string url) { return m_LSL_Functions.llEscapeURL(url); } 1673 {
473 public string llUnescapeURL(string url) { return m_LSL_Functions.llUnescapeURL(url); } 1674 m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons);
474 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { m_LSL_Functions.llMapDestination(simname, pos, look_at); } 1675 }
475 public void llAddToLandBanList(string avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } 1676
476 public void llRemoveFromLandPassList(string avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } 1677 public vector llGetCameraPos()
477 public void llRemoveFromLandBanList(string avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } 1678 {
478 public void llSetCameraParams(List<string> rules) { m_LSL_Functions.llSetCameraParams(rules); } 1679 return m_LSL_Functions.llGetCameraPos();
479 public void llClearCameraParams() { m_LSL_Functions.llClearCameraParams(); } 1680 }
480 public double llListStatistics(int operation, List<string> src) { return m_LSL_Functions.llListStatistics(operation, src); } 1681
481 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } 1682 public rotation llGetCameraRot()
482 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } 1683 {
483 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } 1684 return m_LSL_Functions.llGetCameraRot();
484 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } 1685 }
485 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } 1686
486 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } 1687 public void llSetPrimURL()
487 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } 1688 {
488 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); } 1689 m_LSL_Functions.llSetPrimURL();
489 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelPrimOwners(pos); } 1690 }
490 public int llGetObjectPrimCount(string object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } 1691
1692 public void llRefreshPrimURL()
1693 {
1694 m_LSL_Functions.llRefreshPrimURL();
1695 }
1696
1697 public string llEscapeURL(string url)
1698 {
1699 return m_LSL_Functions.llEscapeURL(url);
1700 }
1701
1702 public string llUnescapeURL(string url)
1703 {
1704 return m_LSL_Functions.llUnescapeURL(url);
1705 }
1706
1707 public void llMapDestination(string simname, vector pos, vector look_at)
1708 {
1709 m_LSL_Functions.llMapDestination(simname, pos, look_at);
1710 }
1711
1712 public void llAddToLandBanList(string avatar, double hours)
1713 {
1714 m_LSL_Functions.llAddToLandBanList(avatar, hours);
1715 }
1716
1717 public void llRemoveFromLandPassList(string avatar)
1718 {
1719 m_LSL_Functions.llRemoveFromLandPassList(avatar);
1720 }
1721
1722 public void llRemoveFromLandBanList(string avatar)
1723 {
1724 m_LSL_Functions.llRemoveFromLandBanList(avatar);
1725 }
1726
1727 public void llSetCameraParams(List<string> rules)
1728 {
1729 m_LSL_Functions.llSetCameraParams(rules);
1730 }
1731
1732 public void llClearCameraParams()
1733 {
1734 m_LSL_Functions.llClearCameraParams();
1735 }
1736
1737 public double llListStatistics(int operation, List<string> src)
1738 {
1739 return m_LSL_Functions.llListStatistics(operation, src);
1740 }
1741
1742 public int llGetUnixTime()
1743 {
1744 return m_LSL_Functions.llGetUnixTime();
1745 }
1746
1747 public int llGetParcelFlags(vector pos)
1748 {
1749 return m_LSL_Functions.llGetParcelFlags(pos);
1750 }
1751
1752 public int llGetRegionFlags()
1753 {
1754 return m_LSL_Functions.llGetRegionFlags();
1755 }
1756
1757 public string llXorBase64StringsCorrect(string str1, string str2)
1758 {
1759 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
1760 }
1761
1762 public void llHTTPRequest(string url, List<string> parameters, string body)
1763 {
1764 m_LSL_Functions.llHTTPRequest(url, parameters, body);
1765 }
1766
1767 public void llResetLandBanList()
1768 {
1769 m_LSL_Functions.llResetLandBanList();
1770 }
1771
1772 public void llResetLandPassList()
1773 {
1774 m_LSL_Functions.llResetLandPassList();
1775 }
1776
1777 public int llGetParcelPrimCount(vector pos, int category, int sim_wide)
1778 {
1779 return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);
1780 }
1781
1782 public List<string> llGetParcelPrimOwners(vector pos)
1783 {
1784 return m_LSL_Functions.llGetParcelPrimOwners(pos);
1785 }
1786
1787 public int llGetObjectPrimCount(string object_id)
1788 {
1789 return m_LSL_Functions.llGetObjectPrimCount(object_id);
1790 }
1791
491 // 1792 //
492 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs 1793 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
493 // 1794 //
494 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); } 1795 public int llGetParcelMaxPrims(vector pos, int sim_wide)
495 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { return m_LSL_Functions.llGetParcelDetails(pos, param); } 1796 {
1797 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
1798 }
1799
1800 public List<string> llGetParcelDetails(vector pos, List<string> param)
1801 {
1802 return m_LSL_Functions.llGetParcelDetails(pos, param);
1803 }
496 1804
497 // 1805 //
498 // OpenSim Functions 1806 // OpenSim Functions
499 // 1807 //
500 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); } 1808 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
1809 int timer)
1810 {
1811 return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer);
1812 }
501 1813
502 // LSL CONSTANTS 1814 // LSL CONSTANTS
503 public const int TRUE = 1; 1815 public const int TRUE = 1;
@@ -803,10 +2115,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
803 public const double SQRT2 = 1.414213538f; 2115 public const double SQRT2 = 1.414213538f;
804 2116
805 // Can not be public const? 2117 // Can not be public const?
806 public LSL_Types.Vector3 ZERO_VECTOR = new LSL_Types.Vector3(0, 0, 0); 2118 public vector ZERO_VECTOR = new vector(0, 0, 0);
807 public LSL_Types.Quaternion ZERO_ROTATION = new LSL_Types.Quaternion(0, 0, 0, 0); 2119 public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0);
808
809
810
811 } 2120 }
812} 2121} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
index 00eb899..190e6d7 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
@@ -27,31 +27,32 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
35 public static class Common 33 public static class Common
36 { 34 {
37 static public bool Debug = true; 35 public static bool Debug = true;
38 static public bool IL_UseTryCatch = true; 36 public static bool IL_UseTryCatch = true;
39 static public bool IL_CreateConstructor = true; 37 public static bool IL_CreateConstructor = true;
40 static public bool IL_CreateFunctionList = true; 38 public static bool IL_CreateFunctionList = true;
41 static public bool IL_ProcessCodeChunks = true; 39 public static bool IL_ProcessCodeChunks = true;
42 40
43 public delegate void SendToDebugEventDelegate(string Message); 41 public delegate void SendToDebugEventDelegate(string Message);
42
44 public delegate void SendToLogEventDelegate(string Message); 43 public delegate void SendToLogEventDelegate(string Message);
45 static public event SendToDebugEventDelegate SendToDebugEvent;
46 static public event SendToLogEventDelegate SendToLogEvent;
47 44
48 static public void SendToDebug(string Message) 45 public static event SendToDebugEventDelegate SendToDebugEvent;
46 public static event SendToLogEventDelegate SendToLogEvent;
47
48 public static void SendToDebug(string Message)
49 { 49 {
50 //if (Debug == true) 50 //if (Debug == true)
51 Console.WriteLine("COMPILER:Debug: " + Message); 51 Console.WriteLine("COMPILER:Debug: " + Message);
52 SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 52 SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
53 } 53 }
54 static public void SendToLog(string Message) 54
55 public static void SendToLog(string Message)
55 { 56 {
56 //if (Debug == true) 57 //if (Debug == true)
57 Console.WriteLine("COMPILER:LOG: " + Message); 58 Console.WriteLine("COMPILER:LOG: " + Message);
@@ -68,6 +69,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
68 Common.SendToDebug("ReverseFormatString format: " + format); 69 Common.SendToDebug("ReverseFormatString format: " + format);
69 return string.Format(format, text1); 70 return string.Format(format, text1);
70 } 71 }
72
71 public static string ReverseFormatString(string text1, UInt32 text2, string format) 73 public static string ReverseFormatString(string text1, UInt32 text2, string format)
72 { 74 {
73 Common.SendToDebug("ReverseFormatString text1: " + text1); 75 Common.SendToDebug("ReverseFormatString text1: " + text1);
@@ -75,10 +77,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
75 Common.SendToDebug("ReverseFormatString format: " + format); 77 Common.SendToDebug("ReverseFormatString format: " + format);
76 return string.Format(format, text1, text2.ToString()); 78 return string.Format(format, text1, text2.ToString());
77 } 79 }
80
78 public static string Cast_ToString(object obj) 81 public static string Cast_ToString(object obj)
79 { 82 {
80 Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString()); 83 Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString());
81 return "ABCDEFGIHJKLMNOPQ123"; 84 return "ABCDEFGIHJKLMNOPQ123";
82 } 85 }
83 } 86 }
84} 87} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
index f060f06..97981cc 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
@@ -27,20 +27,19 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using System.Reflection.Emit; 32using System.Reflection.Emit;
33using System.Text;
32using System.Threading; 34using System.Threading;
33 35
34
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
36{ 37{
37
38
39 public class Engine 38 public class Engine
40 { 39 {
41 //private string LSO_FileName = @"LSO\AdditionTest.lso"; 40 //private string LSO_FileName = @"LSO\AdditionTest.lso";
42 private string LSO_FileName;// = @"LSO\CloseToDefault.lso"; 41 private string LSO_FileName; // = @"LSO\CloseToDefault.lso";
43 AppDomain appDomain; 42 private AppDomain appDomain;
44 43
45 public string Compile(string LSOFileName) 44 public string Compile(string LSOFileName)
46 { 45 {
@@ -52,20 +51,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
52 51
53 // Create Assembly Name 52 // Create Assembly Name
54 AssemblyName asmName = new AssemblyName(); 53 AssemblyName asmName = new AssemblyName();
55 asmName.Name = System.IO.Path.GetFileNameWithoutExtension(LSO_FileName); 54 asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName);
56 //asmName.Name = "TestAssembly"; 55 //asmName.Name = "TestAssembly";
57 56
58 string DLL_FileName = asmName.Name + ".dll"; 57 string DLL_FileName = asmName.Name + ".dll";
59 string DLL_FileName_WithPath = System.IO.Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName; 58 string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
60 59
61 Common.SendToLog("LSO File Name: " + System.IO.Path.GetFileName(LSO_FileName)); 60 Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName));
62 Common.SendToLog("Assembly name: " + asmName.Name); 61 Common.SendToLog("Assembly name: " + asmName.Name);
63 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll"); 62 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll");
64 Common.SendToLog("Starting processing of LSL ByteCode..."); 63 Common.SendToLog("Starting processing of LSL ByteCode...");
65 Common.SendToLog(""); 64 Common.SendToLog("");
66 65
67 66
68
69 // Create Assembly 67 // Create Assembly
70 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly( 68 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly(
71 asmName, 69 asmName,
@@ -78,15 +76,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
78 76
79 // Create a module (and save to disk) 77 // Create a module (and save to disk)
80 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule 78 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
81 (asmName.Name, 79 (asmName.Name,
82 DLL_FileName); 80 DLL_FileName);
83 81
84 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\""); 82 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\"");
85 // Create a Class (/Type) 83 // Create a Class (/Type)
86 TypeBuilder typeBuilder = modBuilder.DefineType( 84 TypeBuilder typeBuilder = modBuilder.DefineType(
87 "LSL_ScriptObject", 85 "LSL_ScriptObject",
88 TypeAttributes.Public | TypeAttributes.BeforeFieldInit, 86 TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
89 typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)); 87 typeof (LSL_BaseClass));
90 //, 88 //,
91 // typeof()); 89 // typeof());
92 //, typeof(LSL_BuiltIn_Commands_Interface)); 90 //, typeof(LSL_BuiltIn_Commands_Interface));
@@ -95,7 +93,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
95 // new Type[] { typeof(LSL_CLRInterface.LSLScript) }); 93 // new Type[] { typeof(LSL_CLRInterface.LSLScript) });
96 94
97 95
98
99 /* 96 /*
100 * Generate the IL itself 97 * Generate the IL itself
101 */ 98 */
@@ -123,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
123 asmBuilder.Save(DLL_FileName); 120 asmBuilder.Save(DLL_FileName);
124 121
125 Common.SendToLog("Returning assembly filename: " + DLL_FileName); 122 Common.SendToLog("Returning assembly filename: " + DLL_FileName);
126 123
127 124
128 return DLL_FileName; 125 return DLL_FileName;
129 126
@@ -135,9 +132,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
135 //object MyScript = (object)Activator.CreateInstance(type); 132 //object MyScript = (object)Activator.CreateInstance(type);
136 133
137 134
138
139
140
141 //System.Reflection.MemberInfo[] Members = type.GetMembers(); 135 //System.Reflection.MemberInfo[] Members = type.GetMembers();
142 136
143 //Common.SendToLog("Members of assembly " + type.ToString() + ":"); 137 //Common.SendToLog("Members of assembly " + type.ToString() + ":");
@@ -165,29 +159,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
165 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" }); 159 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" });
166 160
167 //} 161 //}
168
169
170 } 162 }
171 163
172 164
173 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP) 165 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP)
174 { 166 {
175
176
177 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()"); 167 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
178 //ConstructorBuilder constructor = typeBuilder.DefineConstructor( 168 //ConstructorBuilder constructor = typeBuilder.DefineConstructor(
179 // MethodAttributes.Public, 169 // MethodAttributes.Public,
180 // CallingConventions.Standard, 170 // CallingConventions.Standard,
181 // new Type[0]); 171 // new Type[0]);
182 ConstructorBuilder constructor = typeBuilder.DefineConstructor( 172 ConstructorBuilder constructor = typeBuilder.DefineConstructor(
183 MethodAttributes.Public | 173 MethodAttributes.Public |
184 MethodAttributes.SpecialName | 174 MethodAttributes.SpecialName |
185 MethodAttributes.RTSpecialName, 175 MethodAttributes.RTSpecialName,
186 CallingConventions.Standard, 176 CallingConventions.Standard,
187 new Type[0]); 177 new Type[0]);
188 178
189 //Define the reflection ConstructorInfor for System.Object 179 //Define the reflection ConstructorInfor for System.Object
190 ConstructorInfo conObj = typeof(LSL_BaseClass).GetConstructor(new Type[0]); 180 ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]);
191 181
192 //call constructor of base object 182 //call constructor of base object
193 ILGenerator il = constructor.GetILGenerator(); 183 ILGenerator il = constructor.GetILGenerator();
@@ -230,58 +220,61 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
230 LSO_Struct.StaticBlock sb; 220 LSO_Struct.StaticBlock sb;
231 LSOP.StaticBlocks.TryGetValue(pos, out sb); 221 LSOP.StaticBlocks.TryGetValue(pos, out sb);
232 222
233 if (sb.ObjectType > 0 && sb.ObjectType < 8) { // We don't want void or null's 223 if (sb.ObjectType > 0 && sb.ObjectType < 8)
234
235 il.Emit(OpCodes.Ldarg_0);
236 // Push position to stack
237 il.Emit(OpCodes.Ldc_I4, pos);
238 //il.Emit(OpCodes.Box, typeof(UInt32));
239
240
241 Type datatype = null;
242
243 // Push data to stack
244 Common.SendToDebug("Adding to static (" + pos + ") type: " + ((LSO_Enums.Variable_Type_Codes)sb.ObjectType).ToString() + " (" + sb.ObjectType + ")");
245 switch ((LSO_Enums.Variable_Type_Codes)sb.ObjectType)
246 { 224 {
247 case LSO_Enums.Variable_Type_Codes.Float: 225 // We don't want void or null's
248 case LSO_Enums.Variable_Type_Codes.Integer: 226
249 //UInt32 227 il.Emit(OpCodes.Ldarg_0);
250 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0)); 228 // Push position to stack
251 datatype = typeof(UInt32); 229 il.Emit(OpCodes.Ldc_I4, pos);
252 il.Emit(OpCodes.Box, datatype); 230 //il.Emit(OpCodes.Box, typeof(UInt32));
253 break; 231
254 case LSO_Enums.Variable_Type_Codes.String: 232
255 case LSO_Enums.Variable_Type_Codes.Key: 233 Type datatype = null;
256 //String 234
257 LSO_Struct.HeapBlock hb = LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1); 235 // Push data to stack
258 il.Emit(OpCodes.Ldstr, System.Text.Encoding.UTF8.GetString(hb.Data)); 236 Common.SendToDebug("Adding to static (" + pos + ") type: " +
259 datatype = typeof(string); 237 ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType +
260 break; 238 ")");
261 case LSO_Enums.Variable_Type_Codes.Vector: 239 switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType)
262 datatype = typeof(LSO_Enums.Vector); 240 {
263 //TODO: Not implemented 241 case LSO_Enums.Variable_Type_Codes.Float:
264 break; 242 case LSO_Enums.Variable_Type_Codes.Integer:
265 case LSO_Enums.Variable_Type_Codes.Rotation: 243 //UInt32
266 //Object 244 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
267 //TODO: Not implemented 245 datatype = typeof (UInt32);
268 datatype = typeof(LSO_Enums.Rotation); 246 il.Emit(OpCodes.Box, datatype);
269 break; 247 break;
270 default: 248 case LSO_Enums.Variable_Type_Codes.String:
271 datatype = typeof(object); 249 case LSO_Enums.Variable_Type_Codes.Key:
272 break; 250 //String
273 } 251 LSO_Struct.HeapBlock hb =
274 252 LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
275 253 il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data));
276 // Make call 254 datatype = typeof (string);
277 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddToStatic", new Type[] { typeof(UInt32), datatype })); 255 break;
256 case LSO_Enums.Variable_Type_Codes.Vector:
257 datatype = typeof (LSO_Enums.Vector);
258 //TODO: Not implemented
259 break;
260 case LSO_Enums.Variable_Type_Codes.Rotation:
261 //Object
262 //TODO: Not implemented
263 datatype = typeof (LSO_Enums.Rotation);
264 break;
265 default:
266 datatype = typeof (object);
267 break;
268 }
269
270
271 // Make call
272 il.Emit(OpCodes.Call,
273 typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype}));
278 } 274 }
279
280 } 275 }
281 276
282 277
283
284
285 ////il.Emit(OpCodes.Newobj, typeof(UInt32)); 278 ////il.Emit(OpCodes.Newobj, typeof(UInt32));
286 //il.Emit(OpCodes.Starg_0); 279 //il.Emit(OpCodes.Starg_0);
287 //// Create LSL function library 280 //// Create LSL function library
@@ -293,8 +286,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
293 } 286 }
294 287
295 288
296
297
298 // End of class 289 // End of class
299 } 290 }
300} 291} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
index 65be5e3..2dc8055 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
@@ -27,30 +27,25 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 30using System.Reflection;
33using System.Reflection.Emit; 31using System.Reflection.Emit;
34 32
35namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
36{ 34{
37 partial class LSO_Parser 35 internal partial class LSO_Parser
38 { 36 {
39 private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName) 37 private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName)
40 { 38 {
41 TypeBuilder typeBuilder = modBuilder.DefineType(typeName, 39 TypeBuilder typeBuilder = modBuilder.DefineType(typeName,
42 TypeAttributes.Public | 40 TypeAttributes.Public |
43 TypeAttributes.Class | 41 TypeAttributes.Class |
44 TypeAttributes.AutoClass | 42 TypeAttributes.AutoClass |
45 TypeAttributes.AnsiClass | 43 TypeAttributes.AnsiClass |
46 TypeAttributes.BeforeFieldInit | 44 TypeAttributes.BeforeFieldInit |
47 TypeAttributes.AutoLayout, 45 TypeAttributes.AutoLayout,
48 typeof(object), 46 typeof (object),
49 new Type[] { typeof(object) }); 47 new Type[] {typeof (object)});
50 return typeBuilder; 48 return typeBuilder;
51
52 } 49 }
53
54
55 } 50 }
56} 51} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
index 2fb8e45..b84400c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
@@ -28,9 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
34using OpenSim.Region.ScriptEngine.Common; 31using OpenSim.Region.ScriptEngine.Common;
35 32
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
@@ -39,9 +36,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
39 { 36 {
40 //public MemoryStream LSLStack = new MemoryStream(); 37 //public MemoryStream LSLStack = new MemoryStream();
41 public Stack<object> LSLStack = new Stack<object>(); 38 public Stack<object> LSLStack = new Stack<object>();
42 public Dictionary<UInt32, object> StaticVariables = new Dictionary<UInt32, object>(); 39 public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>();
43 public Dictionary<UInt32, object> GlobalVariables = new Dictionary<UInt32, object>(); 40 public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>();
44 public Dictionary<UInt32, object> LocalVariables = new Dictionary<UInt32, object>(); 41 public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>();
45 //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>(); 42 //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>();
46 //public void AddFunction(String x) { 43 //public void AddFunction(String x) {
47 // FunctionList.Add(x); 44 // FunctionList.Add(x);
@@ -54,19 +51,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
54 //} 51 //}
55 public UInt32 State = 0; 52 public UInt32 State = 0;
56 public LSL_BuiltIn_Commands_Interface LSL_Builtins; 53 public LSL_BuiltIn_Commands_Interface LSL_Builtins;
54
57 public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn() 55 public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn()
58 { 56 {
59 return LSL_Builtins; 57 return LSL_Builtins;
60 } 58 }
61 59
62 60
63 public LSL_BaseClass() { } 61 public LSL_BaseClass()
62 {
63 }
64 64
65 65
66 public virtual int OverrideMe() 66 public virtual int OverrideMe()
67 { 67 {
68 return 0; 68 return 0;
69 } 69 }
70
70 public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins) 71 public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins)
71 { 72 {
72 LSL_Builtins = LSLBuiltins; 73 LSL_Builtins = LSLBuiltins;
@@ -81,8 +82,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
81 Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType()); 82 Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType());
82 StaticVariables.Add(index, obj); 83 StaticVariables.Add(index, obj);
83 } 84 }
84
85
86
87 } 85 }
88} 86} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
index a75b4c8..c805a01 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -53,6 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
53 LocalVariables.Remove(index); 51 LocalVariables.Remove(index);
54 LocalVariables.Add(index, LSLStack.Peek()); 52 LocalVariables.Add(index, LSLStack.Peek());
55 } 53 }
54
56 public void StoreToGlobal(UInt32 index) 55 public void StoreToGlobal(UInt32 index)
57 { 56 {
58 Common.SendToDebug("::StoreToGlobal " + index); 57 Common.SendToDebug("::StoreToGlobal " + index);
@@ -60,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
60 GlobalVariables.Remove(index); 59 GlobalVariables.Remove(index);
61 GlobalVariables.Add(index, LSLStack.Peek()); 60 GlobalVariables.Add(index, LSLStack.Peek());
62 } 61 }
62
63 public void StoreToStatic(UInt32 index) 63 public void StoreToStatic(UInt32 index)
64 { 64 {
65 Common.SendToDebug("::StoreToStatic " + index); 65 Common.SendToDebug("::StoreToStatic " + index);
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
67 // StaticVariables.Remove(index); 67 // StaticVariables.Remove(index);
68 StaticVariables.Add(index, LSLStack.Peek()); 68 StaticVariables.Add(index, LSLStack.Peek());
69 } 69 }
70
70 public void GetFromLocal(UInt32 index) 71 public void GetFromLocal(UInt32 index)
71 { 72 {
72 // TODO: How to determine local? 73 // TODO: How to determine local?
@@ -76,6 +77,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
76 LSLStack.Push(ret); 77 LSLStack.Push(ret);
77 //return ret; 78 //return ret;
78 } 79 }
80
79 public void GetFromGlobal(UInt32 index) 81 public void GetFromGlobal(UInt32 index)
80 { 82 {
81 Common.SendToDebug("::GetFromGlobal " + index); 83 Common.SendToDebug("::GetFromGlobal " + index);
@@ -84,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
84 LSLStack.Push(ret); 86 LSLStack.Push(ret);
85 //return ret; 87 //return ret;
86 } 88 }
89
87 public void GetFromStatic(UInt32 index) 90 public void GetFromStatic(UInt32 index)
88 { 91 {
89 Common.SendToDebug("::GetFromStatic " + index); 92 Common.SendToDebug("::GetFromStatic " + index);
@@ -99,22 +102,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
99 Common.SendToDebug("::POPToStack"); 102 Common.SendToDebug("::POPToStack");
100 //return LSLStack.Pop(); 103 //return LSLStack.Pop();
101 object p = LSLStack.Pop(); 104 object p = LSLStack.Pop();
102 if (p.GetType() == typeof(UInt32)) 105 if (p.GetType() == typeof (UInt32))
103 return (UInt32)p; 106 return (UInt32) p;
104 if (p.GetType() == typeof(string)) 107 if (p.GetType() == typeof (string))
105 return (string)p; 108 return (string) p;
106 if (p.GetType() == typeof(Int32)) 109 if (p.GetType() == typeof (Int32))
107 return (Int32)p; 110 return (Int32) p;
108 if (p.GetType() == typeof(UInt16)) 111 if (p.GetType() == typeof (UInt16))
109 return (UInt16)p; 112 return (UInt16) p;
110 if (p.GetType() == typeof(float)) 113 if (p.GetType() == typeof (float))
111 return (float)p; 114 return (float) p;
112 if (p.GetType() == typeof(LSO_Enums.Vector)) 115 if (p.GetType() == typeof (LSO_Enums.Vector))
113 return (LSO_Enums.Vector)p; 116 return (LSO_Enums.Vector) p;
114 if (p.GetType() == typeof(LSO_Enums.Rotation)) 117 if (p.GetType() == typeof (LSO_Enums.Rotation))
115 return (LSO_Enums.Rotation)p; 118 return (LSO_Enums.Rotation) p;
116 if (p.GetType() == typeof(LSO_Enums.Key)) 119 if (p.GetType() == typeof (LSO_Enums.Key))
117 return (LSO_Enums.Key)p; 120 return (LSO_Enums.Key) p;
118 121
119 return p; 122 return p;
120 } 123 }
@@ -151,6 +154,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
151 LSLStack.Pop(); 154 LSLStack.Pop();
152 } 155 }
153 } 156 }
157
154 public void PUSH(object Param) 158 public void PUSH(object Param)
155 { 159 {
156 if (Param == null) 160 if (Param == null)
@@ -159,205 +163,218 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
159 } 163 }
160 else 164 else
161 { 165 {
162
163 //Common.SendToDebug("::PUSH: " + Param.GetType()); 166 //Common.SendToDebug("::PUSH: " + Param.GetType());
164 } 167 }
165 168
166 LSLStack.Push(Param); 169 LSLStack.Push(Param);
167 } 170 }
171
168 public void ADD(UInt32 Param) 172 public void ADD(UInt32 Param)
169 { 173 {
170 Common.SendToDebug("::ADD: " + Param); 174 Common.SendToDebug("::ADD: " + Param);
171 object o2 = LSLStack.Pop(); 175 object o2 = LSLStack.Pop();
172 object o1 = LSLStack.Pop(); 176 object o1 = LSLStack.Pop();
173 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() + " (" + o2.ToString() + ")"); 177 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() +
174 if (o2.GetType() == typeof(string)) 178 " (" + o2.ToString() + ")");
179 if (o2.GetType() == typeof (string))
175 { 180 {
176 LSLStack.Push((string)o1 + (string)o2); 181 LSLStack.Push((string) o1 + (string) o2);
177 return; 182 return;
178 } 183 }
179 if (o2.GetType() == typeof(UInt32)) 184 if (o2.GetType() == typeof (UInt32))
180 { 185 {
181 LSLStack.Push((UInt32)o1 + (UInt32)o2); 186 LSLStack.Push((UInt32) o1 + (UInt32) o2);
182 return; 187 return;
183 } 188 }
184
185 } 189 }
190
186 public void SUB(UInt32 Param) 191 public void SUB(UInt32 Param)
187 { 192 {
188 Common.SendToDebug("::SUB: " + Param); 193 Common.SendToDebug("::SUB: " + Param);
189 UInt32 i2 = (UInt32)LSLStack.Pop(); 194 UInt32 i2 = (UInt32) LSLStack.Pop();
190 UInt32 i1 = (UInt32)LSLStack.Pop(); 195 UInt32 i1 = (UInt32) LSLStack.Pop();
191 LSLStack.Push((UInt32)(i1 - i2)); 196 LSLStack.Push((UInt32) (i1 - i2));
192 } 197 }
198
193 public void MUL(UInt32 Param) 199 public void MUL(UInt32 Param)
194 { 200 {
195 Common.SendToDebug("::SUB: " + Param); 201 Common.SendToDebug("::SUB: " + Param);
196 UInt32 i2 = (UInt32)LSLStack.Pop(); 202 UInt32 i2 = (UInt32) LSLStack.Pop();
197 UInt32 i1 = (UInt32)LSLStack.Pop(); 203 UInt32 i1 = (UInt32) LSLStack.Pop();
198 LSLStack.Push((UInt32)(i1 * i2)); 204 LSLStack.Push((UInt32) (i1*i2));
199 } 205 }
206
200 public void DIV(UInt32 Param) 207 public void DIV(UInt32 Param)
201 { 208 {
202 Common.SendToDebug("::DIV: " + Param); 209 Common.SendToDebug("::DIV: " + Param);
203 UInt32 i2 = (UInt32)LSLStack.Pop(); 210 UInt32 i2 = (UInt32) LSLStack.Pop();
204 UInt32 i1 = (UInt32)LSLStack.Pop(); 211 UInt32 i1 = (UInt32) LSLStack.Pop();
205 LSLStack.Push((UInt32)(i1 / i2)); 212 LSLStack.Push((UInt32) (i1/i2));
206 } 213 }
207 214
208 215
209 public void MOD(UInt32 Param) 216 public void MOD(UInt32 Param)
210 { 217 {
211 Common.SendToDebug("::MOD: " + Param); 218 Common.SendToDebug("::MOD: " + Param);
212 UInt32 i2 = (UInt32)LSLStack.Pop(); 219 UInt32 i2 = (UInt32) LSLStack.Pop();
213 UInt32 i1 = (UInt32)LSLStack.Pop(); 220 UInt32 i1 = (UInt32) LSLStack.Pop();
214 LSLStack.Push((UInt32)(i1 % i2)); 221 LSLStack.Push((UInt32) (i1%i2));
215 } 222 }
223
216 public void EQ(UInt32 Param) 224 public void EQ(UInt32 Param)
217 { 225 {
218 Common.SendToDebug("::EQ: " + Param); 226 Common.SendToDebug("::EQ: " + Param);
219 UInt32 i2 = (UInt32)LSLStack.Pop(); 227 UInt32 i2 = (UInt32) LSLStack.Pop();
220 UInt32 i1 = (UInt32)LSLStack.Pop(); 228 UInt32 i1 = (UInt32) LSLStack.Pop();
221 if (i1 == i2) 229 if (i1 == i2)
222 { 230 {
223 LSLStack.Push((UInt32)1); 231 LSLStack.Push((UInt32) 1);
224 } 232 }
225 else 233 else
226 { 234 {
227 LSLStack.Push((UInt32)0); 235 LSLStack.Push((UInt32) 0);
228 } 236 }
229 } 237 }
238
230 public void NEQ(UInt32 Param) 239 public void NEQ(UInt32 Param)
231 { 240 {
232 Common.SendToDebug("::NEQ: " + Param); 241 Common.SendToDebug("::NEQ: " + Param);
233 UInt32 i2 = (UInt32)LSLStack.Pop(); 242 UInt32 i2 = (UInt32) LSLStack.Pop();
234 UInt32 i1 = (UInt32)LSLStack.Pop(); 243 UInt32 i1 = (UInt32) LSLStack.Pop();
235 if (i1 != i2) 244 if (i1 != i2)
236 { 245 {
237 LSLStack.Push((UInt32)1); 246 LSLStack.Push((UInt32) 1);
238 } 247 }
239 else 248 else
240 { 249 {
241 LSLStack.Push((UInt32)0); 250 LSLStack.Push((UInt32) 0);
242 } 251 }
243 } 252 }
253
244 public void LEQ(UInt32 Param) 254 public void LEQ(UInt32 Param)
245 { 255 {
246 Common.SendToDebug("::LEQ: " + Param); 256 Common.SendToDebug("::LEQ: " + Param);
247 UInt32 i2 = (UInt32)LSLStack.Pop(); 257 UInt32 i2 = (UInt32) LSLStack.Pop();
248 UInt32 i1 = (UInt32)LSLStack.Pop(); 258 UInt32 i1 = (UInt32) LSLStack.Pop();
249 if (i1 <= i2) 259 if (i1 <= i2)
250 { 260 {
251 LSLStack.Push((UInt32)1); 261 LSLStack.Push((UInt32) 1);
252 } 262 }
253 else 263 else
254 { 264 {
255 LSLStack.Push((UInt32)0); 265 LSLStack.Push((UInt32) 0);
256 } 266 }
257 } 267 }
268
258 public void GEQ(UInt32 Param) 269 public void GEQ(UInt32 Param)
259 { 270 {
260 Common.SendToDebug("::GEQ: " + Param); 271 Common.SendToDebug("::GEQ: " + Param);
261 UInt32 i2 = (UInt32)LSLStack.Pop(); 272 UInt32 i2 = (UInt32) LSLStack.Pop();
262 UInt32 i1 = (UInt32)LSLStack.Pop(); 273 UInt32 i1 = (UInt32) LSLStack.Pop();
263 if (i1 >= i2) 274 if (i1 >= i2)
264 { 275 {
265 LSLStack.Push((UInt32)1); 276 LSLStack.Push((UInt32) 1);
266 } 277 }
267 else 278 else
268 { 279 {
269 LSLStack.Push((UInt32)0); 280 LSLStack.Push((UInt32) 0);
270 } 281 }
271 } 282 }
283
272 public void LESS(UInt32 Param) 284 public void LESS(UInt32 Param)
273 { 285 {
274 Common.SendToDebug("::LESS: " + Param); 286 Common.SendToDebug("::LESS: " + Param);
275 UInt32 i2 = (UInt32)LSLStack.Pop(); 287 UInt32 i2 = (UInt32) LSLStack.Pop();
276 UInt32 i1 = (UInt32)LSLStack.Pop(); 288 UInt32 i1 = (UInt32) LSLStack.Pop();
277 if (i1 < i2) 289 if (i1 < i2)
278 { 290 {
279 LSLStack.Push((UInt32)1); 291 LSLStack.Push((UInt32) 1);
280 } 292 }
281 else 293 else
282 { 294 {
283 LSLStack.Push((UInt32)0); 295 LSLStack.Push((UInt32) 0);
284 } 296 }
285 } 297 }
298
286 public void GREATER(UInt32 Param) 299 public void GREATER(UInt32 Param)
287 { 300 {
288 Common.SendToDebug("::GREATER: " + Param); 301 Common.SendToDebug("::GREATER: " + Param);
289 UInt32 i2 = (UInt32)LSLStack.Pop(); 302 UInt32 i2 = (UInt32) LSLStack.Pop();
290 UInt32 i1 = (UInt32)LSLStack.Pop(); 303 UInt32 i1 = (UInt32) LSLStack.Pop();
291 if (i1 > i2) 304 if (i1 > i2)
292 { 305 {
293 LSLStack.Push((UInt32)1); 306 LSLStack.Push((UInt32) 1);
294 } 307 }
295 else 308 else
296 { 309 {
297 LSLStack.Push((UInt32)0); 310 LSLStack.Push((UInt32) 0);
298 } 311 }
299 } 312 }
300 313
301 314
302
303 public void BITAND() 315 public void BITAND()
304 { 316 {
305 Common.SendToDebug("::BITAND"); 317 Common.SendToDebug("::BITAND");
306 UInt32 i2 = (UInt32)LSLStack.Pop(); 318 UInt32 i2 = (UInt32) LSLStack.Pop();
307 UInt32 i1 = (UInt32)LSLStack.Pop(); 319 UInt32 i1 = (UInt32) LSLStack.Pop();
308 LSLStack.Push((UInt32)(i1 & i2)); 320 LSLStack.Push((UInt32) (i1 & i2));
309 } 321 }
322
310 public void BITOR() 323 public void BITOR()
311 { 324 {
312 Common.SendToDebug("::BITOR"); 325 Common.SendToDebug("::BITOR");
313 UInt32 i2 = (UInt32)LSLStack.Pop(); 326 UInt32 i2 = (UInt32) LSLStack.Pop();
314 UInt32 i1 = (UInt32)LSLStack.Pop(); 327 UInt32 i1 = (UInt32) LSLStack.Pop();
315 LSLStack.Push((UInt32)(i1 | i2)); 328 LSLStack.Push((UInt32) (i1 | i2));
316 } 329 }
330
317 public void BITXOR() 331 public void BITXOR()
318 { 332 {
319 Common.SendToDebug("::BITXOR"); 333 Common.SendToDebug("::BITXOR");
320 UInt32 i2 = (UInt32)LSLStack.Pop(); 334 UInt32 i2 = (UInt32) LSLStack.Pop();
321 UInt32 i1 = (UInt32)LSLStack.Pop(); 335 UInt32 i1 = (UInt32) LSLStack.Pop();
322 LSLStack.Push((UInt32)(i1 ^ i2)); 336 LSLStack.Push((UInt32) (i1 ^ i2));
323 } 337 }
338
324 public void BOOLAND() 339 public void BOOLAND()
325 { 340 {
326 Common.SendToDebug("::BOOLAND"); 341 Common.SendToDebug("::BOOLAND");
327 bool b2 = bool.Parse((string)LSLStack.Pop()); 342 bool b2 = bool.Parse((string) LSLStack.Pop());
328 bool b1 = bool.Parse((string)LSLStack.Pop()); 343 bool b1 = bool.Parse((string) LSLStack.Pop());
329 if (b1 && b2) 344 if (b1 && b2)
330 { 345 {
331 LSLStack.Push((UInt32)1); 346 LSLStack.Push((UInt32) 1);
332 } 347 }
333 else 348 else
334 { 349 {
335 LSLStack.Push((UInt32)0); 350 LSLStack.Push((UInt32) 0);
336 } 351 }
337 } 352 }
353
338 public void BOOLOR() 354 public void BOOLOR()
339 { 355 {
340 Common.SendToDebug("::BOOLOR"); 356 Common.SendToDebug("::BOOLOR");
341 bool b2 = bool.Parse((string)LSLStack.Pop()); 357 bool b2 = bool.Parse((string) LSLStack.Pop());
342 bool b1 = bool.Parse((string)LSLStack.Pop()); 358 bool b1 = bool.Parse((string) LSLStack.Pop());
343 359
344 if (b1 || b2) 360 if (b1 || b2)
345 { 361 {
346 LSLStack.Push((UInt32)1); 362 LSLStack.Push((UInt32) 1);
347 } 363 }
348 else 364 else
349 { 365 {
350 LSLStack.Push((UInt32)0); 366 LSLStack.Push((UInt32) 0);
351 } 367 }
352
353 } 368 }
369
354 public void NEG(UInt32 Param) 370 public void NEG(UInt32 Param)
355 { 371 {
356 Common.SendToDebug("::NEG: " + Param); 372 Common.SendToDebug("::NEG: " + Param);
357 //UInt32 i2 = (UInt32)LSLStack.Pop(); 373 //UInt32 i2 = (UInt32)LSLStack.Pop();
358 UInt32 i1 = (UInt32)LSLStack.Pop(); 374 UInt32 i1 = (UInt32) LSLStack.Pop();
359 LSLStack.Push((UInt32)(i1 * -1)); 375 LSLStack.Push((UInt32) (i1*-1));
360 } 376 }
377
361 public void BITNOT() 378 public void BITNOT()
362 { 379 {
363 //Common.SendToDebug("::BITNOT"); 380 //Common.SendToDebug("::BITNOT");
@@ -365,6 +382,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
365 //UInt32 i1 = (UInt32)LSLStack.Pop(); 382 //UInt32 i1 = (UInt32)LSLStack.Pop();
366 //LSLStack.Push((UInt32)(i1 / i2)); 383 //LSLStack.Push((UInt32)(i1 / i2));
367 } 384 }
385
368 public void BOOLNOT() 386 public void BOOLNOT()
369 { 387 {
370 //Common.SendToDebug("::BOOLNOT"); 388 //Common.SendToDebug("::BOOLNOT");
@@ -372,7 +390,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
372 //UInt32 i1 = (UInt32)LSLStack.Pop(); 390 //UInt32 i1 = (UInt32)LSLStack.Pop();
373 //LSLStack.Push((UInt32)(i1)); 391 //LSLStack.Push((UInt32)(i1));
374 } 392 }
375
376
377 } 393 }
378} 394} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
index 5f01bf5..8b233ba 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 29namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 30{
35 public class LSL_CLRInterface 31 public class LSL_CLRInterface
@@ -76,4 +72,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
76 //void event_http_response(); 72 //void event_http_response();
77 } 73 }
78 } 74 }
79} 75} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
index ee166a6..e1d7768 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
@@ -27,32 +27,28 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Reflection; 30using System.Reflection;
33using System.Reflection.Emit; 31using System.Reflection.Emit;
34using OpenSim.Region.ScriptEngine.Common; 32using OpenSim.Region.ScriptEngine.Common;
35 33
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
37{ 35{
38 partial class LSO_Parser 36 internal partial class LSO_Parser
39 { 37 {
40 //internal Stack<Type> ILStack = new Stack<Type>(); 38 //internal Stack<Type> ILStack = new Stack<Type>();
41 //LSO_Enums MyLSO_Enums = new LSO_Enums(); 39 //LSO_Enums MyLSO_Enums = new LSO_Enums();
42 40
43 internal bool LSL_PROCESS_OPCODE(ILGenerator il) 41 internal bool LSL_PROCESS_OPCODE(ILGenerator il)
44 { 42 {
45
46 byte bp1; 43 byte bp1;
47 UInt32 u32p1; 44 UInt32 u32p1;
48 float fp1; 45 float fp1;
49 UInt16 opcode = br_read(1)[0]; 46 UInt16 opcode = br_read(1)[0];
50 Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table)opcode).ToString()); 47 Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString());
51 string idesc = ((LSO_Enums.Operation_Table)opcode).ToString(); 48 string idesc = ((LSO_Enums.Operation_Table) opcode).ToString();
52 switch ((LSO_Enums.Operation_Table)opcode) 49 switch ((LSO_Enums.Operation_Table) opcode)
53 { 50 {
54 51 /***************
55 /***************
56 * IMPLEMENTED * 52 * IMPLEMENTED *
57 ***************/ 53 ***************/
58 case LSO_Enums.Operation_Table.NOOP: 54 case LSO_Enums.Operation_Table.NOOP:
@@ -60,33 +56,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
60 case LSO_Enums.Operation_Table.PUSHSP: 56 case LSO_Enums.Operation_Table.PUSHSP:
61 // Push Stack Top (Memory Address) to stack 57 // Push Stack Top (Memory Address) to stack
62 Common.SendToDebug("Instruction " + idesc); 58 Common.SendToDebug("Instruction " + idesc);
63 Common.SendToDebug("Instruction " + idesc + ": Description: Pushing Stack Top (Memory Address from header) to stack"); 59 Common.SendToDebug("Instruction " + idesc +
64 IL_Push(il, (UInt32)myHeader.SP); 60 ": Description: Pushing Stack Top (Memory Address from header) to stack");
61 IL_Push(il, (UInt32) myHeader.SP);
65 break; 62 break;
66 // BYTE 63 // BYTE
67 case LSO_Enums.Operation_Table.PUSHARGB: 64 case LSO_Enums.Operation_Table.PUSHARGB:
68 Common.SendToDebug("Param1: " + br_read(1)[0]); 65 Common.SendToDebug("Param1: " + br_read(1)[0]);
69 break; 66 break;
70 // INTEGER 67 // INTEGER
71 case LSO_Enums.Operation_Table.PUSHARGI: 68 case LSO_Enums.Operation_Table.PUSHARGI:
72 u32p1 = BitConverter.ToUInt32(br_read(4), 0); 69 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
73 Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1); 70 Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1);
74 IL_Push(il, u32p1); 71 IL_Push(il, u32p1);
75 break; 72 break;
76 // FLOAT 73 // FLOAT
77 case LSO_Enums.Operation_Table.PUSHARGF: 74 case LSO_Enums.Operation_Table.PUSHARGF:
78 fp1 = BitConverter.ToUInt32(br_read(4), 0); 75 fp1 = BitConverter.ToUInt32(br_read(4), 0);
79 Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1); 76 Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1);
80 IL_Push(il, fp1); 77 IL_Push(il, fp1);
81 break; 78 break;
82 // STRING 79 // STRING
83 case LSO_Enums.Operation_Table.PUSHARGS: 80 case LSO_Enums.Operation_Table.PUSHARGS:
84 string s = Read_String(); 81 string s = Read_String();
85 Common.SendToDebug("Instruction " + idesc + ", Param1: " + s); 82 Common.SendToDebug("Instruction " + idesc + ", Param1: " + s);
86 IL_Debug(il, "OPCODE: " + idesc + ":" + s); 83 IL_Debug(il, "OPCODE: " + idesc + ":" + s);
87 IL_Push(il, s); 84 IL_Push(il, s);
88 break; 85 break;
89 // VECTOR z,y,x 86 // VECTOR z,y,x
90 case LSO_Enums.Operation_Table.PUSHARGV: 87 case LSO_Enums.Operation_Table.PUSHARGV:
91 LSO_Enums.Vector v = new LSO_Enums.Vector(); 88 LSO_Enums.Vector v = new LSO_Enums.Vector();
92 v.Z = BitConverter.ToUInt32(br_read(4), 0); 89 v.Z = BitConverter.ToUInt32(br_read(4), 0);
@@ -97,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
97 Common.SendToDebug("Param1 X: " + v.X); 94 Common.SendToDebug("Param1 X: " + v.X);
98 IL_Push(il, v); 95 IL_Push(il, v);
99 break; 96 break;
100 // ROTATION s,z,y,x 97 // ROTATION s,z,y,x
101 case LSO_Enums.Operation_Table.PUSHARGQ: 98 case LSO_Enums.Operation_Table.PUSHARGQ:
102 LSO_Enums.Rotation r = new LSO_Enums.Rotation(); 99 LSO_Enums.Rotation r = new LSO_Enums.Rotation();
103 r.S = BitConverter.ToUInt32(br_read(4), 0); 100 r.S = BitConverter.ToUInt32(br_read(4), 0);
@@ -112,7 +109,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
112 break; 109 break;
113 110
114 case LSO_Enums.Operation_Table.PUSHE: 111 case LSO_Enums.Operation_Table.PUSHE:
115 IL_Push(il, (UInt32)0); 112 IL_Push(il, (UInt32) 0);
116 break; 113 break;
117 114
118 case LSO_Enums.Operation_Table.PUSHARGE: 115 case LSO_Enums.Operation_Table.PUSHARGE:
@@ -121,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
121 //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1))); 118 //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1)));
122 IL_Push(il, u32p1); 119 IL_Push(il, u32p1);
123 break; 120 break;
124 // BYTE 121 // BYTE
125 case LSO_Enums.Operation_Table.ADD: 122 case LSO_Enums.Operation_Table.ADD:
126 case LSO_Enums.Operation_Table.SUB: 123 case LSO_Enums.Operation_Table.SUB:
127 case LSO_Enums.Operation_Table.MUL: 124 case LSO_Enums.Operation_Table.MUL:
@@ -136,10 +133,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
136 case LSO_Enums.Operation_Table.MOD: 133 case LSO_Enums.Operation_Table.MOD:
137 bp1 = br_read(1)[0]; 134 bp1 = br_read(1)[0];
138 Common.SendToDebug("Param1: " + bp1); 135 Common.SendToDebug("Param1: " + bp1);
139 IL_CallBaseFunction(il, idesc, (UInt32)bp1); 136 IL_CallBaseFunction(il, idesc, (UInt32) bp1);
140 break; 137 break;
141 138
142 // NO ARGUMENTS 139 // NO ARGUMENTS
143 case LSO_Enums.Operation_Table.BITAND: 140 case LSO_Enums.Operation_Table.BITAND:
144 case LSO_Enums.Operation_Table.BITOR: 141 case LSO_Enums.Operation_Table.BITOR:
145 case LSO_Enums.Operation_Table.BITXOR: 142 case LSO_Enums.Operation_Table.BITXOR:
@@ -149,22 +146,23 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
149 case LSO_Enums.Operation_Table.BOOLNOT: 146 case LSO_Enums.Operation_Table.BOOLNOT:
150 IL_CallBaseFunction(il, idesc); 147 IL_CallBaseFunction(il, idesc);
151 break; 148 break;
152 // SHORT 149 // SHORT
153 case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE: 150 case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
154 // TODO: What is size of short? 151 // TODO: What is size of short?
155 UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0); 152 UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0);
156 Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " + ((LSO_Enums.BuiltIn_Functions)U16p1).ToString()); 153 Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " +
154 ((LSO_Enums.BuiltIn_Functions) U16p1).ToString());
157 //Common.SendToDebug("Param1: " + U16p1); 155 //Common.SendToDebug("Param1: " + U16p1);
158 string fname = ((LSO_Enums.BuiltIn_Functions)U16p1).ToString(); 156 string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString();
159 157
160 bool cmdFound = false; 158 bool cmdFound = false;
161 foreach (MethodInfo mi in typeof(LSL_BuiltIn_Commands_Interface).GetMethods()) 159 foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods())
162 { 160 {
163 // Found command 161 // Found command
164 if (mi.Name == fname) 162 if (mi.Name == fname)
165 { 163 {
166 il.Emit(OpCodes.Ldarg_0); 164 il.Emit(OpCodes.Ldarg_0);
167 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] { })); 165 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {}));
168 // Pop required number of items from my stack to .Net stack 166 // Pop required number of items from my stack to .Net stack
169 IL_PopToStack(il, mi.GetParameters().Length); 167 IL_PopToStack(il, mi.GetParameters().Length);
170 il.Emit(OpCodes.Callvirt, mi); 168 il.Emit(OpCodes.Callvirt, mi);
@@ -179,7 +177,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
179 177
180 break; 178 break;
181 179
182 // RETURN 180 // RETURN
183 case LSO_Enums.Operation_Table.RETURN: 181 case LSO_Enums.Operation_Table.RETURN:
184 182
185 Common.SendToDebug("OPCODE: RETURN"); 183 Common.SendToDebug("OPCODE: RETURN");
@@ -195,7 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
195 IL_Pop(il); 193 IL_Pop(il);
196 break; 194 break;
197 195
198 // LONG 196 // LONG
199 case LSO_Enums.Operation_Table.STORE: 197 case LSO_Enums.Operation_Table.STORE:
200 case LSO_Enums.Operation_Table.STORES: 198 case LSO_Enums.Operation_Table.STORES:
201 case LSO_Enums.Operation_Table.STOREL: 199 case LSO_Enums.Operation_Table.STOREL:
@@ -238,7 +236,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
238 IL_Pop(il); 236 IL_Pop(il);
239 break; 237 break;
240 238
241 // PUSH FROM LOCAL FRAME 239 // PUSH FROM LOCAL FRAME
242 case LSO_Enums.Operation_Table.PUSH: 240 case LSO_Enums.Operation_Table.PUSH:
243 case LSO_Enums.Operation_Table.PUSHS: 241 case LSO_Enums.Operation_Table.PUSHS:
244 case LSO_Enums.Operation_Table.PUSHL: 242 case LSO_Enums.Operation_Table.PUSHL:
@@ -250,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
250 248
251 break; 249 break;
252 250
253 // PUSH FROM STATIC FRAME 251 // PUSH FROM STATIC FRAME
254 case LSO_Enums.Operation_Table.PUSHG: 252 case LSO_Enums.Operation_Table.PUSHG:
255 case LSO_Enums.Operation_Table.PUSHGS: 253 case LSO_Enums.Operation_Table.PUSHGS:
256 case LSO_Enums.Operation_Table.PUSHGL: 254 case LSO_Enums.Operation_Table.PUSHGL:
@@ -262,26 +260,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
262 break; 260 break;
263 261
264 262
265 /*********************** 263 /***********************
266 * NOT IMPLEMENTED YET * 264 * NOT IMPLEMENTED YET *
267 ***********************/ 265 ***********************/
268 266
269 267
270
271 case LSO_Enums.Operation_Table.POPIP: 268 case LSO_Enums.Operation_Table.POPIP:
272 case LSO_Enums.Operation_Table.POPSP: 269 case LSO_Enums.Operation_Table.POPSP:
273 case LSO_Enums.Operation_Table.POPSLR: 270 case LSO_Enums.Operation_Table.POPSLR:
274 case LSO_Enums.Operation_Table.POPARG: 271 case LSO_Enums.Operation_Table.POPARG:
275 case LSO_Enums.Operation_Table.POPBP: 272 case LSO_Enums.Operation_Table.POPBP:
276 //Common.SendToDebug("Instruction " + idesc + ": Ignored"); 273 //Common.SendToDebug("Instruction " + idesc + ": Ignored");
277 Common.SendToDebug("Instruction " + idesc + ": Description: Drop x bytes from the stack (TODO: Only popping 1)"); 274 Common.SendToDebug("Instruction " + idesc +
275 ": Description: Drop x bytes from the stack (TODO: Only popping 1)");
278 //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 276 //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
279 IL_Pop(il); 277 IL_Pop(il);
280 break; 278 break;
281 279
282 280
283 281 // None
284 // None
285 case LSO_Enums.Operation_Table.PUSHIP: 282 case LSO_Enums.Operation_Table.PUSHIP:
286 // PUSH INSTRUCTION POINTER 283 // PUSH INSTRUCTION POINTER
287 break; 284 break;
@@ -293,17 +290,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
293 break; 290 break;
294 291
295 292
296 // LONG 293 // LONG
297 case LSO_Enums.Operation_Table.JUMP: 294 case LSO_Enums.Operation_Table.JUMP:
298 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 295 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
299 break; 296 break;
300 // BYTE, LONG 297 // BYTE, LONG
301 case LSO_Enums.Operation_Table.JUMPIF: 298 case LSO_Enums.Operation_Table.JUMPIF:
302 case LSO_Enums.Operation_Table.JUMPNIF: 299 case LSO_Enums.Operation_Table.JUMPNIF:
303 Common.SendToDebug("Param1: " + br_read(1)[0]); 300 Common.SendToDebug("Param1: " + br_read(1)[0]);
304 Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0)); 301 Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0));
305 break; 302 break;
306 // LONG 303 // LONG
307 case LSO_Enums.Operation_Table.STATE: 304 case LSO_Enums.Operation_Table.STATE:
308 bp1 = br_read(1)[0]; 305 bp1 = br_read(1)[0];
309 //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack 306 //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack
@@ -315,12 +312,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
315 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 312 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
316 Common.SendToDebug("ERROR: Function CALL not implemented yet."); 313 Common.SendToDebug("ERROR: Function CALL not implemented yet.");
317 break; 314 break;
318 // BYTE 315 // BYTE
319 case LSO_Enums.Operation_Table.CAST: 316 case LSO_Enums.Operation_Table.CAST:
320 bp1 = br_read(1)[0]; 317 bp1 = br_read(1)[0];
321 Common.SendToDebug("Instruction " + idesc + ": Cast to type: " + ((LSO_Enums.OpCode_Cast_TypeDefs)bp1)); 318 Common.SendToDebug("Instruction " + idesc + ": Cast to type: " +
319 ((LSO_Enums.OpCode_Cast_TypeDefs) bp1));
322 Common.SendToDebug("Param1: " + bp1); 320 Common.SendToDebug("Param1: " + bp1);
323 switch ((LSO_Enums.OpCode_Cast_TypeDefs)bp1) 321 switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)
324 { 322 {
325 case LSO_Enums.OpCode_Cast_TypeDefs.String: 323 case LSO_Enums.OpCode_Cast_TypeDefs.String:
326 Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());"); 324 Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());");
@@ -330,12 +328,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
330 break; 328 break;
331 } 329 }
332 break; 330 break;
333 // LONG 331 // LONG
334 case LSO_Enums.Operation_Table.STACKTOS: 332 case LSO_Enums.Operation_Table.STACKTOS:
335 case LSO_Enums.Operation_Table.STACKTOL: 333 case LSO_Enums.Operation_Table.STACKTOL:
336 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0)); 334 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
337 break; 335 break;
338 // BYTE 336 // BYTE
339 case LSO_Enums.Operation_Table.PRINT: 337 case LSO_Enums.Operation_Table.PRINT:
340 case LSO_Enums.Operation_Table.CALLLIB: 338 case LSO_Enums.Operation_Table.CALLLIB:
341 Common.SendToDebug("Param1: " + br_read(1)[0]); 339 Common.SendToDebug("Param1: " + br_read(1)[0]);
@@ -348,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
348 { 346 {
349 IL_PopToStack(il, 1); 347 IL_PopToStack(il, 1);
350 } 348 }
349
351 private void IL_PopToStack(ILGenerator il, int count) 350 private void IL_PopToStack(ILGenerator il, int count)
352 { 351 {
353 Common.SendToDebug("IL_PopToStack();"); 352 Common.SendToDebug("IL_PopToStack();");
@@ -360,31 +359,35 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
360 // new Type[] { })); 359 // new Type[] { }));
361 } 360 }
362 } 361 }
362
363 private void IL_Pop(ILGenerator il) 363 private void IL_Pop(ILGenerator il)
364 { 364 {
365 Common.SendToDebug("IL_Pop();"); 365 Common.SendToDebug("IL_Pop();");
366 IL_CallBaseFunction(il, "POP"); 366 IL_CallBaseFunction(il, "POP");
367 } 367 }
368
368 private void IL_Debug(ILGenerator il, string text) 369 private void IL_Debug(ILGenerator il, string text)
369 { 370 {
370 il.Emit(OpCodes.Ldstr, text); 371 il.Emit(OpCodes.Ldstr, text);
371 il.Emit(OpCodes.Call, typeof(Common).GetMethod("SendToDebug", 372 il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug",
372 new Type[] { typeof(string) } 373 new Type[] {typeof (string)}
373 )); 374 ));
374 } 375 }
376
375 private void IL_CallBaseFunction(ILGenerator il, string methodname) 377 private void IL_CallBaseFunction(ILGenerator il, string methodname)
376 { 378 {
377 il.Emit(OpCodes.Ldarg_0); 379 il.Emit(OpCodes.Ldarg_0);
378 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { })); 380 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {}));
379 } 381 }
382
380 private void IL_CallBaseFunction(ILGenerator il, string methodname, object data) 383 private void IL_CallBaseFunction(ILGenerator il, string methodname, object data)
381 { 384 {
382 il.Emit(OpCodes.Ldarg_0); 385 il.Emit(OpCodes.Ldarg_0);
383 if (data.GetType() == typeof(string)) 386 if (data.GetType() == typeof (string))
384 il.Emit(OpCodes.Ldstr, (string)data); 387 il.Emit(OpCodes.Ldstr, (string) data);
385 if (data.GetType() == typeof(UInt32)) 388 if (data.GetType() == typeof (UInt32))
386 il.Emit(OpCodes.Ldc_I4, (UInt32)data); 389 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
387 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod(methodname, new Type[] { data.GetType() })); 390 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()}));
388 } 391 }
389 392
390 private void IL_Push(ILGenerator il, object data) 393 private void IL_Push(ILGenerator il, object data)
@@ -394,43 +397,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
394 397
395 IL_PushDataTypeToILStack(il, data); 398 IL_PushDataTypeToILStack(il, data);
396 399
397 il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("PUSH", new Type[] { data.GetType() })); 400 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()}));
398
399 } 401 }
400 402
401 private void IL_PushDataTypeToILStack(ILGenerator il, object data) 403 private void IL_PushDataTypeToILStack(ILGenerator il, object data)
402 { 404 {
403 if (data.GetType() == typeof(UInt16)) 405 if (data.GetType() == typeof (UInt16))
404 { 406 {
405 il.Emit(OpCodes.Ldc_I4, (UInt16)data); 407 il.Emit(OpCodes.Ldc_I4, (UInt16) data);
406 il.Emit(OpCodes.Box, data.GetType()); 408 il.Emit(OpCodes.Box, data.GetType());
407 } 409 }
408 if (data.GetType() == typeof(UInt32)) 410 if (data.GetType() == typeof (UInt32))
409 { 411 {
410 il.Emit(OpCodes.Ldc_I4, (UInt32)data); 412 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
411 il.Emit(OpCodes.Box, data.GetType()); 413 il.Emit(OpCodes.Box, data.GetType());
412 } 414 }
413 if (data.GetType() == typeof(Int32)) 415 if (data.GetType() == typeof (Int32))
414 { 416 {
415 il.Emit(OpCodes.Ldc_I4, (Int32)data); 417 il.Emit(OpCodes.Ldc_I4, (Int32) data);
416 il.Emit(OpCodes.Box, data.GetType()); 418 il.Emit(OpCodes.Box, data.GetType());
417 } 419 }
418 if (data.GetType() == typeof(float)) 420 if (data.GetType() == typeof (float))
419 { 421 {
420 il.Emit(OpCodes.Ldc_I4, (float)data); 422 il.Emit(OpCodes.Ldc_I4, (float) data);
421 il.Emit(OpCodes.Box, data.GetType()); 423 il.Emit(OpCodes.Box, data.GetType());
422 } 424 }
423 if (data.GetType() == typeof(string)) 425 if (data.GetType() == typeof (string))
424 il.Emit(OpCodes.Ldstr, (string)data); 426 il.Emit(OpCodes.Ldstr, (string) data);
425 //if (data.GetType() == typeof(LSO_Enums.Rotation)) 427 //if (data.GetType() == typeof(LSO_Enums.Rotation))
426 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data); 428 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data);
427 //if (data.GetType() == typeof(LSO_Enums.Vector)) 429 //if (data.GetType() == typeof(LSO_Enums.Vector))
428 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data); 430 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data);
429 //if (data.GetType() == typeof(LSO_Enums.Key)) 431 //if (data.GetType() == typeof(LSO_Enums.Key))
430 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data); 432 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data);
431
432 } 433 }
433
434
435 } 434 }
436} 435} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
index 30ce314..a7e3018 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 31namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
34{ 32{
@@ -47,6 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
47 String = 51, 45 String = 51,
48 UInt32 = 17 46 UInt32 = 17
49 } 47 }
48
50 [Serializable] 49 [Serializable]
51 public enum OpCode_Cast_TypeDefs 50 public enum OpCode_Cast_TypeDefs
52 { 51 {
@@ -66,6 +65,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
66 public UInt32 Y; 65 public UInt32 Y;
67 public UInt32 X; 66 public UInt32 X;
68 } 67 }
68
69 [Serializable] 69 [Serializable]
70 public struct Rotation 70 public struct Rotation
71 { 71 {
@@ -74,6 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
74 public UInt32 Y; 74 public UInt32 Y;
75 public UInt32 X; 75 public UInt32 X;
76 } 76 }
77
77 [Serializable] 78 [Serializable]
78 public enum Variable_Type_Codes 79 public enum Variable_Type_Codes
79 { 80 {
@@ -87,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
87 List = 7, 88 List = 7,
88 Null = 8 89 Null = 8
89 } 90 }
91
90 [Serializable] 92 [Serializable]
91 public enum Event_Mask_Values 93 public enum Event_Mask_Values
92 { 94 {
@@ -124,6 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
124 remote_data = 31, 126 remote_data = 31,
125 http_response = 32 127 http_response = 32
126 } 128 }
129
127 [Serializable] 130 [Serializable]
128 public enum Operation_Table 131 public enum Operation_Table
129 { 132 {
@@ -220,6 +223,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
220 SHL = 0xe0, 223 SHL = 0xe0,
221 SHR = 0xe1 224 SHR = 0xe1
222 } 225 }
226
223 [Serializable] 227 [Serializable]
224 public enum BuiltIn_Functions 228 public enum BuiltIn_Functions
225 { 229 {
@@ -552,6 +556,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
552 llGetParcelMaxPrims = 326, 556 llGetParcelMaxPrims = 326,
553 llGetParcelDetails = 327 557 llGetParcelDetails = 327
554 } 558 }
555
556 } 559 }
557} 560} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
index ba97375..a0b4977f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
@@ -27,15 +27,16 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using System.Reflection.Emit; 34using System.Reflection.Emit;
35using System.Text;
35 36
36namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 37namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
37{ 38{
38 partial class LSO_Parser 39 internal partial class LSO_Parser
39 { 40 {
40 private string FileName; 41 private string FileName;
41 private FileStream fs; 42 private FileStream fs;
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
45 //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable(); 46 //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable();
46 47
47 private TypeBuilder typeBuilder; 48 private TypeBuilder typeBuilder;
48 private System.Collections.Generic.List<string> EventList = new System.Collections.Generic.List<string>(); 49 private List<string> EventList = new List<string>();
49 50
50 public LSO_Parser(string _FileName, TypeBuilder _typeBuilder) 51 public LSO_Parser(string _FileName, TypeBuilder _typeBuilder)
51 { 52 {
@@ -59,11 +60,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
59 Common.SendToDebug("Opening filename: " + FileName); 60 Common.SendToDebug("Opening filename: " + FileName);
60 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read); 61 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
61 br = new BinaryReader(fs, Encoding.BigEndianUnicode); 62 br = new BinaryReader(fs, Encoding.BigEndianUnicode);
62
63 } 63 }
64
64 internal void CloseFile() 65 internal void CloseFile()
65 { 66 {
66
67 // Close 67 // Close
68 br.Close(); 68 br.Close();
69 fs.Close(); 69 fs.Close();
@@ -75,9 +75,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
75 /// </summary> 75 /// </summary>
76 public void Parse() 76 public void Parse()
77 { 77 {
78
79
80
81 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack. 78 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
82 79
83 80
@@ -148,14 +145,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
148 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 145 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
149 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 146 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
150 myStaticBlock.ObjectType = br_read(1)[0]; 147 myStaticBlock.ObjectType = br_read(1)[0];
151 Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 148 Common.SendToDebug("Static Block ObjectType: " +
149 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
152 myStaticBlock.Unknown = br_read(1)[0]; 150 myStaticBlock.Unknown = br_read(1)[0];
153 // Size of datatype varies -- what about strings? 151 // Size of datatype varies -- what about strings?
154 if (myStaticBlock.ObjectType != 0) 152 if (myStaticBlock.ObjectType != 0)
155 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType)); 153 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
156 154
157 StaticBlocks.Add((UInt32)startReadPos, myStaticBlock); 155 StaticBlocks.Add((UInt32) startReadPos, myStaticBlock);
158
159 } 156 }
160 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount); 157 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
161 158
@@ -183,7 +180,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
183 // TODO: ADD TO FUNCTION LIST (How do we identify it later?) 180 // TODO: ADD TO FUNCTION LIST (How do we identify it later?)
184 // Note! Absolute position 181 // Note! Absolute position
185 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR; 182 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
186 Common.SendToDebug("Fuction " + i + " code chunk position: " + myFunctionBlock.CodeChunkPointer[i]); 183 Common.SendToDebug("Fuction " + i + " code chunk position: " +
184 myFunctionBlock.CodeChunkPointer[i]);
187 } 185 }
188 } 186 }
189 } 187 }
@@ -204,14 +202,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
204 Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position); 202 Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position);
205 // Position is relative to state frame 203 // Position is relative to state frame
206 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0); 204 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
207 myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8)); 205 myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8));
208 Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location); 206 Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
209 Common.SendToDebug("Total potential EventMask bits: " + myStateFrameBlock.StatePointer[i].EventMask.Count); 207 Common.SendToDebug("Total potential EventMask bits: " +
208 myStateFrameBlock.StatePointer[i].EventMask.Count);
210 209
211 //// Read STATE BLOCK 210 //// Read STATE BLOCK
212 //long CurPos = fs.Position; 211 //long CurPos = fs.Position;
213 //fs.Seek(CurPos, SeekOrigin.Begin); 212 //fs.Seek(CurPos, SeekOrigin.Begin);
214
215 } 213 }
216 } 214 }
217 215
@@ -224,19 +222,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
224 // Go through all State Frame Pointers found 222 // Go through all State Frame Pointers found
225 for (int i = 0; i < myStateFrameBlock.StateCount; i++) 223 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
226 { 224 {
227
228 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin); 225 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
229 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position); 226 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
230 227
231 // READ: STATE BLOCK HEADER 228 // READ: STATE BLOCK HEADER
232 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock(); 229 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
233 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32)fs.Position; // Note 230 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note
234 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0); 231 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
235 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0]; 232 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
236 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32)fs.Position; // Note 233 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note
237 Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos); 234 Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
238 Common.SendToDebug("State block Header Size: " + myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize); 235 Common.SendToDebug("State block Header Size: " +
239 Common.SendToDebug("State block Header End Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.EndPos); 236 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
237 Common.SendToDebug("State block Header End Pos: " +
238 myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
240 239
241 // We need to count number of bits flagged in EventMask? 240 // We need to count number of bits flagged in EventMask?
242 241
@@ -245,27 +244,36 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
245 244
246 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE 245 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
247 //TODO: Create event hooks 246 //TODO: Create event hooks
248 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers = new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1]; 247 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers =
248 new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
249 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 249 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
250 { 250 {
251
252 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true) 251 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
253 { 252 {
254 // We got an event 253 // We got an event
255 // READ: STATE BLOCK HANDLER 254 // READ: STATE BLOCK HANDLER
256 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") at: " + fs.Position); 255 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii +
257 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0); 256 " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " +
258 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0); 257 fs.Position);
259 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer); 258 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer =
260 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize); 259 myStateFrameBlock.StatePointer[i].StateBlock.EndPos +
260 BitConverter.ToUInt32(br_read(4), 0);
261 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize =
262 BitConverter.ToUInt32(br_read(4), 0);
263 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
264 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " +
265 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
266 CodeChunkPointer);
267 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
268 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " +
269 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
270 CallFrameSize);
261 } 271 }
262 } 272 }
263 } 273 }
264 } 274 }
265 275
266 276
267
268
269 //// READ FUNCTION CODE CHUNKS 277 //// READ FUNCTION CODE CHUNKS
270 //// Functions + Function start pos (GFR) 278 //// Functions + Function start pos (GFR)
271 //// TODO: Somehow be able to identify and reference this 279 //// TODO: Somehow be able to identify and reference this
@@ -291,37 +299,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
291 // two level search ain't no good 299 // two level search ain't no good
292 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++) 300 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
293 { 301 {
294
295
296 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0) 302 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
297 { 303 {
298 Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " + (LSO_Enums.Event_Mask_Values)ii); 304 Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " +
305 (LSO_Enums.Event_Mask_Values) ii);
299 306
300 307
301 // Override a Method / Function 308 // Override a Method / Function
302 string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values)ii; 309 string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii;
303 Common.SendToDebug("Event Name: " + eventname); 310 Common.SendToDebug("Event Name: " + eventname);
304 if (Common.IL_ProcessCodeChunks) 311 if (Common.IL_ProcessCodeChunks)
305 { 312 {
306 EventList.Add(eventname); 313 EventList.Add(eventname);
307 314
308 // JUMP TO CODE PROCESSOR 315 // JUMP TO CODE PROCESSOR
309 ProcessCodeChunk(myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer, typeBuilder, eventname); 316 ProcessCodeChunk(
317 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer,
318 typeBuilder, eventname);
310 } 319 }
311 } 320 }
312
313 } 321 }
314
315 } 322 }
316
317 } 323 }
318 324
319 325
320
321
322 if (Common.IL_CreateFunctionList) 326 if (Common.IL_CreateFunctionList)
323 IL_INSERT_FUNCTIONLIST(); 327 IL_INSERT_FUNCTIONLIST();
324
325 } 328 }
326 329
327 internal LSO_Struct.HeapBlock GetHeap(UInt32 pos) 330 internal LSO_Struct.HeapBlock GetHeap(UInt32 pos)
@@ -342,11 +345,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
342 345
343 346
344 Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize); 347 Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
345 Common.SendToDebug("Heap Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myHeapBlock.ObjectType).ToString()); 348 Common.SendToDebug("Heap Block ObjectType: " +
349 ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString());
346 Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount); 350 Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
347 351
348 return myHeapBlock; 352 return myHeapBlock;
349 } 353 }
354
350 private byte[] br_read(int len) 355 private byte[] br_read(int len)
351 { 356 {
352 if (len <= 0) 357 if (len <= 0)
@@ -365,6 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
365 throw (e); 370 throw (e);
366 } 371 }
367 } 372 }
373
368 //private byte[] br_read_smallendian(int len) 374 //private byte[] br_read_smallendian(int len)
369 //{ 375 //{
370 // byte[] bytes = new byte[len]; 376 // byte[] bytes = new byte[len];
@@ -373,29 +379,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
373 //} 379 //}
374 private Type getLLObjectType(byte objectCode) 380 private Type getLLObjectType(byte objectCode)
375 { 381 {
376 switch ((LSO_Enums.Variable_Type_Codes)objectCode) 382 switch ((LSO_Enums.Variable_Type_Codes) objectCode)
377 { 383 {
378 case LSO_Enums.Variable_Type_Codes.Void: return typeof(void); 384 case LSO_Enums.Variable_Type_Codes.Void:
379 case LSO_Enums.Variable_Type_Codes.Integer: return typeof(UInt32); 385 return typeof (void);
380 case LSO_Enums.Variable_Type_Codes.Float: return typeof(float); 386 case LSO_Enums.Variable_Type_Codes.Integer:
381 case LSO_Enums.Variable_Type_Codes.String: return typeof(string); 387 return typeof (UInt32);
382 case LSO_Enums.Variable_Type_Codes.Key: return typeof(string); 388 case LSO_Enums.Variable_Type_Codes.Float:
383 case LSO_Enums.Variable_Type_Codes.Vector: return typeof(LSO_Enums.Vector); 389 return typeof (float);
384 case LSO_Enums.Variable_Type_Codes.Rotation: return typeof(LSO_Enums.Rotation); 390 case LSO_Enums.Variable_Type_Codes.String:
391 return typeof (string);
392 case LSO_Enums.Variable_Type_Codes.Key:
393 return typeof (string);
394 case LSO_Enums.Variable_Type_Codes.Vector:
395 return typeof (LSO_Enums.Vector);
396 case LSO_Enums.Variable_Type_Codes.Rotation:
397 return typeof (LSO_Enums.Rotation);
385 case LSO_Enums.Variable_Type_Codes.List: 398 case LSO_Enums.Variable_Type_Codes.List:
386 Common.SendToDebug("TODO: List datatype not implemented yet!"); 399 Common.SendToDebug("TODO: List datatype not implemented yet!");
387 return typeof(System.Collections.ArrayList); 400 return typeof (ArrayList);
388 case LSO_Enums.Variable_Type_Codes.Null: 401 case LSO_Enums.Variable_Type_Codes.Null:
389 Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!"); 402 Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!");
390 return typeof(string); 403 return typeof (string);
391 default: 404 default:
392 Common.SendToDebug("Lookup of LSL datatype " + objectCode + " to .Net datatype failed: Unknown LSL datatype. Defaulting to object."); 405 Common.SendToDebug("Lookup of LSL datatype " + objectCode +
393 return typeof(object); 406 " to .Net datatype failed: Unknown LSL datatype. Defaulting to object.");
407 return typeof (object);
394 } 408 }
395 } 409 }
410
396 private int getObjectSize(byte ObjectType) 411 private int getObjectSize(byte ObjectType)
397 { 412 {
398 switch ((LSO_Enums.Variable_Type_Codes)ObjectType) 413 switch ((LSO_Enums.Variable_Type_Codes) ObjectType)
399 { 414 {
400 case LSO_Enums.Variable_Type_Codes.Integer: 415 case LSO_Enums.Variable_Type_Codes.Integer:
401 case LSO_Enums.Variable_Type_Codes.Float: 416 case LSO_Enums.Variable_Type_Codes.Float:
@@ -411,13 +426,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
411 return 0; 426 return 0;
412 } 427 }
413 } 428 }
429
414 private string Read_String() 430 private string Read_String()
415 { 431 {
416 string ret = ""; 432 string ret = "";
417 byte reader = br_read(1)[0]; 433 byte reader = br_read(1)[0];
418 while (reader != 0x000) 434 while (reader != 0x000)
419 { 435 {
420 ret += (char)reader; 436 ret += (char) reader;
421 reader = br_read(1)[0]; 437 reader = br_read(1)[0];
422 } 438 }
423 return ret; 439 return ret;
@@ -431,7 +447,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
431 /// <param name="eventname">Name of event (function) to generate</param> 447 /// <param name="eventname">Name of event (function) to generate</param>
432 private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname) 448 private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname)
433 { 449 {
434
435 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk(); 450 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
436 451
437 Common.SendToDebug("Reading Function Code Chunk at: " + pos); 452 Common.SendToDebug("Reading Function Code Chunk at: " + pos);
@@ -442,12 +457,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
442 myCodeChunk.Comment = Read_String(); 457 myCodeChunk.Comment = Read_String();
443 Common.SendToDebug("Function comment: " + myCodeChunk.Comment); 458 Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
444 myCodeChunk.ReturnTypePos = br_read(1)[0]; 459 myCodeChunk.ReturnTypePos = br_read(1)[0];
445 myCodeChunk.ReturnType = GetStaticBlock((long)myCodeChunk.ReturnTypePos + (long)myHeader.GVR); 460 myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR);
446 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " + ((LSO_Enums.Variable_Type_Codes)myCodeChunk.ReturnType.ObjectType).ToString()); 461 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " +
462 ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString());
447 463
448 464
449 // TODO: How to determine number of codechunks -- does this method work? 465 // TODO: How to determine number of codechunks -- does this method work?
450 myCodeChunk.CodeChunkArguments = new System.Collections.Generic.List<LSO_Struct.CodeChunkArgument>(); 466 myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>();
451 byte reader = br_read(1)[0]; 467 byte reader = br_read(1)[0];
452 reader = br_read(1)[0]; 468 reader = br_read(1)[0];
453 469
@@ -464,14 +480,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
464 CCA.NullString = reader; 480 CCA.NullString = reader;
465 CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR); 481 CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR);
466 myCodeChunk.CodeChunkArguments.Add(CCA); 482 myCodeChunk.CodeChunkArguments.Add(CCA);
467 Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType + ": " + (LSO_Enums.Variable_Type_Codes)CCA.FunctionReturnType.ObjectType); 483 Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType +
484 ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType);
468 } 485 }
469 // Create string array 486 // Create string array
470 Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count]; 487 Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count];
471 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++) 488 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++)
472 { 489 {
473 MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType); 490 MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType);
474 Common.SendToDebug("Method argument " + _ic + ": " + getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).ToString()); 491 Common.SendToDebug("Method argument " + _ic + ": " +
492 getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).
493 ToString());
475 } 494 }
476 // End marker is 0x000 495 // End marker is 0x000
477 myCodeChunk.EndMarker = reader; 496 myCodeChunk.EndMarker = reader;
@@ -483,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
483 502
484 Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod..."); 503 Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
485 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 504 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
486 MethodAttributes.Public, 505 MethodAttributes.Public,
487 typeof(void), 506 typeof (void),
488 new Type[] { typeof(object) }); 507 new Type[] {typeof (object)});
489 //MethodArgs); 508 //MethodArgs);
490 //typeof(void), //getLLObjectType(myCodeChunk.ReturnType), 509 //typeof(void), //getLLObjectType(myCodeChunk.ReturnType),
491 // new Type[] { typeof(object) }, //); 510 // new Type[] { typeof(object) }, //);
@@ -504,7 +523,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
504 IL_INSERT_TRY(il, eventname); 523 IL_INSERT_TRY(il, eventname);
505 524
506 525
507
508 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!"); 526 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
509 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 527 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
510 //il.Emit(OpCodes.Call, typeof(Console).GetMethod 528 //il.Emit(OpCodes.Call, typeof(Console).GetMethod
@@ -520,7 +538,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
520 } 538 }
521 539
522 540
523
524 // 541 //
525 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL 542 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL
526 // 543 //
@@ -538,12 +555,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
538 il.Emit(OpCodes.Ret); 555 il.Emit(OpCodes.Ret);
539 556
540 return; 557 return;
541
542 } 558 }
543 559
544 private void IL_INSERT_FUNCTIONLIST() 560 private void IL_INSERT_FUNCTIONLIST()
545 { 561 {
546
547 Common.SendToDebug("Creating function list"); 562 Common.SendToDebug("Creating function list");
548 563
549 564
@@ -557,11 +572,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
557 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private); 572 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private);
558 573
559 574
560
561 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname, 575 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
562 MethodAttributes.Public, 576 MethodAttributes.Public,
563 typeof(string[]), 577 typeof (string[]),
564 null); 578 null);
565 579
566 //typeBuilder.DefineMethodOverride(methodBuilder, 580 //typeBuilder.DefineMethodOverride(methodBuilder,
567 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname)); 581 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
@@ -569,8 +583,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
569 ILGenerator il = methodBuilder.GetILGenerator(); 583 ILGenerator il = methodBuilder.GetILGenerator();
570 584
571 585
572
573
574 // IL_INSERT_TRY(il, eventname); 586 // IL_INSERT_TRY(il, eventname);
575 587
576 // // Push string to stack 588 // // Push string to stack
@@ -586,37 +598,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
586 598
587 ////il.Emit(OpCodes.Ldarg_0); 599 ////il.Emit(OpCodes.Ldarg_0);
588 600
589 il.DeclareLocal(typeof(string[])); 601 il.DeclareLocal(typeof (string[]));
590 602
591 ////il.Emit(OpCodes.Ldarg_0); 603 ////il.Emit(OpCodes.Ldarg_0);
592 il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length 604 il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length
593 il.Emit(OpCodes.Newarr, typeof(String)); // create new string array 605 il.Emit(OpCodes.Newarr, typeof (String)); // create new string array
594 il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack 606 il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack
595 ////SetFunctionList 607 ////SetFunctionList
596 608
597 for (int lv = 0; lv < EventList.Count; lv++) 609 for (int lv = 0; lv < EventList.Count; lv++)
598 { 610 {
599 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack 611 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
600 il.Emit(OpCodes.Ldc_I4, lv); // Push index position 612 il.Emit(OpCodes.Ldc_I4, lv); // Push index position
601 il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value 613 il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
602 il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value 614 il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
603 615
604 //il.Emit(OpCodes.Ldarg_0); 616 //il.Emit(OpCodes.Ldarg_0);
605 //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value 617 //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
606 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) })); 618 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) }));
607
608 } 619 }
609 620
610 621
611
612 // IL_INSERT_END_TRY(il, eventname); 622 // IL_INSERT_END_TRY(il, eventname);
613 623
614 624
615 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack 625 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
616 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) })); 626 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) }));
617 627
618 il.Emit(OpCodes.Ret); // Return 628 il.Emit(OpCodes.Ret); // Return
619
620 } 629 }
621 630
622 631
@@ -631,7 +640,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
631 // Push "Hello World!" string to stack 640 // Push "Hello World!" string to stack
632 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 641 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
633 //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname); 642 //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
634
635 } 643 }
636 644
637 private void IL_INSERT_END_TRY(ILGenerator il, string eventname) 645 private void IL_INSERT_END_TRY(ILGenerator il, string eventname)
@@ -640,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
640 * CATCH 648 * CATCH
641 */ 649 */
642 Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));"); 650 Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
643 il.BeginCatchBlock(typeof(Exception)); 651 il.BeginCatchBlock(typeof (Exception));
644 652
645 // Push "Hello World!" string to stack 653 // Push "Hello World!" string to stack
646 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr..."); 654 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
@@ -648,18 +656,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
648 656
649 //call void [mscorlib]System.Console::WriteLine(string) 657 //call void [mscorlib]System.Console::WriteLine(string)
650 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 658 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
651 il.Emit(OpCodes.Call, typeof(Console).GetMethod 659 il.Emit(OpCodes.Call, typeof (Console).GetMethod
652 ("Write", new Type[] { typeof(string) })); 660 ("Write", new Type[] {typeof (string)}));
653 661
654 //callvirt instance string [mscorlib]System.Exception::get_Message() 662 //callvirt instance string [mscorlib]System.Exception::get_Message()
655 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt..."); 663 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
656 il.Emit(OpCodes.Callvirt, typeof(Exception).GetMethod 664 il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod
657 ("get_Message")); 665 ("get_Message"));
658 666
659 //call void [mscorlib]System.Console::WriteLine(string) 667 //call void [mscorlib]System.Console::WriteLine(string)
660 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call..."); 668 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
661 il.Emit(OpCodes.Call, typeof(Console).GetMethod 669 il.Emit(OpCodes.Call, typeof (Console).GetMethod
662 ("WriteLine", new Type[] { typeof(string) })); 670 ("WriteLine", new Type[] {typeof (string)}));
663 671
664 /* 672 /*
665 * CLR END TRY 673 * CLR END TRY
@@ -673,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
673 long FirstPos = fs.Position; 681 long FirstPos = fs.Position;
674 try 682 try
675 { 683 {
676 UInt32 position = (UInt32)pos; 684 UInt32 position = (UInt32) pos;
677 // STATIC BLOCK 685 // STATIC BLOCK
678 Common.SendToDebug("Reading STATIC BLOCK at: " + position); 686 Common.SendToDebug("Reading STATIC BLOCK at: " + position);
679 fs.Seek(position, SeekOrigin.Begin); 687 fs.Seek(position, SeekOrigin.Begin);
@@ -683,7 +691,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
683 Common.SendToDebug("Found cached STATIC BLOCK"); 691 Common.SendToDebug("Found cached STATIC BLOCK");
684 692
685 693
686
687 return StaticBlocks[pos]; 694 return StaticBlocks[pos];
688 } 695 }
689 696
@@ -699,7 +706,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
699 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock(); 706 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
700 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0); 707 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
701 myStaticBlock.ObjectType = br_read(1)[0]; 708 myStaticBlock.ObjectType = br_read(1)[0];
702 Common.SendToDebug("Static Block ObjectType: " + ((LSO_Enums.Variable_Type_Codes)myStaticBlock.ObjectType).ToString()); 709 Common.SendToDebug("Static Block ObjectType: " +
710 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
703 myStaticBlock.Unknown = br_read(1)[0]; 711 myStaticBlock.Unknown = br_read(1)[0];
704 // Size of datatype varies 712 // Size of datatype varies
705 if (myStaticBlock.ObjectType != 0) 713 if (myStaticBlock.ObjectType != 0)
@@ -715,8 +723,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
715 // Go back to original read pos 723 // Go back to original read pos
716 fs.Seek(FirstPos, SeekOrigin.Begin); 724 fs.Seek(FirstPos, SeekOrigin.Begin);
717 } 725 }
718
719 } 726 }
720
721 } 727 }
722} 728} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
index baeda38..cf64638 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
@@ -28,14 +28,13 @@
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29 29
30using System; 30using System;
31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Text;
33 33
34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO 34namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
35{ 35{
36 static class LSO_Struct 36 internal static class LSO_Struct
37 { 37 {
38
39 public struct Header 38 public struct Header
40 { 39 {
41 public UInt32 TM; 40 public UInt32 TM;
@@ -69,6 +68,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
69 public byte Unknown; 68 public byte Unknown;
70 public byte[] BlockVariable; 69 public byte[] BlockVariable;
71 } 70 }
71
72 /* Not actually a structure 72 /* Not actually a structure
73 public struct StaticBlockVariable 73 public struct StaticBlockVariable
74 { 74 {
@@ -80,6 +80,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
80 public byte[] Rotation_16; 80 public byte[] Rotation_16;
81 public UInt32 Pointer_List_Structure; 81 public UInt32 Pointer_List_Structure;
82 } */ 82 } */
83
83 public struct HeapBlock 84 public struct HeapBlock
84 { 85 {
85 public Int32 DataBlockSize; 86 public Int32 DataBlockSize;
@@ -87,17 +88,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
87 public UInt16 ReferenceCount; 88 public UInt16 ReferenceCount;
88 public byte[] Data; 89 public byte[] Data;
89 } 90 }
91
90 public struct StateFrameBlock 92 public struct StateFrameBlock
91 { 93 {
92 public UInt32 StateCount; 94 public UInt32 StateCount;
93 public StatePointerBlock[] StatePointer; 95 public StatePointerBlock[] StatePointer;
94 } 96 }
97
95 public struct StatePointerBlock 98 public struct StatePointerBlock
96 { 99 {
97 public UInt32 Location; 100 public UInt32 Location;
98 public System.Collections.BitArray EventMask; 101 public BitArray EventMask;
99 public StateBlock StateBlock; 102 public StateBlock StateBlock;
100 } 103 }
104
101 public struct StateBlock 105 public struct StateBlock
102 { 106 {
103 public UInt32 StartPos; 107 public UInt32 StartPos;
@@ -106,25 +110,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
106 public byte Unknown; 110 public byte Unknown;
107 public StateBlockHandler[] StateBlockHandlers; 111 public StateBlockHandler[] StateBlockHandlers;
108 } 112 }
113
109 public struct StateBlockHandler 114 public struct StateBlockHandler
110 { 115 {
111 public UInt32 CodeChunkPointer; 116 public UInt32 CodeChunkPointer;
112 public UInt32 CallFrameSize; 117 public UInt32 CallFrameSize;
113 } 118 }
119
114 public struct FunctionBlock 120 public struct FunctionBlock
115 { 121 {
116 public UInt32 FunctionCount; 122 public UInt32 FunctionCount;
117 public UInt32[] CodeChunkPointer; 123 public UInt32[] CodeChunkPointer;
118 } 124 }
125
119 public struct CodeChunk 126 public struct CodeChunk
120 { 127 {
121 public UInt32 CodeChunkHeaderSize; 128 public UInt32 CodeChunkHeaderSize;
122 public string Comment; 129 public string Comment;
123 public System.Collections.Generic.List<CodeChunkArgument> CodeChunkArguments; 130 public List<CodeChunkArgument> CodeChunkArguments;
124 public byte EndMarker; 131 public byte EndMarker;
125 public byte ReturnTypePos; 132 public byte ReturnTypePos;
126 public StaticBlock ReturnType; 133 public StaticBlock ReturnType;
127 } 134 }
135
128 public struct CodeChunkArgument 136 public struct CodeChunkArgument
129 { 137 {
130 public byte FunctionReturnTypePos; 138 public byte FunctionReturnTypePos;
@@ -132,4 +140,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO
132 public StaticBlock FunctionReturnType; 140 public StaticBlock FunctionReturnType;
133 } 141 }
134 } 142 }
135} 143} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index b94cf90..737dee6 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -26,19 +26,18 @@
26* 26*
27*/ 27*/
28 28
29using Axiom.Math;
30using System; 29using System;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Threading;
34using Axiom.Math;
33using libsecondlife; 35using libsecondlife;
34using OpenSim.Region.Environment.Scenes; 36using OpenSim.Framework;
35using OpenSim.Region.Environment.Scenes.Scripting;
36using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 38using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.ScriptEngine.Common; 39using OpenSim.Region.ScriptEngine.Common;
39using OpenSim.Framework.Console; 40using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
40using OpenSim.Framework;
41using System.Runtime.Remoting.Lifetime;
42 41
43namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler 42namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
44{ 43{
@@ -53,8 +52,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
53 /// </summary> 52 /// </summary>
54 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface 53 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
55 { 54 {
56 55 private ASCIIEncoding enc = new ASCIIEncoding();
57 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
58 private ScriptEngine m_ScriptEngine; 56 private ScriptEngine m_ScriptEngine;
59 private SceneObjectPart m_host; 57 private SceneObjectPart m_host;
60 private uint m_localID; 58 private uint m_localID;
@@ -86,7 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
86 { 84 {
87 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); 85 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
88 // return null; 86 // return null;
89 ILease lease = (ILease)base.InitializeLifetimeService(); 87 ILease lease = (ILease) base.InitializeLifetimeService();
90 88
91 if (lease.CurrentState == LeaseState.Initial) 89 if (lease.CurrentState == LeaseState.Initial)
92 { 90 {
@@ -105,79 +103,130 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
105 103
106 //These are the implementations of the various ll-functions used by the LSL scripts. 104 //These are the implementations of the various ll-functions used by the LSL scripts.
107 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 105 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
108 public double llSin(double f) { return (double)Math.Sin(f); } 106 public double llSin(double f)
109 public double llCos(double f) { return (double)Math.Cos(f); } 107 {
110 public double llTan(double f) { return (double)Math.Tan(f); } 108 return (double) Math.Sin(f);
111 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } 109 }
112 public double llSqrt(double f) { return (double)Math.Sqrt(f); } 110
113 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } 111 public double llCos(double f)
114 public int llAbs(int i) { return (int)Math.Abs(i); } 112 {
115 public double llFabs(double f) { return (double)Math.Abs(f); } 113 return (double) Math.Cos(f);
114 }
115
116 public double llTan(double f)
117 {
118 return (double) Math.Tan(f);
119 }
120
121 public double llAtan2(double x, double y)
122 {
123 return (double) Math.Atan2(y, x);
124 }
125
126 public double llSqrt(double f)
127 {
128 return (double) Math.Sqrt(f);
129 }
130
131 public double llPow(double fbase, double fexponent)
132 {
133 return (double) Math.Pow(fbase, fexponent);
134 }
135
136 public int llAbs(int i)
137 {
138 return (int) Math.Abs(i);
139 }
140
141 public double llFabs(double f)
142 {
143 return (double) Math.Abs(f);
144 }
116 145
117 public double llFrand(double mag) 146 public double llFrand(double mag)
118 { 147 {
119 lock (Util.RandomClass) 148 lock (Util.RandomClass)
120 { 149 {
121 return Util.RandomClass.Next((int)mag); 150 return Util.RandomClass.Next((int) mag);
122 } 151 }
123 } 152 }
124 153
125 public int llFloor(double f) { return (int)Math.Floor(f); } 154 public int llFloor(double f)
126 public int llCeil(double f) { return (int)Math.Ceiling(f); } 155 {
127 public int llRound(double f) { return (int)Math.Round(f, 3); } 156 return (int) Math.Floor(f);
157 }
158
159 public int llCeil(double f)
160 {
161 return (int) Math.Ceiling(f);
162 }
163
164 public int llRound(double f)
165 {
166 return (int) Math.Round(f, 3);
167 }
128 168
129 //This next group are vector operations involving squaring and square root. ckrinke 169 //This next group are vector operations involving squaring and square root. ckrinke
130 public double llVecMag(LSL_Types.Vector3 v) 170 public double llVecMag(LSL_Types.Vector3 v)
131 { 171 {
132 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); 172 return (v.X*v.X + v.Y*v.Y + v.Z*v.Z);
133 } 173 }
134 174
135 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 175 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
136 { 176 {
137 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; 177 double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z;
138 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 178 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
139 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; 179 nor.X = v.X/mag;
180 nor.Y = v.Y/mag;
181 nor.Z = v.Z/mag;
140 return nor; 182 return nor;
141 } 183 }
142 184
143 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 185 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
144 { 186 {
145 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; 187 double dx = a.X - b.X;
146 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 188 double dy = a.Y - b.Y;
189 double dz = a.Z - b.Z;
190 return Math.Sqrt(dx*dx + dy*dy + dz*dz);
147 } 191 }
148 192
149 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke 193 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
150 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 194 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
151 { 195 {
152 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke 196 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
153 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); 197 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R);
154 double m = (t.X + t.Y + t.Z + t.R); 198 double m = (t.X + t.Y + t.Z + t.R);
155 if (m == 0) return new LSL_Types.Vector3(); 199 if (m == 0) return new LSL_Types.Vector3();
156 double n = 2 * (r.Y * r.R + r.X * r.Z); 200 double n = 2*(r.Y*r.R + r.X*r.Z);
157 double p = m * m - n * n; 201 double p = m*m - n*n;
158 if (p > 0) 202 if (p > 0)
159 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), 203 return new LSL_Types.Vector3(Math.Atan2(2.0*(r.X*r.R - r.Y*r.Z), (-t.X - t.Y + t.Z + t.R)),
160 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); 204 Math.Atan2(n, Math.Sqrt(p)),
205 Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R)));
161 else if (n > 0) 206 else if (n > 0)
162 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 207 return new LSL_Types.Vector3(0.0, Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
163 else 208 else
164 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 209 return new LSL_Types.Vector3(0.0, -Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
165 } 210 }
166 211
167 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 212 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
168 { 213 {
169 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 214 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
170 float err = 0.00001f; 215 float err = 0.00001f;
171 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); 216 double ax = Math.Sin(v.X/2);
172 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); 217 double aw = Math.Cos(v.X/2);
173 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); 218 double by = Math.Sin(v.Y/2);
219 double bw = Math.Cos(v.Y/2);
220 double cz = Math.Sin(v.Z/2);
221 double cw = Math.Cos(v.Z/2);
174 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); 222 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw);
175 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); 223 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
176 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); 224 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
177 LSL_Types.Quaternion a = new LSL_Types.Quaternion(); 225 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
178 //This multiplication doesnt compile, yet. a = a1 * a2 * a3; 226 //This multiplication doesnt compile, yet. a = a1 * a2 * a3;
179 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, 227 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
180 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); 228 aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
229 aw*bw*cw - ax*by*cz);
181 LSL_Types.Quaternion c = new LSL_Types.Quaternion(); 230 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
182 //This addition doesnt compile yet c = a + b; 231 //This addition doesnt compile yet c = a + b;
183 LSL_Types.Quaternion d = new LSL_Types.Quaternion(); 232 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
@@ -194,11 +243,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
194 return new LSL_Types.Quaternion(); 243 return new LSL_Types.Quaternion();
195 } 244 }
196 245
197 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } 246 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
198 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 247 {
199 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 248 return new LSL_Types.Quaternion();
200 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 249 }
201 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } 250
251 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
252 {
253 return new LSL_Types.Vector3();
254 }
255
256 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r)
257 {
258 return new LSL_Types.Vector3();
259 }
260
261 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r)
262 {
263 return new LSL_Types.Vector3();
264 }
265
266 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end)
267 {
268 return new LSL_Types.Quaternion();
269 }
202 270
203 public void llWhisper(int channelID, string text) 271 public void llWhisper(int channelID, string text)
204 { 272 {
@@ -214,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
214 { 282 {
215 //type for say is 1 283 //type for say is 1
216 World.SimChat(Helpers.StringToField(text), 284 World.SimChat(Helpers.StringToField(text),
217 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 285 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
218 286
219 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 287 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
220 wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text); 288 wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text);
@@ -230,82 +298,217 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
230 wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text); 298 wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text);
231 } 299 }
232 300
233 public int llListen(int channelID, string name, string ID, string msg) { 301 public int llListen(int channelID, string name, string ID, string msg)
234 302 {
235 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 303 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
236 return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg); 304 return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, ID, msg);
237
238 } 305 }
239 306
240 public void llListenControl(int number, int active) { 307 public void llListenControl(int number, int active)
241 308 {
242 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 309 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
243 wComm.ListenControl(number, active); 310 wComm.ListenControl(number, active);
244
245 } 311 }
246 312
247 public void llListenRemove(int number) { 313 public void llListenRemove(int number)
248 314 {
249 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 315 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
250 wComm.ListenRemove(number); 316 wComm.ListenRemove(number);
251 317 }
252 } 318
253 319 public void llSensor(string name, string id, int type, double range, double arc)
254 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 320 {
255 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 321 NotImplemented("llSensor");
256 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 322 return;
257 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } 323 }
258 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } 324
259 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } 325 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
260 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } 326 {
261 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } 327 NotImplemented("llSensorRepeat");
262 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } 328 return;
263 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } 329 }
264 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } 330
265 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } 331 public void llSensorRemove()
266 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } 332 {
267 public void llDie() { NotImplemented("llDie"); return; } 333 NotImplemented("llSensorRemove");
268 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } 334 return;
269 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } 335 }
270 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } 336
271 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } 337 public string llDetectedName(int number)
272 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } 338 {
339 NotImplemented("llDetectedName");
340 return "";
341 }
342
343 public string llDetectedKey(int number)
344 {
345 NotImplemented("llDetectedKey");
346 return "";
347 }
348
349 public string llDetectedOwner(int number)
350 {
351 NotImplemented("llDetectedOwner");
352 return "";
353 }
354
355 public int llDetectedType(int number)
356 {
357 NotImplemented("llDetectedType");
358 return 0;
359 }
360
361 public LSL_Types.Vector3 llDetectedPos(int number)
362 {
363 NotImplemented("llDetectedPos");
364 return new LSL_Types.Vector3();
365 }
366
367 public LSL_Types.Vector3 llDetectedVel(int number)
368 {
369 NotImplemented("llDetectedVel");
370 return new LSL_Types.Vector3();
371 }
372
373 public LSL_Types.Vector3 llDetectedGrab(int number)
374 {
375 NotImplemented("llDetectedGrab");
376 return new LSL_Types.Vector3();
377 }
378
379 public LSL_Types.Quaternion llDetectedRot(int number)
380 {
381 NotImplemented("llDetectedRot");
382 return new LSL_Types.Quaternion();
383 }
384
385 public int llDetectedGroup(int number)
386 {
387 NotImplemented("llDetectedGroup");
388 return 0;
389 }
390
391 public int llDetectedLinkNumber(int number)
392 {
393 NotImplemented("llDetectedLinkNumber");
394 return 0;
395 }
396
397 public void llDie()
398 {
399 NotImplemented("llDie");
400 return;
401 }
402
403 public double llGround(LSL_Types.Vector3 offset)
404 {
405 NotImplemented("llGround");
406 return 0;
407 }
408
409 public double llCloud(LSL_Types.Vector3 offset)
410 {
411 NotImplemented("llCloud");
412 return 0;
413 }
414
415 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset)
416 {
417 NotImplemented("llWind");
418 return new LSL_Types.Vector3();
419 }
420
421 public void llSetStatus(int status, int value)
422 {
423 NotImplemented("llSetStatus");
424 return;
425 }
426
427 public int llGetStatus(int status)
428 {
429 NotImplemented("llGetStatus");
430 return 0;
431 }
273 432
274 public void llSetScale(LSL_Types.Vector3 scale) 433 public void llSetScale(LSL_Types.Vector3 scale)
275 { 434 {
276 // TODO: this needs to trigger a persistance save as well 435 // TODO: this needs to trigger a persistance save as well
277 LLVector3 tmp = m_host.Scale; 436 LLVector3 tmp = m_host.Scale;
278 tmp.X = (float)scale.X; 437 tmp.X = (float) scale.X;
279 tmp.Y = (float)scale.Y; 438 tmp.Y = (float) scale.Y;
280 tmp.Z = (float)scale.Z; 439 tmp.Z = (float) scale.Z;
281 m_host.Scale = tmp; 440 m_host.Scale = tmp;
282 return; 441 return;
283 } 442 }
443
284 public LSL_Types.Vector3 llGetScale() 444 public LSL_Types.Vector3 llGetScale()
285 { 445 {
286 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 446 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
287 } 447 }
288 448
289 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } 449 public void llSetColor(LSL_Types.Vector3 color, int face)
290 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } 450 {
291 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } 451 NotImplemented("llSetColor");
292 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } 452 return;
293 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } 453 }
294 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } 454
295 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } 455 public double llGetAlpha(int face)
296 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } 456 {
457 NotImplemented("llGetAlpha");
458 return 0;
459 }
460
461 public void llSetAlpha(double alpha, int face)
462 {
463 NotImplemented("llSetAlpha");
464 return;
465 }
466
467 public LSL_Types.Vector3 llGetColor(int face)
468 {
469 NotImplemented("llGetColor");
470 return new LSL_Types.Vector3();
471 }
472
473 public void llSetTexture(string texture, int face)
474 {
475 NotImplemented("llSetTexture");
476 return;
477 }
478
479 public void llScaleTexture(double u, double v, int face)
480 {
481 NotImplemented("llScaleTexture");
482 return;
483 }
484
485 public void llOffsetTexture(double u, double v, int face)
486 {
487 NotImplemented("llOffsetTexture");
488 return;
489 }
297 490
298 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } 491 public void llRotateTexture(double rotation, int face)
492 {
493 NotImplemented("llRotateTexture");
494 return;
495 }
496
497 public string llGetTexture(int face)
498 {
499 NotImplemented("llGetTexture");
500 return "";
501 }
299 502
300 public void llSetPos(LSL_Types.Vector3 pos) 503 public void llSetPos(LSL_Types.Vector3 pos)
301 { 504 {
302 if (m_host.ParentID != 0) 505 if (m_host.ParentID != 0)
303 { 506 {
304 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 507 m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
305 } 508 }
306 else 509 else
307 { 510 {
308 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 511 m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
309 } 512 }
310 } 513 }
311 514
@@ -331,51 +534,183 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
331 m_host.AbsolutePosition.Z); 534 m_host.AbsolutePosition.Z);
332 } 535 }
333 } 536 }
537
334 public void llSetRot(LSL_Types.Quaternion rot) 538 public void llSetRot(LSL_Types.Quaternion rot)
335 { 539 {
336 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); 540 m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R));
337 } 541 }
542
338 public LSL_Types.Quaternion llGetRot() 543 public LSL_Types.Quaternion llGetRot()
339 { 544 {
340 LLQuaternion q = m_host.RotationOffset; 545 LLQuaternion q = m_host.RotationOffset;
341 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 546 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
342 } 547 }
343 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } 548
344 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } 549 public LSL_Types.Quaternion llGetLocalRot()
345 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } 550 {
346 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } 551 NotImplemented("llGetLocalRot");
347 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } 552 return new LSL_Types.Quaternion();
348 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } 553 }
349 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } 554
350 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } 555 public void llSetForce(LSL_Types.Vector3 force, int local)
351 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } 556 {
352 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } 557 NotImplemented("llSetForce");
353 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } 558 }
354 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } 559
355 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } 560 public LSL_Types.Vector3 llGetForce()
356 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } 561 {
357 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } 562 NotImplemented("llGetForce");
358 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } 563 return new LSL_Types.Vector3();
359 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } 564 }
360 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } 565
566 public int llTarget(LSL_Types.Vector3 position, double range)
567 {
568 NotImplemented("llTarget");
569 return 0;
570 }
571
572 public void llTargetRemove(int number)
573 {
574 NotImplemented("llTargetRemove");
575 }
576
577 public int llRotTarget(LSL_Types.Quaternion rot, double error)
578 {
579 NotImplemented("llRotTarget");
580 return 0;
581 }
582
583 public void llRotTargetRemove(int number)
584 {
585 NotImplemented("llRotTargetRemove");
586 }
587
588 public void llMoveToTarget(LSL_Types.Vector3 target, double tau)
589 {
590 NotImplemented("llMoveToTarget");
591 }
592
593 public void llStopMoveToTarget()
594 {
595 NotImplemented("llStopMoveToTarget");
596 }
597
598 public void llApplyImpulse(LSL_Types.Vector3 force, int local)
599 {
600 NotImplemented("llApplyImpulse");
601 }
602
603 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local)
604 {
605 NotImplemented("llApplyRotationalImpulse");
606 }
607
608 public void llSetTorque(LSL_Types.Vector3 torque, int local)
609 {
610 NotImplemented("llSetTorque");
611 }
612
613 public LSL_Types.Vector3 llGetTorque()
614 {
615 NotImplemented("llGetTorque");
616 return new LSL_Types.Vector3();
617 }
618
619 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local)
620 {
621 NotImplemented("llSetForceAndTorque");
622 }
623
624 public LSL_Types.Vector3 llGetVel()
625 {
626 NotImplemented("llGetVel");
627 return new LSL_Types.Vector3();
628 }
629
630 public LSL_Types.Vector3 llGetAccel()
631 {
632 NotImplemented("llGetAccel");
633 return new LSL_Types.Vector3();
634 }
635
636 public LSL_Types.Vector3 llGetOmega()
637 {
638 NotImplemented("llGetOmega");
639 return new LSL_Types.Vector3();
640 }
641
642 public double llGetTimeOfDay()
643 {
644 NotImplemented("llGetTimeOfDay");
645 return 0;
646 }
361 647
362 public double llGetWallclock() 648 public double llGetWallclock()
363 { 649 {
364 return DateTime.Now.TimeOfDay.TotalSeconds; 650 return DateTime.Now.TimeOfDay.TotalSeconds;
365 } 651 }
366 652
367 public double llGetTime() { NotImplemented("llGetTime"); return 0; } 653 public double llGetTime()
368 public void llResetTime() { NotImplemented("llResetTime"); } 654 {
369 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } 655 NotImplemented("llGetTime");
370 public void llSound() { NotImplemented("llSound"); } 656 return 0;
371 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } 657 }
372 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } 658
373 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } 659 public void llResetTime()
374 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } 660 {
375 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } 661 NotImplemented("llResetTime");
376 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } 662 }
377 public void llStopSound() { NotImplemented("llStopSound"); } 663
378 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } 664 public double llGetAndResetTime()
665 {
666 NotImplemented("llGetAndResetTime");
667 return 0;
668 }
669
670 public void llSound()
671 {
672 NotImplemented("llSound");
673 }
674
675 public void llPlaySound(string sound, double volume)
676 {
677 NotImplemented("llPlaySound");
678 }
679
680 public void llLoopSound(string sound, double volume)
681 {
682 NotImplemented("llLoopSound");
683 }
684
685 public void llLoopSoundMaster(string sound, double volume)
686 {
687 NotImplemented("llLoopSoundMaster");
688 }
689
690 public void llLoopSoundSlave(string sound, double volume)
691 {
692 NotImplemented("llLoopSoundSlave");
693 }
694
695 public void llPlaySoundSlave(string sound, double volume)
696 {
697 NotImplemented("llPlaySoundSlave");
698 }
699
700 public void llTriggerSound(string sound, double volume)
701 {
702 NotImplemented("llTriggerSound");
703 }
704
705 public void llStopSound()
706 {
707 NotImplemented("llStopSound");
708 }
709
710 public void llPreloadSound(string sound)
711 {
712 NotImplemented("llPreloadSound");
713 }
379 714
380 public string llGetSubString(string src, int start, int end) 715 public string llGetSubString(string src, int start, int end)
381 { 716 {
@@ -386,10 +721,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
386 { 721 {
387 return src.Remove(start, end - start); 722 return src.Remove(start, end - start);
388 } 723 }
724
389 public string llInsertString(string dst, int position, string src) 725 public string llInsertString(string dst, int position, string src)
390 { 726 {
391 return dst.Insert(position, src); 727 return dst.Insert(position, src);
392 } 728 }
729
393 public string llToUpper(string src) 730 public string llToUpper(string src)
394 { 731 {
395 return src.ToUpper(); 732 return src.ToUpper();
@@ -400,14 +737,46 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
400 return src.ToLower(); 737 return src.ToLower();
401 } 738 }
402 739
403 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } 740 public int llGiveMoney(string destination, int amount)
404 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } 741 {
405 public void llMakeFountain() { NotImplemented("llMakeFountain"); } 742 NotImplemented("llGiveMoney");
406 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } 743 return 0;
407 public void llMakeFire() { NotImplemented("llMakeFire"); } 744 }
408 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } 745
409 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } 746 public void llMakeExplosion()
410 public void llStopLookAt() { NotImplemented("llStopLookAt"); } 747 {
748 NotImplemented("llMakeExplosion");
749 }
750
751 public void llMakeFountain()
752 {
753 NotImplemented("llMakeFountain");
754 }
755
756 public void llMakeSmoke()
757 {
758 NotImplemented("llMakeSmoke");
759 }
760
761 public void llMakeFire()
762 {
763 NotImplemented("llMakeFire");
764 }
765
766 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param)
767 {
768 NotImplemented("llRezObject");
769 }
770
771 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping)
772 {
773 NotImplemented("llLookAt");
774 }
775
776 public void llStopLookAt()
777 {
778 NotImplemented("llStopLookAt");
779 }
411 780
412 public void llSetTimerEvent(double sec) 781 public void llSetTimerEvent(double sec)
413 { 782 {
@@ -417,38 +786,104 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
417 786
418 public void llSleep(double sec) 787 public void llSleep(double sec)
419 { 788 {
420 System.Threading.Thread.Sleep((int)(sec * 1000)); 789 Thread.Sleep((int) (sec*1000));
790 }
791
792 public double llGetMass()
793 {
794 NotImplemented("llGetMass");
795 return 0;
796 }
797
798 public void llCollisionFilter(string name, string id, int accept)
799 {
800 NotImplemented("llCollisionFilter");
801 }
802
803 public void llTakeControls(int controls, int accept, int pass_on)
804 {
805 NotImplemented("llTakeControls");
806 }
807
808 public void llReleaseControls()
809 {
810 NotImplemented("llReleaseControls");
811 }
812
813 public void llAttachToAvatar(int attachment)
814 {
815 NotImplemented("llAttachToAvatar");
816 }
817
818 public void llDetachFromAvatar()
819 {
820 NotImplemented("llDetachFromAvatar");
821 }
822
823 public void llTakeCamera()
824 {
825 NotImplemented("llTakeCamera");
421 } 826 }
422 827
423 public double llGetMass() { NotImplemented("llGetMass"); return 0; } 828 public void llReleaseCamera()
424 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } 829 {
425 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } 830 NotImplemented("llReleaseCamera");
426 public void llReleaseControls() { NotImplemented("llReleaseControls"); } 831 }
427 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); }
428 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); }
429 public void llTakeCamera() { NotImplemented("llTakeCamera"); }
430 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); }
431 832
432 public string llGetOwner() 833 public string llGetOwner()
433 { 834 {
434 return m_host.ObjectOwner.ToStringHyphenated(); 835 return m_host.ObjectOwner.ToStringHyphenated();
435 } 836 }
436 837
437 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } 838 public void llInstantMessage(string user, string message)
438 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } 839 {
439 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } 840 NotImplemented("llInstantMessage");
841 }
842
843 public void llEmail(string address, string subject, string message)
844 {
845 NotImplemented("llEmail");
846 }
847
848 public void llGetNextEmail(string address, string subject)
849 {
850 NotImplemented("llGetNextEmail");
851 }
440 852
441 public string llGetKey() 853 public string llGetKey()
442 { 854 {
443 return m_host.UUID.ToStringHyphenated(); 855 return m_host.UUID.ToStringHyphenated();
444 } 856 }
445 857
446 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } 858 public void llSetBuoyancy(double buoyancy)
447 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } 859 {
448 public void llStopHover() { NotImplemented("llStopHover"); } 860 NotImplemented("llSetBuoyancy");
449 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } 861 }
450 public void llSoundPreload() { NotImplemented("llSoundPreload"); } 862
451 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } 863 public void llSetHoverHeight(double height, int water, double tau)
864 {
865 NotImplemented("llSetHoverHeight");
866 }
867
868 public void llStopHover()
869 {
870 NotImplemented("llStopHover");
871 }
872
873 public void llMinEventDelay(double delay)
874 {
875 NotImplemented("llMinEventDelay");
876 }
877
878 public void llSoundPreload()
879 {
880 NotImplemented("llSoundPreload");
881 }
882
883 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping)
884 {
885 NotImplemented("llRotLookAt");
886 }
452 887
453 public int llStringLength(string str) 888 public int llStringLength(string str)
454 { 889 {
@@ -462,88 +897,289 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
462 } 897 }
463 } 898 }
464 899
465 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } 900 public void llStartAnimation(string anim)
466 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } 901 {
467 public void llPointAt() { NotImplemented("llPointAt"); } 902 NotImplemented("llStartAnimation");
468 public void llStopPointAt() { NotImplemented("llStopPointAt"); } 903 }
469 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } 904
470 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } 905 public void llStopAnimation(string anim)
471 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } 906 {
472 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } 907 NotImplemented("llStopAnimation");
473 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } 908 }
474 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } 909
475 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } 910 public void llPointAt()
476 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } 911 {
477 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } 912 NotImplemented("llPointAt");
478 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } 913 }
479 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } 914
480 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } 915 public void llStopPointAt()
481 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } 916 {
482 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } 917 NotImplemented("llStopPointAt");
483 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } 918 }
484 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } 919
485 public double llGetEnergy() { return 1.0f; } 920 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain)
486 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } 921 {
487 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } 922 NotImplemented("llTargetOmega");
923 }
924
925 public int llGetStartParameter()
926 {
927 NotImplemented("llGetStartParameter");
928 return 0;
929 }
930
931 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos)
932 {
933 NotImplemented("llGodLikeRezObject");
934 }
935
936 public void llRequestPermissions(string agent, int perm)
937 {
938 NotImplemented("llRequestPermissions");
939 }
940
941 public string llGetPermissionsKey()
942 {
943 NotImplemented("llGetPermissionsKey");
944 return "";
945 }
946
947 public int llGetPermissions()
948 {
949 NotImplemented("llGetPermissions");
950 return 0;
951 }
952
953 public int llGetLinkNumber()
954 {
955 NotImplemented("llGetLinkNumber");
956 return 0;
957 }
958
959 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face)
960 {
961 NotImplemented("llSetLinkColor");
962 }
963
964 public void llCreateLink(string target, int parent)
965 {
966 NotImplemented("llCreateLink");
967 }
968
969 public void llBreakLink(int linknum)
970 {
971 NotImplemented("llBreakLink");
972 }
973
974 public void llBreakAllLinks()
975 {
976 NotImplemented("llBreakAllLinks");
977 }
978
979 public string llGetLinkKey(int linknum)
980 {
981 NotImplemented("llGetLinkKey");
982 return "";
983 }
984
985 public void llGetLinkName(int linknum)
986 {
987 NotImplemented("llGetLinkName");
988 }
989
990 public int llGetInventoryNumber(int type)
991 {
992 NotImplemented("llGetInventoryNumber");
993 return 0;
994 }
995
996 public string llGetInventoryName(int type, int number)
997 {
998 NotImplemented("llGetInventoryName");
999 return "";
1000 }
1001
1002 public void llSetScriptState(string name, int run)
1003 {
1004 NotImplemented("llSetScriptState");
1005 }
1006
1007 public double llGetEnergy()
1008 {
1009 return 1.0f;
1010 }
1011
1012 public void llGiveInventory(string destination, string inventory)
1013 {
1014 NotImplemented("llGiveInventory");
1015 }
1016
1017 public void llRemoveInventory(string item)
1018 {
1019 NotImplemented("llRemoveInventory");
1020 }
488 1021
489 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 1022 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
490 { 1023 {
491 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); 1024 Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z);
492 m_host.SetText(text, av3, alpha); 1025 m_host.SetText(text, av3, alpha);
493 } 1026 }
494 1027
495 1028
496 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } 1029 public double llWater(LSL_Types.Vector3 offset)
497 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } 1030 {
498 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } 1031 NotImplemented("llWater");
499 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } 1032 return 0;
500 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } 1033 }
501 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } 1034
502 public void llModifyLand(int action, int brush) { } 1035 public void llPassTouches(int pass)
503 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } 1036 {
504 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } 1037 NotImplemented("llPassTouches");
505 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } 1038 }
506 public void llResetScript() 1039
1040 public string llRequestAgentData(string id, int data)
1041 {
1042 NotImplemented("llRequestAgentData");
1043 return "";
1044 }
1045
1046 public string llRequestInventoryData(string name)
1047 {
1048 NotImplemented("llRequestInventoryData");
1049 return "";
1050 }
1051
1052 public void llSetDamage(double damage)
1053 {
1054 NotImplemented("llSetDamage");
1055 }
1056
1057 public void llTeleportAgentHome(string agent)
1058 {
1059 NotImplemented("llTeleportAgentHome");
1060 }
1061
1062 public void llModifyLand(int action, int brush)
1063 {
1064 }
1065
1066 public void llCollisionSound(string impact_sound, double impact_volume)
1067 {
1068 NotImplemented("llCollisionSound");
1069 }
1070
1071 public void llCollisionSprite(string impact_sprite)
1072 {
1073 NotImplemented("llCollisionSprite");
1074 }
1075
1076 public string llGetAnimation(string id)
1077 {
1078 NotImplemented("llGetAnimation");
1079 return "";
1080 }
1081
1082 public void llResetScript()
507 { 1083 {
508 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 1084 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
509 } 1085 }
510 public void llMessageLinked(int linknum, int num, string str, string id) { }
511 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { }
512 public void llPassCollisions(int pass) { }
513 public string llGetScriptName() { return ""; }
514 1086
515 public int llGetNumberOfSides() { return 0; } 1087 public void llMessageLinked(int linknum, int num, string str, string id)
1088 {
1089 }
1090
1091 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local)
1092 {
1093 }
1094
1095 public void llPassCollisions(int pass)
1096 {
1097 }
1098
1099 public string llGetScriptName()
1100 {
1101 return "";
1102 }
1103
1104 public int llGetNumberOfSides()
1105 {
1106 return 0;
1107 }
1108
1109 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle)
1110 {
1111 return new LSL_Types.Quaternion();
1112 }
1113
1114 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot)
1115 {
1116 return new LSL_Types.Vector3();
1117 }
516 1118
517 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } 1119 public void llRot2Angle()
518 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } 1120 {
519 public void llRot2Angle() { } 1121 }
520 1122
521 public double llAcos(double val) 1123 public double llAcos(double val)
522 { 1124 {
523 return (double)Math.Acos(val); 1125 return (double) Math.Acos(val);
524 } 1126 }
525 1127
526 public double llAsin(double val) 1128 public double llAsin(double val)
527 { 1129 {
528 return (double)Math.Asin(val); 1130 return (double) Math.Asin(val);
529 } 1131 }
530 1132
531 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } 1133 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
532 public string llGetInventoryKey(string name) { return ""; } 1134 {
533 public void llAllowInventoryDrop(int add) { } 1135 return 0;
534 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } 1136 }
535 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 1137
536 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 1138 public string llGetInventoryKey(string name)
537 public double llGetTextureRot(int side) { return 0; } 1139 {
1140 return "";
1141 }
1142
1143 public void llAllowInventoryDrop(int add)
1144 {
1145 }
1146
1147 public LSL_Types.Vector3 llGetSunDirection()
1148 {
1149 return new LSL_Types.Vector3();
1150 }
1151
1152 public LSL_Types.Vector3 llGetTextureOffset(int face)
1153 {
1154 return new LSL_Types.Vector3();
1155 }
1156
1157 public LSL_Types.Vector3 llGetTextureScale(int side)
1158 {
1159 return new LSL_Types.Vector3();
1160 }
1161
1162 public double llGetTextureRot(int side)
1163 {
1164 return 0;
1165 }
538 1166
539 public int llSubStringIndex(string source, string pattern) 1167 public int llSubStringIndex(string source, string pattern)
540 { 1168 {
541 return source.IndexOf(pattern); 1169 return source.IndexOf(pattern);
542 } 1170 }
543 1171
544 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } 1172 public string llGetOwnerKey(string id)
1173 {
1174 NotImplemented("llGetOwnerKey");
1175 return "";
1176 }
545 1177
546 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } 1178 public LSL_Types.Vector3 llGetCenterOfMass()
1179 {
1180 NotImplemented("llGetCenterOfMass");
1181 return new LSL_Types.Vector3();
1182 }
547 1183
548 public List<string> llListSort(List<string> src, int stride, int ascending) 1184 public List<string> llListSort(List<string> src, int stride, int ascending)
549 { 1185 {
@@ -577,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
577 ret.AddRange(ls); 1213 ret.AddRange(ls);
578 } 1214 }
579 1215
580 if (ascending == LSL.LSL_BaseClass.TRUE) 1216 if (ascending == LSL_BaseClass.TRUE)
581 return ret; 1217 return ret;
582 ret.Reverse(); 1218 ret.Reverse();
583 return ret; 1219 return ret;
@@ -616,12 +1252,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
616 1252
617 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 1253 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
618 { 1254 {
619 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); 1255 return
1256 new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]),
1257 double.Parse(src[index + 2]));
620 } 1258 }
1259
621 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 1260 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
622 { 1261 {
623 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); 1262 return
1263 new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]),
1264 double.Parse(src[index + 2]), double.Parse(src[index + 3]));
624 } 1265 }
1266
625 public List<string> llList2List(List<string> src, int start, int end) 1267 public List<string> llList2List(List<string> src, int start, int end)
626 { 1268 {
627 if (end > start) 1269 if (end > start)
@@ -638,18 +1280,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
638 ret.AddRange(src.GetRange(0, end)); 1280 ret.AddRange(src.GetRange(0, end));
639 return ret; 1281 return ret;
640 } 1282 }
641
642
643
644
645 } 1283 }
1284
646 public List<string> llDeleteSubList(List<string> src, int start, int end) 1285 public List<string> llDeleteSubList(List<string> src, int start, int end)
647 { 1286 {
648 List<string> ret = new List<string>(src); 1287 List<string> ret = new List<string>(src);
649 ret.RemoveRange(start, end - start); 1288 ret.RemoveRange(start, end - start);
650 return ret; 1289 return ret;
651 } 1290 }
652 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 1291
1292 public int llGetListEntryType(List<string> src, int index)
1293 {
1294 NotImplemented("llGetListEntryType");
1295 return 0;
1296 }
1297
653 public string llList2CSV(List<string> src) 1298 public string llList2CSV(List<string> src)
654 { 1299 {
655 string ret = ""; 1300 string ret = "";
@@ -661,6 +1306,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
661 } 1306 }
662 return ret; 1307 return ret;
663 } 1308 }
1309
664 public List<string> llCSV2List(string src) 1310 public List<string> llCSV2List(string src)
665 { 1311 {
666 List<string> ret = new List<string>(); 1312 List<string> ret = new List<string>();
@@ -670,6 +1316,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
670 } 1316 }
671 return ret; 1317 return ret;
672 } 1318 }
1319
673 public List<string> llListRandomize(List<string> src, int stride) 1320 public List<string> llListRandomize(List<string> src, int stride)
674 { 1321 {
675 int s = stride; 1322 int s = stride;
@@ -711,9 +1358,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
711 } 1358 }
712 1359
713 return ret; 1360 return ret;
714
715
716 } 1361 }
1362
717 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 1363 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
718 { 1364 {
719 List<string> ret = new List<string>(); 1365 List<string> ret = new List<string>();
@@ -739,12 +1385,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
739 1385
740 public LSL_Types.Vector3 llGetRegionCorner() 1386 public LSL_Types.Vector3 llGetRegionCorner()
741 { 1387 {
742 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 1388 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
743 } 1389 }
744 1390
745 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 1391 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
746 { 1392 {
747
748 List<string> ret = new List<string>(dest); 1393 List<string> ret = new List<string>(dest);
749 //foreach (string s in src.Reverse()) 1394 //foreach (string s in src.Reverse())
750 for (int ci = src.Count - 1; ci > -1; ci--) 1395 for (int ci = src.Count - 1; ci > -1; ci--)
@@ -753,13 +1398,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
753 } 1398 }
754 return ret; 1399 return ret;
755 } 1400 }
1401
756 public int llListFindList(List<string> src, List<string> test) 1402 public int llListFindList(List<string> src, List<string> test)
757 { 1403 {
758 foreach (string s in test) 1404 foreach (string s in test)
759 { 1405 {
760 for (int ci = 0; ci < src.Count; ci++) 1406 for (int ci = 0; ci < src.Count; ci++)
761 { 1407 {
762
763 if (s == src[ci]) 1408 if (s == src[ci])
764 return ci; 1409 return ci;
765 } 1410 }
@@ -784,37 +1429,139 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
784 return result; 1429 return result;
785 } 1430 }
786 1431
787 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } 1432 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir)
788 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } 1433 {
789 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } 1434 NotImplemented("llEdgeOfWorld");
790 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } 1435 return 0;
791 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } 1436 }
792 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } 1437
793 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } 1438 public int llGetAgentInfo(string id)
794 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } 1439 {
795 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } 1440 NotImplemented("llGetAgentInfo");
796 1441 return 0;
797 public void llParseString2List() { NotImplemented("llParseString2List"); } 1442 }
798 1443
799 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } 1444 public void llAdjustSoundVolume(double volume)
800 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } 1445 {
801 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } 1446 NotImplemented("llAdjustSoundVolume");
802 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } 1447 }
803 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } 1448
804 public void llUnSit(string id) { NotImplemented("llUnSit"); } 1449 public void llSetSoundQueueing(int queue)
805 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } 1450 {
806 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } 1451 NotImplemented("llSetSoundQueueing");
807 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } 1452 }
808 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } 1453
809 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } 1454 public void llSetSoundRadius(double radius)
1455 {
1456 NotImplemented("llSetSoundRadius");
1457 }
1458
1459 public string llKey2Name(string id)
1460 {
1461 NotImplemented("llKey2Name");
1462 return "";
1463 }
1464
1465 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
1466 {
1467 NotImplemented("llSetTextureAnim");
1468 }
1469
1470 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
1471 LSL_Types.Vector3 bottom_south_west)
1472 {
1473 NotImplemented("llTriggerSoundLimited");
1474 }
1475
1476 public void llEjectFromLand(string pest)
1477 {
1478 NotImplemented("llEjectFromLand");
1479 }
1480
1481 public void llParseString2List()
1482 {
1483 NotImplemented("llParseString2List");
1484 }
1485
1486 public int llOverMyLand(string id)
1487 {
1488 NotImplemented("llOverMyLand");
1489 return 0;
1490 }
1491
1492 public string llGetLandOwnerAt(LSL_Types.Vector3 pos)
1493 {
1494 NotImplemented("llGetLandOwnerAt");
1495 return "";
1496 }
1497
1498 public string llGetNotecardLine(string name, int line)
1499 {
1500 NotImplemented("llGetNotecardLine");
1501 return "";
1502 }
1503
1504 public LSL_Types.Vector3 llGetAgentSize(string id)
1505 {
1506 NotImplemented("llGetAgentSize");
1507 return new LSL_Types.Vector3();
1508 }
1509
1510 public int llSameGroup(string agent)
1511 {
1512 NotImplemented("llSameGroup");
1513 return 0;
1514 }
1515
1516 public void llUnSit(string id)
1517 {
1518 NotImplemented("llUnSit");
1519 }
1520
1521 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset)
1522 {
1523 NotImplemented("llGroundSlope");
1524 return new LSL_Types.Vector3();
1525 }
1526
1527 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset)
1528 {
1529 NotImplemented("llGroundNormal");
1530 return new LSL_Types.Vector3();
1531 }
1532
1533 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset)
1534 {
1535 NotImplemented("llGroundContour");
1536 return new LSL_Types.Vector3();
1537 }
1538
1539 public int llGetAttached()
1540 {
1541 NotImplemented("llGetAttached");
1542 return 0;
1543 }
1544
1545 public int llGetFreeMemory()
1546 {
1547 NotImplemented("llGetFreeMemory");
1548 return 0;
1549 }
810 1550
811 public string llGetRegionName() 1551 public string llGetRegionName()
812 { 1552 {
813 return World.RegionInfo.RegionName; 1553 return World.RegionInfo.RegionName;
814 } 1554 }
815 1555
816 public double llGetRegionTimeDilation() { return 1.0f; } 1556 public double llGetRegionTimeDilation()
817 public double llGetRegionFPS() { return 10.0f; } 1557 {
1558 return 1.0f;
1559 }
1560
1561 public double llGetRegionFPS()
1562 {
1563 return 10.0f;
1564 }
818 1565
819 /* particle system rules should be coming into this routine as doubles, that is 1566 /* particle system rules should be coming into this routine as doubles, that is
820 rule[0] should be an integer from this list and rule[1] should be the arg 1567 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -824,6 +1571,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
824 We iterate through the list for 'Count' elements, incrementing by two for each 1571 We iterate through the list for 'Count' elements, incrementing by two for each
825 iteration and set the members of Primitive.ParticleSystem, one at a time. 1572 iteration and set the members of Primitive.ParticleSystem, one at a time.
826 */ 1573 */
1574
827 public enum PrimitiveRule : int 1575 public enum PrimitiveRule : int
828 { 1576 {
829 PSYS_PART_FLAGS = 0, 1577 PSYS_PART_FLAGS = 0,
@@ -854,109 +1602,152 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
854 Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); 1602 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
855 for (int i = 0; i < rules.Count; i += 2) 1603 for (int i = 0; i < rules.Count; i += 2)
856 { 1604 {
857 switch ((int)rules[i]) 1605 switch ((int) rules[i])
858 { 1606 {
859 case (int)PrimitiveRule.PSYS_PART_FLAGS: 1607 case (int) PrimitiveRule.PSYS_PART_FLAGS:
860 prules.PartFlags = (uint)rules[i + 1]; 1608 prules.PartFlags = (uint) rules[i + 1];
861 break; 1609 break;
862 1610
863 case (int)PrimitiveRule.PSYS_PART_START_COLOR: 1611 case (int) PrimitiveRule.PSYS_PART_START_COLOR:
864 prules.PartStartColor = (LLColor)rules[i + 1]; 1612 prules.PartStartColor = (LLColor) rules[i + 1];
865 break; 1613 break;
866 1614
867 case (int)PrimitiveRule.PSYS_PART_START_ALPHA: 1615 case (int) PrimitiveRule.PSYS_PART_START_ALPHA:
868 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1616 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
869 break; 1617 break;
870 1618
871 case (int)PrimitiveRule.PSYS_PART_END_COLOR: 1619 case (int) PrimitiveRule.PSYS_PART_END_COLOR:
872 prules.PartEndColor = (LLColor)rules[i + 1]; 1620 prules.PartEndColor = (LLColor) rules[i + 1];
873 break; 1621 break;
874 1622
875 case (int)PrimitiveRule.PSYS_PART_END_ALPHA: 1623 case (int) PrimitiveRule.PSYS_PART_END_ALPHA:
876 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1624 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
877 break; 1625 break;
878 1626
879 case (int)PrimitiveRule.PSYS_PART_START_SCALE: 1627 case (int) PrimitiveRule.PSYS_PART_START_SCALE:
880 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1628 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
881 break; 1629 break;
882 1630
883 case (int)PrimitiveRule.PSYS_PART_END_SCALE: 1631 case (int) PrimitiveRule.PSYS_PART_END_SCALE:
884 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1632 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
885 break; 1633 break;
886 1634
887 case (int)PrimitiveRule.PSYS_PART_MAX_AGE: 1635 case (int) PrimitiveRule.PSYS_PART_MAX_AGE:
888 prules.MaxAge = (float)rules[i + 1]; 1636 prules.MaxAge = (float) rules[i + 1];
889 break; 1637 break;
890 1638
891 case (int)PrimitiveRule.PSYS_SRC_ACCEL: 1639 case (int) PrimitiveRule.PSYS_SRC_ACCEL:
892 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1640 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
893 break; 1641 break;
894 1642
895 case (int)PrimitiveRule.PSYS_SRC_PATTERN: 1643 case (int) PrimitiveRule.PSYS_SRC_PATTERN:
896 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; 1644 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
897 break; 1645 break;
898 1646
899 case (int)PrimitiveRule.PSYS_SRC_TEXTURE: 1647 case (int) PrimitiveRule.PSYS_SRC_TEXTURE:
900 prules.Texture = (LLUUID)rules[i + 1]; 1648 prules.Texture = (LLUUID) rules[i + 1];
901 break; 1649 break;
902 1650
903 case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: 1651 case (int) PrimitiveRule.PSYS_SRC_BURST_RATE:
904 prules.BurstRate = (float)rules[i + 1]; 1652 prules.BurstRate = (float) rules[i + 1];
905 break; 1653 break;
906 1654
907 case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: 1655 case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
908 prules.BurstPartCount = (byte)rules[i + 1]; 1656 prules.BurstPartCount = (byte) rules[i + 1];
909 break; 1657 break;
910 1658
911 case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: 1659 case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS:
912 prules.BurstRadius = (float)rules[i + 1]; 1660 prules.BurstRadius = (float) rules[i + 1];
913 break; 1661 break;
914 1662
915 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: 1663 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
916 prules.BurstSpeedMin = (float)rules[i + 1]; 1664 prules.BurstSpeedMin = (float) rules[i + 1];
917 break; 1665 break;
918 1666
919 case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: 1667 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
920 prules.BurstSpeedMax = (float)rules[i + 1]; 1668 prules.BurstSpeedMax = (float) rules[i + 1];
921 break; 1669 break;
922 1670
923 case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: 1671 case (int) PrimitiveRule.PSYS_SRC_MAX_AGE:
924 prules.MaxAge = (float)rules[i + 1]; 1672 prules.MaxAge = (float) rules[i + 1];
925 break; 1673 break;
926 1674
927 case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: 1675 case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY:
928 prules.Target = (LLUUID)rules[i + 1]; 1676 prules.Target = (LLUUID) rules[i + 1];
929 break; 1677 break;
930 1678
931 case (int)PrimitiveRule.PSYS_SRC_OMEGA: 1679 case (int) PrimitiveRule.PSYS_SRC_OMEGA:
932 //cast?? prules.MaxAge = (float)rules[i + 1]; 1680 //cast?? prules.MaxAge = (float)rules[i + 1];
933 break; 1681 break;
934 1682
935 case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: 1683 case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
936 prules.InnerAngle = (float)rules[i + 1]; 1684 prules.InnerAngle = (float) rules[i + 1];
937 break; 1685 break;
938 1686
939 case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: 1687 case (int) PrimitiveRule.PSYS_SRC_ANGLE_END:
940 prules.OuterAngle = (float)rules[i + 1]; 1688 prules.OuterAngle = (float) rules[i + 1];
941 break; 1689 break;
942
943 } 1690 }
944 } 1691 }
945 1692
946 m_host.AddNewParticleSystem(prules); 1693 m_host.AddNewParticleSystem(prules);
947 } 1694 }
948 1695
949 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } 1696 public void llGroundRepel(double height, int water, double tau)
950 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } 1697 {
951 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } 1698 NotImplemented("llGroundRepel");
952 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } 1699 }
953 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } 1700
954 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } 1701 public void llGiveInventoryList()
955 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } 1702 {
956 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } 1703 NotImplemented("llGiveInventoryList");
957 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } 1704 }
958 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } 1705
959 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } 1706 public void llSetVehicleType(int type)
1707 {
1708 NotImplemented("llSetVehicleType");
1709 }
1710
1711 public void llSetVehicledoubleParam(int param, double value)
1712 {
1713 NotImplemented("llSetVehicledoubleParam");
1714 }
1715
1716 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec)
1717 {
1718 NotImplemented("llSetVehicleVectorParam");
1719 }
1720
1721 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot)
1722 {
1723 NotImplemented("llSetVehicleRotationParam");
1724 }
1725
1726 public void llSetVehicleFlags(int flags)
1727 {
1728 NotImplemented("llSetVehicleFlags");
1729 }
1730
1731 public void llRemoveVehicleFlags(int flags)
1732 {
1733 NotImplemented("llRemoveVehicleFlags");
1734 }
1735
1736 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
1737 {
1738 NotImplemented("llSitTarget");
1739 }
1740
1741 public string llAvatarOnSitTarget()
1742 {
1743 NotImplemented("llAvatarOnSitTarget");
1744 return "";
1745 }
1746
1747 public void llAddToLandPassList(string avatar, double hours)
1748 {
1749 NotImplemented("llAddToLandPassList");
1750 }
960 1751
961 public void llSetTouchText(string text) 1752 public void llSetTouchText(string text)
962 { 1753 {
@@ -968,49 +1759,91 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
968 m_host.SitName = text; 1759 m_host.SitName = text;
969 } 1760 }
970 1761
971 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } 1762 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset)
972 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } 1763 {
973 public void llDumpList2String() { NotImplemented("llDumpList2String"); } 1764 NotImplemented("llSetCameraEyeOffset");
974 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } 1765 }
975 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); }
976 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); }
977 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); }
978 1766
979 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } 1767 public void llSetCameraAtOffset(LSL_Types.Vector3 offset)
1768 {
1769 NotImplemented("llSetCameraAtOffset");
1770 }
980 1771
981 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 1772 public void llDumpList2String()
982 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 1773 {
983 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 1774 NotImplemented("llDumpList2String");
1775 }
1776
1777 public void llScriptDanger(LSL_Types.Vector3 pos)
1778 {
1779 NotImplemented("llScriptDanger");
1780 }
1781
1782 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1783 {
1784 NotImplemented("llDialog");
1785 }
1786
1787 public void llVolumeDetect(int detect)
1788 {
1789 NotImplemented("llVolumeDetect");
1790 }
1791
1792 public void llResetOtherScript(string name)
1793 {
1794 NotImplemented("llResetOtherScript");
1795 }
1796
1797 public int llGetScriptState(string name)
1798 {
1799 NotImplemented("llGetScriptState");
1800 return 0;
1801 }
1802
1803 public void llRemoteLoadScript()
1804 {
1805 NotImplemented("llRemoteLoadScript");
1806 }
1807
1808 public void llSetRemoteScriptAccessPin(int pin)
1809 {
1810 NotImplemented("llSetRemoteScriptAccessPin");
1811 }
1812
1813 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1814 {
1815 NotImplemented("llRemoteLoadScriptPin");
1816 }
984 1817
985 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) 1818 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
986 // Not sure where these constants should live: 1819 // Not sure where these constants should live:
987 // REMOTE_DATA_CHANNEL = 1 1820 // REMOTE_DATA_CHANNEL = 1
988 // REMOTE_DATA_REQUEST = 2 1821 // REMOTE_DATA_REQUEST = 2
989 // REMOTE_DATA_REPLY = 3 1822 // REMOTE_DATA_REPLY = 3
990 public void llOpenRemoteDataChannel() { 1823 public void llOpenRemoteDataChannel()
991 1824 {
992 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1825 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
993 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); 1826 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID);
994 object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, "" }; 1827 object[] resobj = new object[] {1, channelID.ToString(), LLUUID.Zero.ToString(), "", 0, ""};
995 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj); 1828 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", resobj);
996
997 } 1829 }
998 1830
999 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 1831 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
1832 {
1833 NotImplemented("llSendRemoteData");
1834 return "";
1835 }
1000 1836
1001 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) 1837 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
1002 { 1838 {
1003
1004 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1839 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
1005 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 1840 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
1006
1007 } 1841 }
1008
1009 public void llCloseRemoteDataChannel(string channel) {
1010 1842
1843 public void llCloseRemoteDataChannel(string channel)
1844 {
1011 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 1845 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
1012 xmlrpcMod.CloseXMLRPCChannel(channel); 1846 xmlrpcMod.CloseXMLRPCChannel(channel);
1013
1014 } 1847 }
1015 1848
1016 public string llMD5String(string src, int nonce) 1849 public string llMD5String(string src, int nonce)
@@ -1018,14 +1851,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1018 return Util.Md5Hash(src + ":" + nonce.ToString()); 1851 return Util.Md5Hash(src + ":" + nonce.ToString());
1019 } 1852 }
1020 1853
1021 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } 1854 public void llSetPrimitiveParams(List<string> rules)
1022 public string llStringToBase64(string str)
1023 { 1855 {
1856 NotImplemented("llSetPrimitiveParams");
1857 }
1024 1858
1859 public string llStringToBase64(string str)
1860 {
1025 try 1861 try
1026 { 1862 {
1027 byte[] encData_byte = new byte[str.Length]; 1863 byte[] encData_byte = new byte[str.Length];
1028 encData_byte = System.Text.Encoding.UTF8.GetBytes(str); 1864 encData_byte = Encoding.UTF8.GetBytes(str);
1029 string encodedData = Convert.ToBase64String(encData_byte); 1865 string encodedData = Convert.ToBase64String(encData_byte);
1030 return encodedData; 1866 return encodedData;
1031 } 1867 }
@@ -1037,11 +1873,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1037 1873
1038 public string llBase64ToString(string str) 1874 public string llBase64ToString(string str)
1039 { 1875 {
1040 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 1876 UTF8Encoding encoder = new UTF8Encoding();
1041 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 1877 Decoder utf8Decode = encoder.GetDecoder();
1042 try 1878 try
1043 { 1879 {
1044
1045 byte[] todecode_byte = Convert.FromBase64String(str); 1880 byte[] todecode_byte = Convert.FromBase64String(str);
1046 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 1881 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
1047 char[] decoded_char = new char[charCount]; 1882 char[] decoded_char = new char[charCount];
@@ -1054,16 +1889,49 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1054 throw new Exception("Error in base64Decode" + e.Message); 1889 throw new Exception("Error in base64Decode" + e.Message);
1055 } 1890 }
1056 } 1891 }
1057 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); }
1058 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); }
1059 public double llLog10(double val) { return (double)Math.Log10(val); }
1060 public double llLog(double val) { return (double)Math.Log(val); }
1061 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); }
1062 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); }
1063 1892
1064 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } 1893 public void llXorBase64Strings()
1894 {
1895 throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead.");
1896 }
1897
1898 public void llRemoteDataSetRegion()
1899 {
1900 NotImplemented("llRemoteDataSetRegion");
1901 }
1902
1903 public double llLog10(double val)
1904 {
1905 return (double) Math.Log10(val);
1906 }
1065 1907
1066 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } 1908 public double llLog(double val)
1909 {
1910 return (double) Math.Log(val);
1911 }
1912
1913 public List<string> llGetAnimationList(string id)
1914 {
1915 NotImplemented("llGetAnimationList");
1916 return new List<string>();
1917 }
1918
1919 public void llSetParcelMusicURL(string url)
1920 {
1921 NotImplemented("llSetParcelMusicURL");
1922 }
1923
1924 public LSL_Types.Vector3 llGetRootPosition()
1925 {
1926 NotImplemented("llGetRootPosition");
1927 return new LSL_Types.Vector3();
1928 }
1929
1930 public LSL_Types.Quaternion llGetRootRotation()
1931 {
1932 NotImplemented("llGetRootRotation");
1933 return new LSL_Types.Quaternion();
1934 }
1067 1935
1068 public string llGetObjectDesc() 1936 public string llGetObjectDesc()
1069 { 1937 {
@@ -1080,20 +1948,55 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1080 return m_host.ObjectCreator.ToStringHyphenated(); 1948 return m_host.ObjectCreator.ToStringHyphenated();
1081 } 1949 }
1082 1950
1083 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } 1951 public string llGetTimestamp()
1084 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } 1952 {
1085 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } 1953 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
1086 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } 1954 }
1087 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } 1955
1088 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } 1956 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1089 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } 1957 {
1958 NotImplemented("llSetLinkAlpha");
1959 }
1960
1961 public int llGetNumberOfPrims()
1962 {
1963 NotImplemented("llGetNumberOfPrims");
1964 return 0;
1965 }
1966
1967 public string llGetNumberOfNotecardLines(string name)
1968 {
1969 NotImplemented("llGetNumberOfNotecardLines");
1970 return "";
1971 }
1972
1973 public List<string> llGetBoundingBox(string obj)
1974 {
1975 NotImplemented("llGetBoundingBox");
1976 return new List<string>();
1977 }
1978
1979 public LSL_Types.Vector3 llGetGeometricCenter()
1980 {
1981 NotImplemented("llGetGeometricCenter");
1982 return new LSL_Types.Vector3();
1983 }
1984
1985 public void llGetPrimitiveParams()
1986 {
1987 NotImplemented("llGetPrimitiveParams");
1988 }
1989
1090 public string llIntegerToBase64(int number) 1990 public string llIntegerToBase64(int number)
1091 { 1991 {
1092 NotImplemented("llIntegerToBase64"); return ""; 1992 NotImplemented("llIntegerToBase64");
1993 return "";
1093 } 1994 }
1995
1094 public int llBase64ToInteger(string str) 1996 public int llBase64ToInteger(string str)
1095 { 1997 {
1096 NotImplemented("llBase64ToInteger"); return 0; 1998 NotImplemented("llBase64ToInteger");
1999 return 0;
1097 } 2000 }
1098 2001
1099 public double llGetGMTclock() 2002 public double llGetGMTclock()
@@ -1106,31 +2009,92 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1106 return System.Environment.MachineName; 2009 return System.Environment.MachineName;
1107 } 2010 }
1108 2011
1109 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } 2012 public void llSetLocalRot(LSL_Types.Quaternion rot)
1110 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } 2013 {
1111 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } 2014 NotImplemented("llSetLocalRot");
2015 }
1112 2016
1113 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } 2017 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
2018 {
2019 NotImplemented("llParseStringKeepNulls");
2020 return new List<string>();
2021 }
1114 2022
1115 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } 2023 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
2024 LSL_Types.Quaternion rot, int param)
2025 {
2026 NotImplemented("llRezAtRoot");
2027 }
1116 2028
1117 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } 2029 public int llGetObjectPermMask(int mask)
1118 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } 2030 {
1119 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } 2031 NotImplemented("llGetObjectPermMask");
1120 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } 2032 return 0;
1121 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } 2033 }
1122 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } 2034
1123 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } 2035 public void llSetObjectPermMask(int mask, int value)
1124 public void llListReplaceList() { NotImplemented("llListReplaceList"); } 2036 {
2037 NotImplemented("llSetObjectPermMask");
2038 }
2039
2040 public void llGetInventoryPermMask(string item, int mask)
2041 {
2042 NotImplemented("llGetInventoryPermMask");
2043 }
2044
2045 public void llSetInventoryPermMask(string item, int mask, int value)
2046 {
2047 NotImplemented("llSetInventoryPermMask");
2048 }
2049
2050 public string llGetInventoryCreator(string item)
2051 {
2052 NotImplemented("llGetInventoryCreator");
2053 return "";
2054 }
2055
2056 public void llOwnerSay(string msg)
2057 {
2058 NotImplemented("llOwnerSay");
2059 }
2060
2061 public void llRequestSimulatorData(string simulator, int data)
2062 {
2063 NotImplemented("llRequestSimulatorData");
2064 }
2065
2066 public void llForceMouselook(int mouselook)
2067 {
2068 NotImplemented("llForceMouselook");
2069 }
2070
2071 public double llGetObjectMass(string id)
2072 {
2073 NotImplemented("llGetObjectMass");
2074 return 0;
2075 }
2076
2077 public void llListReplaceList()
2078 {
2079 NotImplemented("llListReplaceList");
2080 }
1125 2081
1126 public void llLoadURL(string avatar_id, string message, string url) 2082 public void llLoadURL(string avatar_id, string message, string url)
1127 { 2083 {
1128 LLUUID avatarId = new LLUUID(avatar_id); 2084 LLUUID avatarId = new LLUUID(avatar_id);
1129 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); 2085 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
2086 url);
1130 } 2087 }
1131 2088
1132 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } 2089 public void llParcelMediaCommandList(List<string> commandList)
1133 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } 2090 {
2091 NotImplemented("llParcelMediaCommandList");
2092 }
2093
2094 public void llParcelMediaQuery()
2095 {
2096 NotImplemented("llParcelMediaQuery");
2097 }
1134 2098
1135 public int llModPow(int a, int b, int c) 2099 public int llModPow(int a, int b, int c)
1136 { 2100 {
@@ -1139,13 +2103,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1139 return Convert.ToInt32(tmp); 2103 return Convert.ToInt32(tmp);
1140 } 2104 }
1141 2105
1142 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } 2106 public int llGetInventoryType(string name)
2107 {
2108 NotImplemented("llGetInventoryType");
2109 return 0;
2110 }
2111
2112 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
2113 {
2114 NotImplemented("llSetPayPrice");
2115 }
2116
2117 public LSL_Types.Vector3 llGetCameraPos()
2118 {
2119 NotImplemented("llGetCameraPos");
2120 return new LSL_Types.Vector3();
2121 }
2122
2123 public LSL_Types.Quaternion llGetCameraRot()
2124 {
2125 NotImplemented("llGetCameraRot");
2126 return new LSL_Types.Quaternion();
2127 }
2128
2129 public void llSetPrimURL()
2130 {
2131 NotImplemented("llSetPrimURL");
2132 }
1143 2133
1144 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } 2134 public void llRefreshPrimURL()
1145 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } 2135 {
1146 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } 2136 NotImplemented("llRefreshPrimURL");
1147 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } 2137 }
1148 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); }
1149 2138
1150 public string llEscapeURL(string url) 2139 public string llEscapeURL(string url)
1151 { 2140 {
@@ -1170,21 +2159,60 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1170 return "llUnescapeURL: " + ex.ToString(); 2159 return "llUnescapeURL: " + ex.ToString();
1171 } 2160 }
1172 } 2161 }
1173 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } 2162
1174 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } 2163 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at)
1175 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } 2164 {
1176 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } 2165 NotImplemented("llMapDestination");
1177 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } 2166 }
1178 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } 2167
1179 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } 2168 public void llAddToLandBanList(string avatar, double hours)
2169 {
2170 NotImplemented("llAddToLandBanList");
2171 }
2172
2173 public void llRemoveFromLandPassList(string avatar)
2174 {
2175 NotImplemented("llRemoveFromLandPassList");
2176 }
2177
2178 public void llRemoveFromLandBanList(string avatar)
2179 {
2180 NotImplemented("llRemoveFromLandBanList");
2181 }
2182
2183 public void llSetCameraParams(List<string> rules)
2184 {
2185 NotImplemented("llSetCameraParams");
2186 }
2187
2188 public void llClearCameraParams()
2189 {
2190 NotImplemented("llClearCameraParams");
2191 }
2192
2193 public double llListStatistics(int operation, List<string> src)
2194 {
2195 NotImplemented("llListStatistics");
2196 return 0;
2197 }
1180 2198
1181 public int llGetUnixTime() 2199 public int llGetUnixTime()
1182 { 2200 {
1183 return Util.UnixTimeSinceEpoch(); 2201 return Util.UnixTimeSinceEpoch();
1184 } 2202 }
1185 2203
1186 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } 2204 public int llGetParcelFlags(LSL_Types.Vector3 pos)
1187 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } 2205 {
2206 NotImplemented("llGetParcelFlags");
2207 return 0;
2208 }
2209
2210 public int llGetRegionFlags()
2211 {
2212 NotImplemented("llGetRegionFlags");
2213 return 0;
2214 }
2215
1188 public string llXorBase64StringsCorrect(string str1, string str2) 2216 public string llXorBase64StringsCorrect(string str1, string str2)
1189 { 2217 {
1190 string ret = ""; 2218 string ret = "";
@@ -1201,27 +2229,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1201 } 2229 }
1202 return llStringToBase64(ret); 2230 return llStringToBase64(ret);
1203 } 2231 }
2232
1204 public void llHTTPRequest(string url, List<string> parameters, string body) 2233 public void llHTTPRequest(string url, List<string> parameters, string body)
1205 { 2234 {
1206 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); 2235 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
1207 } 2236 }
1208 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } 2237
1209 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } 2238 public void llResetLandBanList()
1210 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } 2239 {
1211 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } 2240 NotImplemented("llResetLandBanList");
1212 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } 2241 }
1213 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } 2242
1214 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } 2243 public void llResetLandPassList()
2244 {
2245 NotImplemented("llResetLandPassList");
2246 }
2247
2248 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
2249 {
2250 NotImplemented("llGetParcelPrimCount");
2251 return 0;
2252 }
2253
2254 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos)
2255 {
2256 NotImplemented("llGetParcelPrimOwners");
2257 return new List<string>();
2258 }
2259
2260 public int llGetObjectPrimCount(string object_id)
2261 {
2262 NotImplemented("llGetObjectPrimCount");
2263 return 0;
2264 }
2265
2266 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide)
2267 {
2268 NotImplemented("llGetParcelMaxPrims");
2269 return 0;
2270 }
2271
2272 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param)
2273 {
2274 NotImplemented("llGetParcelDetails");
2275 return new List<string>();
2276 }
1215 2277
1216 // 2278 //
1217 // OpenSim functions 2279 // OpenSim functions
1218 // 2280 //
1219 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) 2281 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
2282 int timer)
1220 { 2283 {
1221 if (dynamicID == "") 2284 if (dynamicID == "")
1222 { 2285 {
1223 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); 2286 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
1224 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer); 2287 LLUUID createdTexture =
2288 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
2289 extraParams, timer);
1225 return createdTexture.ToStringHyphenated(); 2290 return createdTexture.ToStringHyphenated();
1226 } 2291 }
1227 else 2292 else
@@ -1237,6 +2302,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
1237 if (throwErrorOnNotImplemented) 2302 if (throwErrorOnNotImplemented)
1238 throw new NotImplementedException("Command not implemented: " + Command); 2303 throw new NotImplementedException("Command not implemented: " + Command);
1239 } 2304 }
1240
1241 } 2305 }
1242} 2306} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 8f0a591..85ac597 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -27,11 +27,8 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 30using libsecondlife;
33using OpenSim.Framework; 31using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes.Scripting;
35 32
36namespace OpenSim.Region.ScriptEngine.DotNetEngine 33namespace OpenSim.Region.ScriptEngine.DotNetEngine
37{ 34{
@@ -39,7 +36,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
39 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. 36 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it.
40 /// </summary> 37 /// </summary>
41 [Serializable] 38 [Serializable]
42 class EventManager 39 internal class EventManager
43 { 40 {
44 private ScriptEngine myScriptEngine; 41 private ScriptEngine myScriptEngine;
45 //public IScriptHost TEMP_OBJECT_ID; 42 //public IScriptHost TEMP_OBJECT_ID;
@@ -55,7 +52,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
55 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 52 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
56 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 53 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
57 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 54 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
58
59 } 55 }
60 56
61 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 57 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
@@ -63,17 +59,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
63 // Add to queue for all scripts in ObjectID object 59 // Add to queue for all scripts in ObjectID object
64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); 60 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
65 //Console.WriteLine("touch_start localID: " + localID); 61 //Console.WriteLine("touch_start localID: " + localID);
66 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); 62 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1});
67 } 63 }
64
68 public void OnRezScript(uint localID, LLUUID itemID, string script) 65 public void OnRezScript(uint localID, LLUUID itemID, string script)
69 { 66 {
70 //myScriptEngine.myScriptManager.StartScript( 67 //myScriptEngine.myScriptManager.StartScript(
71 // Path.Combine("ScriptEngines", "Default.lsl"), 68 // Path.Combine("ScriptEngines", "Default.lsl"),
72 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() 69 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
73 //); 70 //);
74 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); 71 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
72 script.Length);
75 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); 73 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
76 } 74 }
75
77 public void OnRemoveScript(uint localID, LLUUID itemID) 76 public void OnRemoveScript(uint localID, LLUUID itemID)
78 { 77 {
79 //myScriptEngine.myScriptManager.StartScript( 78 //myScriptEngine.myScriptManager.StartScript(
@@ -84,48 +83,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
84 myScriptEngine.m_ScriptManager.StopScript( 83 myScriptEngine.m_ScriptManager.StopScript(
85 localID, 84 localID,
86 itemID 85 itemID
87 ); 86 );
88
89 } 87 }
90 88
91 // TODO: Replace placeholders below 89 // TODO: Replace placeholders below
92 // These needs to be hooked up to OpenSim during init of this class 90 // These needs to be hooked up to OpenSim during init of this class
93 // then queued in EventQueueManager. 91 // then queued in EventQueueManager.
94 // When queued in EventQueueManager they need to be LSL compatible (name and params) 92 // When queued in EventQueueManager they need to be LSL compatible (name and params)
95 93
96 //public void state_entry() { } // 94 //public void state_entry() { } //
97 public void state_exit() { } 95 public void state_exit()
96 {
97 }
98
98 //public void touch_start() { } 99 //public void touch_start() { }
99 public void touch() { } 100 public void touch()
100 public void touch_end() { } 101 {
101 public void collision_start() { } 102 }
102 public void collision() { } 103
103 public void collision_end() { } 104 public void touch_end()
104 public void land_collision_start() { } 105 {
105 public void land_collision() { } 106 }
106 public void land_collision_end() { } 107
107 public void timer() { } 108 public void collision_start()
108 public void listen() { } 109 {
109 public void on_rez() { } 110 }
110 public void sensor() { } 111
111 public void no_sensor() { } 112 public void collision()
112 public void control() { } 113 {
113 public void money() { } 114 }
114 public void email() { } 115
115 public void at_target() { } 116 public void collision_end()
116 public void not_at_target() { } 117 {
117 public void at_rot_target() { } 118 }
118 public void not_at_rot_target() { } 119
119 public void run_time_permissions() { } 120 public void land_collision_start()
120 public void changed() { } 121 {
121 public void attach() { } 122 }
122 public void dataserver() { } 123
123 public void link_message() { } 124 public void land_collision()
124 public void moving_start() { } 125 {
125 public void moving_end() { } 126 }
126 public void object_rez() { } 127
127 public void remote_data() { } 128 public void land_collision_end()
128 public void http_response() { } 129 {
130 }
131
132 public void timer()
133 {
134 }
135
136 public void listen()
137 {
138 }
139
140 public void on_rez()
141 {
142 }
143
144 public void sensor()
145 {
146 }
147
148 public void no_sensor()
149 {
150 }
151
152 public void control()
153 {
154 }
155
156 public void money()
157 {
158 }
159
160 public void email()
161 {
162 }
163
164 public void at_target()
165 {
166 }
167
168 public void not_at_target()
169 {
170 }
171
172 public void at_rot_target()
173 {
174 }
175
176 public void not_at_rot_target()
177 {
178 }
179
180 public void run_time_permissions()
181 {
182 }
183
184 public void changed()
185 {
186 }
187
188 public void attach()
189 {
190 }
191
192 public void dataserver()
193 {
194 }
195
196 public void link_message()
197 {
198 }
199
200 public void moving_start()
201 {
202 }
203
204 public void moving_end()
205 {
206 }
207
208 public void object_rez()
209 {
210 }
211
212 public void remote_data()
213 {
214 }
129 215
216 public void http_response()
217 {
218 }
130 } 219 }
131} 220} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index aa36ea2..d7491d9 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -27,12 +27,11 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Reflection;
34using OpenSim.Region.Environment.Scenes.Scripting;
35using libsecondlife; 33using libsecondlife;
34using OpenSim.Region.Environment.Scenes.Scripting;
36using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 35using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
37 36
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 37namespace OpenSim.Region.ScriptEngine.DotNetEngine
@@ -42,25 +41,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
42 /// Events are queued and executed in separate thread 41 /// Events are queued and executed in separate thread
43 /// </summary> 42 /// </summary>
44 [Serializable] 43 [Serializable]
45 class EventQueueManager 44 internal class EventQueueManager
46 { 45 {
47 /// <summary> 46 /// <summary>
48 /// List of threads processing event queue 47 /// List of threads processing event queue
49 /// </summary> 48 /// </summary>
50 private List<Thread> eventQueueThreads = new List<Thread>(); 49 private List<Thread> eventQueueThreads = new List<Thread>();
50
51 private object queueLock = new object(); // Mutex lock object 51 private object queueLock = new object(); // Mutex lock object
52
52 /// <summary> 53 /// <summary>
53 /// How many ms to sleep if queue is empty 54 /// How many ms to sleep if queue is empty
54 /// </summary> 55 /// </summary>
55 private int nothingToDoSleepms = 50; 56 private int nothingToDoSleepms = 50;
57
56 /// <summary> 58 /// <summary>
57 /// How many threads to process queue with 59 /// How many threads to process queue with
58 /// </summary> 60 /// </summary>
59 private int numberOfThreads = 2; 61 private int numberOfThreads = 2;
62
60 /// <summary> 63 /// <summary>
61 /// Queue containing events waiting to be executed 64 /// Queue containing events waiting to be executed
62 /// </summary> 65 /// </summary>
63 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>(); 66 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>();
67
64 /// <summary> 68 /// <summary>
65 /// Queue item structure 69 /// Queue item structure
66 /// </summary> 70 /// </summary>
@@ -76,9 +80,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
76 /// List of localID locks for mutex processing of script events 80 /// List of localID locks for mutex processing of script events
77 /// </summary> 81 /// </summary>
78 private List<uint> objectLocks = new List<uint>(); 82 private List<uint> objectLocks = new List<uint>();
83
79 private object tryLockLock = new object(); // Mutex lock object 84 private object tryLockLock = new object(); // Mutex lock object
80 85
81 private ScriptEngine m_ScriptEngine; 86 private ScriptEngine m_ScriptEngine;
87
82 public EventQueueManager(ScriptEngine _ScriptEngine) 88 public EventQueueManager(ScriptEngine _ScriptEngine)
83 { 89 {
84 m_ScriptEngine = _ScriptEngine; 90 m_ScriptEngine = _ScriptEngine;
@@ -96,11 +102,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
96 EventQueueThread.Start(); 102 EventQueueThread.Start();
97 } 103 }
98 } 104 }
105
99 ~EventQueueManager() 106 ~EventQueueManager()
100 { 107 {
101
102 // Kill worker threads 108 // Kill worker threads
103 foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) 109 foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads))
104 { 110 {
105 if (EventQueueThread != null && EventQueueThread.IsAlive == true) 111 if (EventQueueThread != null && EventQueueThread.IsAlive == true)
106 { 112 {
@@ -118,7 +124,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
118 eventQueueThreads.Clear(); 124 eventQueueThreads.Clear();
119 // Todo: Clean up our queues 125 // Todo: Clean up our queues
120 eventQueue.Clear(); 126 eventQueue.Clear();
121
122 } 127 }
123 128
124 /// <summary> 129 /// <summary>
@@ -176,18 +181,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
176 // Execute function 181 // Execute function
177 try 182 try
178 { 183 {
179 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); 184 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
185 QIS.functionName, QIS.param);
180 } 186 }
181 catch (Exception e) 187 catch (Exception e)
182 { 188 {
183 // DISPLAY ERROR INWORLD 189 // DISPLAY ERROR INWORLD
184 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; 190 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
185 if (e.InnerException != null) 191 if (e.InnerException != null)
186 { // Send inner exception 192 {
193 // Send inner exception
187 text += e.InnerException.Message.ToString(); 194 text += e.InnerException.Message.ToString();
188 } 195 }
189 else 196 else
190 { // Send normal 197 {
198 // Send normal
191 text += e.Message.ToString(); 199 text += e.Message.ToString();
192 } 200 }
193 try 201 try
@@ -195,28 +203,33 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
195 if (text.Length > 1500) 203 if (text.Length > 1500)
196 text = text.Substring(0, 1500); 204 text = text.Substring(0, 1500);
197 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); 205 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
198 //if (m_host != null) 206 //if (m_host != null)
199 //{ 207 //{
200 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 208 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0,
201 } catch { 209 m_host.AbsolutePosition, m_host.Name, m_host.UUID);
202 //} 210 }
203 //else 211 catch
204 //{ 212 {
213 //}
214 //else
215 //{
205 // T oconsole 216 // T oconsole
206 Console.WriteLine("Unable to send text in-world:\r\n" + text); 217 Console.WriteLine("Unable to send text in-world:\r\n" + text);
207 } 218 }
208
209 } 219 }
210 finally 220 finally
211 { 221 {
212 ReleaseLock(QIS.localID); 222 ReleaseLock(QIS.localID);
213 } 223 }
214 } 224 }
215
216 } // Something in queue 225 } // Something in queue
217 } catch (ThreadAbortException tae) { 226 }
227 catch (ThreadAbortException tae)
228 {
218 throw tae; 229 throw tae;
219 } catch (Exception e) { 230 }
231 catch (Exception e)
232 {
220 Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString()); 233 Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString());
221 } 234 }
222 } // while 235 } // while
@@ -283,15 +296,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
283 return; 296 return;
284 } 297 }
285 298
286 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); 299 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys =
300 m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
287 301
288 foreach ( LLUUID itemID in scriptKeys ) 302 foreach (LLUUID itemID in scriptKeys)
289 { 303 {
290 // Add to each script in that object 304 // Add to each script in that object
291 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter? 305 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter?
292 AddToScriptQueue(localID, itemID, FunctionName, param); 306 AddToScriptQueue(localID, itemID, FunctionName, param);
293 } 307 }
294
295 } 308 }
296 309
297 /// <summary> 310 /// <summary>
@@ -316,6 +329,5 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
316 eventQueue.Enqueue(QIS); 329 eventQueue.Enqueue(QIS);
317 } 330 }
318 } 331 }
319
320 } 332 }
321} 333} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index e6c2c47..5061629 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -28,24 +28,23 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.Threading; 31using System.Threading;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Region.ScriptEngine.Common;
35using OpenSim.Region.Environment.Modules;
36using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Modules;
37 35
38namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
39{ 37{
40 /// <summary> 38 /// <summary>
41 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. 39 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
42 /// </summary> 40 /// </summary>
43 class LSLLongCmdHandler 41 internal class LSLLongCmdHandler
44 { 42 {
45 private Thread cmdHandlerThread; 43 private Thread cmdHandlerThread;
46 private int cmdHandlerThreadCycleSleepms = 100; 44 private int cmdHandlerThreadCycleSleepms = 100;
47 45
48 private ScriptEngine m_ScriptEngine; 46 private ScriptEngine m_ScriptEngine;
47
49 public LSLLongCmdHandler(ScriptEngine _ScriptEngine) 48 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
50 { 49 {
51 m_ScriptEngine = _ScriptEngine; 50 m_ScriptEngine = _ScriptEngine;
@@ -56,8 +55,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
56 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 55 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
57 cmdHandlerThread.IsBackground = true; 56 cmdHandlerThread.IsBackground = true;
58 cmdHandlerThread.Start(); 57 cmdHandlerThread.Start();
59
60 } 58 }
59
61 ~LSLLongCmdHandler() 60 ~LSLLongCmdHandler()
62 { 61 {
63 // Shut down thread 62 // Shut down thread
@@ -72,7 +71,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
72 } 71 }
73 } 72 }
74 } 73 }
75 catch { } 74 catch
75 {
76 }
76 } 77 }
77 78
78 private void CmdHandlerThreadLoop() 79 private void CmdHandlerThreadLoop()
@@ -124,8 +125,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
124 public double interval; 125 public double interval;
125 public DateTime next; 126 public DateTime next;
126 } 127 }
128
127 private List<TimerClass> Timers = new List<TimerClass>(); 129 private List<TimerClass> Timers = new List<TimerClass>();
128 private object TimerListLock = new object(); 130 private object TimerListLock = new object();
131
129 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) 132 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
130 { 133 {
131 Console.WriteLine("SetTimerEvent"); 134 Console.WriteLine("SetTimerEvent");
@@ -146,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
146 Timers.Add(ts); 149 Timers.Add(ts);
147 } 150 }
148 } 151 }
152
149 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) 153 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
150 { 154 {
151 // Remove from timer 155 // Remove from timer
@@ -163,6 +167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
163 Timers = NewTimers; 167 Timers = NewTimers;
164 } 168 }
165 } 169 }
170
166 public void CheckTimerEvents() 171 public void CheckTimerEvents()
167 { 172 {
168 // Nothing to do here? 173 // Nothing to do here?
@@ -171,7 +176,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
171 176
172 lock (TimerListLock) 177 lock (TimerListLock)
173 { 178 {
174
175 // Go through all timers 179 // Go through all timers
176 foreach (TimerClass ts in Timers) 180 foreach (TimerClass ts in Timers)
177 { 181 {
@@ -179,7 +183,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
179 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 183 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
180 { 184 {
181 // Add it to queue 185 // Add it to queue
182 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 186 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer",
187 new object[] {});
183 // set next interval 188 // set next interval
184 189
185 190
@@ -188,6 +193,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
188 } 193 }
189 } // lock 194 } // lock
190 } 195 }
196
191 #endregion 197 #endregion
192 198
193 #region HTTP REQUEST 199 #region HTTP REQUEST
@@ -213,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
213 { 219 {
214 // TODO: SEND REQUEST!!! 220 // TODO: SEND REQUEST!!!
215 } 221 }
222
216 public void Stop() 223 public void Stop()
217 { 224 {
218 // TODO: Cancel any ongoing request 225 // TODO: Cancel any ongoing request
219 } 226 }
227
220 public bool CheckResponse() 228 public bool CheckResponse()
221 { 229 {
222 // TODO: Check if we got a response yet, return true if so -- false if not 230 // TODO: Check if we got a response yet, return true if so -- false if not
@@ -227,11 +235,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
227 //response_status 235 //response_status
228 //response_metadata 236 //response_metadata
229 //response_body 237 //response_body
230
231 } 238 }
232 } 239 }
240
233 private List<HttpClass> HttpRequests = new List<HttpClass>(); 241 private List<HttpClass> HttpRequests = new List<HttpClass>();
234 private object HttpListLock = new object(); 242 private object HttpListLock = new object();
243
235 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 244 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
236 { 245 {
237 Console.WriteLine("StartHttpRequest"); 246 Console.WriteLine("StartHttpRequest");
@@ -244,11 +253,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
244 htc.body = body; 253 htc.body = body;
245 lock (HttpListLock) 254 lock (HttpListLock)
246 { 255 {
247
248 //ADD REQUEST 256 //ADD REQUEST
249 HttpRequests.Add(htc); 257 HttpRequests.Add(htc);
250 } 258 }
251 } 259 }
260
252 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 261 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
253 { 262 {
254 // Remove from list 263 // Remove from list
@@ -272,6 +281,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
272 HttpRequests = NewHttpList; 281 HttpRequests = NewHttpList;
273 } 282 }
274 } 283 }
284
275 public void CheckHttpRequests() 285 public void CheckHttpRequests()
276 { 286 {
277 // Nothing to do here? 287 // Nothing to do here?
@@ -282,68 +292,64 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
282 { 292 {
283 foreach (HttpClass ts in HttpRequests) 293 foreach (HttpClass ts in HttpRequests)
284 { 294 {
285
286 if (ts.CheckResponse() == true) 295 if (ts.CheckResponse() == true)
287 { 296 {
288 // Add it to event queue 297 // Add it to event queue
289 //key request_id, integer status, list metadata, string body 298 //key request_id, integer status, list metadata, string body
290 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; 299 object[] resobj =
291 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); 300 new object[]
301 {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body};
302 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response",
303 resobj);
292 // Now stop it 304 // Now stop it
293 StopHttpRequest(ts.localID, ts.itemID); 305 StopHttpRequest(ts.localID, ts.itemID);
294 } 306 }
295 } 307 }
296 } // lock 308 } // lock
297 } 309 }
310
298 #endregion 311 #endregion
299 312
300 public void CheckXMLRPCRequests() 313 public void CheckXMLRPCRequests()
301 { 314 {
302
303 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 315 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
304 316
305 while (xmlrpc.hasRequests()) 317 while (xmlrpc.hasRequests())
306 { 318 {
307 RPCRequestInfo rInfo = xmlrpc.GetNextRequest(); 319 RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
308 System.Console.WriteLine("PICKED REQUEST"); 320 Console.WriteLine("PICKED REQUEST");
309 321
310 //Deliver data to prim's remote_data handler 322 //Deliver data to prim's remote_data handler
311 object[] resobj = new object[] { 323 object[] resobj = new object[]
312 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), rInfo.GetStrVal() 324 {
313 }; 325 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(),
326 rInfo.GetStrVal()
327 };
314 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 328 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
315 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj 329 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj
316 ); 330 );
317
318 } 331 }
319
320 } 332 }
321 333
322 public void CheckListeners() 334 public void CheckListeners()
323 { 335 {
324
325 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 336 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
326 337
327 while (comms.HasMessages()) 338 while (comms.HasMessages())
328 { 339 {
329 ListenerInfo lInfo = comms.GetNextMessage(); 340 ListenerInfo lInfo = comms.GetNextMessage();
330 System.Console.WriteLine("PICKED LISTENER"); 341 Console.WriteLine("PICKED LISTENER");
331 342
332 //Deliver data to prim's listen handler 343 //Deliver data to prim's listen handler
333 object[] resobj = new object[] { 344 object[] resobj = new object[]
334 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() 345 {
335 }; 346 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
347 };
336 348
337 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 349 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
338 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj 350 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj
339 ); 351 );
340
341 } 352 }
342
343 } 353 }
344
345
346
347
348 } 354 }
349} 355} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
index 0aa1a0b..00027ca 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.DotNetEngine")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.DotNetEngine")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")] 24
25[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices;
31// 33//
32// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 35// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 36
35[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 38bf746..eaa3a09 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -27,14 +27,10 @@
27*/ 27*/
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using Nini.Config;
31using System.Text;
32using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Scenes.Scripting;
35using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
36using libsecondlife; 33using OpenSim.Region.Environment.Scenes;
37using Nini.Config;
38 34
39namespace OpenSim.Region.ScriptEngine.DotNetEngine 35namespace OpenSim.Region.ScriptEngine.DotNetEngine
40{ 36{
@@ -42,17 +38,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
42 /// This is the root object for ScriptEngine 38 /// This is the root object for ScriptEngine
43 /// </summary> 39 /// </summary>
44 [Serializable] 40 [Serializable]
45 public class ScriptEngine :IRegionModule 41 public class ScriptEngine : IRegionModule
46 { 42 {
47 43 internal Scene World;
48 internal OpenSim.Region.Environment.Scenes.Scene World; 44 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
49 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim 45 internal EventQueueManager m_EventQueueManager; // Executes events
50 internal EventQueueManager m_EventQueueManager; // Executes events 46 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
51 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
52 internal AppDomainManager m_AppDomainManager; 47 internal AppDomainManager m_AppDomainManager;
53 internal LSLLongCmdHandler m_LSLLongCmdHandler; 48 internal LSLLongCmdHandler m_LSLLongCmdHandler;
54 49
55 private OpenSim.Framework.Console.LogBase m_log; 50 private LogBase m_log;
56 51
57 public ScriptEngine() 52 public ScriptEngine()
58 { 53 {
@@ -65,9 +60,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
65 get { return m_log; } 60 get { return m_log; }
66 } 61 }
67 62
68 public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) 63 public void InitializeEngine(Scene Sceneworld, LogBase logger)
69 { 64 {
70
71 World = Sceneworld; 65 World = Sceneworld;
72 m_log = logger; 66 m_log = logger;
73 67
@@ -84,10 +78,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
84 78
85 // Should we iterate the region for scripts that needs starting? 79 // Should we iterate the region for scripts that needs starting?
86 // Or can we assume we are loaded before anything else so we can use proper events? 80 // Or can we assume we are loaded before anything else so we can use proper events?
87
88
89 } 81 }
90 82
91 public void Shutdown() 83 public void Shutdown()
92 { 84 {
93 // We are shutting down 85 // We are shutting down
@@ -106,12 +98,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
106 98
107 public void Initialise(Scene scene, IConfigSource config) 99 public void Initialise(Scene scene, IConfigSource config)
108 { 100 {
109 this.InitializeEngine(scene, MainLog.Instance); 101 InitializeEngine(scene, MainLog.Instance);
110 } 102 }
111 103
112 public void PostInitialise() 104 public void PostInitialise()
113 { 105 {
114
115 } 106 }
116 107
117 public void Close() 108 public void Close()
@@ -130,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
130 121
131 #endregion 122 #endregion
132 } 123 }
133} 124} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 381fd8c..54a5ef5 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -28,19 +28,14 @@
28/* Original code: Tedd Hansen */ 28/* Original code: Tedd Hansen */
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.IO;
32using System.Threading;
33using System.Reflection; 32using System.Reflection;
34using System.Runtime.Remoting;
35using System.Runtime.Serialization;
36using System.Runtime.Serialization.Formatters.Binary; 33using System.Runtime.Serialization.Formatters.Binary;
34using System.Threading;
35using libsecondlife;
37using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
38using OpenSim.Region.Environment.Scenes.Scripting;
39using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 37using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
40using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 38using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
41using OpenSim.Region.ScriptEngine.Common;
42using libsecondlife;
43
44 39
45namespace OpenSim.Region.ScriptEngine.DotNetEngine 40namespace OpenSim.Region.ScriptEngine.DotNetEngine
46{ 41{
@@ -53,16 +48,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
53 public class ScriptManager 48 public class ScriptManager
54 { 49 {
55 #region Declares 50 #region Declares
51
56 private Thread scriptLoadUnloadThread; 52 private Thread scriptLoadUnloadThread;
57 private int scriptLoadUnloadThread_IdleSleepms = 100; 53 private int scriptLoadUnloadThread_IdleSleepms = 100;
58 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>(); 54 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>();
59 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>(); 55 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>();
56
60 private struct LoadStruct 57 private struct LoadStruct
61 { 58 {
62 public uint localID; 59 public uint localID;
63 public LLUUID itemID; 60 public LLUUID itemID;
64 public string script; 61 public string script;
65 } 62 }
63
66 private struct UnloadStruct 64 private struct UnloadStruct
67 { 65 {
68 public uint localID; 66 public uint localID;
@@ -72,17 +70,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
72 // Object<string, Script<string, script>> 70 // Object<string, Script<string, script>>
73 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. 71 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
74 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! 72 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
75 internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>(); 73 internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts =
74 new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
75
76 public Scene World 76 public Scene World
77 { 77 {
78 get 78 get { return m_scriptEngine.World; }
79 {
80 return m_scriptEngine.World;
81 }
82 } 79 }
83#endregion 80
81 #endregion
82
84 #region Object init/shutdown 83 #region Object init/shutdown
84
85 private ScriptEngine m_scriptEngine; 85 private ScriptEngine m_scriptEngine;
86
86 public ScriptManager(ScriptEngine scriptEngine) 87 public ScriptManager(ScriptEngine scriptEngine)
87 { 88 {
88 m_scriptEngine = scriptEngine; 89 m_scriptEngine = scriptEngine;
@@ -92,9 +93,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
92 scriptLoadUnloadThread.IsBackground = true; 93 scriptLoadUnloadThread.IsBackground = true;
93 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; 94 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
94 scriptLoadUnloadThread.Start(); 95 scriptLoadUnloadThread.Start();
95
96 } 96 }
97 ~ScriptManager () 97
98 ~ScriptManager()
98 { 99 {
99 // Abort load/unload thread 100 // Abort load/unload thread
100 try 101 try
@@ -112,8 +113,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
112 { 113 {
113 } 114 }
114 } 115 }
116
115 #endregion 117 #endregion
118
116 #region Load / Unload scripts (Thread loop) 119 #region Load / Unload scripts (Thread loop)
120
117 private void ScriptLoadUnloadThreadLoop() 121 private void ScriptLoadUnloadThreadLoop()
118 { 122 {
119 try 123 try
@@ -134,9 +138,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
134 UnloadStruct item = unloadQueue.Dequeue(); 138 UnloadStruct item = unloadQueue.Dequeue();
135 _StopScript(item.localID, item.itemID); 139 _StopScript(item.localID, item.itemID);
136 } 140 }
137
138
139
140 } 141 }
141 } 142 }
142 catch (ThreadAbortException tae) 143 catch (ThreadAbortException tae)
@@ -145,21 +146,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
145 a = ""; 146 a = "";
146 // Expected 147 // Expected
147 } 148 }
148
149 } 149 }
150
150 #endregion 151 #endregion
152
151 #region Helper functions 153 #region Helper functions
154
152 private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) 155 private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
153 { 156 {
154
155 //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name); 157 //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name);
156 return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null; 158 return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null;
157
158 } 159 }
159 160
160
161 #endregion 161 #endregion
162
162 #region Internal functions to keep track of script 163 #region Internal functions to keep track of script
164
163 internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID) 165 internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID)
164 { 166 {
165 if (Scripts.ContainsKey(localID) == false) 167 if (Scripts.ContainsKey(localID) == false)
@@ -169,7 +171,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
169 Scripts.TryGetValue(localID, out Obj); 171 Scripts.TryGetValue(localID, out Obj);
170 172
171 return Obj.Keys; 173 return Obj.Keys;
172
173 } 174 }
174 175
175 internal LSL_BaseClass GetScript(uint localID, LLUUID itemID) 176 internal LSL_BaseClass GetScript(uint localID, LLUUID itemID)
@@ -187,8 +188,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
187 Obj.TryGetValue(itemID, out Script); 188 Obj.TryGetValue(itemID, out Script);
188 189
189 return Script; 190 return Script;
190
191 } 191 }
192
192 internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script) 193 internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script)
193 { 194 {
194 // Create object if it doesn't exist 195 // Create object if it doesn't exist
@@ -205,8 +206,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
205 206
206 // Add to object 207 // Add to object
207 Obj.Add(itemID, Script); 208 Obj.Add(itemID, Script);
208
209 } 209 }
210
210 internal void RemoveScript(uint localID, LLUUID itemID) 211 internal void RemoveScript(uint localID, LLUUID itemID)
211 { 212 {
212 // Don't have that object? 213 // Don't have that object?
@@ -218,10 +219,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
218 Scripts.TryGetValue(localID, out Obj); 219 Scripts.TryGetValue(localID, out Obj);
219 if (Obj.ContainsKey(itemID) == true) 220 if (Obj.ContainsKey(itemID) == true)
220 Obj.Remove(itemID); 221 Obj.Remove(itemID);
221
222 } 222 }
223
223 #endregion 224 #endregion
225
224 #region Start/Stop/Reset script 226 #region Start/Stop/Reset script
227
225 /// <summary> 228 /// <summary>
226 /// Fetches, loads and hooks up a script to an objects events 229 /// Fetches, loads and hooks up a script to an objects events
227 /// </summary> 230 /// </summary>
@@ -235,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
235 ls.script = Script; 238 ls.script = Script;
236 loadQueue.Enqueue(ls); 239 loadQueue.Enqueue(ls);
237 } 240 }
241
238 /// <summary> 242 /// <summary>
239 /// Disables and unloads a script 243 /// Disables and unloads a script
240 /// </summary> 244 /// </summary>
@@ -247,6 +251,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
247 ls.itemID = itemID; 251 ls.itemID = itemID;
248 unloadQueue.Enqueue(ls); 252 unloadQueue.Enqueue(ls);
249 } 253 }
254
250 public void ResetScript(uint localID, LLUUID itemID) 255 public void ResetScript(uint localID, LLUUID itemID)
251 { 256 {
252 string script = GetScript(localID, itemID).SourceCode; 257 string script = GetScript(localID, itemID).SourceCode;
@@ -267,12 +272,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
267 272
268 try 273 try
269 { 274 {
270
271
272
273
274 // Create a new instance of the compiler (currently we don't want reuse) 275 // Create a new instance of the compiler (currently we don't want reuse)
275 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); 276 Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
276 // Compile (We assume LSL) 277 // Compile (We assume LSL)
277 ScriptSource = LSLCompiler.CompileFromLSLText(Script); 278 ScriptSource = LSLCompiler.CompileFromLSLText(Script);
278 //Console.WriteLine("Compilation of " + FileName + " done"); 279 //Console.WriteLine("Compilation of " + FileName + " done");
@@ -289,10 +290,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
289 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); 290 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
290 291
291#if DEBUG 292#if DEBUG
292 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 293 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
293#endif 294#endif
294 295
295 CompiledScript.SourceCode = ScriptSource; 296 CompiledScript.SourceCode = ScriptSource;
296 // Add it to our script memstruct 297 // Add it to our script memstruct
297 SetScript(localID, itemID, CompiledScript); 298 SetScript(localID, itemID, CompiledScript);
298 299
@@ -306,9 +307,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
306 CompiledScript.Start(LSLB); 307 CompiledScript.Start(LSLB);
307 308
308 // Fire the first start-event 309 // Fire the first start-event
309 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); 310 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
310
311
312 } 311 }
313 catch (Exception e) 312 catch (Exception e)
314 { 313 {
@@ -326,9 +325,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
326 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); 325 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
327 } 326 }
328 } 327 }
329
330
331
332 } 328 }
333 329
334 private void _StopScript(uint localID, LLUUID itemID) 330 private void _StopScript(uint localID, LLUUID itemID)
@@ -359,19 +355,24 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
359 // Tell AppDomain that we have stopped script 355 // Tell AppDomain that we have stopped script
360 m_scriptEngine.m_AppDomainManager.StopScript(ad); 356 m_scriptEngine.m_AppDomainManager.StopScript(ad);
361 } 357 }
362 catch(Exception e) 358 catch (Exception e)
363 { 359 {
364 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString()); 360 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
361 ": " + e.ToString());
365 } 362 }
366 } 363 }
367 private string ProcessYield(string FileName) 364
365 private string ProcessYield(string FileName)
368 { 366 {
369 // TODO: Create a new assembly and copy old but insert Yield Code 367 // TODO: Create a new assembly and copy old but insert Yield Code
370 //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); 368 //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName);
371 return FileName; 369 return FileName;
372 } 370 }
371
373 #endregion 372 #endregion
373
374 #region Perform event execution in script 374 #region Perform event execution in script
375
375 /// <summary> 376 /// <summary>
376 /// Execute a LL-event-function in Script 377 /// Execute a LL-event-function in Script
377 /// </summary> 378 /// </summary>
@@ -381,7 +382,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
381 /// <param name="args">Arguments to pass to function</param> 382 /// <param name="args">Arguments to pass to function</param>
382 internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args) 383 internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args)
383 { 384 {
384
385 // Execute a function in the script 385 // Execute a function in the script
386 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); 386 //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
387 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); 387 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
@@ -390,28 +390,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
390 390
391 // Must be done in correct AppDomain, so leaving it up to the script itself 391 // Must be done in correct AppDomain, so leaving it up to the script itself
392 Script.Exec.ExecuteEvent(FunctionName, args); 392 Script.Exec.ExecuteEvent(FunctionName, args);
393
394 } 393 }
394
395 #endregion 395 #endregion
396 396
397 #region Script serialization/deserialization 397 #region Script serialization/deserialization
398
398 public void GetSerializedScript(uint localID, LLUUID itemID) 399 public void GetSerializedScript(uint localID, LLUUID itemID)
399 { 400 {
400 // Serialize the script and return it 401 // Serialize the script and return it
401 // Should not be a problem 402 // Should not be a problem
402 System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); 403 FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID);
403 BinaryFormatter b = new BinaryFormatter(); 404 BinaryFormatter b = new BinaryFormatter();
404 b.Serialize(fs, GetScript(localID,itemID)); 405 b.Serialize(fs, GetScript(localID, itemID));
405 fs.Close(); 406 fs.Close();
406
407
408 } 407 }
408
409 public void PutSerializedScript(uint localID, LLUUID itemID) 409 public void PutSerializedScript(uint localID, LLUUID itemID)
410 { 410 {
411 // Deserialize the script and inject it into an AppDomain 411 // Deserialize the script and inject it into an AppDomain
412 412
413 // How to inject into an AppDomain? 413 // How to inject into an AppDomain?
414 } 414 }
415
415 #endregion 416 #endregion
416 } 417 }
417} 418} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
index 8f935f1..072c249 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
@@ -27,12 +27,9 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.IO;
31using System.Text;
32using Rail.Transformation;
33using Rail.Reflect; 31using Rail.Reflect;
34using Rail.Exceptions; 32using Rail.Transformation;
35using Rail.MSIL;
36 33
37namespace OpenSim.Region.ScriptEngine.DotNetEngine 34namespace OpenSim.Region.ScriptEngine.DotNetEngine
38{ 35{
@@ -40,25 +37,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
40 /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! 37 /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes!
41 /// Its offspring will be the actual implementation. 38 /// Its offspring will be the actual implementation.
42 /// </summary> 39 /// </summary>
43 class TempDotNetMicroThreadingCodeInjector 40 internal class TempDotNetMicroThreadingCodeInjector
44 { 41 {
45 public static string TestFix(string FileName) 42 public static string TestFix(string FileName)
46 { 43 {
47 string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); 44 string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll");
48 45
49 Console.WriteLine("Loading: \"" + FileName + "\""); 46 Console.WriteLine("Loading: \"" + FileName + "\"");
50 RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); 47 RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName);
51 48
52 49
53 //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe 50 //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe
54 RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); 51 RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script");
55 52
56 //Get the methods in the type 53 //Get the methods in the type
57 RMethod[] m = type.GetMethods(); 54 RMethod[] m = type.GetMethods();
58 55
59 //Create a MethodPrologueAdder visitor object with the method to add 56 //Create a MethodPrologueAdder visitor object with the method to add
60 //and with the flag that enables local variable creation set to true 57 //and with the flag that enables local variable creation set to true
61 MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); 58 MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true);
62 59
63 //Apply the changes to the assembly 60 //Apply the changes to the assembly
64 rAssembly.Accept(mpa); 61 rAssembly.Accept(mpa);
@@ -67,7 +64,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
67 rAssembly.SaveAssembly(ret); 64 rAssembly.SaveAssembly(ret);
68 65
69 return ret; 66 return ret;
70
71 } 67 }
72 } 68 }
73} 69} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 729db7e..1b16a07 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -29,10 +29,11 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.IO;
32using libsecondlife; 33using libsecondlife;
33using Mono.Data.SqliteClient; 34using Mono.Data.SqliteClient;
34using OpenSim.Framework.Console;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console;
36using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Environment.LandManagement; 38using OpenSim.Region.Environment.LandManagement;
38using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
@@ -55,6 +56,7 @@ namespace OpenSim.DataStore.MonoSqlite
55 * Public Interface Functions 56 * Public Interface Functions
56 * 57 *
57 **********************************************************************/ 58 **********************************************************************/
59
58 public void Initialise(string dbfile, string dbname) 60 public void Initialise(string dbfile, string dbname)
59 { 61 {
60 string connectionString = "URI=file:" + dbfile + ",version=3"; 62 string connectionString = "URI=file:" + dbfile + ",version=3";
@@ -80,17 +82,18 @@ namespace OpenSim.DataStore.MonoSqlite
80 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); 82 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema");
81 TestTables(conn); 83 TestTables(conn);
82 84
83 lock(ds) { 85 lock (ds)
86 {
84 ds.Tables.Add(createPrimTable()); 87 ds.Tables.Add(createPrimTable());
85 setupPrimCommands(primDa, conn); 88 setupPrimCommands(primDa, conn);
86 primDa.Fill(ds.Tables["prims"]); 89 primDa.Fill(ds.Tables["prims"]);
87 90
88 ds.Tables.Add(createShapeTable()); 91 ds.Tables.Add(createShapeTable());
89 setupShapeCommands(shapeDa, conn); 92 setupShapeCommands(shapeDa, conn);
90 93
91 ds.Tables.Add(createTerrainTable()); 94 ds.Tables.Add(createTerrainTable());
92 setupTerrainCommands(terrainDa, conn); 95 setupTerrainCommands(terrainDa, conn);
93 96
94 // WORKAROUND: This is a work around for sqlite on 97 // WORKAROUND: This is a work around for sqlite on
95 // windows, which gets really unhappy with blob columns 98 // windows, which gets really unhappy with blob columns
96 // that have no sample data in them. At some point we 99 // that have no sample data in them. At some point we
@@ -118,7 +121,8 @@ namespace OpenSim.DataStore.MonoSqlite
118 121
119 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 122 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
120 { 123 {
121 lock (ds) { 124 lock (ds)
125 {
122 foreach (SceneObjectPart prim in obj.Children.Values) 126 foreach (SceneObjectPart prim in obj.Children.Values)
123 { 127 {
124 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 128 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
@@ -136,11 +140,12 @@ namespace OpenSim.DataStore.MonoSqlite
136 DataTable shapes = ds.Tables["primshapes"]; 140 DataTable shapes = ds.Tables["primshapes"];
137 141
138 string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; 142 string selectExp = "SceneGroupID = '" + obj.ToString() + "'";
139 lock (ds) { 143 lock (ds)
144 {
140 DataRow[] primRows = prims.Select(selectExp); 145 DataRow[] primRows = prims.Select(selectExp);
141 foreach (DataRow row in primRows) 146 foreach (DataRow row in primRows)
142 { 147 {
143 LLUUID uuid = new LLUUID((string)row["UUID"]); 148 LLUUID uuid = new LLUUID((string) row["UUID"]);
144 DataRow shapeRow = shapes.Rows.Find(uuid); 149 DataRow shapeRow = shapes.Rows.Find(uuid);
145 if (shapeRow != null) 150 if (shapeRow != null)
146 { 151 {
@@ -149,7 +154,7 @@ namespace OpenSim.DataStore.MonoSqlite
149 row.Delete(); 154 row.Delete();
150 } 155 }
151 } 156 }
152 157
153 Commit(); 158 Commit();
154 } 159 }
155 160
@@ -165,16 +170,18 @@ namespace OpenSim.DataStore.MonoSqlite
165 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; 170 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'";
166 string orderByParent = "ParentID ASC"; 171 string orderByParent = "ParentID ASC";
167 172
168 lock (ds) { 173 lock (ds)
174 {
169 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); 175 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
170 MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 176 MainLog.Instance.Verbose("DATASTORE",
171 177 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
178
172 foreach (DataRow primRow in primsForRegion) 179 foreach (DataRow primRow in primsForRegion)
173 { 180 {
174 try 181 try
175 { 182 {
176 string uuid = (string)primRow["UUID"]; 183 string uuid = (string) primRow["UUID"];
177 string objID = (string)primRow["SceneGroupID"]; 184 string objID = (string) primRow["SceneGroupID"];
178 if (uuid == objID) //is new SceneObjectGroup ? 185 if (uuid == objID) //is new SceneObjectGroup ?
179 { 186 {
180 SceneObjectGroup group = new SceneObjectGroup(); 187 SceneObjectGroup group = new SceneObjectGroup();
@@ -186,12 +193,13 @@ namespace OpenSim.DataStore.MonoSqlite
186 } 193 }
187 else 194 else
188 { 195 {
189 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 196 MainLog.Instance.Notice(
197 "No shape found for prim in storage, so setting default box shape");
190 prim.Shape = BoxShape.Default; 198 prim.Shape = BoxShape.Default;
191 } 199 }
192 group.AddPart(prim); 200 group.AddPart(prim);
193 group.RootPart = prim; 201 group.RootPart = prim;
194 202
195 createdObjects.Add(group.UUID, group); 203 createdObjects.Add(group.UUID, group);
196 retvals.Add(group); 204 retvals.Add(group);
197 } 205 }
@@ -205,7 +213,8 @@ namespace OpenSim.DataStore.MonoSqlite
205 } 213 }
206 else 214 else
207 { 215 {
208 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 216 MainLog.Instance.Notice(
217 "No shape found for prim in storage, so setting default box shape");
209 prim.Shape = BoxShape.Default; 218 prim.Shape = BoxShape.Default;
210 } 219 }
211 createdObjects[new LLUUID(objID)].AddPart(prim); 220 createdObjects[new LLUUID(objID)].AddPart(prim);
@@ -228,46 +237,48 @@ namespace OpenSim.DataStore.MonoSqlite
228 237
229 public void StoreTerrain(double[,] ter, LLUUID regionID) 238 public void StoreTerrain(double[,] ter, LLUUID regionID)
230 { 239 {
231 int revision = OpenSim.Framework.Util.UnixTimeSinceEpoch(); 240 int revision = Util.UnixTimeSinceEpoch();
232 241
233 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); 242 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString());
234 243
235 DataTable terrain = ds.Tables["terrain"]; 244 DataTable terrain = ds.Tables["terrain"];
236 lock (ds) { 245 lock (ds)
246 {
237 DataRow newrow = terrain.NewRow(); 247 DataRow newrow = terrain.NewRow();
238 fillTerrainRow(newrow, regionID, revision, ter); 248 fillTerrainRow(newrow, regionID, revision, ter);
239 terrain.Rows.Add(newrow); 249 terrain.Rows.Add(newrow);
240 250
241 Commit(); 251 Commit();
242 } 252 }
243 } 253 }
244 254
245 public double[,] LoadTerrain(LLUUID regionID) 255 public double[,] LoadTerrain(LLUUID regionID)
246 { 256 {
247 double[,] terret = new double[256, 256]; 257 double[,] terret = new double[256,256];
248 terret.Initialize(); 258 terret.Initialize();
249 259
250 DataTable terrain = ds.Tables["terrain"]; 260 DataTable terrain = ds.Tables["terrain"];
251 261
252 lock (ds) { 262 lock (ds)
253 DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'","Revision DESC"); 263 {
254 264 DataRow[] rows = terrain.Select("RegionUUID = '" + regionID.ToString() + "'", "Revision DESC");
265
255 int rev = 0; 266 int rev = 0;
256 267
257 if (rows.Length > 0) 268 if (rows.Length > 0)
258 { 269 {
259 DataRow row = rows[0]; 270 DataRow row = rows[0];
260 271
261 byte[] heightmap = (byte[])row["Heightfield"]; 272 byte[] heightmap = (byte[]) row["Heightfield"];
262 for (int x = 0; x < 256; x++) 273 for (int x = 0; x < 256; x++)
263 { 274 {
264 for (int y = 0; y < 256; y++) 275 for (int y = 0; y < 256; y++)
265 { 276 {
266 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); 277 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
267 } 278 }
268 } 279 }
269 280
270 rev = (int)row["Revision"]; 281 rev = (int) row["Revision"];
271 } 282 }
272 else 283 else
273 { 284 {
@@ -275,7 +286,7 @@ namespace OpenSim.DataStore.MonoSqlite
275 return null; 286 return null;
276 } 287 }
277 288
278 289
279 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); 290 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString());
280 } 291 }
281 292
@@ -284,12 +295,10 @@ namespace OpenSim.DataStore.MonoSqlite
284 295
285 public void RemoveLandObject(uint id) 296 public void RemoveLandObject(uint id)
286 { 297 {
287
288 } 298 }
289 299
290 public void StoreParcel(Land parcel) 300 public void StoreParcel(Land parcel)
291 { 301 {
292
293 } 302 }
294 303
295 public List<Land> LoadLandObjects() 304 public List<Land> LoadLandObjects()
@@ -299,7 +308,8 @@ namespace OpenSim.DataStore.MonoSqlite
299 308
300 public void Commit() 309 public void Commit()
301 { 310 {
302 lock (ds) { 311 lock (ds)
312 {
303 primDa.Update(ds, "prims"); 313 primDa.Update(ds, "prims");
304 shapeDa.Update(ds, "primshapes"); 314 shapeDa.Update(ds, "primshapes");
305 terrainDa.Update(ds, "terrain"); 315 terrainDa.Update(ds, "terrain");
@@ -320,7 +330,7 @@ namespace OpenSim.DataStore.MonoSqlite
320 * 330 *
321 **********************************************************************/ 331 **********************************************************************/
322 332
323 private void createCol(DataTable dt, string name, System.Type type) 333 private void createCol(DataTable dt, string name, Type type)
324 { 334 {
325 DataColumn col = new DataColumn(name, type); 335 DataColumn col = new DataColumn(name, type);
326 dt.Columns.Add(col); 336 dt.Columns.Add(col);
@@ -330,9 +340,9 @@ namespace OpenSim.DataStore.MonoSqlite
330 { 340 {
331 DataTable terrain = new DataTable("terrain"); 341 DataTable terrain = new DataTable("terrain");
332 342
333 createCol(terrain, "RegionUUID", typeof(System.String)); 343 createCol(terrain, "RegionUUID", typeof (String));
334 createCol(terrain, "Revision", typeof(System.Int32)); 344 createCol(terrain, "Revision", typeof (Int32));
335 createCol(terrain, "Heightfield", typeof(System.Byte[])); 345 createCol(terrain, "Heightfield", typeof (Byte[]));
336 346
337 return terrain; 347 return terrain;
338 } 348 }
@@ -341,52 +351,52 @@ namespace OpenSim.DataStore.MonoSqlite
341 { 351 {
342 DataTable prims = new DataTable("prims"); 352 DataTable prims = new DataTable("prims");
343 353
344 createCol(prims, "UUID", typeof(System.String)); 354 createCol(prims, "UUID", typeof (String));
345 createCol(prims, "RegionUUID", typeof(System.String)); 355 createCol(prims, "RegionUUID", typeof (String));
346 createCol(prims, "ParentID", typeof(System.Int32)); 356 createCol(prims, "ParentID", typeof (Int32));
347 createCol(prims, "CreationDate", typeof(System.Int32)); 357 createCol(prims, "CreationDate", typeof (Int32));
348 createCol(prims, "Name", typeof(System.String)); 358 createCol(prims, "Name", typeof (String));
349 createCol(prims, "SceneGroupID", typeof(System.String)); 359 createCol(prims, "SceneGroupID", typeof (String));
350 // various text fields 360 // various text fields
351 createCol(prims, "Text", typeof(System.String)); 361 createCol(prims, "Text", typeof (String));
352 createCol(prims, "Description", typeof(System.String)); 362 createCol(prims, "Description", typeof (String));
353 createCol(prims, "SitName", typeof(System.String)); 363 createCol(prims, "SitName", typeof (String));
354 createCol(prims, "TouchName", typeof(System.String)); 364 createCol(prims, "TouchName", typeof (String));
355 // permissions 365 // permissions
356 createCol(prims, "ObjectFlags", typeof(System.Int32)); 366 createCol(prims, "ObjectFlags", typeof (Int32));
357 createCol(prims, "CreatorID", typeof(System.String)); 367 createCol(prims, "CreatorID", typeof (String));
358 createCol(prims, "OwnerID", typeof(System.String)); 368 createCol(prims, "OwnerID", typeof (String));
359 createCol(prims, "GroupID", typeof(System.String)); 369 createCol(prims, "GroupID", typeof (String));
360 createCol(prims, "LastOwnerID", typeof(System.String)); 370 createCol(prims, "LastOwnerID", typeof (String));
361 createCol(prims, "OwnerMask", typeof(System.Int32)); 371 createCol(prims, "OwnerMask", typeof (Int32));
362 createCol(prims, "NextOwnerMask", typeof(System.Int32)); 372 createCol(prims, "NextOwnerMask", typeof (Int32));
363 createCol(prims, "GroupMask", typeof(System.Int32)); 373 createCol(prims, "GroupMask", typeof (Int32));
364 createCol(prims, "EveryoneMask", typeof(System.Int32)); 374 createCol(prims, "EveryoneMask", typeof (Int32));
365 createCol(prims, "BaseMask", typeof(System.Int32)); 375 createCol(prims, "BaseMask", typeof (Int32));
366 // vectors 376 // vectors
367 createCol(prims, "PositionX", typeof(System.Double)); 377 createCol(prims, "PositionX", typeof (Double));
368 createCol(prims, "PositionY", typeof(System.Double)); 378 createCol(prims, "PositionY", typeof (Double));
369 createCol(prims, "PositionZ", typeof(System.Double)); 379 createCol(prims, "PositionZ", typeof (Double));
370 createCol(prims, "GroupPositionX", typeof(System.Double)); 380 createCol(prims, "GroupPositionX", typeof (Double));
371 createCol(prims, "GroupPositionY", typeof(System.Double)); 381 createCol(prims, "GroupPositionY", typeof (Double));
372 createCol(prims, "GroupPositionZ", typeof(System.Double)); 382 createCol(prims, "GroupPositionZ", typeof (Double));
373 createCol(prims, "VelocityX", typeof(System.Double)); 383 createCol(prims, "VelocityX", typeof (Double));
374 createCol(prims, "VelocityY", typeof(System.Double)); 384 createCol(prims, "VelocityY", typeof (Double));
375 createCol(prims, "VelocityZ", typeof(System.Double)); 385 createCol(prims, "VelocityZ", typeof (Double));
376 createCol(prims, "AngularVelocityX", typeof(System.Double)); 386 createCol(prims, "AngularVelocityX", typeof (Double));
377 createCol(prims, "AngularVelocityY", typeof(System.Double)); 387 createCol(prims, "AngularVelocityY", typeof (Double));
378 createCol(prims, "AngularVelocityZ", typeof(System.Double)); 388 createCol(prims, "AngularVelocityZ", typeof (Double));
379 createCol(prims, "AccelerationX", typeof(System.Double)); 389 createCol(prims, "AccelerationX", typeof (Double));
380 createCol(prims, "AccelerationY", typeof(System.Double)); 390 createCol(prims, "AccelerationY", typeof (Double));
381 createCol(prims, "AccelerationZ", typeof(System.Double)); 391 createCol(prims, "AccelerationZ", typeof (Double));
382 // quaternions 392 // quaternions
383 createCol(prims, "RotationX", typeof(System.Double)); 393 createCol(prims, "RotationX", typeof (Double));
384 createCol(prims, "RotationY", typeof(System.Double)); 394 createCol(prims, "RotationY", typeof (Double));
385 createCol(prims, "RotationZ", typeof(System.Double)); 395 createCol(prims, "RotationZ", typeof (Double));
386 createCol(prims, "RotationW", typeof(System.Double)); 396 createCol(prims, "RotationW", typeof (Double));
387 397
388 // Add in contraints 398 // Add in contraints
389 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 399 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
390 400
391 return prims; 401 return prims;
392 } 402 }
@@ -394,40 +404,40 @@ namespace OpenSim.DataStore.MonoSqlite
394 private DataTable createShapeTable() 404 private DataTable createShapeTable()
395 { 405 {
396 DataTable shapes = new DataTable("primshapes"); 406 DataTable shapes = new DataTable("primshapes");
397 createCol(shapes, "UUID", typeof(System.String)); 407 createCol(shapes, "UUID", typeof (String));
398 // shape is an enum 408 // shape is an enum
399 createCol(shapes, "Shape", typeof(System.Int32)); 409 createCol(shapes, "Shape", typeof (Int32));
400 // vectors 410 // vectors
401 createCol(shapes, "ScaleX", typeof(System.Double)); 411 createCol(shapes, "ScaleX", typeof (Double));
402 createCol(shapes, "ScaleY", typeof(System.Double)); 412 createCol(shapes, "ScaleY", typeof (Double));
403 createCol(shapes, "ScaleZ", typeof(System.Double)); 413 createCol(shapes, "ScaleZ", typeof (Double));
404 // paths 414 // paths
405 createCol(shapes, "PCode", typeof(System.Int32)); 415 createCol(shapes, "PCode", typeof (Int32));
406 createCol(shapes, "PathBegin", typeof(System.Int32)); 416 createCol(shapes, "PathBegin", typeof (Int32));
407 createCol(shapes, "PathEnd", typeof(System.Int32)); 417 createCol(shapes, "PathEnd", typeof (Int32));
408 createCol(shapes, "PathScaleX", typeof(System.Int32)); 418 createCol(shapes, "PathScaleX", typeof (Int32));
409 createCol(shapes, "PathScaleY", typeof(System.Int32)); 419 createCol(shapes, "PathScaleY", typeof (Int32));
410 createCol(shapes, "PathShearX", typeof(System.Int32)); 420 createCol(shapes, "PathShearX", typeof (Int32));
411 createCol(shapes, "PathShearY", typeof(System.Int32)); 421 createCol(shapes, "PathShearY", typeof (Int32));
412 createCol(shapes, "PathSkew", typeof(System.Int32)); 422 createCol(shapes, "PathSkew", typeof (Int32));
413 createCol(shapes, "PathCurve", typeof(System.Int32)); 423 createCol(shapes, "PathCurve", typeof (Int32));
414 createCol(shapes, "PathRadiusOffset", typeof(System.Int32)); 424 createCol(shapes, "PathRadiusOffset", typeof (Int32));
415 createCol(shapes, "PathRevolutions", typeof(System.Int32)); 425 createCol(shapes, "PathRevolutions", typeof (Int32));
416 createCol(shapes, "PathTaperX", typeof(System.Int32)); 426 createCol(shapes, "PathTaperX", typeof (Int32));
417 createCol(shapes, "PathTaperY", typeof(System.Int32)); 427 createCol(shapes, "PathTaperY", typeof (Int32));
418 createCol(shapes, "PathTwist", typeof(System.Int32)); 428 createCol(shapes, "PathTwist", typeof (Int32));
419 createCol(shapes, "PathTwistBegin", typeof(System.Int32)); 429 createCol(shapes, "PathTwistBegin", typeof (Int32));
420 // profile 430 // profile
421 createCol(shapes, "ProfileBegin", typeof(System.Int32)); 431 createCol(shapes, "ProfileBegin", typeof (Int32));
422 createCol(shapes, "ProfileEnd", typeof(System.Int32)); 432 createCol(shapes, "ProfileEnd", typeof (Int32));
423 createCol(shapes, "ProfileCurve", typeof(System.Int32)); 433 createCol(shapes, "ProfileCurve", typeof (Int32));
424 createCol(shapes, "ProfileHollow", typeof(System.Int32)); 434 createCol(shapes, "ProfileHollow", typeof (Int32));
425 // text TODO: this isn't right, but I'm not sure the right 435 // text TODO: this isn't right, but I'm not sure the right
426 // way to specify this as a blob atm 436 // way to specify this as a blob atm
427 createCol(shapes, "Texture", typeof(System.Byte[])); 437 createCol(shapes, "Texture", typeof (Byte[]));
428 createCol(shapes, "ExtraParams", typeof(System.Byte[])); 438 createCol(shapes, "ExtraParams", typeof (Byte[]));
429 439
430 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 440 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
431 441
432 return shapes; 442 return shapes;
433 } 443 }
@@ -446,23 +456,23 @@ namespace OpenSim.DataStore.MonoSqlite
446 // interesting has to be done to actually get these values 456 // interesting has to be done to actually get these values
447 // back out. Not enough time to figure it out yet. 457 // back out. Not enough time to figure it out yet.
448 SceneObjectPart prim = new SceneObjectPart(); 458 SceneObjectPart prim = new SceneObjectPart();
449 prim.UUID = new LLUUID((String)row["UUID"]); 459 prim.UUID = new LLUUID((String) row["UUID"]);
450 // explicit conversion of integers is required, which sort 460 // explicit conversion of integers is required, which sort
451 // of sucks. No idea if there is a shortcut here or not. 461 // of sucks. No idea if there is a shortcut here or not.
452 prim.ParentID = Convert.ToUInt32(row["ParentID"]); 462 prim.ParentID = Convert.ToUInt32(row["ParentID"]);
453 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 463 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
454 prim.Name = (String)row["Name"]; 464 prim.Name = (String) row["Name"];
455 // various text fields 465 // various text fields
456 prim.Text = (String)row["Text"]; 466 prim.Text = (String) row["Text"];
457 prim.Description = (String)row["Description"]; 467 prim.Description = (String) row["Description"];
458 prim.SitName = (String)row["SitName"]; 468 prim.SitName = (String) row["SitName"];
459 prim.TouchName = (String)row["TouchName"]; 469 prim.TouchName = (String) row["TouchName"];
460 // permissions 470 // permissions
461 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 471 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
462 prim.CreatorID = new LLUUID((String)row["CreatorID"]); 472 prim.CreatorID = new LLUUID((String) row["CreatorID"]);
463 prim.OwnerID = new LLUUID((String)row["OwnerID"]); 473 prim.OwnerID = new LLUUID((String) row["OwnerID"]);
464 prim.GroupID = new LLUUID((String)row["GroupID"]); 474 prim.GroupID = new LLUUID((String) row["GroupID"]);
465 prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); 475 prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]);
466 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 476 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
467 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 477 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
468 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 478 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -510,8 +520,8 @@ namespace OpenSim.DataStore.MonoSqlite
510 row["RegionUUID"] = regionUUID; 520 row["RegionUUID"] = regionUUID;
511 row["Revision"] = rev; 521 row["Revision"] = rev;
512 522
513 System.IO.MemoryStream str = new System.IO.MemoryStream(65536 * sizeof(double)); 523 MemoryStream str = new MemoryStream(65536*sizeof (double));
514 System.IO.BinaryWriter bw = new System.IO.BinaryWriter(str); 524 BinaryWriter bw = new BinaryWriter(str);
515 525
516 // TODO: COMPATIBILITY - Add byte-order conversions 526 // TODO: COMPATIBILITY - Add byte-order conversions
517 for (int x = 0; x < 256; x++) 527 for (int x = 0; x < 256; x++)
@@ -599,8 +609,8 @@ namespace OpenSim.DataStore.MonoSqlite
599 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 609 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
600 // text TODO: this isn't right] = but I'm not sure the right 610 // text TODO: this isn't right] = but I'm not sure the right
601 // way to specify this as a blob atm 611 // way to specify this as a blob atm
602 s.TextureEntry = (byte[])row["Texture"]; 612 s.TextureEntry = (byte[]) row["Texture"];
603 s.ExtraParams = (byte[])row["ExtraParams"]; 613 s.ExtraParams = (byte[]) row["ExtraParams"];
604 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 614 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
605 // string texture = encoding.GetString((Byte[])row["Texture"]); 615 // string texture = encoding.GetString((Byte[])row["Texture"]);
606 // if (!texture.StartsWith("<")) 616 // if (!texture.StartsWith("<"))
@@ -751,7 +761,8 @@ namespace OpenSim.DataStore.MonoSqlite
751 foreach (DataColumn col in dt.Columns) 761 foreach (DataColumn col in dt.Columns)
752 { 762 {
753 if (subsql.Length > 0) 763 if (subsql.Length > 0)
754 { // a map function would rock so much here 764 {
765 // a map function would rock so much here
755 subsql += ", "; 766 subsql += ", ";
756 } 767 }
757 subsql += col.ColumnName + "= :" + col.ColumnName; 768 subsql += col.ColumnName + "= :" + col.ColumnName;
@@ -778,7 +789,8 @@ namespace OpenSim.DataStore.MonoSqlite
778 foreach (DataColumn col in dt.Columns) 789 foreach (DataColumn col in dt.Columns)
779 { 790 {
780 if (subsql.Length > 0) 791 if (subsql.Length > 0)
781 { // a map function would rock so much here 792 {
793 // a map function would rock so much here
782 subsql += ",\n"; 794 subsql += ",\n";
783 } 795 }
784 subsql += col.ColumnName + " " + sqliteType(col.DataType); 796 subsql += col.ColumnName + " " + sqliteType(col.DataType);
@@ -812,7 +824,7 @@ namespace OpenSim.DataStore.MonoSqlite
812 /// for us. 824 /// for us.
813 ///</summary> 825 ///</summary>
814 ///<returns>a built sqlite parameter</returns> 826 ///<returns>a built sqlite parameter</returns>
815 private SqliteParameter createSqliteParameter(string name, System.Type type) 827 private SqliteParameter createSqliteParameter(string name, Type type)
816 { 828 {
817 SqliteParameter param = new SqliteParameter(); 829 SqliteParameter param = new SqliteParameter();
818 param.ParameterName = ":" + name; 830 param.ParameterName = ":" + name;
@@ -831,7 +843,7 @@ namespace OpenSim.DataStore.MonoSqlite
831 da.UpdateCommand.Connection = conn; 843 da.UpdateCommand.Connection = conn;
832 844
833 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); 845 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
834 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 846 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
835 delete.Connection = conn; 847 delete.Connection = conn;
836 da.DeleteCommand = delete; 848 da.DeleteCommand = delete;
837 } 849 }
@@ -851,7 +863,7 @@ namespace OpenSim.DataStore.MonoSqlite
851 da.UpdateCommand.Connection = conn; 863 da.UpdateCommand.Connection = conn;
852 864
853 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); 865 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
854 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 866 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
855 delete.Connection = conn; 867 delete.Connection = conn;
856 da.DeleteCommand = delete; 868 da.DeleteCommand = delete;
857 } 869 }
@@ -871,8 +883,9 @@ namespace OpenSim.DataStore.MonoSqlite
871 { 883 {
872 pcmd.ExecuteNonQuery(); 884 pcmd.ExecuteNonQuery();
873 } 885 }
874 catch (SqliteSyntaxException) { 886 catch (SqliteSyntaxException)
875 MainLog.Instance.Warn("SQLITE","Primitives Table Already Exists"); 887 {
888 MainLog.Instance.Warn("SQLITE", "Primitives Table Already Exists");
876 } 889 }
877 890
878 try 891 try
@@ -912,7 +925,7 @@ namespace OpenSim.DataStore.MonoSqlite
912 sDa.Fill(tmpDS, "primshapes"); 925 sDa.Fill(tmpDS, "primshapes");
913 tDa.Fill(tmpDS, "terrain"); 926 tDa.Fill(tmpDS, "terrain");
914 } 927 }
915 catch (Mono.Data.SqliteClient.SqliteSyntaxException) 928 catch (SqliteSyntaxException)
916 { 929 {
917 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 930 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
918 InitDB(conn); 931 InitDB(conn);
@@ -957,27 +970,27 @@ namespace OpenSim.DataStore.MonoSqlite
957 970
958 private DbType dbtypeFromType(Type type) 971 private DbType dbtypeFromType(Type type)
959 { 972 {
960 if (type == typeof(System.String)) 973 if (type == typeof (String))
961 { 974 {
962 return DbType.String; 975 return DbType.String;
963 } 976 }
964 else if (type == typeof(System.Int32)) 977 else if (type == typeof (Int32))
965 { 978 {
966 return DbType.Int32; 979 return DbType.Int32;
967 } 980 }
968 else if (type == typeof(System.Double)) 981 else if (type == typeof (Double))
969 { 982 {
970 return DbType.Double; 983 return DbType.Double;
971 } 984 }
972 else if (type == typeof(System.Byte)) 985 else if (type == typeof (Byte))
973 { 986 {
974 return DbType.Byte; 987 return DbType.Byte;
975 } 988 }
976 else if (type == typeof(System.Double)) 989 else if (type == typeof (Double))
977 { 990 {
978 return DbType.Double; 991 return DbType.Double;
979 } 992 }
980 else if (type == typeof(System.Byte[])) 993 else if (type == typeof (Byte[]))
981 { 994 {
982 return DbType.Binary; 995 return DbType.Binary;
983 } 996 }
@@ -991,19 +1004,19 @@ namespace OpenSim.DataStore.MonoSqlite
991 // slightly differently. 1004 // slightly differently.
992 private string sqliteType(Type type) 1005 private string sqliteType(Type type)
993 { 1006 {
994 if (type == typeof(System.String)) 1007 if (type == typeof (String))
995 { 1008 {
996 return "varchar(255)"; 1009 return "varchar(255)";
997 } 1010 }
998 else if (type == typeof(System.Int32)) 1011 else if (type == typeof (Int32))
999 { 1012 {
1000 return "integer"; 1013 return "integer";
1001 } 1014 }
1002 else if (type == typeof(System.Double)) 1015 else if (type == typeof (Double))
1003 { 1016 {
1004 return "float"; 1017 return "float";
1005 } 1018 }
1006 else if (type == typeof(System.Byte[])) 1019 else if (type == typeof (Byte[]))
1007 { 1020 {
1008 return "blob"; 1021 return "blob";
1009 } 1022 }
@@ -1013,4 +1026,4 @@ namespace OpenSim.DataStore.MonoSqlite
1013 } 1026 }
1014 } 1027 }
1015 } 1028 }
1016} 1029} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
index f726ea2..4e1f71e 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
@@ -26,21 +26,16 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.LandManagement;
35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Framework.Console;
37using libsecondlife; 30using libsecondlife;
31using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.LandManagement;
33using OpenSim.Region.Environment.Scenes;
38 34
39namespace OpenSim.DataStore.NullStorage 35namespace OpenSim.DataStore.NullStorage
40{ 36{
41 public class NullDataStore : IRegionDataStore 37 public class NullDataStore : IRegionDataStore
42 { 38 {
43
44 public void Initialise(string dbfile, string dbname) 39 public void Initialise(string dbfile, string dbname)
45 { 40 {
46 return; 41 return;
@@ -48,12 +43,10 @@ namespace OpenSim.DataStore.NullStorage
48 43
49 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 44 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
50 { 45 {
51
52 } 46 }
53 47
54 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 48 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
55 { 49 {
56
57 } 50 }
58 51
59 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) 52 public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
@@ -63,7 +56,6 @@ namespace OpenSim.DataStore.NullStorage
63 56
64 public void StoreTerrain(double[,] ter, LLUUID regionID) 57 public void StoreTerrain(double[,] ter, LLUUID regionID)
65 { 58 {
66
67 } 59 }
68 60
69 public double[,] LoadTerrain(LLUUID regionID) 61 public double[,] LoadTerrain(LLUUID regionID)
@@ -73,12 +65,10 @@ namespace OpenSim.DataStore.NullStorage
73 65
74 public void RemoveLandObject(uint id) 66 public void RemoveLandObject(uint id)
75 { 67 {
76
77 } 68 }
78 69
79 public void StoreParcel(Land land) 70 public void StoreParcel(Land land)
80 { 71 {
81
82 } 72 }
83 73
84 public List<Land> LoadLandObjects() 74 public List<Land> LoadLandObjects()
@@ -88,7 +78,6 @@ namespace OpenSim.DataStore.NullStorage
88 78
89 public void Shutdown() 79 public void Shutdown()
90 { 80 {
91
92 } 81 }
93 } 82 }
94} 83} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
index fd86315..7608202 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.DataStore.NullStorage")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.DataStore.NullStorage")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.DataStore.NullStorage")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.DataStore.NullStorage")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b4a1656d-de22-4080-a970-fd8166acbf16")] 24
25[assembly : Guid("b4a1656d-de22-4080-a970-fd8166acbf16")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices;
31// 33//
32// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below: 35// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")] 36
35[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
index e1c3191..e531f01 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OpenSim.Region.Terrain.BasicTerrain")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OpenSim.Region.Terrain.BasicTerrain")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")] 51
52[assembly : Guid("3263f5b5-0a41-4ed5-91a2-9baaaeecc849")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -56,5 +60,6 @@ using System.Runtime.InteropServices;
56// 60//
57// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 62// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 63
60[assembly: AssemblyFileVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index c8c6e51..bbbb4d7 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -29,11 +29,11 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using System.Globalization;
32using System.IO; 33using System.IO;
34using System.Threading;
33using libTerrain; 35using libTerrain;
34using OpenJPEGNet; 36using OpenJPEGNet;
35using OpenSim.Framework.Interfaces;
36using System.Globalization;
37using OpenSim.Framework; 37using OpenSim.Framework;
38 38
39namespace OpenSim.Region.Terrain 39namespace OpenSim.Region.Terrain
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Terrain
51 51
52 public class TerrainEngine 52 public class TerrainEngine
53 { 53 {
54 public static System.Threading.Mutex fileIOLock = new System.Threading.Mutex(); 54 public static Mutex fileIOLock = new Mutex();
55 55
56 /// <summary> 56 /// <summary>
57 /// Plugin library for scripts 57 /// Plugin library for scripts
@@ -95,12 +95,13 @@ namespace OpenSim.Region.Terrain
95 /// </summary> 95 /// </summary>
96 public int tainted; 96 public int tainted;
97 97
98 int w, h; 98 private int w, h;
99 99
100 /// <summary> 100 /// <summary>
101 /// Used to determine what offset to use when loading singular heightmaps across multiple sims 101 /// Used to determine what offset to use when loading singular heightmaps across multiple sims
102 /// </summary> 102 /// </summary>
103 private int offsetX; 103 private int offsetX;
104
104 private int offsetY; 105 private int offsetY;
105 106
106 107
@@ -139,13 +140,13 @@ namespace OpenSim.Region.Terrain
139 140
140 public bool Tainted(int x, int y) 141 public bool Tainted(int x, int y)
141 { 142 {
142 return (heightmap.diff[x / 16, y / 16] != 0); 143 return (heightmap.diff[x/16, y/16] != 0);
143 } 144 }
144 145
145 public void ResetTaint() 146 public void ResetTaint()
146 { 147 {
147 tainted = 0; 148 tainted = 0;
148 heightmap.diff = new int[w / 16, h / 16]; 149 heightmap.diff = new int[w/16,h/16];
149 } 150 }
150 151
151 //Testing to see if moving the TerraForming packet handling code into here works well 152 //Testing to see if moving the TerraForming packet handling code into here works well
@@ -158,40 +159,40 @@ namespace OpenSim.Region.Terrain
158 /// <param name="action">The action to be performed</param> 159 /// <param name="action">The action to be performed</param>
159 /// <param name="north">Distance from the north border where the cursor is located</param> 160 /// <param name="north">Distance from the north border where the cursor is located</param>
160 /// <param name="west">Distance from the west border where the cursor is located</param> 161 /// <param name="west">Distance from the west border where the cursor is located</param>
161 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) 162 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
163 IClientAPI remoteUser)
162 { 164 {
163
164 // Shiny. 165 // Shiny.
165 double size = (double)(1 << brushsize); 166 double size = (double) (1 << brushsize);
166 167
167 switch (action) 168 switch (action)
168 { 169 {
169 case 0: 170 case 0:
170 // flatten terrain 171 // flatten terrain
171 this.FlattenTerrain(west, north, size, (double)seconds / 5.0); 172 FlattenTerrain(west, north, size, (double) seconds/5.0);
172 break; 173 break;
173 case 1: 174 case 1:
174 // raise terrain 175 // raise terrain
175 this.RaiseTerrain(west, north, size, (double)seconds / 5.0); 176 RaiseTerrain(west, north, size, (double) seconds/5.0);
176 break; 177 break;
177 case 2: 178 case 2:
178 //lower terrain 179 //lower terrain
179 this.LowerTerrain(west, north, size, (double)seconds / 5.0); 180 LowerTerrain(west, north, size, (double) seconds/5.0);
180 break; 181 break;
181 case 3: 182 case 3:
182 // smooth terrain 183 // smooth terrain
183 this.SmoothTerrain(west, north, size, (double)seconds / 5.0); 184 SmoothTerrain(west, north, size, (double) seconds/5.0);
184 break; 185 break;
185 case 4: 186 case 4:
186 // noise 187 // noise
187 this.NoiseTerrain(west, north, size, (double)seconds / 5.0); 188 NoiseTerrain(west, north, size, (double) seconds/5.0);
188 break; 189 break;
189 case 5: 190 case 5:
190 // revert 191 // revert
191 this.RevertTerrain(west, north, size, (double)seconds / 5.0); 192 RevertTerrain(west, north, size, (double) seconds/5.0);
192 break; 193 break;
193 194
194 // CLIENT EXTENSIONS GO HERE 195 // CLIENT EXTENSIONS GO HERE
195 case 128: 196 case 128:
196 // erode-thermal 197 // erode-thermal
197 break; 198 break;
@@ -207,9 +208,9 @@ namespace OpenSim.Region.Terrain
207 { 208 {
208 for (int y = 0; y < 16; y++) 209 for (int y = 0; y < 16; y++)
209 { 210 {
210 if (this.Tainted(x * 16, y * 16)) 211 if (Tainted(x*16, y*16))
211 { 212 {
212 remoteUser.SendLayerData(x, y, this.GetHeights1D()); 213 remoteUser.SendLayerData(x, y, GetHeights1D());
213 } 214 }
214 } 215 }
215 } 216 }
@@ -249,12 +250,12 @@ namespace OpenSim.Region.Terrain
249 /// <returns>A float[65536] array containing the heightmap</returns> 250 /// <returns>A float[65536] array containing the heightmap</returns>
250 public float[] GetHeights1D() 251 public float[] GetHeights1D()
251 { 252 {
252 float[] heights = new float[w * h]; 253 float[] heights = new float[w*h];
253 int i; 254 int i;
254 255
255 for (i = 0; i < w * h; i++) 256 for (i = 0; i < w*h; i++)
256 { 257 {
257 heights[i] = (float)heightmap.map[i % w, i / w]; 258 heights[i] = (float) heightmap.map[i%w, i/w];
258 } 259 }
259 260
260 return heights; 261 return heights;
@@ -266,13 +267,13 @@ namespace OpenSim.Region.Terrain
266 /// <returns>An array of 256,256 values containing the heightmap</returns> 267 /// <returns>An array of 256,256 values containing the heightmap</returns>
267 public float[,] GetHeights2D() 268 public float[,] GetHeights2D()
268 { 269 {
269 float[,] heights = new float[w, h]; 270 float[,] heights = new float[w,h];
270 int x, y; 271 int x, y;
271 for (x = 0; x < w; x++) 272 for (x = 0; x < w; x++)
272 { 273 {
273 for (y = 0; y < h; y++) 274 for (y = 0; y < h; y++)
274 { 275 {
275 heights[x, y] = (float)heightmap.map[x, y]; 276 heights[x, y] = (float) heightmap.map[x, y];
276 } 277 }
277 } 278 }
278 return heights; 279 return heights;
@@ -294,9 +295,9 @@ namespace OpenSim.Region.Terrain
294 public void GetHeights1D(float[] heights) 295 public void GetHeights1D(float[] heights)
295 { 296 {
296 int i; 297 int i;
297 for (i = 0; i < w * h; i++) 298 for (i = 0; i < w*h; i++)
298 { 299 {
299 heightmap.map[i % w, i / w] = heights[i]; 300 heightmap.map[i%w, i/w] = heights[i];
300 } 301 }
301 302
302 tainted++; 303 tainted++;
@@ -313,7 +314,7 @@ namespace OpenSim.Region.Terrain
313 { 314 {
314 for (y = 0; y < h; y++) 315 for (y = 0; y < h; y++)
315 { 316 {
316 heightmap.Set(x, y, (double)heights[x, y]); 317 heightmap.Set(x, y, (double) heights[x, y]);
317 } 318 }
318 } 319 }
319 SaveRevertMap(); 320 SaveRevertMap();
@@ -376,28 +377,36 @@ namespace OpenSim.Region.Terrain
376 377
377 try 378 try
378 { 379 {
379
380 switch (command) 380 switch (command)
381 { 381 {
382 case "help": 382 case "help":
383 resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; 383 resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n";
384 resultText += "terrain hills <type> <number of hills> <min height> <max height> <island t/f> <additive t/f> <noisy t/f>\n"; 384 resultText +=
385 "terrain hills <type> <number of hills> <min height> <max height> <island t/f> <additive t/f> <noisy t/f>\n";
385 resultText += " type should be spheres, blocks, cones, or squared\n"; 386 resultText += " type should be spheres, blocks, cones, or squared\n";
386 resultText += "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block"; 387 resultText +=
388 "terrain voronoi <points> <blocksize> - generates a worley fractal with X points per block";
387 resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; 389 resultText += "terrain seed <seed> - sets the random seed value to <seed>\n";
388 resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n"; 390 resultText +=
389 resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n"; 391 "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64', 'RAW' or 'IMG'\n";
390 resultText += "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n"; 392 resultText +=
391 resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; 393 "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32', 'F64', 'PNG', 'RAW' or 'HIRAW'\n";
394 resultText +=
395 "terrain save grdmap <filename> <gradient map> - creates a PNG snapshot of the region using a named gradient map\n";
396 resultText +=
397 "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n";
392 resultText += "terrain fill <val> - fills a terrain at the specified height\n"; 398 resultText += "terrain fill <val> - fills a terrain at the specified height\n";
393 resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest t/f> <fluid dynamics t/f>\n"; 399 resultText +=
400 "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest t/f> <fluid dynamics t/f>\n";
394 resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; 401 resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
395 resultText += "terrain erode hydraulic <rain> <evaporation> <solubility> <frequency> <rounds>\n"; 402 resultText += "terrain erode hydraulic <rain> <evaporation> <solubility> <frequency> <rounds>\n";
396 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; 403 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
397 resultText += "terrain revert - reverts the terrain to the stored original\n"; 404 resultText += "terrain revert - reverts the terrain to the stored original\n";
398 resultText += "terrain bake - saves the current terrain into the revert map\n"; 405 resultText += "terrain bake - saves the current terrain into the revert map\n";
399 resultText += "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n"; 406 resultText +=
400 resultText += "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n"; 407 "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n";
408 resultText +=
409 "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n";
401 foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters) 410 foreach (KeyValuePair<string, ITerrainFilter> filter in customFilters.filters)
402 { 411 {
403 resultText += filter.Value.Help(); 412 resultText += filter.Value.Help();
@@ -466,8 +475,8 @@ namespace OpenSim.Region.Terrain
466 475
467 case "load": 476 case "load":
468 string filenameL = args[2].Replace("%name%", simName); 477 string filenameL = args[2].Replace("%name%", simName);
469 filenameL = filenameL.Replace("%x%", this.offsetX.ToString()); 478 filenameL = filenameL.Replace("%x%", offsetX.ToString());
470 filenameL = filenameL.Replace("%y%", this.offsetY.ToString()); 479 filenameL = filenameL.Replace("%y%", offsetY.ToString());
471 480
472 switch (args[1].ToLower()) 481 switch (args[1].ToLower())
473 { 482 {
@@ -499,11 +508,11 @@ namespace OpenSim.Region.Terrain
499 { 508 {
500 case "f32": 509 case "f32":
501 LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), 510 LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]),
502 Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); 511 Convert.ToInt32(args[5]), Convert.ToInt32(args[6]));
503 break; 512 break;
504 case "img": 513 case "img":
505 LoadFromFileIMG(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), 514 LoadFromFileIMG(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]),
506 Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); 515 Convert.ToInt32(args[5]), Convert.ToInt32(args[6]));
507 break; 516 break;
508 default: 517 default:
509 resultText = "Unknown or unsupported image or data format"; 518 resultText = "Unknown or unsupported image or data format";
@@ -513,8 +522,8 @@ namespace OpenSim.Region.Terrain
513 522
514 case "save": 523 case "save":
515 string filename = args[2].Replace("%name%", simName); 524 string filename = args[2].Replace("%name%", simName);
516 filename = filename.Replace("%x%", this.offsetX.ToString()); 525 filename = filename.Replace("%x%", offsetX.ToString());
517 filename = filename.Replace("%y%", this.offsetY.ToString()); 526 filename = filename.Replace("%y%", offsetY.ToString());
518 527
519 switch (args[1].ToLower()) 528 switch (args[1].ToLower())
520 { 529 {
@@ -589,15 +598,20 @@ namespace OpenSim.Region.Terrain
589 { 598 {
590 case "aerobic": 599 case "aerobic":
591 // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest 600 // WindSpeed, PickupMinimum,DropMinimum,Carry,Rounds,Lowest
592 heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), Convert.ToBoolean(args[8])); 601 heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]),
602 Convert.ToDouble(args[4]), Convert.ToDouble(args[5]),
603 Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]),
604 Convert.ToBoolean(args[8]));
593 break; 605 break;
594 case "thermal": 606 case "thermal":
595 heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); 607 heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]),
608 Convert.ToDouble(args[4]));
596 break; 609 break;
597 case "hydraulic": 610 case "hydraulic":
598 Channel rainMap = new Channel(w, h); 611 Channel rainMap = new Channel(w, h);
599 rainMap.Fill(Convert.ToDouble(args[2])); 612 rainMap.Fill(Convert.ToDouble(args[2]));
600 heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); 613 heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]),
614 Convert.ToInt32(args[5]), Convert.ToInt32(args[6]));
601 break; 615 break;
602 default: 616 default:
603 resultText = "Unknown erosion type"; 617 resultText = "Unknown erosion type";
@@ -624,8 +638,10 @@ namespace OpenSim.Region.Terrain
624 if (args.GetLength(0) > 2) 638 if (args.GetLength(0) > 2)
625 { 639 {
626 int.TryParse(args[2].ToString(), out count); 640 int.TryParse(args[2].ToString(), out count);
627 double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeMin); 641 double.TryParse(args[3].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
628 double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out sizeRange); 642 out sizeMin);
643 double.TryParse(args[4].ToString(), NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
644 out sizeRange);
629 bool.TryParse(args[5].ToString(), out island); 645 bool.TryParse(args[5].ToString(), out island);
630 bool.TryParse(args[6].ToString(), out additive); 646 bool.TryParse(args[6].ToString(), out additive);
631 bool.TryParse(args[7].ToString(), out noisy); 647 bool.TryParse(args[7].ToString(), out noisy);
@@ -669,7 +685,7 @@ namespace OpenSim.Region.Terrain
669 /// <param name="max">Maximum value of the new array</param> 685 /// <param name="max">Maximum value of the new array</param>
670 public void SetRange(float min, float max) 686 public void SetRange(float min, float max)
671 { 687 {
672 heightmap.Normalise((double)min, (double)max); 688 heightmap.Normalise((double) min, (double) max);
673 tainted++; 689 tainted++;
674 } 690 }
675 691
@@ -713,7 +729,7 @@ namespace OpenSim.Region.Terrain
713 { 729 {
714 for (x = 0; x < w; x++) 730 for (x = 0; x < w; x++)
715 { 731 {
716 heightmap.map[x, y] = (double)bs.ReadSingle(); 732 heightmap.map[x, y] = (double) bs.ReadSingle();
717 } 733 }
718 } 734 }
719 735
@@ -736,11 +752,10 @@ namespace OpenSim.Region.Terrain
736 fileIOLock.WaitOne(); 752 fileIOLock.WaitOne();
737 try 753 try
738 { 754 {
755 int sectionToLoadX = ((offsetX - lowerboundX)*w);
756 int sectionToLoadY = ((offsetY - lowerboundY)*h);
739 757
740 int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w); 758 double[,] tempMap = new double[dimensionX,dimensionY];
741 int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h);
742
743 double[,] tempMap = new double[dimensionX, dimensionY];
744 759
745 FileInfo file = new FileInfo(filename); 760 FileInfo file = new FileInfo(filename);
746 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 761 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
@@ -751,7 +766,7 @@ namespace OpenSim.Region.Terrain
751 { 766 {
752 for (y = 0; y < dimensionY; y++) 767 for (y = 0; y < dimensionY; y++)
753 { 768 {
754 tempMap[x, y] = (double)bs.ReadSingle(); 769 tempMap[x, y] = (double) bs.ReadSingle();
755 } 770 }
756 } 771 }
757 772
@@ -784,19 +799,19 @@ namespace OpenSim.Region.Terrain
784 /// <param name="lowerboundY">Where sim coords begin for this patch</param> 799 /// <param name="lowerboundY">Where sim coords begin for this patch</param>
785 public void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY) 800 public void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY)
786 { 801 {
787 int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w); 802 int sectionToLoadX = ((offsetX - lowerboundX)*w);
788 int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h); 803 int sectionToLoadY = ((offsetY - lowerboundY)*h);
789 804
790 double[,] tempMap = new double[dimensionX, dimensionY]; 805 double[,] tempMap = new double[dimensionX,dimensionY];
791 806
792 System.Drawing.Bitmap lgrBmp = new Bitmap(filename); 807 Bitmap lgrBmp = new Bitmap(filename);
793 808
794 int x, y; 809 int x, y;
795 for (x = 0; x < dimensionX; x++) 810 for (x = 0; x < dimensionX; x++)
796 { 811 {
797 for (y = 0; y < dimensionY; y++) 812 for (y = 0; y < dimensionY; y++)
798 { 813 {
799 tempMap[x, y] = (float)lgrBmp.GetPixel(x, y).GetBrightness(); 814 tempMap[x, y] = (float) lgrBmp.GetPixel(x, y).GetBrightness();
800 } 815 }
801 } 816 }
802 817
@@ -826,7 +841,7 @@ namespace OpenSim.Region.Terrain
826 { 841 {
827 for (x = 0; x < w; x++) 842 for (x = 0; x < w; x++)
828 { 843 {
829 heightmap.map[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); 844 heightmap.map[x, y] = (double) bs.ReadByte()*((double) bs.ReadByte()/127.0);
830 bs.ReadBytes(11); // Advance the stream to next bytes. 845 bs.ReadBytes(11); // Advance the stream to next bytes.
831 } 846 }
832 } 847 }
@@ -875,7 +890,7 @@ namespace OpenSim.Region.Terrain
875 { 890 {
876 for (x = 0; x < w; x++) 891 for (x = 0; x < w; x++)
877 { 892 {
878 bs.Write((float)heightmap.Get(x, y)); 893 bs.Write((float) heightmap.Get(x, y));
879 } 894 }
880 } 895 }
881 896
@@ -897,27 +912,27 @@ namespace OpenSim.Region.Terrain
897 int x, y; 912 int x, y;
898 913
899 // Used for the 'green' channel. 914 // Used for the 'green' channel.
900 byte avgMultiplier = (byte)heightmap.Avg(); 915 byte avgMultiplier = (byte) heightmap.Avg();
901 byte backupMultiplier = (byte)revertmap.Avg(); 916 byte backupMultiplier = (byte) revertmap.Avg();
902 917
903 // Limit the multiplier so it can represent points >64m. 918 // Limit the multiplier so it can represent points >64m.
904 if (avgMultiplier > 196) 919 if (avgMultiplier > 196)
905 avgMultiplier = 196; 920 avgMultiplier = 196;
906 if(backupMultiplier > 196) 921 if (backupMultiplier > 196)
907 backupMultiplier = 196; 922 backupMultiplier = 196;
908 // Make sure it's at least one to prevent a div by zero 923 // Make sure it's at least one to prevent a div by zero
909 if (avgMultiplier < 1) 924 if (avgMultiplier < 1)
910 avgMultiplier = 1; 925 avgMultiplier = 1;
911 if(backupMultiplier < 1) 926 if (backupMultiplier < 1)
912 backupMultiplier = 1; 927 backupMultiplier = 1;
913 928
914 for (y = 0; y < h; y++) 929 for (y = 0; y < h; y++)
915 { 930 {
916 for (x = 0; x < h; x++) 931 for (x = 0; x < h; x++)
917 { 932 {
918 byte red = (byte)(heightmap.Get(x, y) / ((double)avgMultiplier / 128.0)); 933 byte red = (byte) (heightmap.Get(x, y)/((double) avgMultiplier/128.0));
919 byte green = avgMultiplier; 934 byte green = avgMultiplier;
920 byte blue = (byte)watermap.Get(x, y); 935 byte blue = (byte) watermap.Get(x, y);
921 byte alpha1 = 0; // Land Parcels 936 byte alpha1 = 0; // Land Parcels
922 byte alpha2 = 0; // For Sale Land 937 byte alpha2 = 0; // For Sale Land
923 byte alpha3 = 0; // Public Edit Object 938 byte alpha3 = 0; // Public Edit Object
@@ -926,7 +941,7 @@ namespace OpenSim.Region.Terrain
926 byte alpha6 = 255; // Flying Allowed 941 byte alpha6 = 255; // Flying Allowed
927 byte alpha7 = 255; // Create Landmark 942 byte alpha7 = 255; // Create Landmark
928 byte alpha8 = 255; // Outside Scripts 943 byte alpha8 = 255; // Outside Scripts
929 byte alpha9 = (byte)(revertmap.Get(x, y) / ((double)backupMultiplier / 128.0)); 944 byte alpha9 = (byte) (revertmap.Get(x, y)/((double) backupMultiplier/128.0));
930 byte alpha10 = backupMultiplier; 945 byte alpha10 = backupMultiplier;
931 946
932 binStream.Write(red); 947 binStream.Write(red);
@@ -966,7 +981,7 @@ namespace OpenSim.Region.Terrain
966 { 981 {
967 for (j = 0; j < 256; j++) 982 for (j = 0; j < 256; j++)
968 { 983 {
969 lookupHeightTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); 984 lookupHeightTable[i + (j*256)] = ((double) i*((double) j/127.0));
970 } 985 }
971 } 986 }
972 987
@@ -988,9 +1003,9 @@ namespace OpenSim.Region.Terrain
988 } 1003 }
989 } 1004 }
990 1005
991 byte red = (byte)(index & 0xFF); 1006 byte red = (byte) (index & 0xFF);
992 byte green = (byte)((index >> 8) & 0xFF); 1007 byte green = (byte) ((index >> 8) & 0xFF);
993 byte blue = (byte)watermap.Get(x, y); 1008 byte blue = (byte) watermap.Get(x, y);
994 byte alpha1 = 0; // Land Parcels 1009 byte alpha1 = 0; // Land Parcels
995 byte alpha2 = 0; // For Sale Land 1010 byte alpha2 = 0; // For Sale Land
996 byte alpha3 = 0; // Public Edit Object 1011 byte alpha3 = 0; // Public Edit Object
@@ -1140,7 +1155,7 @@ namespace OpenSim.Region.Terrain
1140 smoothed.Smooth(amount); 1155 smoothed.Smooth(amount);
1141 1156
1142 Channel mask = new Channel(); 1157 Channel mask = new Channel();
1143 mask.Raise(rx,ry,size,amount); 1158 mask.Raise(rx, ry, size, amount);
1144 1159
1145 heightmap.Blend(smoothed, mask); 1160 heightmap.Blend(smoothed, mask);
1146 } 1161 }
@@ -1221,8 +1236,7 @@ namespace OpenSim.Region.Terrain
1221 { 1236 {
1222 Bitmap bmp = TerrainToBitmap(gradientmap); 1237 Bitmap bmp = TerrainToBitmap(gradientmap);
1223 1238
1224 imageData = OpenJPEG.EncodeFromImage(bmp, true ); 1239 imageData = OpenJPEG.EncodeFromImage(bmp, true);
1225
1226 } 1240 }
1227 catch (Exception e) 1241 catch (Exception e)
1228 { 1242 {
@@ -1252,12 +1266,11 @@ namespace OpenSim.Region.Terrain
1252 for (int x = 0; x < copy.w; x++) 1266 for (int x = 0; x < copy.w; x++)
1253 { 1267 {
1254 // 512 is the largest possible height before colours clamp 1268 // 512 is the largest possible height before colours clamp
1255 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(x, y) / 512.0), 0.0) * (pallete - 1)); 1269 int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1));
1256 bmp.SetPixel(x, y, colours[colorindex]); 1270 bmp.SetPixel(x, y, colours[colorindex]);
1257 } 1271 }
1258 } 1272 }
1259 return bmp; 1273 return bmp;
1260 } 1274 }
1261
1262 } 1275 }
1263} 1276} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
index 2ae55f0..8c29c6a 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
@@ -87,11 +87,12 @@ namespace OpenSim.Region.Terrain
87 { 87 {
88 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) 88 foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
89 { 89 {
90 Type testInterface = pluginType.GetInterface("ITerrainFilter",true); 90 Type testInterface = pluginType.GetInterface("ITerrainFilter", true);
91 91
92 if (testInterface != null) 92 if (testInterface != null)
93 { 93 {
94 ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); 94 ITerrainFilter filter =
95 (ITerrainFilter) compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
95 96
96 string filterName = filter.Register(); 97 string filterName = filter.Register();
97 Console.WriteLine("Plugin: " + filterName + " loaded."); 98 Console.WriteLine("Plugin: " + filterName + " loaded.");
@@ -107,7 +108,6 @@ namespace OpenSim.Region.Terrain
107 } 108 }
108 } 109 }
109 } 110 }
110
111 } 111 }
112 112
113 public void LoadFilterCSharp(string filename) 113 public void LoadFilterCSharp(string filename)
@@ -122,4 +122,4 @@ namespace OpenSim.Region.Terrain
122 LoadFilter(compiler, filename); 122 LoadFilter(compiler, filename);
123 } 123 }
124 } 124 }
125} 125} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
index 8359f8e..8b5fbed 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
@@ -26,18 +26,16 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Drawing; 29using System.Drawing;
30using System.Drawing.Imaging;
33 31
34namespace libTerrain 32namespace libTerrain
35{ 33{
36 class Raster 34 internal class Raster
37 { 35 {
38 int w; 36 private int w;
39 int h; 37 private int h;
40 Bitmap bmp; 38 private Bitmap bmp;
41 39
42 /// <summary> 40 /// <summary>
43 /// Creates a new Raster channel for use with bitmap or GDI functions 41 /// Creates a new Raster channel for use with bitmap or GDI functions
@@ -48,7 +46,7 @@ namespace libTerrain
48 { 46 {
49 w = width; 47 w = width;
50 h = height; 48 h = height;
51 bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 49 bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
52 } 50 }
53 51
54 /// <summary> 52 /// <summary>
@@ -65,7 +63,7 @@ namespace libTerrain
65 for (y = 0; y < bmp.Height; y++) 63 for (y = 0; y < bmp.Height; y++)
66 { 64 {
67 Color val = bmp.GetPixel(x, y); 65 Color val = bmp.GetPixel(x, y);
68 chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; 66 chan.map[x, y] = (((double) val.R + (double) val.G + (double) val.B)/3.0)/255.0;
69 } 67 }
70 } 68 }
71 69
@@ -86,7 +84,7 @@ namespace libTerrain
86 sf.LineAlignment = StringAlignment.Center; 84 sf.LineAlignment = StringAlignment.Center;
87 85
88 Graphics gd = Graphics.FromImage(bmp); 86 Graphics gd = Graphics.FromImage(bmp);
89 gd.DrawString(txt, new Font(font, (float)size), new SolidBrush(Color.White), area, sf); 87 gd.DrawString(txt, new Font(font, (float) size), new SolidBrush(Color.White), area, sf);
90 } 88 }
91 } 89 }
92} 90} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
index 093bfb1..4cb70c2 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
@@ -26,12 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System; 29 /* Channel
30using System.Collections.Generic;
31using System.Text;
32
33
34/* Channel
35 * A channel is a single heightmap array 30 * A channel is a single heightmap array
36 * */ 31 * */
37 32
@@ -50,17 +45,16 @@ namespace libTerrain
50 { 45 {
51 w = 256; 46 w = 256;
52 h = 256; 47 h = 256;
53 map = new double[w, h]; 48 map = new double[w,h];
54 diff = new int[(int)(w / 16), (int)(h / 16)]; 49 diff = new int[(int) (w/16),(int) (h/16)];
55 } 50 }
56 51
57 public Channel(int width, int height) 52 public Channel(int width, int height)
58 { 53 {
59 w = width; 54 w = width;
60 h = height; 55 h = height;
61 map = new double[w, h]; 56 map = new double[w,h];
62 diff = new int[(int)(w / 16), (int)(h / 16)]; 57 diff = new int[(int) (w/16),(int) (h/16)];
63 } 58 }
64
65 } 59 }
66} 60} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
index 730f206..2ad784b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
@@ -28,8 +28,6 @@
28 28
29 29
30using System; 30using System;
31using System.Collections.Generic;
32using System.Text;
33 31
34namespace libTerrain 32namespace libTerrain
35{ 33{
@@ -39,6 +37,7 @@ namespace libTerrain
39 { 37 {
40 return w; 38 return w;
41 } 39 }
40
42 public int GetHeight() 41 public int GetHeight()
43 { 42 {
44 return h; 43 return h;
@@ -47,7 +46,7 @@ namespace libTerrain
47 public Channel Copy() 46 public Channel Copy()
48 { 47 {
49 Channel x = new Channel(w, h); 48 Channel x = new Channel(w, h);
50 x.map = (double[,])this.map.Clone(); 49 x.map = (double[,]) map.Clone();
51 return x; 50 return x;
52 } 51 }
53 52
@@ -58,9 +57,9 @@ namespace libTerrain
58 57
59 public void SetDiff(int val) 58 public void SetDiff(int val)
60 { 59 {
61 for (int x = 0; x < w / 16; x++) 60 for (int x = 0; x < w/16; x++)
62 { 61 {
63 for (int y = 0; y < h / 16; y++) 62 for (int y = 0; y < h/16; y++)
64 { 63 {
65 diff[x, y] = val; 64 diff[x, y] = val;
66 } 65 }
@@ -69,7 +68,7 @@ namespace libTerrain
69 68
70 public void SetDiff(int x, int y) 69 public void SetDiff(int x, int y)
71 { 70 {
72 diff[x / 16, y / 16]++; 71 diff[x/16, y/16]++;
73 } 72 }
74 73
75 public void Set(int x, int y, double val) 74 public void Set(int x, int y, double val)
@@ -124,10 +123,10 @@ namespace libTerrain
124 y = 0.0; 123 y = 0.0;
125 124
126 int stepSize = 1; 125 int stepSize = 1;
127 double h00 = Get((int)x, (int)y); 126 double h00 = Get((int) x, (int) y);
128 double h10 = Get((int)x + stepSize, (int)y); 127 double h10 = Get((int) x + stepSize, (int) y);
129 double h01 = Get((int)x, (int)y + stepSize); 128 double h01 = Get((int) x, (int) y + stepSize);
130 double h11 = Get((int)x + stepSize, (int)y + stepSize); 129 double h11 = Get((int) x + stepSize, (int) y + stepSize);
131 double h1 = h00; 130 double h1 = h00;
132 double h2 = h10; 131 double h2 = h10;
133 double h3 = h01; 132 double h3 = h01;
@@ -136,9 +135,9 @@ namespace libTerrain
136 double a10 = h2 - h1; 135 double a10 = h2 - h1;
137 double a01 = h3 - h1; 136 double a01 = h3 - h1;
138 double a11 = h1 - h2 - h3 + h4; 137 double a11 = h1 - h2 - h3 + h4;
139 double partialx = x - (int)x; 138 double partialx = x - (int) x;
140 double partialz = y - (int)y; 139 double partialz = y - (int) y;
141 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); 140 double hi = a00 + (a10*partialx) + (a01*partialz) + (a11*partialx*partialz);
142 return hi; 141 return hi;
143 } 142 }
144 143
@@ -159,7 +158,7 @@ namespace libTerrain
159 { 158 {
160 SetDiff(x, y); 159 SetDiff(x, y);
161 160
162 map[x % w, y % h] = val; 161 map[x%w, y%h] = val;
163 } 162 }
164 163
165 public void SetWrapClip(int x, int y, double val) 164 public void SetWrapClip(int x, int y, double val)
@@ -171,7 +170,7 @@ namespace libTerrain
171 if (val < 0.0) 170 if (val < 0.0)
172 val = 0.0; 171 val = 0.0;
173 172
174 map[x % w, y % h] = val; 173 map[x%w, y%h] = val;
175 } 174 }
176 175
177 public void Fill(double val) 176 public void Fill(double val)
@@ -255,7 +254,7 @@ namespace libTerrain
255 254
256 public double Avg() 255 public double Avg()
257 { 256 {
258 return Sum() / (w * h); 257 return Sum()/(w*h);
259 } 258 }
260 259
261 public bool ContainsNaN() 260 public bool ContainsNaN()
@@ -274,4 +273,4 @@ namespace libTerrain
274 return false; 273 return false;
275 } 274 }
276 } 275 }
277} 276} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
index 45bb06b..e753847 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
@@ -28,8 +28,6 @@
28 28
29 29
30using System; 30using System;
31using System.Collections.Generic;
32using System.Text;
33 31
34namespace libTerrain 32namespace libTerrain
35{ 33{
@@ -58,12 +56,12 @@ namespace libTerrain
58 56
59 // Establish the average height under the area 57 // Establish the average height under the area
60 Channel newmap = new Channel(w, h); 58 Channel newmap = new Channel(w, h);
61 newmap.map = (double[,])map.Clone(); 59 newmap.map = (double[,]) map.Clone();
62 60
63 newmap *= temp; 61 newmap *= temp;
64 62
65 double total_terrain = newmap.Sum(); 63 double total_terrain = newmap.Sum();
66 double avg_height = total_terrain / total_mod; 64 double avg_height = total_terrain/total_mod;
67 65
68 // Create a flat terrain using the average height 66 // Create a flat terrain using the average height
69 Channel flat = new Channel(w, h); 67 Channel flat = new Channel(w, h);
@@ -72,7 +70,6 @@ namespace libTerrain
72 // Blend the current terrain with the average height terrain 70 // Blend the current terrain with the average height terrain
73 // using the "raised" empty terrain as a mask 71 // using the "raised" empty terrain as a mask
74 Blend(flat, temp); 72 Blend(flat, temp);
75
76 } 73 }
77 74
78 private void FlattenFast(double rx, double ry, double size, double amount) 75 private void FlattenFast(double rx, double ry, double size, double amount)
@@ -81,10 +78,10 @@ namespace libTerrain
81 double avg = 0; 78 double avg = 0;
82 double div = 0; 79 double div = 0;
83 80
84 int minX = Math.Max(0, (int)(rx - (size + 1))); 81 int minX = Math.Max(0, (int) (rx - (size + 1)));
85 int maxX = Math.Min(w, (int)(rx + (size + 1))); 82 int maxX = Math.Min(w, (int) (rx + (size + 1)));
86 int minY = Math.Max(0, (int)(ry - (size + 1))); 83 int minY = Math.Max(0, (int) (ry - (size + 1)));
87 int maxY = Math.Min(h, (int)(ry + (size + 1))); 84 int maxY = Math.Min(h, (int) (ry + (size + 1)));
88 85
89 for (x = minX; x < maxX; x++) 86 for (x = minX; x < maxX; x++)
90 { 87 {
@@ -92,17 +89,17 @@ namespace libTerrain
92 { 89 {
93 double z = size; 90 double z = size;
94 z *= z; 91 z *= z;
95 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 92 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
96 93
97 if (z < 0) 94 if (z < 0)
98 z = 0; 95 z = 0;
99 96
100 avg += z * amount; 97 avg += z*amount;
101 div += z; 98 div += z;
102 } 99 }
103 } 100 }
104 101
105 double height = avg / div; 102 double height = avg/div;
106 103
107 for (x = minX; x < maxX; x++) 104 for (x = minX; x < maxX; x++)
108 { 105 {
@@ -110,7 +107,7 @@ namespace libTerrain
110 { 107 {
111 double z = size; 108 double z = size;
112 z *= z; 109 z *= z;
113 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 110 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
114 111
115 if (z < 0) 112 if (z < 0)
116 z = 0; 113 z = 0;
@@ -123,19 +120,19 @@ namespace libTerrain
123 public void Flatten(Channel mask, double amount) 120 public void Flatten(Channel mask, double amount)
124 { 121 {
125 // Generate the mask 122 // Generate the mask
126 Channel temp = mask * amount; 123 Channel temp = mask*amount;
127 temp.Clip(0, 1); // Cut off out-of-bounds values 124 temp.Clip(0, 1); // Cut off out-of-bounds values
128 125
129 double total_mod = temp.Sum(); 126 double total_mod = temp.Sum();
130 127
131 // Establish the average height under the area 128 // Establish the average height under the area
132 Channel map = new Channel(w, h); 129 Channel map = new Channel(w, h);
133 map.map = (double[,])this.map.Clone(); 130 map.map = (double[,]) this.map.Clone();
134 131
135 map *= temp; 132 map *= temp;
136 133
137 double total_terrain = map.Sum(); 134 double total_terrain = map.Sum();
138 double avg_height = total_terrain / total_mod; 135 double avg_height = total_terrain/total_mod;
139 136
140 // Create a flat terrain using the average height 137 // Create a flat terrain using the average height
141 Channel flat = new Channel(w, h); 138 Channel flat = new Channel(w, h);
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
index 15631df..9e8f3a4 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
@@ -28,8 +28,6 @@
28 28
29 29
30using System; 30using System;
31using System.Collections.Generic;
32using System.Text;
33 31
34namespace libTerrain 32namespace libTerrain
35{ 33{
@@ -63,12 +61,12 @@ namespace libTerrain
63 { 61 {
64 double z = size; 62 double z = size;
65 z *= z; 63 z *= z;
66 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 64 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
67 65
68 if (z < 0) 66 if (z < 0)
69 z = 0; 67 z = 0;
70 68
71 Set(x, y, map[x, y] + (z * amount)); 69 Set(x, y, map[x, y] + (z*amount));
72 } 70 }
73 } 71 }
74 } 72 }
@@ -88,12 +86,12 @@ namespace libTerrain
88 for (y = 0; y < h; y++) 86 for (y = 0; y < h; y++)
89 { 87 {
90 double z = size; 88 double z = size;
91 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 89 z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry)));
92 90
93 if (z < 0) 91 if (z < 0)
94 z = 0; 92 z = 0;
95 93
96 Set(x, y, map[x, y] + (z * amount)); 94 Set(x, y, map[x, y] + (z*amount));
97 } 95 }
98 } 96 }
99 } 97 }
@@ -126,12 +124,12 @@ namespace libTerrain
126 { 124 {
127 double z = size; 125 double z = size;
128 z *= z; 126 z *= z;
129 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 127 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
130 128
131 if (z < 0) 129 if (z < 0)
132 z = 0; 130 z = 0;
133 131
134 Set(x, y, map[x, y] - (z * amount)); 132 Set(x, y, map[x, y] - (z*amount));
135 } 133 }
136 } 134 }
137 } 135 }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
index 5949759..b4eda47 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
@@ -27,9 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging;
33 32
34namespace libTerrain 33namespace libTerrain
35{ 34{
@@ -48,7 +47,7 @@ namespace libTerrain
48 for (y = 0; y < bit.Height; y++) 47 for (y = 0; y < bit.Height; y++)
49 { 48 {
50 Color val = bit.GetPixel(x, y); 49 Color val = bit.GetPixel(x, y);
51 chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; 50 chan.map[x, y] = (((double) val.R + (double) val.G + (double) val.B)/3.0)/255.0;
52 } 51 }
53 } 52 }
54 53
@@ -57,21 +56,21 @@ namespace libTerrain
57 56
58 public void SaveImage(string filename) 57 public void SaveImage(string filename)
59 { 58 {
60 Channel outmap = this.Copy(); 59 Channel outmap = Copy();
61 outmap.Normalise(); 60 outmap.Normalise();
62 61
63 Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 62 Bitmap bit = new Bitmap(w, h, PixelFormat.Format24bppRgb);
64 int x, y; 63 int x, y;
65 for (x = 0; x < w; x++) 64 for (x = 0; x < w; x++)
66 { 65 {
67 for (y = 0; y < h; y++) 66 for (y = 0; y < h; y++)
68 { 67 {
69 int val = Math.Min(255, (int)(outmap.map[x,y] * 255)); 68 int val = Math.Min(255, (int) (outmap.map[x, y]*255));
70 Color col = Color.FromArgb(val,val,val); 69 Color col = Color.FromArgb(val, val, val);
71 bit.SetPixel(x, y, col); 70 bit.SetPixel(x, y, col);
72 } 71 }
73 } 72 }
74 bit.Save(filename); 73 bit.Save(filename);
75 } 74 }
76 } 75 }
77} 76} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
index 3a9b7f7..65badd1 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -60,19 +58,19 @@ namespace libTerrain
60 } 58 }
61 if (val < 512) 59 if (val < 512)
62 { 60 {
63 ret[0] = (val % 256); 61 ret[0] = (val%256);
64 ret[1] = 255; 62 ret[1] = 255;
65 return ret; 63 return ret;
66 } 64 }
67 if (val < 768) 65 if (val < 768)
68 { 66 {
69 ret[0] = 255; 67 ret[0] = 255;
70 ret[1] = 255 - (val % 256); 68 ret[1] = 255 - (val%256);
71 return ret; 69 return ret;
72 } 70 }
73 if (val < 1024) 71 if (val < 1024)
74 { 72 {
75 ret[0] = 255 - (val % 256); 73 ret[0] = 255 - (val%256);
76 ret[1] = 255; 74 ret[1] = 255;
77 return ret; 75 return ret;
78 } 76 }
@@ -100,7 +98,7 @@ namespace libTerrain
100 { 98 {
101 for (int y = 0; y < h; y++) 99 for (int y = 0; y < h; y++)
102 { 100 {
103 double miny = Tools.LinearInterpolate(a[1], b[1], (double)x / (double)w); 101 double miny = Tools.LinearInterpolate(a[1], b[1], (double) x/(double) w);
104 102
105 if (v >= 0.5) 103 if (v >= 0.5)
106 { 104 {
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
index 8a1b048..b6e2491 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
@@ -26,15 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 partial class Channel 31 partial class Channel
36 { 32 {
37
38 public void GradientCube() 33 public void GradientCube()
39 { 34 {
40 SetDiff(); 35 SetDiff();
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
index 7cea800..6806748 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -44,7 +42,8 @@ namespace libTerrain
44 /// <param name="island">Whether to bias hills towards the center of the map</param> 42 /// <param name="island">Whether to bias hills towards the center of the map</param>
45 /// <param name="additive">Whether to add hills together or to pick the largest value</param> 43 /// <param name="additive">Whether to add hills together or to pick the largest value</param>
46 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> 44 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
47 public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) 45 public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive,
46 bool noisy)
48 { 47 {
49 SetDiff(); 48 SetDiff();
50 49
@@ -55,20 +54,20 @@ namespace libTerrain
55 54
56 for (i = 0; i < number; i++) 55 for (i = 0; i < number; i++)
57 { 56 {
58 double rx = Math.Min(255.0, random.NextDouble() * w); 57 double rx = Math.Min(255.0, random.NextDouble()*w);
59 double ry = Math.Min(255.0, random.NextDouble() * h); 58 double ry = Math.Min(255.0, random.NextDouble()*h);
60 double rand = random.NextDouble(); 59 double rand = random.NextDouble();
61 60
62 if (island) 61 if (island)
63 { 62 {
64 // Move everything towards the center 63 // Move everything towards the center
65 rx -= w / 2; 64 rx -= w/2;
66 rx /= 2; 65 rx /= 2;
67 rx += w / 2; 66 rx += w/2;
68 67
69 ry -= h / 2; 68 ry -= h/2;
70 ry /= 2; 69 ry /= 2;
71 ry += h / 2; 70 ry += h/2;
72 } 71 }
73 72
74 for (x = 0; x < w; x++) 73 for (x = 0; x < w; x++)
@@ -78,9 +77,9 @@ namespace libTerrain
78 if (noisy) 77 if (noisy)
79 rand = random.NextDouble(); 78 rand = random.NextDouble();
80 79
81 double z = (scale_min + (scale_range * rand)); 80 double z = (scale_min + (scale_range*rand));
82 z *= z; 81 z *= z;
83 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 82 z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry));
84 83
85 if (z < 0) 84 if (z < 0)
86 z = 0; 85 z = 0;
@@ -121,20 +120,20 @@ namespace libTerrain
121 120
122 for (i = 0; i < number; i++) 121 for (i = 0; i < number; i++)
123 { 122 {
124 double rx = Math.Min(255.0, random.NextDouble() * w); 123 double rx = Math.Min(255.0, random.NextDouble()*w);
125 double ry = Math.Min(255.0, random.NextDouble() * h); 124 double ry = Math.Min(255.0, random.NextDouble()*h);
126 double rand = random.NextDouble(); 125 double rand = random.NextDouble();
127 126
128 if (island) 127 if (island)
129 { 128 {
130 // Move everything towards the center 129 // Move everything towards the center
131 rx -= w / 2; 130 rx -= w/2;
132 rx /= 2; 131 rx /= 2;
133 rx += w / 2; 132 rx += w/2;
134 133
135 ry -= h / 2; 134 ry -= h/2;
136 ry /= 2; 135 ry /= 2;
137 ry += h / 2; 136 ry += h/2;
138 } 137 }
139 138
140 for (x = 0; x < w; x++) 139 for (x = 0; x < w; x++)
@@ -144,8 +143,8 @@ namespace libTerrain
144 if (noisy) 143 if (noisy)
145 rand = random.NextDouble(); 144 rand = random.NextDouble();
146 145
147 double z = (scale_min + (scale_range * rand)); 146 double z = (scale_min + (scale_range*rand));
148 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 147 z -= Math.Sqrt(((x - rx)*(x - rx)) + ((y - ry)*(y - ry)));
149 148
150 if (z < 0) 149 if (z < 0)
151 z = 0; 150 z = 0;
@@ -176,20 +175,20 @@ namespace libTerrain
176 175
177 for (i = 0; i < number; i++) 176 for (i = 0; i < number; i++)
178 { 177 {
179 double rx = Math.Min(255.0, random.NextDouble() * w); 178 double rx = Math.Min(255.0, random.NextDouble()*w);
180 double ry = Math.Min(255.0, random.NextDouble() * h); 179 double ry = Math.Min(255.0, random.NextDouble()*h);
181 double rand = random.NextDouble(); 180 double rand = random.NextDouble();
182 181
183 if (island) 182 if (island)
184 { 183 {
185 // Move everything towards the center 184 // Move everything towards the center
186 rx -= w / 2; 185 rx -= w/2;
187 rx /= 2; 186 rx /= 2;
188 rx += w / 2; 187 rx += w/2;
189 188
190 ry -= h / 2; 189 ry -= h/2;
191 ry /= 2; 190 ry /= 2;
192 ry += h / 2; 191 ry += h/2;
193 } 192 }
194 193
195 for (x = 0; x < w; x++) 194 for (x = 0; x < w; x++)
@@ -199,8 +198,8 @@ namespace libTerrain
199 if (noisy) 198 if (noisy)
200 rand = random.NextDouble(); 199 rand = random.NextDouble();
201 200
202 double z = (scale_min + (scale_range * rand)); 201 double z = (scale_min + (scale_range*rand));
203 z -= Math.Abs(x-rx) + Math.Abs(y-ry); 202 z -= Math.Abs(x - rx) + Math.Abs(y - ry);
204 //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 203 //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry)));
205 204
206 if (z < 0) 205 if (z < 0)
@@ -221,7 +220,8 @@ namespace libTerrain
221 Normalise(); 220 Normalise();
222 } 221 }
223 222
224 public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) 223 public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive,
224 bool noisy)
225 { 225 {
226 SetDiff(); 226 SetDiff();
227 227
@@ -232,20 +232,20 @@ namespace libTerrain
232 232
233 for (i = 0; i < number; i++) 233 for (i = 0; i < number; i++)
234 { 234 {
235 double rx = Math.Min(255.0, random.NextDouble() * w); 235 double rx = Math.Min(255.0, random.NextDouble()*w);
236 double ry = Math.Min(255.0, random.NextDouble() * h); 236 double ry = Math.Min(255.0, random.NextDouble()*h);
237 double rand = random.NextDouble(); 237 double rand = random.NextDouble();
238 238
239 if (island) 239 if (island)
240 { 240 {
241 // Move everything towards the center 241 // Move everything towards the center
242 rx -= w / 2; 242 rx -= w/2;
243 rx /= 2; 243 rx /= 2;
244 rx += w / 2; 244 rx += w/2;
245 245
246 ry -= h / 2; 246 ry -= h/2;
247 ry /= 2; 247 ry /= 2;
248 ry += h / 2; 248 ry += h/2;
249 } 249 }
250 250
251 for (x = 0; x < w; x++) 251 for (x = 0; x < w; x++)
@@ -255,11 +255,11 @@ namespace libTerrain
255 if (noisy) 255 if (noisy)
256 rand = random.NextDouble(); 256 rand = random.NextDouble();
257 257
258 double z = (scale_min + (scale_range * rand)); 258 double z = (scale_min + (scale_range*rand));
259 z *= z * z * z; 259 z *= z*z*z;
260 double dx = Math.Abs(x - rx); 260 double dx = Math.Abs(x - rx);
261 double dy = Math.Abs(y - ry); 261 double dy = Math.Abs(y - ry);
262 z -= (dx * dx * dx * dx) + (dy * dy * dy * dy); 262 z -= (dx*dx*dx*dx) + (dy*dy*dy*dy);
263 263
264 if (z < 0) 264 if (z < 0)
265 z = 0; 265 z = 0;
@@ -278,6 +278,5 @@ namespace libTerrain
278 278
279 Normalise(); 279 Normalise();
280 } 280 }
281
282 } 281 }
283} 282} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
index 43ae37a..5d39cd5 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -53,4 +51,4 @@ namespace libTerrain
53 } 51 }
54 } 52 }
55 } 53 }
56} 54} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
index d7e0dcd..10eaf71 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32 31
33namespace libTerrain 32namespace libTerrain
34{ 33{
@@ -36,10 +35,10 @@ namespace libTerrain
36 { 35 {
37 private double[] CoordinatesToPolar(int x, int y) 36 private double[] CoordinatesToPolar(int x, int y)
38 { 37 {
39 double theta = Math.Atan2(x - (w / 2), y - (h / 2)); 38 double theta = Math.Atan2(x - (w/2), y - (h/2));
40 double rx = (double)x - ((double)w / 2); 39 double rx = (double) x - ((double) w/2);
41 double ry = (double)y - ((double)h / 2); 40 double ry = (double) y - ((double) h/2);
42 double r = Math.Sqrt((rx * rx) + (ry * ry)); 41 double r = Math.Sqrt((rx*rx) + (ry*ry));
43 42
44 double[] coords = new double[2]; 43 double[] coords = new double[2];
45 coords[0] = r; 44 coords[0] = r;
@@ -47,15 +46,16 @@ namespace libTerrain
47 return coords; 46 return coords;
48 } 47 }
49 48
50 public int[] PolarToCoordinates(double r, double theta) { 49 public int[] PolarToCoordinates(double r, double theta)
50 {
51 double nx; 51 double nx;
52 double ny; 52 double ny;
53 53
54 nx = (double)r * Math.Cos(theta); 54 nx = (double) r*Math.Cos(theta);
55 ny = (double)r * Math.Sin(theta); 55 ny = (double) r*Math.Sin(theta);
56 56
57 nx += w / 2; 57 nx += w/2;
58 ny += h / 2; 58 ny += h/2;
59 59
60 if (nx >= w) 60 if (nx >= w)
61 nx = w - 1; 61 nx = w - 1;
@@ -70,8 +70,8 @@ namespace libTerrain
70 ny = 0; 70 ny = 0;
71 71
72 int[] coords = new int[2]; 72 int[] coords = new int[2];
73 coords[0] = (int)nx; 73 coords[0] = (int) nx;
74 coords[1] = (int)ny; 74 coords[1] = (int) ny;
75 return coords; 75 return coords;
76 } 76 }
77 77
@@ -79,19 +79,19 @@ namespace libTerrain
79 { 79 {
80 SetDiff(); 80 SetDiff();
81 81
82 Channel n = this.Copy(); 82 Channel n = Copy();
83 83
84 int x, y; 84 int x, y;
85 for (x = 0; x < w; x++) 85 for (x = 0; x < w; x++)
86 { 86 {
87 for (y = 0; y < h; y++) 87 for (y = 0; y < h; y++)
88 { 88 {
89 double[] coords = CoordinatesToPolar(x,y); 89 double[] coords = CoordinatesToPolar(x, y);
90 90
91 coords[0] += w / 2.0; 91 coords[0] += w/2.0;
92 coords[1] += h / 2.0; 92 coords[1] += h/2.0;
93 93
94 map[x, y] = n.map[(int)coords[0] % n.w, (int)coords[1] % n.h]; 94 map[x, y] = n.map[(int) coords[0]%n.w, (int) coords[1]%n.h];
95 } 95 }
96 } 96 }
97 } 97 }
@@ -108,12 +108,13 @@ namespace libTerrain
108 r += incRadius; 108 r += incRadius;
109 theta += incAngle; 109 theta += incAngle;
110 110
111 int[] coords = PolarToCoordinates(r,theta); 111 int[] coords = PolarToCoordinates(r, theta);
112 Raise(coords[0], coords[1], 20, 1); 112 Raise(coords[0], coords[1], 20, 1);
113 } 113 }
114 } 114 }
115 115
116 public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, double[] c) 116 public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle,
117 double[] c)
117 { 118 {
118 SetDiff(); 119 SetDiff();
119 120
@@ -128,7 +129,7 @@ namespace libTerrain
128 theta += incAngle; 129 theta += incAngle;
129 130
130 int[] coords = PolarToCoordinates(r, theta); 131 int[] coords = PolarToCoordinates(r, theta);
131 points.Add(new Point2D(coords[0],coords[1])); 132 points.Add(new Point2D(coords[0], coords[1]));
132 } 133 }
133 134
134 VoronoiDiagram(points, c); 135 VoronoiDiagram(points, c);
@@ -145,9 +146,9 @@ namespace libTerrain
145 for (y = 0; y < h; y++) 146 for (y = 0; y < h; y++)
146 { 147 {
147 z++; 148 z++;
148 double dx = Math.Abs((w / 2) - x); 149 double dx = Math.Abs((w/2) - x);
149 double dy = Math.Abs((h / 2) - y); 150 double dy = Math.Abs((h/2) - y);
150 map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); 151 map[x, y] += Math.Sin(dx/wid) + Math.Cos(dy/hig);
151 } 152 }
152 } 153 }
153 Normalise(); 154 Normalise();
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
index e2f9560..0159b87 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32 31
33namespace libTerrain 32namespace libTerrain
34{ 33{
@@ -57,8 +56,8 @@ namespace libTerrain
57 { 56 {
58 for (i = 0; i < pointsPerBlock; i++) 57 for (i = 0; i < pointsPerBlock; i++)
59 { 58 {
60 double pX = x + (generator.NextDouble() * (double)blockSize); 59 double pX = x + (generator.NextDouble()*(double) blockSize);
61 double pY = y + (generator.NextDouble() * (double)blockSize); 60 double pY = y + (generator.NextDouble()*(double) blockSize);
62 61
63 points.Add(new Point2D(pX, pY)); 62 points.Add(new Point2D(pX, pY));
64 } 63 }
@@ -75,10 +74,10 @@ namespace libTerrain
75 for (i = 0; i < points.Count; i++) 74 for (i = 0; i < points.Count; i++)
76 { 75 {
77 double dx, dy; 76 double dx, dy;
78 dx = Math.Abs((double)x - points[i].x); 77 dx = Math.Abs((double) x - points[i].x);
79 dy = Math.Abs((double)y - points[i].y); 78 dy = Math.Abs((double) y - points[i].y);
80 79
81 distances[i] = (dx * dx + dy * dy); 80 distances[i] = (dx*dx + dy*dy);
82 } 81 }
83 82
84 Array.Sort(distances); 83 Array.Sort(distances);
@@ -92,7 +91,7 @@ namespace libTerrain
92 if (i >= points.Count) 91 if (i >= points.Count)
93 break; 92 break;
94 93
95 f += c[i] * distances[i]; 94 f += c[i]*distances[i];
96 } 95 }
97 96
98 map[x, y] = f; 97 map[x, y] = f;
@@ -119,10 +118,10 @@ namespace libTerrain
119 for (i = 0; i < points.Count; i++) 118 for (i = 0; i < points.Count; i++)
120 { 119 {
121 double dx, dy; 120 double dx, dy;
122 dx = Math.Abs((double)x - points[i].x); 121 dx = Math.Abs((double) x - points[i].x);
123 dy = Math.Abs((double)y - points[i].y); 122 dy = Math.Abs((double) y - points[i].y);
124 123
125 distances[i] = (dx * dx + dy * dy); 124 distances[i] = (dx*dx + dy*dy);
126 } 125 }
127 126
128 Array.Sort(distances); 127 Array.Sort(distances);
@@ -136,7 +135,7 @@ namespace libTerrain
136 if (i >= points.Count) 135 if (i >= points.Count)
137 break; 136 break;
138 137
139 f += c[i] * distances[i]; 138 f += c[i]*distances[i];
140 } 139 }
141 140
142 map[x, y] = f; 141 map[x, y] = f;
@@ -162,8 +161,8 @@ namespace libTerrain
162 { 161 {
163 for (i = 0; i < pointsPerBlock; i++) 162 for (i = 0; i < pointsPerBlock; i++)
164 { 163 {
165 double pX = x + (generator.NextDouble() * (double)blockSize); 164 double pX = x + (generator.NextDouble()*(double) blockSize);
166 double pY = y + (generator.NextDouble() * (double)blockSize); 165 double pY = y + (generator.NextDouble()*(double) blockSize);
167 166
168 points.Add(new Point2D(pX, pY)); 167 points.Add(new Point2D(pX, pY));
169 } 168 }
@@ -180,10 +179,10 @@ namespace libTerrain
180 for (i = 0; i < points.Count; i++) 179 for (i = 0; i < points.Count; i++)
181 { 180 {
182 double dx, dy; 181 double dx, dy;
183 dx = Math.Abs((double)x - points[i].x); 182 dx = Math.Abs((double) x - points[i].x);
184 dy = Math.Abs((double)y - points[i].y); 183 dy = Math.Abs((double) y - points[i].y);
185 184
186 distances[i] = (dx * dx + dy * dy); 185 distances[i] = (dx*dx + dy*dy);
187 } 186 }
188 187
189 //Array.Sort(distances); 188 //Array.Sort(distances);
@@ -191,7 +190,7 @@ namespace libTerrain
191 double f = 0.0; 190 double f = 0.0;
192 191
193 double min = double.MaxValue; 192 double min = double.MaxValue;
194 for (int j = 0; j < distances.Length;j++ ) 193 for (int j = 0; j < distances.Length; j++)
195 { 194 {
196 if (distances[j] < min) 195 if (distances[j] < min)
197 { 196 {
@@ -211,4 +210,4 @@ namespace libTerrain
211 Normalise(); 210 Normalise();
212 } 211 }
213 } 212 }
214} 213} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
index 788134d..deb2e0e 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -54,18 +52,18 @@ namespace libTerrain
54 double rx, ry; 52 double rx, ry;
55 if (centerspawn) 53 if (centerspawn)
56 { 54 {
57 rx = w / 2.0; 55 rx = w/2.0;
58 ry = h / 2.0; 56 ry = h/2.0;
59 } 57 }
60 else 58 else
61 { 59 {
62 rx = random.NextDouble() * (w - 1); 60 rx = random.NextDouble()*(w - 1);
63 ry = random.NextDouble() * (h - 1); 61 ry = random.NextDouble()*(h - 1);
64 } 62 }
65 for (j = 0; j < rounds; j++) 63 for (j = 0; j < rounds; j++)
66 { 64 {
67 rx += (random.NextDouble() * movement) - (movement / 2.0); 65 rx += (random.NextDouble()*movement) - (movement/2.0);
68 ry += (random.NextDouble() * movement) - (movement / 2.0); 66 ry += (random.NextDouble()*movement) - (movement/2.0);
69 Raise(rx, ry, size, 1.0); 67 Raise(rx, ry, size, 1.0);
70 } 68 }
71 } 69 }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
index 0155791..24df5b9 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -49,13 +47,13 @@ namespace libTerrain
49 { 47 {
50 for (y = 0; y < h; y++) 48 for (y = 0; y < h; y++)
51 { 49 {
52 map[x, y] = (map[x, y] - min) * (1.0 / (max - min)); 50 map[x, y] = (map[x, y] - min)*(1.0/(max - min));
53 } 51 }
54 } 52 }
55 } 53 }
56 else 54 else
57 { 55 {
58 this.Fill(0.5); 56 Fill(0.5);
59 } 57 }
60 58
61 return this; 59 return this;
@@ -82,7 +80,7 @@ namespace libTerrain
82 { 80 {
83 if (min != max) 81 if (min != max)
84 { 82 {
85 double val = (map[x, y] - min) * (1.0 / max - min); 83 double val = (map[x, y] - min)*(1.0/max - min);
86 val *= maxv - minv; 84 val *= maxv - minv;
87 val += minv; 85 val += minv;
88 86
@@ -179,9 +177,9 @@ namespace libTerrain
179 SetDiff(); 177 SetDiff();
180 178
181 double area = amount; 179 double area = amount;
182 double step = amount / 4.0; 180 double step = amount/4.0;
183 181
184 double[,] manipulate = new double[w, h]; 182 double[,] manipulate = new double[w,h];
185 int x, y; 183 int x, y;
186 double n, l; 184 double n, l;
187 for (x = 0; x < w; x++) 185 for (x = 0; x < w; x++)
@@ -200,7 +198,7 @@ namespace libTerrain
200 } 198 }
201 } 199 }
202 200
203 manipulate[x, y] = average / avgsteps; 201 manipulate[x, y] = average/avgsteps;
204 } 202 }
205 } 203 }
206 map = manipulate; 204 map = manipulate;
@@ -211,7 +209,7 @@ namespace libTerrain
211 SetDiff(); 209 SetDiff();
212 210
213 // Simple pertubation filter 211 // Simple pertubation filter
214 double[,] manipulated = new double[w, h]; 212 double[,] manipulated = new double[w,h];
215 Random generator = new Random(seed); // Seeds FTW! 213 Random generator = new Random(seed); // Seeds FTW!
216 //double amount = 8.0; 214 //double amount = 8.0;
217 215
@@ -220,8 +218,8 @@ namespace libTerrain
220 { 218 {
221 for (y = 0; y < h; y++) 219 for (y = 0; y < h; y++)
222 { 220 {
223 double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); 221 double offset_x = (double) x + (generator.NextDouble()*amount) - (amount/2.0);
224 double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); 222 double offset_y = (double) y + (generator.NextDouble()*amount) - (amount/2.0);
225 double p = GetBilinearInterpolate(offset_x, offset_y); 223 double p = GetBilinearInterpolate(offset_x, offset_y);
226 manipulated[x, y] = p; 224 manipulated[x, y] = p;
227 } 225 }
@@ -232,7 +230,7 @@ namespace libTerrain
232 public void PertubationMask(Channel mask) 230 public void PertubationMask(Channel mask)
233 { 231 {
234 // Simple pertubation filter 232 // Simple pertubation filter
235 double[,] manipulated = new double[w, h]; 233 double[,] manipulated = new double[w,h];
236 Random generator = new Random(seed); // Seeds FTW! 234 Random generator = new Random(seed); // Seeds FTW!
237 //double amount = 8.0; 235 //double amount = 8.0;
238 236
@@ -244,8 +242,8 @@ namespace libTerrain
244 for (y = 0; y < h; y++) 242 for (y = 0; y < h; y++)
245 { 243 {
246 amount = mask.map[x, y]; 244 amount = mask.map[x, y];
247 double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); 245 double offset_x = (double) x + (generator.NextDouble()*amount) - (amount/2.0);
248 double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); 246 double offset_y = (double) y + (generator.NextDouble()*amount) - (amount/2.0);
249 247
250 if (offset_x > w) 248 if (offset_x > w)
251 offset_x = w - 1; 249 offset_x = w - 1;
@@ -267,7 +265,7 @@ namespace libTerrain
267 public void Distort(Channel mask, double str) 265 public void Distort(Channel mask, double str)
268 { 266 {
269 // Simple pertubation filter 267 // Simple pertubation filter
270 double[,] manipulated = new double[w, h]; 268 double[,] manipulated = new double[w,h];
271 269
272 double amount; 270 double amount;
273 271
@@ -277,8 +275,8 @@ namespace libTerrain
277 for (y = 0; y < h; y++) 275 for (y = 0; y < h; y++)
278 { 276 {
279 amount = mask.map[x, y]; 277 amount = mask.map[x, y];
280 double offset_x = (double)x + (amount * str) - (0.5 * str); 278 double offset_x = (double) x + (amount*str) - (0.5*str);
281 double offset_y = (double)y + (amount * str) - (0.5 * str); 279 double offset_y = (double) y + (amount*str) - (0.5*str);
282 280
283 if (offset_x > w) 281 if (offset_x > w)
284 offset_x = w - 1; 282 offset_x = w - 1;
@@ -295,13 +293,12 @@ namespace libTerrain
295 } 293 }
296 } 294 }
297 map = manipulated; 295 map = manipulated;
298
299 } 296 }
300 297
301 public void Distort(Channel mask, Channel mask2, double str) 298 public void Distort(Channel mask, Channel mask2, double str)
302 { 299 {
303 // Simple pertubation filter 300 // Simple pertubation filter
304 double[,] manipulated = new double[w, h]; 301 double[,] manipulated = new double[w,h];
305 302
306 double amountX; 303 double amountX;
307 double amountY; 304 double amountY;
@@ -313,8 +310,8 @@ namespace libTerrain
313 { 310 {
314 amountX = mask.map[x, y]; 311 amountX = mask.map[x, y];
315 amountY = mask2.map[x, y]; 312 amountY = mask2.map[x, y];
316 double offset_x = (double)x + (amountX * str) - (0.5 * str); 313 double offset_x = (double) x + (amountX*str) - (0.5*str);
317 double offset_y = (double)y + (amountY * str) - (0.5 * str); 314 double offset_y = (double) y + (amountY*str) - (0.5*str);
318 315
319 if (offset_x > w) 316 if (offset_x > w)
320 offset_x = w - 1; 317 offset_x = w - 1;
@@ -331,7 +328,6 @@ namespace libTerrain
331 } 328 }
332 } 329 }
333 map = manipulated; 330 map = manipulated;
334
335 } 331 }
336 332
337 public Channel Blend(Channel other, double amount) 333 public Channel Blend(Channel other, double amount)
@@ -360,4 +356,4 @@ namespace libTerrain
360 return this; 356 return this;
361 } 357 }
362 } 358 }
363} 359} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
index ca93c25..c8584e8 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -74,17 +72,18 @@ namespace libTerrain
74 /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> 72 /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param>
75 /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> 73 /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param>
76 /// <param name="lowest">Drop sediment at the lowest point?</param> 74 /// <param name="lowest">Drop sediment at the lowest point?</param>
77 public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) 75 public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry,
76 int rounds, bool lowest, bool usingFluidDynamics)
78 { 77 {
79 bool debugImages = false; 78 bool debugImages = false;
80 79
81 Channel wind = new Channel(w, h) ; 80 Channel wind = new Channel(w, h);
82 Channel sediment = new Channel(w, h); 81 Channel sediment = new Channel(w, h);
83 int x, y, i, j; 82 int x, y, i, j;
84 83
85 this.Normalise(); 84 Normalise();
86 85
87 wind = this.Copy(); 86 wind = Copy();
88 wind.Noise(); 87 wind.Noise();
89 88
90 if (debugImages) 89 if (debugImages)
@@ -120,7 +119,7 @@ namespace libTerrain
120 surfacearea += Math.Abs(target - me); 119 surfacearea += Math.Abs(target - me);
121 } 120 }
122 121
123 double amount = surfacearea * wind.map[x, y] * carry; 122 double amount = surfacearea*wind.map[x, y]*carry;
124 123
125 if (amount < 0) 124 if (amount < 0)
126 amount = 0; 125 amount = 0;
@@ -147,7 +146,7 @@ namespace libTerrain
147 } 146 }
148 else 147 else
149 { 148 {
150 wind.Pertubation(15); // Can do better later 149 wind.Pertubation(15); // Can do better later
151 wind.seed++; 150 wind.seed++;
152 sediment.Pertubation(10); // Sediment is blown around a bit 151 sediment.Pertubation(10); // Sediment is blown around a bit
153 sediment.seed++; 152 sediment.seed++;
@@ -175,12 +174,12 @@ namespace libTerrain
175 174
176 if (target < min && lowest) 175 if (target < min && lowest)
177 { 176 {
178 minside = (int[])coords.Clone(); 177 minside = (int[]) coords.Clone();
179 min = target; 178 min = target;
180 } 179 }
181 } 180 }
182 181
183 double amount = surfacearea * (1.0 - wind.map[x, y]) * carry; 182 double amount = surfacearea*(1.0 - wind.map[x, y])*carry;
184 183
185 if (amount < 0) 184 if (amount < 0)
186 amount = 0; 185 amount = 0;
@@ -199,7 +198,7 @@ namespace libTerrain
199 wind.Normalise(); 198 wind.Normalise();
200 wind *= windspeed; 199 wind *= windspeed;
201 200
202 this.Normalise(); 201 Normalise();
203 } 202 }
204 203
205 Channel myself = this; 204 Channel myself = this;
@@ -207,7 +206,7 @@ namespace libTerrain
207 myself.Normalise(); 206 myself.Normalise();
208 207
209 if (debugImages) 208 if (debugImages)
210 this.SaveImage("testimg/output.png"); 209 SaveImage("testimg/output.png");
211 } 210 }
212 } 211 }
213} \ No newline at end of file 212} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
index 4f58f71..0e47e1b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -44,7 +42,7 @@ namespace libTerrain
44 Channel waterFlow = new Channel(w, h); 42 Channel waterFlow = new Channel(w, h);
45 43
46 NeighbourSystem type = NeighbourSystem.Moore; 44 NeighbourSystem type = NeighbourSystem.Moore;
47 int NEIGHBOUR_ME = 4; 45 int NEIGHBOUR_ME = 4;
48 46
49 int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; 47 int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5;
50 48
@@ -52,7 +50,7 @@ namespace libTerrain
52 { 50 {
53 water += rain; 51 water += rain;
54 52
55 sediment = terrain * water; 53 sediment = terrain*water;
56 terrain -= sediment; 54 terrain -= sediment;
57 55
58 for (int x = 1; x < w - 1; x++) 56 for (int x = 1; x < w - 1; x++)
@@ -72,7 +70,8 @@ namespace libTerrain
72 coords[0] += x; 70 coords[0] += x;
73 coords[1] += y; 71 coords[1] += y;
74 72
75 heights[j] = map[coords[0], coords[1]] + water.map[coords[0], coords[1]] + sediment.map[coords[0], coords[1]]; 73 heights[j] = map[coords[0], coords[1]] + water.map[coords[0], coords[1]] +
74 sediment.map[coords[0], coords[1]];
76 diffs[j] = heightCenter - heights[j]; 75 diffs[j] = heightCenter - heights[j];
77 } 76 }
78 } 77 }
@@ -97,13 +96,13 @@ namespace libTerrain
97 if (totalCellsCounted == 1) 96 if (totalCellsCounted == 1)
98 continue; 97 continue;
99 98
100 double averageHeight = totalHeight / totalCellsCounted; 99 double averageHeight = totalHeight/totalCellsCounted;
101 double waterAmount = Math.Min(water.map[x, y], heightCenter - averageHeight); 100 double waterAmount = Math.Min(water.map[x, y], heightCenter - averageHeight);
102 101
103 // TODO: Check this. 102 // TODO: Check this.
104 waterFlow.map[x, y] += waterFlow.map[x, y] - waterAmount; 103 waterFlow.map[x, y] += waterFlow.map[x, y] - waterAmount;
105 104
106 double totalInverseDiff = waterAmount / totalHeightDiff; 105 double totalInverseDiff = waterAmount/totalHeightDiff;
107 106
108 for (int j = 0; j < NEIGHBOUR_MAX; j++) 107 for (int j = 0; j < NEIGHBOUR_MAX; j++)
109 { 108 {
@@ -115,7 +114,8 @@ namespace libTerrain
115 114
116 if (diffs[j] > 0) 115 if (diffs[j] > 0)
117 { 116 {
118 waterFlow.SetWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); 117 waterFlow.SetWrap(coords[0], coords[1],
118 waterFlow.map[coords[0], coords[1]] + diffs[j]*totalInverseDiff);
119 } 119 }
120 } 120 }
121 } 121 }
@@ -131,7 +131,7 @@ namespace libTerrain
131 { 131 {
132 for (int y = 0; y < h; y++) 132 for (int y = 0; y < h; y++)
133 { 133 {
134 double deposition = sediment.map[x, y] - water.map[x, y] * solubility; 134 double deposition = sediment.map[x, y] - water.map[x, y]*solubility;
135 if (deposition > 0) 135 if (deposition > 0)
136 { 136 {
137 sediment.map[x, y] -= deposition; 137 sediment.map[x, y] -= deposition;
@@ -139,7 +139,6 @@ namespace libTerrain
139 } 139 }
140 } 140 }
141 } 141 }
142
143 } 142 }
144 } 143 }
145 } 144 }
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
index 401cf95..8c16d7c 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 partial class Channel 31 partial class Channel
@@ -42,7 +38,7 @@ namespace libTerrain
42 38
43 private static int nsIX(int i, int j, int N) 39 private static int nsIX(int i, int j, int N)
44 { 40 {
45 return ((i) + (N + 2) * (j)); 41 return ((i) + (N + 2)*(j));
46 } 42 }
47 43
48 private static void nsSwap(ref double x0, ref double x) 44 private static void nsSwap(ref double x0, ref double x)
@@ -62,10 +58,10 @@ namespace libTerrain
62 private void nsAddSource(int N, ref double[] x, ref double[] s, double dt) 58 private void nsAddSource(int N, ref double[] x, ref double[] s, double dt)
63 { 59 {
64 int i; 60 int i;
65 int size = (N + 2) * (N + 2); 61 int size = (N + 2)*(N + 2);
66 for (i = 0; i < size; i++) 62 for (i = 0; i < size; i++)
67 { 63 {
68 x[i] += dt * s[i]; 64 x[i] += dt*s[i];
69 } 65 }
70 } 66 }
71 67
@@ -74,15 +70,15 @@ namespace libTerrain
74 int i; 70 int i;
75 for (i = 0; i <= N; i++) 71 for (i = 0; i <= N; i++)
76 { 72 {
77 x[nsIX(0, i, N)] = b == 1 ? -x[nsIX(1, i, N)] : x[nsIX(1, i, N)]; 73 x[nsIX(0, i, N)] = b == 1 ? -x[nsIX(1, i, N)] : x[nsIX(1, i, N)];
78 x[nsIX(0, N + 1, N)] = b == 1 ? -x[nsIX(N, i, N)] : x[nsIX(N, i, N)]; 74 x[nsIX(0, N + 1, N)] = b == 1 ? -x[nsIX(N, i, N)] : x[nsIX(N, i, N)];
79 x[nsIX(i, 0, N)] = b == 2 ? -x[nsIX(i, 1, N)] : x[nsIX(i, 1, N)]; 75 x[nsIX(i, 0, N)] = b == 2 ? -x[nsIX(i, 1, N)] : x[nsIX(i, 1, N)];
80 x[nsIX(i, N + 1, N)] = b == 2 ? -x[nsIX(i, N, N)] : x[nsIX(i, N, N)]; 76 x[nsIX(i, N + 1, N)] = b == 2 ? -x[nsIX(i, N, N)] : x[nsIX(i, N, N)];
81 } 77 }
82 x[nsIX(0, 0, N)] = 0.5f * (x[nsIX(1, 0, N)] + x[nsIX(0, 1, N)]); 78 x[nsIX(0, 0, N)] = 0.5f*(x[nsIX(1, 0, N)] + x[nsIX(0, 1, N)]);
83 x[nsIX(0, N + 1, N)] = 0.5f * (x[nsIX(1, N + 1, N)] + x[nsIX(0, N, N)]); 79 x[nsIX(0, N + 1, N)] = 0.5f*(x[nsIX(1, N + 1, N)] + x[nsIX(0, N, N)]);
84 x[nsIX(N + 1, 0, N)] = 0.5f * (x[nsIX(N, 0, N)] + x[nsIX(N + 1, 1, N)]); 80 x[nsIX(N + 1, 0, N)] = 0.5f*(x[nsIX(N, 0, N)] + x[nsIX(N + 1, 1, N)]);
85 x[nsIX(N + 1, N + 1, N)] = 0.5f * (x[nsIX(N, N + 1, N)] + x[nsIX(N + 1, N, N)]); 81 x[nsIX(N + 1, N + 1, N)] = 0.5f*(x[nsIX(N, N + 1, N)] + x[nsIX(N + 1, N, N)]);
86 } 82 }
87 83
88 private void nsLinSolve(int N, int b, ref double[] x, ref double[] x0, double a, double c) 84 private void nsLinSolve(int N, int b, ref double[] x, ref double[] x0, double a, double c)
@@ -92,11 +88,11 @@ namespace libTerrain
92 { 88 {
93 for (j = 1; j <= N; j++) 89 for (j = 1; j <= N; j++)
94 { 90 {
95 x[nsIX(i, j, N)] = (x0[nsIX(i, j, N)] + a * 91 x[nsIX(i, j, N)] = (x0[nsIX(i, j, N)] + a*
96 (x[nsIX(i - 1, j, N)] + 92 (x[nsIX(i - 1, j, N)] +
97 x[nsIX(i + 1, j, N)] + 93 x[nsIX(i + 1, j, N)] +
98 x[nsIX(i, j - 1, N)] + x[nsIX(i, j + 1, N)]) 94 x[nsIX(i, j - 1, N)] + x[nsIX(i, j + 1, N)])
99 ) / c; 95 )/c;
100 } 96 }
101 } 97 }
102 98
@@ -105,8 +101,8 @@ namespace libTerrain
105 101
106 private void nsDiffuse(int N, int b, ref double[] x, ref double[] x0, double diff, double dt) 102 private void nsDiffuse(int N, int b, ref double[] x, ref double[] x0, double diff, double dt)
107 { 103 {
108 double a = dt * diff * N * N; 104 double a = dt*diff*N*N;
109 nsLinSolve(N, b, ref x, ref x0, a, 1 + 4 * a); 105 nsLinSolve(N, b, ref x, ref x0, a, 1 + 4*a);
110 } 106 }
111 107
112 private void nsAdvect(int N, int b, ref double[] d, ref double[] d0, ref double[] u, ref double[] v, double dt) 108 private void nsAdvect(int N, int b, ref double[] d, ref double[] d0, ref double[] u, ref double[] v, double dt)
@@ -114,27 +110,27 @@ namespace libTerrain
114 int i, j, i0, j0, i1, j1; 110 int i, j, i0, j0, i1, j1;
115 double x, y, s0, t0, s1, t1, dt0; 111 double x, y, s0, t0, s1, t1, dt0;
116 112
117 dt0 = dt * N; 113 dt0 = dt*N;
118 114
119 for (i = 1; i <= N; i++) 115 for (i = 1; i <= N; i++)
120 { 116 {
121 for (j = 1; j <= N; j++) 117 for (j = 1; j <= N; j++)
122 { 118 {
123 x = i - dt0 * u[nsIX(i, j, N)]; 119 x = i - dt0*u[nsIX(i, j, N)];
124 y = j - dt0 * v[nsIX(i, j, N)]; 120 y = j - dt0*v[nsIX(i, j, N)];
125 121
126 if (x < 0.5) 122 if (x < 0.5)
127 x = 0.5; 123 x = 0.5;
128 if (x > N + 0.5) 124 if (x > N + 0.5)
129 x = N + 0.5; 125 x = N + 0.5;
130 i0 = (int)x; 126 i0 = (int) x;
131 i1 = i0 + 1; 127 i1 = i0 + 1;
132 128
133 if (y < 0.5) 129 if (y < 0.5)
134 y = 0.5; 130 y = 0.5;
135 if (y > N + 0.5) 131 if (y > N + 0.5)
136 y = N + 0.5; 132 y = N + 0.5;
137 j0 = (int)y; 133 j0 = (int) y;
138 j1 = j0 + 1; 134 j1 = j0 + 1;
139 135
140 s1 = x - i0; 136 s1 = x - i0;
@@ -142,8 +138,8 @@ namespace libTerrain
142 t1 = y - j0; 138 t1 = y - j0;
143 t0 = 1 - t1; 139 t0 = 1 - t1;
144 140
145 d[nsIX(i, j, N)] = s0 * (t0 * d0[nsIX(i0, j0, N)] + t1 * d0[nsIX(i0, j1, N)]) + 141 d[nsIX(i, j, N)] = s0*(t0*d0[nsIX(i0, j0, N)] + t1*d0[nsIX(i0, j1, N)]) +
146 s1 * (t0 * d0[nsIX(i1, j0, N)] + t1 * d0[nsIX(i1, j1, N)]); 142 s1*(t0*d0[nsIX(i1, j0, N)] + t1*d0[nsIX(i1, j1, N)]);
147 } 143 }
148 } 144 }
149 145
@@ -158,7 +154,9 @@ namespace libTerrain
158 { 154 {
159 for (j = 1; j <= N; j++) 155 for (j = 1; j <= N; j++)
160 { 156 {
161 div[nsIX(i, j, N)] = -0.5 * (u[nsIX(i + 1, j, N)] - u[nsIX(i - 1, j, N)] + v[nsIX(i, j + 1, N)] - v[nsIX(i, j - 1, N)]) / N; 157 div[nsIX(i, j, N)] = -0.5*
158 (u[nsIX(i + 1, j, N)] - u[nsIX(i - 1, j, N)] + v[nsIX(i, j + 1, N)] -
159 v[nsIX(i, j - 1, N)])/N;
162 p[nsIX(i, j, N)] = 0; 160 p[nsIX(i, j, N)] = 0;
163 } 161 }
164 } 162 }
@@ -172,8 +170,8 @@ namespace libTerrain
172 { 170 {
173 for (j = 1; j <= N; j++) 171 for (j = 1; j <= N; j++)
174 { 172 {
175 u[nsIX(i, j, N)] -= 0.5 * N * (p[nsIX(i + 1, j, N)] - p[nsIX(i - 1, j, N)]); 173 u[nsIX(i, j, N)] -= 0.5*N*(p[nsIX(i + 1, j, N)] - p[nsIX(i - 1, j, N)]);
176 v[nsIX(i, j, N)] -= 0.5 * N * (p[nsIX(i, j + 1, N)] - p[nsIX(i, j - 1, N)]); 174 v[nsIX(i, j, N)] -= 0.5*N*(p[nsIX(i, j + 1, N)] - p[nsIX(i, j - 1, N)]);
177 } 175 }
178 } 176 }
179 177
@@ -181,7 +179,8 @@ namespace libTerrain
181 nsSetBnd(N, 2, ref v); 179 nsSetBnd(N, 2, ref v);
182 } 180 }
183 181
184 private void nsDensStep(int N, ref double[] x, ref double[] x0, ref double[] u, ref double[] v, double diff, double dt) 182 private void nsDensStep(int N, ref double[] x, ref double[] x0, ref double[] u, ref double[] v, double diff,
183 double dt)
185 { 184 {
186 nsAddSource(N, ref x, ref x0, dt); 185 nsAddSource(N, ref x, ref x0, dt);
187 nsSwap(ref x0, ref x); 186 nsSwap(ref x0, ref x);
@@ -190,7 +189,8 @@ namespace libTerrain
190 nsAdvect(N, 0, ref x, ref x0, ref u, ref v, dt); 189 nsAdvect(N, 0, ref x, ref x0, ref u, ref v, dt);
191 } 190 }
192 191
193 private void nsVelStep(int N, ref double[] u, ref double[] v, ref double[] u0, ref double[] v0, double visc, double dt) 192 private void nsVelStep(int N, ref double[] u, ref double[] v, ref double[] u0, ref double[] v0, double visc,
193 double dt)
194 { 194 {
195 nsAddSource(N, ref u, ref u0, dt); 195 nsAddSource(N, ref u, ref u0, dt);
196 nsAddSource(N, ref v, ref v0, dt); 196 nsAddSource(N, ref v, ref v0, dt);
@@ -236,17 +236,17 @@ namespace libTerrain
236 236
237 private void nsSimulate(int N, int rounds, double dt, double diff, double visc) 237 private void nsSimulate(int N, int rounds, double dt, double diff, double visc)
238 { 238 {
239 int size = (N * 2) * (N * 2); 239 int size = (N*2)*(N*2);
240 240
241 double[] u = new double[size]; // Force, X axis 241 double[] u = new double[size]; // Force, X axis
242 double[] v = new double[size]; // Force, Y axis 242 double[] v = new double[size]; // Force, Y axis
243 double[] u_prev = new double[size]; 243 double[] u_prev = new double[size];
244 double[] v_prev = new double[size]; 244 double[] v_prev = new double[size];
245 double[] dens = new double[size]; 245 double[] dens = new double[size];
246 double[] dens_prev = new double[size]; 246 double[] dens_prev = new double[size];
247 247
248 nsDoublesToBuffer(this.map, N, ref dens); 248 nsDoublesToBuffer(map, N, ref dens);
249 nsDoublesToBuffer(this.map, N, ref dens_prev); 249 nsDoublesToBuffer(map, N, ref dens_prev);
250 250
251 for (int i = 0; i < rounds; i++) 251 for (int i = 0; i < rounds; i++)
252 { 252 {
@@ -258,7 +258,7 @@ namespace libTerrain
258 nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt); 258 nsDensStep(N, ref dens, ref dens_prev, ref u, ref v, diff, dt);
259 } 259 }
260 260
261 nsBufferToDoubles(ref dens, N, ref this.map); 261 nsBufferToDoubles(ref dens, N, ref map);
262 } 262 }
263 263
264 /// <summary> 264 /// <summary>
@@ -270,14 +270,14 @@ namespace libTerrain
270 /// <param name="visc">Fluid viscosity (Recommended: 0.0)</param> 270 /// <param name="visc">Fluid viscosity (Recommended: 0.0)</param>
271 public void navierStokes(int rounds, double dt, double diff, double visc) 271 public void navierStokes(int rounds, double dt, double diff, double visc)
272 { 272 {
273 nsSimulate(this.h, rounds, dt, diff, visc); 273 nsSimulate(h, rounds, dt, diff, visc);
274 } 274 }
275 275
276 public void navierStokes(int rounds, double dt, double diff, double visc, ref double[,] uret, ref double[,] vret) 276 public void navierStokes(int rounds, double dt, double diff, double visc, ref double[,] uret, ref double[,] vret)
277 { 277 {
278 int N = this.h; 278 int N = h;
279 279
280 int size = (N * 2) * (N * 2); 280 int size = (N*2)*(N*2);
281 281
282 double[] u = new double[size]; // Force, X axis 282 double[] u = new double[size]; // Force, X axis
283 double[] v = new double[size]; // Force, Y axis 283 double[] v = new double[size]; // Force, Y axis
@@ -286,8 +286,8 @@ namespace libTerrain
286 double[] dens = new double[size]; 286 double[] dens = new double[size];
287 double[] dens_prev = new double[size]; 287 double[] dens_prev = new double[size];
288 288
289 nsDoublesToBuffer(this.map, N, ref dens); 289 nsDoublesToBuffer(map, N, ref dens);
290 nsDoublesToBuffer(this.map, N, ref dens_prev); 290 nsDoublesToBuffer(map, N, ref dens_prev);
291 291
292 for (int i = 0; i < rounds; i++) 292 for (int i = 0; i < rounds; i++)
293 { 293 {
@@ -301,7 +301,7 @@ namespace libTerrain
301 301
302 nsBufferToDoubles(ref u, N, ref uret); 302 nsBufferToDoubles(ref u, N, ref uret);
303 nsBufferToDoubles(ref v, N, ref vret); 303 nsBufferToDoubles(ref v, N, ref vret);
304 nsBufferToDoubles(ref dens, N, ref this.map); 304 nsBufferToDoubles(ref dens, N, ref map);
305 } 305 }
306 } 306 }
307} \ No newline at end of file 307} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
index 9148c3c..0ca3d48 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 partial class Channel 31 partial class Channel
@@ -47,10 +43,11 @@ namespace libTerrain
47 double[,] lastFrame; 43 double[,] lastFrame;
48 double[,] thisFrame; 44 double[,] thisFrame;
49 45
50 lastFrame = (double[,])map.Clone(); 46 lastFrame = (double[,]) map.Clone();
51 thisFrame = (double[,])map.Clone(); 47 thisFrame = (double[,]) map.Clone();
52 48
53 NeighbourSystem type = NeighbourSystem.Moore; // Using moore neighbourhood (twice as computationally expensive) 49 NeighbourSystem type = NeighbourSystem.Moore;
50 // Using moore neighbourhood (twice as computationally expensive)
54 int NEIGHBOUR_ME = 4; // I am always 4 in both systems. 51 int NEIGHBOUR_ME = 4; // I am always 4 in both systems.
55 52
56 int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; 53 int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5;
@@ -88,19 +85,18 @@ namespace libTerrain
88 85
89 if (target > heightF + talus) 86 if (target > heightF + talus)
90 { 87 {
91 double calc = c * ((target - heightF) - talus); 88 double calc = c*((target - heightF) - talus);
92 heightF += calc; 89 heightF += calc;
93 target -= calc; 90 target -= calc;
94 } 91 }
95 92
96 thisFrame[x, y] = heightF; 93 thisFrame[x, y] = heightF;
97 thisFrame[coords[0], coords[1]] = target; 94 thisFrame[coords[0], coords[1]] = target;
98
99 } 95 }
100 } 96 }
101 } 97 }
102 } 98 }
103 lastFrame = (double[,])thisFrame.Clone(); 99 lastFrame = (double[,]) thisFrame.Clone();
104 } 100 }
105 101
106 map = thisFrame; 102 map = thisFrame;
@@ -109,4 +105,4 @@ namespace libTerrain
109 return this; 105 return this;
110 } 106 }
111 } 107 }
112} 108} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
index 316bd9a..4004747 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
@@ -26,19 +26,15 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 partial class Channel 31 partial class Channel
36 { 32 {
37 enum NeighbourSystem 33 private enum NeighbourSystem
38 { 34 {
39 Moore, 35 Moore,
40 VonNeumann 36 VonNeumann
41 }; 37 } ;
42 38
43 private int[] Neighbours(NeighbourSystem type, int index) 39 private int[] Neighbours(NeighbourSystem type, int index)
44 { 40 {
@@ -138,4 +134,4 @@ namespace libTerrain
138 return coord; 134 return coord;
139 } 135 }
140 } 136 }
141} 137} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
index 0306e58..ae7530c 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
@@ -138,7 +136,7 @@ namespace libTerrain
138 { 136 {
139 for (y = 0; y < A.h; y++) 137 for (y = 0; y < A.h; y++)
140 { 138 {
141 A.map[x, y] = Math.Pow(A.map[x,y],B.map[x, y]); 139 A.map[x, y] = Math.Pow(A.map[x, y], B.map[x, y]);
142 } 140 }
143 } 141 }
144 142
@@ -230,7 +228,7 @@ namespace libTerrain
230 { 228 {
231 for (y = 0; y < A.h; y++) 229 for (y = 0; y < A.h; y++)
232 { 230 {
233 A.map[x, y] = Math.Pow(A.map[x,y],B); 231 A.map[x, y] = Math.Pow(A.map[x, y], B);
234 } 232 }
235 } 233 }
236 234
@@ -238,6 +236,5 @@ namespace libTerrain
238 236
239 return A; 237 return A;
240 } 238 }
241
242 } 239 }
243} 240} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs
index 9985f03..1d52da9 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace libTerrain 29namespace libTerrain
34{ 30{
35 public class Point2D 31 public class Point2D
@@ -43,4 +39,4 @@ namespace libTerrain
43 y = Y; 39 y = Y;
44 } 40 }
45 } 41 }
46} 42} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
index 3207f15..d805794 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs
@@ -27,33 +27,34 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace libTerrain 31namespace libTerrain
34{ 32{
35 class Tools 33 internal class Tools
36 { 34 {
37 public static double LinearInterpolate(double a, double b, double amount) 35 public static double LinearInterpolate(double a, double b, double amount)
38 { 36 {
39 return a + ((b - a) * amount); 37 return a + ((b - a)*amount);
40 } 38 }
41 39
42 public static double ExponentialInterpolate(double a, double b, double amount) 40 public static double ExponentialInterpolate(double a, double b, double amount)
43 { 41 {
44 a = Math.Pow(a, amount); 42 a = Math.Pow(a, amount);
45 b = Math.Pow(b - a, 1.0 - amount); 43 b = Math.Pow(b - a, 1.0 - amount);
46 return a+b; 44 return a + b;
47 } 45 }
48 46
49 public static int PowerOf2Log2(int n) { 47 public static int PowerOf2Log2(int n)
50 for (int i = 0; i < 31; i++) { 48 {
51 if ((n & 1) == 1) { 49 for (int i = 0; i < 31; i++)
52 return i; 50 {
53 } 51 if ((n & 1) == 1)
54 n >>= 1; 52 {
55 } 53 return i;
56 return 0; 54 }
57 } 55 n >>= 1;
56 }
57 return 0;
58 }
58 } 59 }
59} 60} \ No newline at end of file