aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/textures/advtrains_hud_atc.pngbin369 -> 504 bytes
-rw-r--r--advtrains/textures/advtrains_hud_b.pngbin0 -> 239 bytes
-rw-r--r--advtrains/textures/advtrains_hud_b1.pngbin256 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_b2.pngbin309 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_bg.pngbin0 -> 67 bytes
-rw-r--r--advtrains/textures/advtrains_hud_blank.pngbin81 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_blue.pngbin83 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_emg.pngbin441 -> 525 bytes
-rw-r--r--advtrains/textures/advtrains_hud_f.pngbin139 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_forward.pngbin0 -> 788 bytes
-rw-r--r--advtrains/textures/advtrains_hud_gray.pngbin82 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_l_right.pngbin119 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_left_door.pngbin0 -> 719 bytes
-rw-r--r--advtrains/textures/advtrains_hud_lzb.pngbin329 -> 408 bytes
-rw-r--r--advtrains/textures/advtrains_hud_man.pngbin416 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_n.pngbin204 -> 243 bytes
-rw-r--r--advtrains/textures/advtrains_hud_na.pngbin329 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_neutral.pngbin0 -> 678 bytes
-rw-r--r--advtrains/textures/advtrains_hud_orange.pngbin83 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_p.pngbin193 -> 195 bytes
-rw-r--r--advtrains/textures/advtrains_hud_r.pngbin206 -> 215 bytes
-rw-r--r--advtrains/textures/advtrains_hud_red.pngbin83 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_reverse.pngbin0 -> 913 bytes
-rw-r--r--advtrains/textures/advtrains_hud_right_door.pngbin0 -> 890 bytes
-rw-r--r--advtrains/textures/advtrains_hud_shunt.pngbin440 -> 572 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_atc.pngbin139 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_bg.pngbin122 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_ind.pngbin67 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_limit.pngbin82 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_max.pngbin75 -> 0 bytes
-rw-r--r--advtrains/textures/advtrains_hud_speed_next.pngbin144 -> 0 bytes
-rw-r--r--advtrains/trainhud.lua105
32 files changed, 75 insertions, 30 deletions
diff --git a/advtrains/textures/advtrains_hud_atc.png b/advtrains/textures/advtrains_hud_atc.png
index e46f9bb..766c961 100644
--- a/advtrains/textures/advtrains_hud_atc.png
+++ b/advtrains/textures/advtrains_hud_atc.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_b.png b/advtrains/textures/advtrains_hud_b.png
new file mode 100644
index 0000000..6058ba0
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_b.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_b1.png b/advtrains/textures/advtrains_hud_b1.png
deleted file mode 100644
index 50fe46e..0000000
--- a/advtrains/textures/advtrains_hud_b1.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_b2.png b/advtrains/textures/advtrains_hud_b2.png
deleted file mode 100644
index 6aa91bf..0000000
--- a/advtrains/textures/advtrains_hud_b2.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_bg.png b/advtrains/textures/advtrains_hud_bg.png
new file mode 100644
index 0000000..aa168d4
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_bg.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_blank.png b/advtrains/textures/advtrains_hud_blank.png
deleted file mode 100644
index 26b59e7..0000000
--- a/advtrains/textures/advtrains_hud_blank.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_blue.png b/advtrains/textures/advtrains_hud_blue.png
deleted file mode 100644
index 9fbc572..0000000
--- a/advtrains/textures/advtrains_hud_blue.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_emg.png b/advtrains/textures/advtrains_hud_emg.png
index 1633caa..735706b 100644
--- a/advtrains/textures/advtrains_hud_emg.png
+++ b/advtrains/textures/advtrains_hud_emg.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_f.png b/advtrains/textures/advtrains_hud_f.png
deleted file mode 100644
index 2ca5d0a..0000000
--- a/advtrains/textures/advtrains_hud_f.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_forward.png b/advtrains/textures/advtrains_hud_forward.png
new file mode 100644
index 0000000..ca05e97
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_forward.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_gray.png b/advtrains/textures/advtrains_hud_gray.png
deleted file mode 100644
index 96e0535..0000000
--- a/advtrains/textures/advtrains_hud_gray.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_l_right.png b/advtrains/textures/advtrains_hud_l_right.png
deleted file mode 100644
index 70d51db..0000000
--- a/advtrains/textures/advtrains_hud_l_right.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_left_door.png b/advtrains/textures/advtrains_hud_left_door.png
new file mode 100644
index 0000000..0f15727
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_left_door.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_lzb.png b/advtrains/textures/advtrains_hud_lzb.png
index d74b1ed..3f827ec 100644
--- a/advtrains/textures/advtrains_hud_lzb.png
+++ b/advtrains/textures/advtrains_hud_lzb.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_man.png b/advtrains/textures/advtrains_hud_man.png
deleted file mode 100644
index 9c1f906..0000000
--- a/advtrains/textures/advtrains_hud_man.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_n.png b/advtrains/textures/advtrains_hud_n.png
index bdf26f1..762a48e 100644
--- a/advtrains/textures/advtrains_hud_n.png
+++ b/advtrains/textures/advtrains_hud_n.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_na.png b/advtrains/textures/advtrains_hud_na.png
deleted file mode 100644
index b4a53ee..0000000
--- a/advtrains/textures/advtrains_hud_na.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_neutral.png b/advtrains/textures/advtrains_hud_neutral.png
new file mode 100644
index 0000000..266a634
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_neutral.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_orange.png b/advtrains/textures/advtrains_hud_orange.png
deleted file mode 100644
index 1d62d51..0000000
--- a/advtrains/textures/advtrains_hud_orange.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_p.png b/advtrains/textures/advtrains_hud_p.png
index 8ef4f46..11d9981 100644
--- a/advtrains/textures/advtrains_hud_p.png
+++ b/advtrains/textures/advtrains_hud_p.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_r.png b/advtrains/textures/advtrains_hud_r.png
index edd11df..0a061d4 100644
--- a/advtrains/textures/advtrains_hud_r.png
+++ b/advtrains/textures/advtrains_hud_r.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_red.png b/advtrains/textures/advtrains_hud_red.png
deleted file mode 100644
index 983ce1f..0000000
--- a/advtrains/textures/advtrains_hud_red.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_reverse.png b/advtrains/textures/advtrains_hud_reverse.png
new file mode 100644
index 0000000..7d23a6e
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_reverse.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_right_door.png b/advtrains/textures/advtrains_hud_right_door.png
new file mode 100644
index 0000000..ccddb63
--- /dev/null
+++ b/advtrains/textures/advtrains_hud_right_door.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_shunt.png b/advtrains/textures/advtrains_hud_shunt.png
index e01a91a..f2d106a 100644
--- a/advtrains/textures/advtrains_hud_shunt.png
+++ b/advtrains/textures/advtrains_hud_shunt.png
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_atc.png b/advtrains/textures/advtrains_hud_speed_atc.png
deleted file mode 100644
index 81f7901..0000000
--- a/advtrains/textures/advtrains_hud_speed_atc.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_bg.png b/advtrains/textures/advtrains_hud_speed_bg.png
deleted file mode 100644
index bdd7b8f..0000000
--- a/advtrains/textures/advtrains_hud_speed_bg.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_ind.png b/advtrains/textures/advtrains_hud_speed_ind.png
deleted file mode 100644
index 5e27891..0000000
--- a/advtrains/textures/advtrains_hud_speed_ind.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_limit.png b/advtrains/textures/advtrains_hud_speed_limit.png
deleted file mode 100644
index 2dd3998..0000000
--- a/advtrains/textures/advtrains_hud_speed_limit.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_max.png b/advtrains/textures/advtrains_hud_speed_max.png
deleted file mode 100644
index 3ea0909..0000000
--- a/advtrains/textures/advtrains_hud_speed_max.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/textures/advtrains_hud_speed_next.png b/advtrains/textures/advtrains_hud_speed_next.png
deleted file mode 100644
index e562437..0000000
--- a/advtrains/textures/advtrains_hud_speed_next.png
+++ /dev/null
Binary files differ
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index 255324e..a4b5ef0 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -130,7 +130,7 @@ function advtrains.set_trainhud(name, text, driver)
hud.oldText=text
end
if hud.driver then
- player:hud_change(hud.driver, "text", driver or "advtrains_hud_blank.png")
+ player:hud_change(hud.driver, "text", driver or "")
elseif driver then
hud.driver = player:hud_add(driverhud)
end
@@ -183,49 +183,94 @@ function advtrains.hud_train_format(train, flip)
local vel = advtrains.abs_ceil(train.velocity)
local vel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.velocity))
- local levers = {
- [0] = "advtrains_hud_red.png^advtrains_hud_emg.png",
- "advtrains_hud_orange.png^advtrains_hud_b2.png",
- "advtrains_hud_orange.png^advtrains_hud_b1.png",
- "advtrains_hud_gray.png^advtrains_hud_n.png",
- "advtrains_hud_blue.png^advtrains_hud_p.png"}
- local tlev=train.lever
+ local levers = {[0] = "emg","b","r","n","p"}
+ local lvrcolor = {[0] = "red", "orange", "orange", "cyan", "cyan"}
+ local tlev=train.lever or 1
if train.velocity==0 and not train.active_control then tlev=1 end
local st = {}
if train.debug then st = {train.debug} end
- local ht = ("[combine:100x110:0,0=(%s):50,0=(%s):0,22=(%s):50,22=(%s):0,44=(%s):50,44=(%s):0,66=advtrains_hud_speed_bg.png"
- ..":%d,77=(advtrains_hud_speed_ind.png%s)"):format(
- ("advtrains_hud_blue.png^advtrains_hud_%s.png"):format(flip and "r" or "f"),
- levers[tlev or 32767] or "advtrains_hud_gray.png^advtrains_hud_na.png",
- (train.tarvelocity or train.atc_command)
- and "advtrains_hud_blue.png^advtrains_hud_atc.png"
- or (train.ctrl.lzb and "advtrains_hud_red.png^advtrains_hud_lzb.png" or "advtrains_hud_gray.png^advtrains_hud_man.png"),
- train.is_shunt and "advtrains_hud_orange.png^advtrains_hud_shunt.png" or "advtrains_hud_gray.png^advtrains_hud_shunt.png",
- train.door_open == -1 and "advtrains_hud_blue.png^advtrains_hud_l_right.png" or "advtrains_hud_gray.png^advtrains_hud_l_right.png",
- train.door_open == 1 and "advtrains_hud_blue.png^advtrains_hud_r.png" or "advtrains_hud_gray.png^advtrains_hud_r.png",
- vel*4.85, (res and res>=0) and "" or "^[resize\\:3x22")
- local si = {}
- if max < 20 then
- si[#si+1] = ("%d,77=(advtrains_hud_speed_max.png^[resize\\:%dx22)"):format(max*5,100-max*5)
+ local ht = {"[combine:300x130:0,0=(advtrains_hud_bg.png^[resize\\:300x130)"}
+ ht[#ht+1] = "100,0=(advtrains_hud_" .. (flip and "reverse" or "forward") .. ".png^[resize\\:100x20)"
+ ht[#ht+1] = "200,0=(advtrains_hud_" .. (levers[tlev] or "bg") .. ".png^[resize\\:100x20^[multiply\\:" .. (lvrcolor[tlev] or "#000000") .. ")"
+ if train.tarvelocity or train.atc_command then
+ ht[#ht+1] = "100,20=(advtrains_hud_atc.png^[resize\\:100x20)"
end
- if res and res>=0 then
- si[#si+1] = ("%d,88=advtrains_hud_speed_limit.png"):format(res*4.85)
+ if train.ctrl.lzb then
+ ht[#ht+1] = "200,20=(advtrains_hud_lzb.png^[resize\\:100x20^[multiply\\:red)"
end
- if train.tarvelocity then
- si[#si+1] = ("%d,66=advtrains_hud_speed_atc.png"):format(train.tarvelocity*4.85)
+ if train.is_shunt then
+ ht[#ht+1] = "100,40=(advtrains_hud_shunt.png^[resize\\:100x20)"
+ end
+ if train.door_open == -1 then
+ ht[#ht+1] = "100,60=(advtrains_hud_left_door.png^[resize\\:100x20)"
+ elseif train.door_open == 1 then
+ ht[#ht+1] = "200,60=(advtrains_hud_right_door.png^[resize\\:100x20)"
end
local lzb = train.lzb
if lzb and lzb.oncoming then
for i = 1, #lzb.oncoming do
local k = lzb.oncoming[i]
- if k.spd and k.spd >= 0 then
- si[#si+1] = ("%d,102=advtrains_hud_speed_next.png"):format(k.spd*4.85)
- break
+ if not k.spd then
+ ht[#ht+1] = "203,43=(advtrains_hud_bg.png^[resize\\:14x14^[colorize\\:lime\\:255)"
+ elseif k.spd == 0 then
+ ht[#ht+1] = "283,43=(advtrains_hud_bg.png^[resize\\:14x14^[colorize\\:red\\:255)"
+ else
+ ht[#ht+1] = "243,43=(advtrains_hud_bg.png^[resize\\:14x14^[colorize\\:orange\\:255)"
+ end
+ break
+ end
+ end
+ -- speed indication(s)
+ local function sevenseg(digit, x, y, w, h, m)
+ --[[
+ -1-
+ 2 3
+ -4-
+ 5 6
+ -7-
+ ]]
+ local segs = {
+ {h, 0, w, h},
+ {0, h, h, w},
+ {w+h, h, h, w},
+ {h, w+h, w, h},
+ {0, w+2*h, h, w},
+ {w+h, w+2*h, h, w},
+ {h, 2*(w+h), w, h}}
+ local trans = {
+ [0] = {true, true, true, false, true, true, true},
+ [1] = {false, false, true, false, false, true, false},
+ [2] = {true, false, true, true, true, false, true},
+ [3] = {true, false, true, true, false, true, true},
+ [4] = {false, true, true, true, false, true, false},
+ [5] = {true, true, false, true, false, true, true},
+ [6] = {true, true, false, true, true, true, true},
+ [7] = {true, false, true, false, false, true, false},
+ [8] = {true, true, true, true, true, true, true},
+ [9] = {true, true, true, true, false, true, true}}
+ local ent = trans[digit or 10]
+ if not ent then return end
+ for i = 1, 7, 1 do
+ if ent[i] then
+ local s = segs[i]
+ ht[#ht+1] = ("%d,%d=(advtrains_hud_bg.png^[resize\\:%dx%d^%s)"):format(x+s[1], y+s[2], s[3], s[4], m)
end
end
end
+ sevenseg(math.floor(vel/10), 5, 5, 20, 10, "[colorize\\:red\\:255")
+ sevenseg(vel%10, 55, 5, 20, 10, "[colorize\\:red\\:255")
+ ht[#ht+1] = ("10,100=(advtrains_hud_bg.png^[resize\\:%dx10^[colorize\\:white\\:255)"):format(vel*14)
+ if max < 20 then
+ ht[#ht+1] = ("%d,100=(advtrains_hud_bg.png^[resize\\:%dx10^[colorize\\:gray\\:255)"):format(10+max*14, 280-max*14)
+ end
+ if res and res > 0 then
+ ht[#ht+1] = ("10,85=(advtrains_hud_bg.png^[resize\\:%dx10^[colorize\\:red\\:255)"):format(res*14)
+ end
+ if train.tarvelocity then
+ ht[#ht+1] = ("10,115=(advtrains_hud_bg.png^[resize\\:%dx10^[colorize\\:cyan\\:255)"):format(train.tarvelocity*14)
+ end
if res and res == 0 then
st[#st+1] = attrans("OVERRUN RED SIGNAL! Examine situation and reverse train to move again.")
@@ -235,5 +280,5 @@ function advtrains.hud_train_format(train, flip)
st[#st+1] = ("ATC: %s%s"):format(train.atc_delay and advtrains.abs_ceil(train.atc_delay).."s " or "", train.atc_command or "")
end
- return table.concat(st,"\n"), #si>0 and ht..":"..table.concat(si,":") or ht
+ return table.concat(st,"\n"), table.concat(ht,":")
end