-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
-- Apply Gamepad Deadzone

local function ApplyDeadzone(n)
	if math.abs(n) < GAMEPAD_DEADZONE then return 0 end
	return (n + (n > 0 and -GAMEPAD_DEADZONE or GAMEPAD_DEADZONE)) / (1 - GAMEPAD_DEADZONE)
end -- ApplyDeadzone()

local function UpdateBoost(boost, step)	
	-- Update boost amount
	if boost and boostAmount > step then
		boostAmount = boostAmount - step
	elseif ((boostAmount >= 0) and (boostAmount < maxBoostAmount)) then
		-- Restore boost when boost is off (restores at half speed of use rate)
		boostAmount = boostAmount + step/2
		boost = false 
	end
	
	return boost
end
