if !global.altcontrol
{
	_jump_p    = ingame.kcp("Z")       || ingame.gcp(gp_face1);
	_jump_r    = ingame.kcr("Z")       || ingame.gcr(gp_face1);
	_dash      = ingame.kcp("C")       || ingame.gcp(gp_shoulderr);
	_attack    = ingame.kcp("X")       || ingame.gcp(gp_face3);
	_left      = ingame.kc(vk_left)    || ingame.gc(gp_padl) || (ingame.ga(gp_axislh) < 0);
	_right     = ingame.kc(vk_right)   || ingame.gc(gp_padr) || (ingame.ga(gp_axislh) > 0);
	_up        = ingame.kc(vk_up)      || ingame.gc(gp_padu) || (ingame.ga(gp_axislv) < 0);
	_down      = ingame.kc(vk_down)    || ingame.gc(gp_padd) || (ingame.ga(gp_axislv) > 0);
	_inventory = ingame.kcp("I")       || ingame.gcp(gp_face4);
	_focus     = ingame.kcp("A")       || ingame.gcp(gp_face2);
	_pause     = ingame.kcp(vk_escape) || ingame.gcp(gp_start);
}
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") || title.gcp(gp_padu);
_down_title   = title.kcp(vk_down)  || title.kcp("S") || title.gcp(gp_padd);
_left_title   = title.kcp(vk_left)  || title.kcp("A") || title.gcp(gp_padl);
_right_title  = title.kcp(vk_right) || title.kcp("D") || title.gcp(gp_padr);
_select_title = title.kcp("Z")      || title.kcp("J") || title.gcp(gp_face1);

_left_inv  = inventory.kcp(vk_left)  || inventory.gcp(gp_padu);
_right_inv = inventory.kcp(vk_right) || inventory.gcp(gp_padd);
_up_inv    = inventory.kcp(vk_up)    || inventory.gcp(gp_padl);
_down_inv  = inventory.kcp(vk_down)  || inventory.gcp(gp_padr);
_close_inv = inventory.kcp("I") || inventory.kcp(vk_escape) || inventory.gcp(gp_face4) || inventory.gcp(gp_start);

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

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.2 : 1.0;
    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();
				
				//
				bgm_play("explore");
			};
			_ripple = icl(oRippleShrink, 960, 540);
			_ripple.callback = _func;
			break;

		case 1:
			autodel_handle("title");
			
			_func = function()
			{
				icl(oRippleExpand);
				
				global.save_data = get_default_save_data();
				save_game_to_disk();
				load_game_from_disk();
				
				//
				bgm_play("explore");
			};
			
			_ripple = icl(oRippleShrink, 960, 600);
			_ripple.callback = _func;
			break;

        case 4: game_end(); break;
    }
}
if (_left_title || _right_title || _select_title) && menu_index == 3
	global.altcontrol = !global.altcontrol;
menu_options[3] = global.altcontrol ? "控制-WASD" : "控制-方向键";

if instance_exists(info_typer1)
	info_typer1.active = (menu_index == 2);
if instance_exists(info_typer2)
	info_typer2.active = (menu_index == 2);

animation_timer += 0.05;