forked from erle/xmaps
Add tiny player position marker
This commit is contained in:
parent
be3bb494fb
commit
4fa5c94515
|
@ -47,3 +47,14 @@ local pixels = {
|
||||||
{ _, _, _, _, _, _, _ },
|
{ _, _, _, _, _, _, _ },
|
||||||
}
|
}
|
||||||
tga_encoder.image(pixels):save("textures/xmaps_dot_small.tga")
|
tga_encoder.image(pixels):save("textures/xmaps_dot_small.tga")
|
||||||
|
|
||||||
|
local pixels = {
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
{ _, _, _, K, K, _, _ },
|
||||||
|
{ _, _, K, W, W, K, _ },
|
||||||
|
{ _, _, K, W, W, K, _ },
|
||||||
|
{ _, _, _, K, K, _, _ },
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
}
|
||||||
|
tga_encoder.image(pixels):save("textures/xmaps_dot_tiny.tga")
|
||||||
|
|
41
init.lua
41
init.lua
|
@ -637,37 +637,60 @@ xmaps.show_map_hud = function(player)
|
||||||
local marker
|
local marker
|
||||||
local dot_large = "xmaps_dot_large.tga" .. "^[makealpha:1,1,1"
|
local dot_large = "xmaps_dot_large.tga" .. "^[makealpha:1,1,1"
|
||||||
local dot_small = "xmaps_dot_small.tga" .. "^[makealpha:1,1,1"
|
local dot_small = "xmaps_dot_small.tga" .. "^[makealpha:1,1,1"
|
||||||
|
local dot_tiny = "xmaps_dot_tiny.tga" .. "^[makealpha:1,1,1"
|
||||||
|
|
||||||
if pos.x < minp.x then
|
if pos.x < minp.x then
|
||||||
if minp.x - pos.x < size then
|
if minp.x - pos.x < size * 2 then
|
||||||
marker = dot_large
|
marker = dot_large
|
||||||
else
|
elseif minp.x - pos.x < size * 4 then
|
||||||
marker = dot_small
|
marker = dot_small
|
||||||
|
else
|
||||||
|
marker = dot_tiny
|
||||||
end
|
end
|
||||||
pos.x = minp.x
|
pos.x = minp.x
|
||||||
elseif pos.x > maxp.x then
|
elseif pos.x > maxp.x then
|
||||||
if pos.x - maxp.x < size then
|
if pos.x - maxp.x < size * 2 then
|
||||||
marker = dot_large
|
marker = dot_large
|
||||||
else
|
elseif pos.x - maxp.x < size * 4 then
|
||||||
marker = dot_small
|
marker = dot_small
|
||||||
|
else
|
||||||
|
marker = dot_tiny
|
||||||
end
|
end
|
||||||
pos.x = maxp.x
|
pos.x = maxp.x
|
||||||
end
|
end
|
||||||
|
|
||||||
-- we never override the small marker
|
-- we never override a smaller marker
|
||||||
-- yes, this is a literal corner case
|
-- yes, this is a literal corner case
|
||||||
if pos.z < minp.z then
|
if pos.z < minp.z then
|
||||||
if minp.z - pos.z < 256 and marker ~= dot_small then
|
if (
|
||||||
|
minp.z - pos.z < size * 2 and
|
||||||
|
marker ~= dot_small and
|
||||||
|
marker ~= dot_tiny
|
||||||
|
) then
|
||||||
marker = dot_large
|
marker = dot_large
|
||||||
else
|
elseif (
|
||||||
|
minp.z - pos.z < size * 4 and
|
||||||
|
marker ~= dot_tiny
|
||||||
|
) then
|
||||||
marker = dot_small
|
marker = dot_small
|
||||||
|
else
|
||||||
|
marker = dot_tiny
|
||||||
end
|
end
|
||||||
pos.z = minp.z
|
pos.z = minp.z
|
||||||
elseif pos.z > maxp.z then
|
elseif pos.z > maxp.z then
|
||||||
if pos.z - maxp.z < 256 and marker ~= dot_small then
|
if (
|
||||||
|
pos.z - maxp.z < size * 2 and
|
||||||
|
marker ~= dot_small and
|
||||||
|
marker ~= dot_tiny
|
||||||
|
) then
|
||||||
marker = dot_large
|
marker = dot_large
|
||||||
else
|
elseif (
|
||||||
|
pos.z - maxp.z < size * 4 and
|
||||||
|
marker ~= dot_tiny
|
||||||
|
) then
|
||||||
marker = dot_small
|
marker = dot_small
|
||||||
|
else
|
||||||
|
marker = dot_tiny
|
||||||
end
|
end
|
||||||
pos.z = maxp.z
|
pos.z = maxp.z
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue