// This is the game over screen. It's lovely.

// It appears in front of all the other screens using the menu window.

	let sprite = background_level_1[arb]
	let base_frame = 4
	let current_frame = base_frame

	let world_x = 320
	let world_y = 208

	set_private_co_ords

	let opengl_booleans = opengl_boolean_blend_add + OPENGL_BOOLEAN_VERTEX_COLOUR_ALPHA
	let opengl_booleans = opengl_booleans + OPENGL_BOOLEAN_SCALE
	let opengl_booleans = opengl_booleans + OPENGL_BOOLEAN_FILTERED

	let draw_mode = draw_mode_sprite

	// This'll do as it'll be the only thing in this window.
	let draw_order = 0

	let counter = 2500

	let opengl_vertex_alpha = 0
	let opengl_vertex_green = 0
	let opengl_vertex_blue = 0

	enable_window FLOATING_OVERLAY_WINDOW

	let window_number = FLOATING_OVERLAY_WINDOW

	let signal = false

start

	gosub update_scale

	let opengl_vertex_alpha = opengl_vertex_alpha + 5 !> 255

	if opengl_vertex_alpha = 255 then
		let opengl_vertex_green = opengl_vertex_green + 5 !> 255
		let opengl_vertex_blue = opengl_vertex_green

//		if opengl_vertex_green = 255 then
			IF_INPUT_PLAYER_CONTROL_HIT (PLAYER_1,FIRE_1) THEN
				goto fade_out
			END_IF
//		end_if
	end_if

end



.fade_out

start

	gosub update_scale

	let opengl_vertex_alpha = opengl_vertex_alpha - 15 !< 0

	if opengl_vertex_alpha = 0 then
		goto time_for_bed
	end_if

end



.update_scale

	let counter = counter + 50 !> 10000

	let opengl_scale_x = counter CURVE_PERCENTAGE CURVE_PERCENTAGE_FISO
	let opengl_scale_y = opengl_scale_x

	return



.time_for_bed

	let signal = true

	disable_window FLOATING_OVERLAY_WINDOW

	kill_entity own_id


