if !global.altcontrol
{
	_jump_p    = ingame.kcp("Z");
	_jump_r    = ingame.kcr("Z");
	_dash      = ingame.kcp("C");
	_attack    = ingame.kcp("X");
	_left_p    = ingame.kcp(vk_left);
	_right_p   = ingame.kcp(vk_right);
	_up_p      = ingame.kcp(vk_up);
	_down_p    = ingame.kcp(vk_down);
	_left      = ingame.kc(vk_left);
	_right     = ingame.kc(vk_right);
	_up        = ingame.kc(vk_up);
	_down      = ingame.kc(vk_down);
	_inventory = ingame.kcp("I");
	_focus     = ingame.kcp("A");
	_pause     = ingame.kcp(vk_escape);
}
else
{
	_jump_p    = ingame.kcp("J");
	_jump_r    = ingame.kcr("J");
	_dash      = ingame.kcp("L");
	_attack    = ingame.kcp("K");
	_left      = ingame.kc("A");
	_right     = ingame.kc("D");
	_up        = ingame.kc("W");
	_down      = ingame.kc("S");
	_inventory = ingame.kcp("I");
	_focus     = ingame.kcp("U");
	_pause     = ingame.kcp(vk_escape);
}
_up_title     = title.kcp(vk_up) || title.kcp("W");
_down_title   = title.kcp(vk_down) || title.kcp("S");
_left_title   = title.kcp(vk_left) || title.kcp("A");
_right_title  = title.kcp(vk_right) || title.kcp("D");
_select_title = title.kcp("Z") || title.kcp("J");

_left_inv  = inventory.kcp(vk_left);
_right_inv = inventory.kcp(vk_right);
_up_inv    = inventory.kcp(vk_up);
_down_inv  = inventory.kcp(vk_down);
_close_inv = inventory.kcp("I") || inventory.kcp(vk_escape);

_save_pause  = pause.kcp("Z");
_close_pause = pause.kcp("X") || pause.kcp(vk_escape);

_1_debug = debug.kcp("1");

if room != rTitle
	exit;

if _up_title
{
    menu_index--;
    if menu_index < 0
		menu_index = array_length(menu_options) - 1;
}
if _down_title
{
    menu_index++;
    if menu_index >= array_length(menu_options)
		menu_index = 0;
}
for(var i = 0; i < array_length(menu_options); i++)
{
    var _target = (i == menu_index) ? 1.0 : 0.8;
    option_scale[i] = lerp(option_scale[i], _target, lerp_speed);
}
if _select_title
{
	var _func, _ripple;
    switch(menu_index) 
	{
        case 0:
			if !file_exists("ddmyx_save.dat")
				break; 

			autodel_handle("title");
			
			_func = function()
			{
				icl(oRippleExpand);
				
				load_game_from_disk();
				
			};
			_ripple = icl(oRippleShrink, RES_W / 2, RES_H / 2);
			_ripple.callback = _func;
			break;

		case 1:
			autodel_handle("title");
			
			_func = function()
			{
				icl(oRippleExpand);
				
				initialize_save_data();
				save_game_to_disk();
				load_game_from_disk();
			};
			
			_ripple = icl(oRippleShrink, RES_W / 2, RES_H / 2);
			_ripple.callback = _func;
			break;

        case 2: game_end(); break;
    }
}
/*
if (_left_title || _right_title || _select_title) && menu_index == 3
	global.altcontrol = !global.altcontrol;
menu_options[2] = global.altcontrol ? "Control-WASD" : "Control-Arrows";
*/
animation_timer += 0.05;