Skip to content

Commit

Permalink
Fixed minimap and added colouring of friends.
Browse files Browse the repository at this point in the history
  • Loading branch information
Katharine committed May 22, 2010
1 parent 97a6529 commit d8ea863
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 52 deletions.
67 changes: 16 additions & 51 deletions client/AjaxLife.MiniMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,55 +57,6 @@ AjaxLife.MiniMap = function() {
// Sets up the redraw delay - used to ensure we don't waste time redrawing excessively.
var redrawdelay = new Ext.util.DelayedTask(redraw);

// This turns our 64x64 grid of heights into a 256x256 grid of heights,
// smoothly interpolating this missing values.
function interpolate(heights)
{
var newheight = [];
for(var i = 0; i < 64; ++i)
{
newheight[i*4] = [];
for(var j = 0; j < 64; ++j)
{
var height = heights[i][j];
newheight[i*4][j*4] = height;
var next = heights[i][j+1];
if(next === null || next === undefined)
{
next = height;
}
var step = (next-height)/4;
newheight[i*4][j*4+1] = height+step;
newheight[i*4][j*4+2] = height+step*2;
newheight[i*4][j*4+3] = height+step*3;
}
}
for(var i = 0; i < 64; ++i)
{
newheight[i*4+1] = [];
newheight[i*4+2] = [];
newheight[i*4+3] = [];
for(var j = 0; j < 256; ++j)
{
var height = newheight[i*4][j];
var next = 0;
if(!newheight[(i+1)*4])
{
next = height;
}
else
{
next = newheight[(i+1)*4][j];
}
var step = (next-height)/4;
newheight[i*4+1][j] = height+step;
newheight[i*4+2][j] = height+step*2;
newheight[i*4+3][j] = height+step*3;
}
}
return newheight;
}

// This draws the landscape on the visible canvas.
function drawLandscape()
{
Expand Down Expand Up @@ -264,7 +215,14 @@ AjaxLife.MiniMap = function() {
drawObjects();
for(var i in marks)
{
drawMark(marks[i]);
if(AjaxLife.Friends.IsFriend(i))
{
drawMark(marks[i], 239, 221, 27);
}
else
{
drawMark(marks[i], 0, 255, 0);
}
}
drawTarget();
drawSelf();
Expand Down Expand Up @@ -306,7 +264,14 @@ AjaxLife.MiniMap = function() {
}
else
{
drawMark(pos);
if(AjaxLife.Friends.IsFriend(id))
{
drawMark(pos, 239, 221, 27);
}
else
{
drawMark(pos, 0, 255, 0);
}
return true;
}
},
Expand Down
6 changes: 5 additions & 1 deletion server/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public Hashtable GetFooter(GridClient client)
{
Hashtable message = new Hashtable();
message.Add("MessageType", "UsefulData");
message.Add("Positions", client.Network.CurrentSim.AvatarPositions);
Dictionary<UUID, Vector3> positions = new Dictionary<UUID, Vector3>();
client.Network.CurrentSim.AvatarPositions.ForEach(delegate(KeyValuePair<UUID, Vector3> pair) {
positions.Add(pair.Key, pair.Value);
});
message.Add("Positions", positions);
message.Add("YourPosition", client.Self.SimPosition);
message.Add("YourRegion", client.Network.CurrentSim.Name);
return message;
Expand Down

0 comments on commit d8ea863

Please sign in to comment.