one hit mode, fix vertmeter
full height meters overflowed p8num range
This commit is contained in:
parent
4f8b861cdb
commit
fa0cff1ffc
@ -338,11 +338,16 @@ function drawhud()
|
||||
inset(120,66,125,125)
|
||||
-- 57 px vertically
|
||||
local mxs, mxh = primary_ship.maxshield, primary_ship.maxhp
|
||||
local split = 57 * (mxs / (mxs + mxh-1)) \ 1 + 66
|
||||
line(121, split, 124, split, 0xba)
|
||||
vertmeter(121,67,124,split-1,primary_ship.shield, mxs,{204,220,221})
|
||||
vertmeter(121,split+1,124,124,primary_ship.hp-1, mxh-1, hpcols)
|
||||
fillp(0)
|
||||
if mxs + mxh > 1 then
|
||||
local split = 57 * (mxs / (mxs + mxh-1)) \ 1 + 66
|
||||
line(121, split, 124, split, 0xba)
|
||||
vertmeter(121,67,124,split-1,primary_ship.shield, mxs,{204,220,221})
|
||||
vertmeter(121,split+1,124,124,primary_ship.hp-1, mxh-1, hpcols)
|
||||
else
|
||||
print("!", 122, 94, 9)
|
||||
print("!", 121, 93, 8)
|
||||
end
|
||||
fillp(0)
|
||||
end
|
||||
|
||||
function draw_gun_info(lbl,fgc,x,y,gun)
|
||||
@ -368,9 +373,9 @@ function draw_gun_info(lbl,fgc,x,y,gun)
|
||||
end
|
||||
|
||||
function vertmeter(x0,y0,x1,y1,val,maxval,cols)
|
||||
if (val <= 0 or maxval <= 0) return
|
||||
if ((val <= 0) or (maxval <= 0)) return
|
||||
local h = y1-y0
|
||||
local px = -flr(-(h*val)\maxval)
|
||||
local px = val/maxval * h \ 1
|
||||
local ncols = #cols
|
||||
local firstcol = ((h-px)*ncols\h)+1
|
||||
local lastbottom = y0+(h*firstcol\ncols)
|
||||
@ -906,6 +911,11 @@ player = ship_m.new{
|
||||
mknew(player,
|
||||
function(p)
|
||||
p.main_gun = zap_gun.new()
|
||||
-- ONE HIT MODE
|
||||
-- p.hp = 1
|
||||
-- p.maxhp = 1
|
||||
-- p.shield = 0
|
||||
-- p.maxshield = 0
|
||||
end
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user