--
-- Originally was Boss HUD rendering code.
-- (c) Inuyasha 2014.
-- Permissionwas granted by Inuyasha to use this code
-- and the associated graphics in other mods.
--
local function boostbar(v, player)
		if player.mo and player.mo.skin == "sonic"
		   local notboostfill = 0;
			local notboostcap = 0;
			local boostready = 0;
			notboostcap = $1 + 50
            notboostfill = $1 + player.notboostmeter
			boostready = $1 + player.boost
 
			local p_startseg = v.cachePatch("METRENDL")
			local p_onseg    = v.cachePatch("METRMIDL")
			local p_offseg   = v.cachePatch("METRMPTY")
			local p_endseg   = v.cachePatch("METRENDR")
			local p_boost    = v.cachePatch("BOOST")
 
			local posx = 320 - 26
			local posy = 176
 
     
			v.draw(posx, posy, p_endseg, V_SNAPTOTOP|V_SNAPTORIGHT)
			posx = $1 - 1
 
			-- Step through backwards, to match the way we're drawing.
			for i = notboostcap, 1, -1
					if notboostfill >= i
						v.draw(posx, posy, p_onseg, V_SNAPTOTOP|V_SNAPTORIGHT)
					else
                        v.draw(posx, posy, p_offseg, V_SNAPTOTOP|V_SNAPTORIGHT)
					end
					posx = $1 - 1;
			end
		
            v.draw(246, 162, p_boost)
 
			-- Start segment
			v.draw(posx, posy, p_startseg, V_SNAPTOTOP|V_SNAPTORIGHT);


		end
	end
hud.add(boostbar)