From 4fa5c945150becbe1437caa4aef39e1337606876 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sun, 22 May 2022 15:54:25 +0200 Subject: [PATCH] Add tiny player position marker --- generate_textures.lua | 11 ++++++++++ init.lua | 41 ++++++++++++++++++++++++++++-------- textures/xmaps_dot_tiny.tga | Bin 0 -> 93 bytes 3 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 textures/xmaps_dot_tiny.tga diff --git a/generate_textures.lua b/generate_textures.lua index 4007428..bc95ba5 100644 --- a/generate_textures.lua +++ b/generate_textures.lua @@ -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") diff --git a/init.lua b/init.lua index 1d60c76..b4961c6 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/textures/xmaps_dot_tiny.tga b/textures/xmaps_dot_tiny.tga new file mode 100644 index 0000000000000000000000000000000000000000..335a5c2a0545a06042388e256befa4b42d073a60 GIT binary patch literal 93 zcmZQzU}k^;b_R9^4hBYazyKCv`2Qb7Ln%gxAXq6(dq_~IYnW%Sr@x