Add tiny player position marker

This commit is contained in:
Nils Dagsson Moskopp 2022-05-22 15:54:25 +02:00
parent be3bb494fb
commit 4fa5c94515
Signed by untrusted user who does not match committer: erlehmann
GPG Key ID: A3BC671C35191080
3 changed files with 43 additions and 9 deletions

View File

@ -47,3 +47,14 @@ local pixels = {
{ _, _, _, _, _, _, _ },
}
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")

View File

@ -637,37 +637,60 @@ xmaps.show_map_hud = function(player)
local marker
local dot_large = "xmaps_dot_large.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 minp.x - pos.x < size then
if minp.x - pos.x < size * 2 then
marker = dot_large
else
elseif minp.x - pos.x < size * 4 then
marker = dot_small
else
marker = dot_tiny
end
pos.x = minp.x
elseif pos.x > maxp.x then
if pos.x - maxp.x < size then
if pos.x - maxp.x < size * 2 then
marker = dot_large
else
elseif pos.x - maxp.x < size * 4 then
marker = dot_small
else
marker = dot_tiny
end
pos.x = maxp.x
end
-- we never override the small marker
-- we never override a smaller marker
-- yes, this is a literal corner case
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
else
elseif (
minp.z - pos.z < size * 4 and
marker ~= dot_tiny
) then
marker = dot_small
else
marker = dot_tiny
end
pos.z = minp.z
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
else
elseif (
pos.z - maxp.z < size * 4 and
marker ~= dot_tiny
) then
marker = dot_small
else
marker = dot_tiny
end
pos.z = maxp.z
end

BIN
textures/xmaps_dot_tiny.tga Normal file

Binary file not shown.