aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-08 18:15:36 +0000
committerMelanie Thielker2008-09-08 18:15:36 +0000
commite7abde70a211d17ebfbae5e3ff379338a649f567 (patch)
treeac79095cce47bbfeebbfdd66856541af77bbb13c /OpenSim/Region/ScriptEngine
parent* some if inversions and added {}'s for readability (diff)
downloadopensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.zip
opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.gz
opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.bz2
opensim-SC-e7abde70a211d17ebfbae5e3ff379338a649f567.tar.xz
Mantis #2147
Thank you, ralphos, for a patch the adapts llSetColor and friends to a change in the underlying types. Also, thank you for a much cleaner way of casting types out of lists, which I will adopt throughout.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs46
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs7
2 files changed, 27 insertions, 26 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0cc8279..bc58a8a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1001,9 +1001,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1001 if (face > -1) 1001 if (face > -1)
1002 { 1002 {
1003 texcolor = tex.CreateFace((uint)face).RGBA; 1003 texcolor = tex.CreateFace((uint)face).RGBA;
1004 texcolor.R = (float)Math.Abs(color.x - 1); 1004 texcolor.R = (float)color.x;
1005 texcolor.G = (float)Math.Abs(color.y - 1); 1005 texcolor.G = (float)color.y;
1006 texcolor.B = (float)Math.Abs(color.z - 1); 1006 texcolor.B = (float)color.z;
1007 tex.FaceTextures[face].RGBA = texcolor; 1007 tex.FaceTextures[face].RGBA = texcolor;
1008 part.UpdateTexture(tex); 1008 part.UpdateTexture(tex);
1009 return; 1009 return;
@@ -1015,15 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1015 if (tex.FaceTextures[i] != null) 1015 if (tex.FaceTextures[i] != null)
1016 { 1016 {
1017 texcolor = tex.FaceTextures[i].RGBA; 1017 texcolor = tex.FaceTextures[i].RGBA;
1018 texcolor.R = (float)Math.Abs(color.x - 1); 1018 texcolor.R = (float)color.x;
1019 texcolor.G = (float)Math.Abs(color.y - 1); 1019 texcolor.G = (float)color.y;
1020 texcolor.B = (float)Math.Abs(color.z - 1); 1020 texcolor.B = (float)color.z;
1021 tex.FaceTextures[i].RGBA = texcolor; 1021 tex.FaceTextures[i].RGBA = texcolor;
1022 } 1022 }
1023 texcolor = tex.DefaultTexture.RGBA; 1023 texcolor = tex.DefaultTexture.RGBA;
1024 texcolor.R = (float)Math.Abs(color.x - 1); 1024 texcolor.R = (float)color.x;
1025 texcolor.G = (float)Math.Abs(color.y - 1); 1025 texcolor.G = (float)color.y;
1026 texcolor.B = (float)Math.Abs(color.z - 1); 1026 texcolor.B = (float)color.z;
1027 tex.DefaultTexture.RGBA = texcolor; 1027 tex.DefaultTexture.RGBA = texcolor;
1028 } 1028 }
1029 part.UpdateTexture(tex); 1029 part.UpdateTexture(tex);
@@ -5783,11 +5783,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5783 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 5783 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
5784 if (remain < 5) 5784 if (remain < 5)
5785 return; 5785 return;
5786 LSL_Types.LSLInteger light = new LSL_Types.LSLInteger(rules.Data[idx++].ToString()); 5786 bool light = rules.GetLSLIntegerItem(idx++);
5787 LSL_Types.Vector3 lightcolor = new LSL_Types.Vector3(rules.Data[idx++].ToString()); 5787 LSL_Types.Vector3 lightcolor = rules.GetVector3Item(idx++);
5788 float intensity = (float)Convert.ToDouble(rules.Data[idx++].ToString()); 5788 float intensity = (float)rules.GetLSLFloatItem(idx++);
5789 float radius = (float)Convert.ToDouble(rules.Data[idx++].ToString()); 5789 float radius = (float)rules.GetLSLFloatItem(idx++);
5790 float falloff = (float)Convert.ToDouble(rules.Data[idx++].ToString()); 5790 float falloff = (float)rules.GetLSLFloatItem(idx++);
5791 5791
5792 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 5792 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
5793 5793
@@ -5795,8 +5795,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5795 case (int)ScriptBaseClass.PRIM_GLOW: 5795 case (int)ScriptBaseClass.PRIM_GLOW:
5796 if (remain < 2) 5796 if (remain < 2)
5797 return; 5797 return;
5798 // TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list
5799 // as a raw CLI Int32. When / if this is inserted as an
5800 // LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem
5801 // face = rules.GetLSLIntegerItem(idx++);
5798 face = Convert.ToInt32(rules.Data[idx++].ToString()); 5802 face = Convert.ToInt32(rules.Data[idx++].ToString());
5799 float glow = (float)Convert.ToDouble(rules.Data[idx++].ToString()); 5803 float glow = (float)rules.GetLSLFloatItem(idx++);
5800 5804
5801 SetGlow(part, face, glow); 5805 SetGlow(part, face, glow);
5802 5806
@@ -5814,14 +5818,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5814 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 5818 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
5815 if (remain < 2) 5819 if (remain < 2)
5816 return; 5820 return;
5821 // TODO: LSL constant ALL_SIDES (value -1) is inserted into LSL_Types.list
5822 // as a raw CLI Int32. When / if this is inserted as an
5823 // LSL_Types.LSLInteger extract value using LSL_Types.list.GetLSLIntegerItem
5824 // face = rules.GetLSLIntegerItem(idx++);
5817 face = Convert.ToInt32(rules.Data[idx++].ToString()); 5825 face = Convert.ToInt32(rules.Data[idx++].ToString());
5818 string bv = rules.Data[idx++].ToString(); 5826 bool st = rules.GetLSLIntegerItem(idx++);
5819 bool st;
5820 if (bv.Equals("1"))
5821 st = true;
5822 else
5823 st = false;
5824
5825 SetFullBright(part, face , st); 5827 SetFullBright(part, face , st);
5826 break; 5828 break;
5827 case (int)ScriptBaseClass.PRIM_MATERIAL: 5829 case (int)ScriptBaseClass.PRIM_MATERIAL:
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 3820dae..4554b0c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -472,7 +472,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
472 return (LSL_Types.key)m_data[itemIndex]; 472 return (LSL_Types.key)m_data[itemIndex];
473 } 473 }
474 474
475
476 public static list operator +(list a, list b) 475 public static list operator +(list a, list b)
477 { 476 {
478 object[] tmp; 477 object[] tmp;
@@ -488,19 +487,19 @@ namespace OpenSim.Region.ScriptEngine.Shared
488 m_data.SetValue(o, Length - 1); 487 m_data.SetValue(o, Length - 1);
489 } 488 }
490 489
491 public static list operator +(list a, string s) 490 public static list operator +(list a, LSLString s)
492 { 491 {
493 a.ExtendAndAdd(s); 492 a.ExtendAndAdd(s);
494 return a; 493 return a;
495 } 494 }
496 495
497 public static list operator +(list a, int i) 496 public static list operator +(list a, LSLInteger i)
498 { 497 {
499 a.ExtendAndAdd(i); 498 a.ExtendAndAdd(i);
500 return a; 499 return a;
501 } 500 }
502 501
503 public static list operator +(list a, double d) 502 public static list operator +(list a, LSLFloat d)
504 { 503 {
505 a.ExtendAndAdd(d); 504 a.ExtendAndAdd(d);
506 return a; 505 return a;