aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs12
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs24
2 files changed, 28 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index a438ae6..e1a591b 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -217,7 +217,8 @@ namespace OpenSim.Region.Environment.Modules
217 217
218 if (avatar != null) 218 if (avatar != null)
219 { 219 {
220 fromPos = avatar.AbsolutePosition; 220 fromPos = avatar.AbsolutePosition;
221 fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0);
221 fromName = avatar.Firstname + " " + avatar.Lastname; 222 fromName = avatar.Firstname + " " + avatar.Lastname;
222 fromAgentID = e.Sender.AgentId; 223 fromAgentID = e.Sender.AgentId;
223 avatar = null; 224 avatar = null;
@@ -271,12 +272,12 @@ namespace OpenSim.Region.Environment.Modules
271 int dis = -100000; 272 int dis = -100000;
272 273
273 LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); 274 LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0);
274 dis = (int)avatarRegionPos.GetDistanceTo(fromRegionPos); 275 dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
275 276
276 switch (e.Type) 277 switch (e.Type)
277 { 278 {
278 case ChatTypeEnum.Whisper: 279 case ChatTypeEnum.Whisper:
279 if ((dis < m_whisperdistance) && (dis > -m_whisperdistance)) 280 if (dis < m_whisperdistance)
280 { 281 {
281 //should change so the message is sent through the avatar rather than direct to the ClientView 282 //should change so the message is sent through the avatar rather than direct to the ClientView
282 presence.ControllingClient.SendChatMessage(message, 283 presence.ControllingClient.SendChatMessage(message,
@@ -286,8 +287,9 @@ namespace OpenSim.Region.Environment.Modules
286 fromAgentID); 287 fromAgentID);
287 } 288 }
288 break; 289 break;
290 default:
289 case ChatTypeEnum.Say: 291 case ChatTypeEnum.Say:
290 if ((dis < m_saydistance) && (dis > -m_saydistance)) 292 if (dis < m_saydistance)
291 { 293 {
292 //Console.WriteLine("sending chat"); 294 //Console.WriteLine("sending chat");
293 presence.ControllingClient.SendChatMessage(message, 295 presence.ControllingClient.SendChatMessage(message,
@@ -298,7 +300,7 @@ namespace OpenSim.Region.Environment.Modules
298 } 300 }
299 break; 301 break;
300 case ChatTypeEnum.Shout: 302 case ChatTypeEnum.Shout:
301 if ((dis < m_shoutdistance) && (dis > -m_shoutdistance)) 303 if (dis < m_shoutdistance)
302 { 304 {
303 presence.ControllingClient.SendChatMessage(message, 305 presence.ControllingClient.SendChatMessage(message,
304 type, 306 type,
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
index 4f98af1..8359f8e 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
@@ -39,6 +39,11 @@ namespace libTerrain
39 int h; 39 int h;
40 Bitmap bmp; 40 Bitmap bmp;
41 41
42 /// <summary>
43 /// Creates a new Raster channel for use with bitmap or GDI functions
44 /// </summary>
45 /// <param name="width">Width in pixels</param>
46 /// <param name="height">Height in pixels</param>
42 public Raster(int width, int height) 47 public Raster(int width, int height)
43 { 48 {
44 w = width; 49 w = width;
@@ -46,6 +51,10 @@ namespace libTerrain
46 bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 51 bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
47 } 52 }
48 53
54 /// <summary>
55 /// Converts a raster image to a channel by averaging the RGB values to a single 0..1 heightmap
56 /// </summary>
57 /// <returns>A libTerrain Channel</returns>
49 public Channel ToChannel() 58 public Channel ToChannel()
50 { 59 {
51 Channel chan = new Channel(bmp.Width, bmp.Height); 60 Channel chan = new Channel(bmp.Width, bmp.Height);
@@ -63,12 +72,21 @@ namespace libTerrain
63 return chan; 72 return chan;
64 } 73 }
65 74
75 /// <summary>
76 /// Draws a piece of text into the specified raster
77 /// </summary>
78 /// <param name="txt">The text string to print</param>
79 /// <param name="font">The font to use to draw the specified image</param>
80 /// <param name="size">Font size (points) to use</param>
66 public void DrawText(string txt, string font, double size) 81 public void DrawText(string txt, string font, double size)
67 { 82 {
68 Graphics gd = Graphics.FromImage(bmp); 83 Rectangle area = new Rectangle(0, 0, 256, 256);
69 //gd.DrawString(txt, 84 StringFormat sf = new StringFormat();
85 sf.Alignment = StringAlignment.Center;
86 sf.LineAlignment = StringAlignment.Center;
70 87
71 88 Graphics gd = Graphics.FromImage(bmp);
89 gd.DrawString(txt, new Font(font, (float)size), new SolidBrush(Color.White), area, sf);
72 } 90 }
73 } 91 }
74} 92}