remove gradients from meters, make vertmeter segmented
This commit is contained in:
parent
a5ce0fd020
commit
0f7c7a810b
@ -136,23 +136,8 @@ function once_next_frame(f)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- health gradients for 1..5 hp
|
|
||||||
-- exactly, then all "more".
|
|
||||||
hpcols_lut = csv[[36
|
|
||||||
34, 136
|
|
||||||
34, 130, 136
|
|
||||||
34, 34, 130, 136
|
|
||||||
34, 34, 130, 130, 136]]
|
|
||||||
|
|
||||||
-- call after any change to maxhp
|
|
||||||
-- configures health gradient
|
|
||||||
function init_hpcols()
|
|
||||||
hpcols = hpcols_lut[min(primary_ship.maxhp,6)]
|
|
||||||
end
|
|
||||||
|
|
||||||
function wipe_level()
|
function wipe_level()
|
||||||
primary_ship = player.new()
|
primary_ship = player.new()
|
||||||
init_hpcols()
|
|
||||||
pships = linked_list.new()
|
pships = linked_list.new()
|
||||||
pships:push_back(primary_ship)
|
pships:push_back(primary_ship)
|
||||||
eships = linked_list.new()
|
eships = linked_list.new()
|
||||||
@ -321,7 +306,6 @@ function drawgame()
|
|||||||
drawhud()
|
drawhud()
|
||||||
end
|
end
|
||||||
|
|
||||||
powcols=split"170,154,153,148,68"
|
|
||||||
function drawhud()
|
function drawhud()
|
||||||
-- 112-and-right is hud zone
|
-- 112-and-right is hud zone
|
||||||
rectfill(112, 0, 127, 127,0x56)
|
rectfill(112, 0, 127, 127,0x56)
|
||||||
@ -334,17 +318,15 @@ function drawhud()
|
|||||||
|
|
||||||
dropshadow("pwr",114,59,1)
|
dropshadow("pwr",114,59,1)
|
||||||
inset(114,66,125,92)
|
inset(114,66,125,92)
|
||||||
fillp(0x5a5a)
|
vertmeter(115,67,124,91,primary_ship.power, primary_ship.max_power, 9,8)
|
||||||
vertmeter(115,67,124,91,primary_ship.power, primary_ship.max_power, powcols)
|
|
||||||
|
|
||||||
|
|
||||||
dropshadow("h s",114,97,1)
|
dropshadow("h s",114,97,1)
|
||||||
inset(114,104,125,125)
|
inset(114,104,125,125)
|
||||||
line(119,105,119,124,119)
|
line(119,105,119,124,119)
|
||||||
line(120,105,120,125,85)
|
line(120,105,120,125,85)
|
||||||
vertmeter(115,105,118,124,primary_ship.hp, primary_ship.maxhp, hpcols)
|
vertmeter(115,105,118,124,primary_ship.hp, primary_ship.maxhp, 8,3)
|
||||||
vertmeter(121,105,124,124,primary_ship.shield, primary_ship.maxshield,{204,220,221})
|
vertmeter(121,105,124,124,primary_ship.shield, primary_ship.maxshield,12,3)
|
||||||
fillp(0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_gun_info(lbl,fgc,x,y,gun)
|
function draw_gun_info(lbl,fgc,x,y,gun)
|
||||||
@ -369,20 +351,17 @@ function draw_gun_info(lbl,fgc,x,y,gun)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function vertmeter(x0,y0,x1,y1,val,maxval,cols)
|
function vertmeter(x0,y0,x1,y1,val,maxval,col,seg)
|
||||||
if (val <= 0) return
|
if (val <= 0) return
|
||||||
local h = y1-y0
|
local h = y1-y0+1
|
||||||
local px = -flr(-(h*val)\maxval)
|
local per_seg = ceil((h+1)/seg) - 1
|
||||||
local ncols = #cols
|
local px = (h-seg+1)*val\maxval
|
||||||
local firstcol = ((h-px)*ncols\h)+1
|
while px > 0 do
|
||||||
local lastbottom = y0+(h*firstcol\ncols)
|
rectfill (x0, y1-min(px, per_seg)+1, x1, y1, col)
|
||||||
rectfill(x0, y1-px, x1, lastbottom, cols[firstcol])
|
px -= per_seg
|
||||||
for i=firstcol+1,ncols do
|
y1 -= per_seg+1
|
||||||
local bottom = y0+h*i\ncols
|
|
||||||
rectfill(x0,lastbottom,x1,bottom,cols[i])
|
|
||||||
lastbottom = bottom
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function inset(x0,y0,x1,y1)
|
function inset(x0,y0,x1,y1)
|
||||||
rectfill(x0,y0,x1,y1,0)
|
rectfill(x0,y0,x1,y1,0)
|
||||||
|
Loading…
Reference in New Issue
Block a user