* Fixed an issue whereby avatar chat distances were being calculated against the region corner due to a zero vector.
* Bonus Commit: Fixed the Raster class in libTerrain.afrisby
parent
2afecae39c
commit
5adafd538a
|
@ -218,6 +218,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
if (avatar != null)
|
||||
{
|
||||
fromPos = avatar.AbsolutePosition;
|
||||
fromRegionPos = fromPos + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0);
|
||||
fromName = avatar.Firstname + " " + avatar.Lastname;
|
||||
fromAgentID = e.Sender.AgentId;
|
||||
avatar = null;
|
||||
|
@ -271,12 +272,12 @@ namespace OpenSim.Region.Environment.Modules
|
|||
int dis = -100000;
|
||||
|
||||
LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0);
|
||||
dis = (int)avatarRegionPos.GetDistanceTo(fromRegionPos);
|
||||
dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
case ChatTypeEnum.Whisper:
|
||||
if ((dis < m_whisperdistance) && (dis > -m_whisperdistance))
|
||||
if (dis < m_whisperdistance)
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
|
@ -286,8 +287,9 @@ namespace OpenSim.Region.Environment.Modules
|
|||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case ChatTypeEnum.Say:
|
||||
if ((dis < m_saydistance) && (dis > -m_saydistance))
|
||||
if (dis < m_saydistance)
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
|
@ -298,7 +300,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
}
|
||||
break;
|
||||
case ChatTypeEnum.Shout:
|
||||
if ((dis < m_shoutdistance) && (dis > -m_shoutdistance))
|
||||
if (dis < m_shoutdistance)
|
||||
{
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
|
|
|
@ -39,6 +39,11 @@ namespace libTerrain
|
|||
int h;
|
||||
Bitmap bmp;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Raster channel for use with bitmap or GDI functions
|
||||
/// </summary>
|
||||
/// <param name="width">Width in pixels</param>
|
||||
/// <param name="height">Height in pixels</param>
|
||||
public Raster(int width, int height)
|
||||
{
|
||||
w = width;
|
||||
|
@ -46,6 +51,10 @@ namespace libTerrain
|
|||
bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a raster image to a channel by averaging the RGB values to a single 0..1 heightmap
|
||||
/// </summary>
|
||||
/// <returns>A libTerrain Channel</returns>
|
||||
public Channel ToChannel()
|
||||
{
|
||||
Channel chan = new Channel(bmp.Width, bmp.Height);
|
||||
|
@ -63,12 +72,21 @@ namespace libTerrain
|
|||
return chan;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a piece of text into the specified raster
|
||||
/// </summary>
|
||||
/// <param name="txt">The text string to print</param>
|
||||
/// <param name="font">The font to use to draw the specified image</param>
|
||||
/// <param name="size">Font size (points) to use</param>
|
||||
public void DrawText(string txt, string font, double size)
|
||||
{
|
||||
Rectangle area = new Rectangle(0, 0, 256, 256);
|
||||
StringFormat sf = new StringFormat();
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
|
||||
Graphics gd = Graphics.FromImage(bmp);
|
||||
//gd.DrawString(txt,
|
||||
|
||||
|
||||
gd.DrawString(txt, new Font(font, (float)size), new SolidBrush(Color.White), area, sf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue