./pause_ctrl_scheme.lua

  1. local ON_FOOT_INDEX					= 1 
  2. local VEHICLE_INDEX						= 2 
  3.  
  4. local Anims = {} 
  5.  
  6. local Input_tracker 
  7. local Mouse_input_tracker 
  8.  
  9. local Control_list = -1 
  10. local Ctrl_scheme_doc = -1 
  11. Pause_menu_controller 				= -1 
  12. Pause_menu_controller_thread_h 	= -1 
  13. local PAUSE_MENU_CONTROL_SCHEME_ID		= 14 
  14.  
  15. local Tween_done = true 
  16.  
  17. function pause_ctrl_scheme_init() 
  18. 	Ctrl_scheme_doc = vint_document_find("pause_ctrl_scheme") 
  19. 	-- Subscribe to the button presses we need 
  20. 	Input_tracker = Vdo_input_tracker:new() 
  21. 	Input_tracker:add_input("select", "pause_ctrl_scheme_button_a", 50) 
  22. 	Input_tracker:add_input("back", "pause_ctrl_scheme_button_b", 50) 
  23. 	Input_tracker:add_input("nav_up", "pause_ctrl_scheme_nav_up", 50) 
  24. 	Input_tracker:add_input("nav_down", "pause_ctrl_scheme_nav_down", 50) 
  25. 	Input_tracker:add_input("nav_left", "pause_ctrl_scheme_nav_left", 50) 
  26. 	Input_tracker:add_input("nav_right", "pause_ctrl_scheme_nav_right", 50) 
  27. 	if In_pause_menu then 
  28. 		Input_tracker:add_input("pause", "pause_ctrl_scheme_button_start", 50) 
  29. 	end 
  30. 	 
  31. 	Input_tracker:subscribe(false) 
  32.  
  33. 	--Initialize Header 
  34. 	local ctrl_header_obj = Vdo_pause_header:new("header",0,Ctrl_scheme_doc) 
  35. 	ctrl_header_obj:set_text("MENU_CONTROL_SCHEMES", 800) 
  36.  
  37. 	Control_list = Vdo_mega_list:new("list",0,Ctrl_scheme_doc) 
  38. 	Control_list:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY) 
  39. 	 
  40. 	--Get the selection option from when the menu was last loaded 
  41. 	local last_option_selected = menu_common_stack_get_index() 
  42.  
  43. 	--Setup button hints 
  44. 	local hint_data = { 
  45. 		{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  46. 	} 
  47. 	Menu_hint_bar:set_hints(hint_data)   
  48. 	 
  49. 	--Change controller image based on platform... 
  50. 	local controller_h = vint_object_find("controller") 
  51. 	if game_get_platform() == "PS3" then 
  52. 		vint_set_property(controller_h, "image", "ui_menu_ctrl_ps3") 
  53. 	else 
  54. 		vint_set_property(controller_h, "image", "ui_menu_ctrl_xbox2") 
  55. 	end 
  56.  
  57. 	--Get control schemes and populate stuff 
  58. 	-- On foot Controls 
  59. 	local which_controller, which_scheme, num_buttons = pause_menu_control_scheme_init(true, 0) 
  60. 	--Options_Controls_Data[1].current_value = which_scheme + 1 
  61. 	 
  62. 	-- Vehicle Controls 
  63. 	local which_controller, which_scheme, num_buttons = pause_menu_control_scheme_init(true, 1) 
  64. 	--Options_Controls_Data[2].current_value = which_scheme + 1 
  65. 	 
  66. 	-- Aircraft Controls 
  67. 	local which_controller, which_scheme, num_buttons = pause_menu_control_scheme_init(true, 2) 
  68. 	 
  69. 	--Reset Controls Menu... 
  70. 	pause_ctrl_scheme_reset(0) 
  71. 	 
  72. 	-- Draw the list for the first time 
  73. 	local screen_width = 850 
  74. 	if vint_is_std_res() == true then 
  75. 		screen_width = 800 
  76. 	end 
  77. 	Control_list:draw_items(Options_Controls_Data, 1, screen_width) 
  78. 	 
  79. 	--Store some locals to the pause menu common for screen processing. 
  80. 	menu_common_set_list_style(List, Header_obj, screen_width) 
  81. 	menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_slide_out_anim) 
  82. 	 
  83. 	-- Add mouse inputs for the PC 
  84. 	if game_get_platform() == "PC" then 
  85. 		Menu_hint_bar:set_highlight(0) 
  86. 		 
  87. 		Mouse_input_tracker = Vdo_input_tracker:new() 
  88. 		Control_list:add_mouse_inputs("pause_ctrl_scheme", Mouse_input_tracker) 
  89. 		Menu_hint_bar:add_mouse_inputs("pause_ctrl_scheme", Mouse_input_tracker) 
  90. 		Mouse_input_tracker:subscribe(true) 
  91. 		 
  92. 		--menu_common_set_mouse_tracker(Mouse_input_tracker) 
  93. 	end 
  94. 	 
  95. 	List:set_visible(false) 
  96. 	Header_obj:set_visible(false) 
  97.  
  98. 	 
  99. 	if not In_pause_menu then 
  100. 		--get the list x and y 
  101. 		local new_x 
  102. 		local middle_x 
  103. 		if vint_is_std_res() == false then 
  104. 			middle_x = 640 
  105. 		else 
  106. 			middle_x = 320 * 1.5 
  107. 		end 
  108. 		new_x = middle_x - (screen_width * 0.5) 
  109. 		local mask_start_x = middle_x + (screen_width * 0.5) 
  110. 		 
  111. 		local mask_anchor_twn = vint_object_find("ctrl_mask_anchor_twn", 0, Ctrl_scheme_doc) 
  112. 		local mask_x,mask_y = vint_get_property(mask_anchor_twn,"start_value") 
  113. 		vint_set_property(mask_anchor_twn,"start_value", mask_start_x, mask_y) 
  114. 		 
  115. 		bg_saints_set_type(BG_TYPE_CENTER, true, screen_width) 
  116. 		pause_ctrl_scheme_set_slide_in_values( new_x ) 
  117. 		pause_ctrl_scheme_mask_morph(BG_TYPE_CENTER, screen_width, new_x) 
  118. 	else 
  119. 		local mask_h = vint_object_find("screen_mask", 0, Ctrl_scheme_doc) 
  120. 		local mask_x,mask_y = vint_get_property(mask_h, "anchor") 
  121. 		pause_ctrl_scheme_mask_morph(BG_TYPE_STRONGHOLD, screen_width, mask_x) 
  122. 	end 
  123. 	 
  124. 	local screen_in_anim = Vdo_anim_object:new("ctrl_back_in_anim", 0, Ctrl_scheme_doc) 
  125. 	screen_in_anim:play(0) 
  126. 	 
  127. end 
  128.  
  129.  
  130. function pause_ctrl_scheme_cleanup() 
  131. 	--Kill menu cycle thread... 
  132. 	thread_kill(Pause_menu_controller_thread_h) 
  133. 	Pause_menu_controller_thread_h = -1 
  134.  
  135. 	--Free up Memory... 
  136. 	pause_menu_control_scheme_init(false) 
  137. 	 
  138. 	-- Nuke all button subscriptions 
  139. 	Input_tracker:subscribe(false) 
  140. 	if Mouse_input_tracker ~= nil then 
  141. 		Mouse_input_tracker:subscribe(false) 
  142. 	end 
  143. 	List:enable_toggle_input(false) 
  144. end 
  145.  
  146. function pause_ctrl_scheme_nav_up(event, acceleration) 
  147. end 
  148.  
  149. function pause_ctrl_scheme_nav_down(event, acceleration) 
  150. end 
  151.  
  152. function pause_ctrl_scheme_nav_left(event, acceleration) 
  153. 	-- Move highlight left 
  154. 	Control_list:move_slider(-1) 
  155. 	 
  156. 	--Update control menu... 
  157. 	pause_ctrl_scheme_reset(Control_list:get_toggle_selection() - 1) 
  158. end 
  159.  
  160. function pause_ctrl_scheme_nav_right(event, acceleration) 
  161. 	-- Move highlight right 
  162. 	Control_list:move_slider(1) 
  163. 	 
  164. 	--Update control menu... 
  165. 	pause_ctrl_scheme_reset(Control_list:get_toggle_selection() - 1) 
  166. end 
  167.  
  168. function pause_ctrl_scheme_button_a(event, acceleration) 
  169. 	if Tween_done == true then 
  170. 		--pass off the input to the list 
  171. 		--Control_list:button_a() 
  172. 		pause_ctrl_scheme_nav_right(event, acceleration) 
  173. 	end 
  174. end 
  175.  
  176. function pause_ctrl_scheme_button_b(event, acceleration) 
  177. 	if Tween_done == true then 
  178. 		--slide the screen out 
  179. 		local screen_out_anim = Vdo_anim_object:new("ctrl_slide_out_anim",0,Ctrl_scheme_doc) 
  180. 		screen_out_anim:play(0) 
  181. 	 
  182. 		if Mouse_input_tracker ~= nil then 
  183. 			Mouse_input_tracker:subscribe(false) 
  184. 		end 
  185. 		List:enable_toggle_input(false) 
  186.  
  187. 		-- Save options 
  188. 		pause_menu_accept_options() 
  189. 		 
  190. 		--Remove from internal stack for button tracking and pop screen. 
  191. 		menu_common_stack_remove() 
  192. 		 
  193. 		Control_list:button_b() 
  194. 		menu_common_transition_pop(1)	 
  195. 		 
  196. 		--List:set_visible(true) 
  197. 		--Header_obj:set_visible(true) 
  198. 	end 
  199. end 
  200.  
  201. -------------------------------------------------- 
  202. -- SR2 Stuff... 
  203. -------------------------------------------------- 
  204.  
  205. function pause_ctrl_scheme_reset(scheme_id) 
  206. 	local which_controller, which_scheme, num_buttons = pause_menu_control_scheme_init(true, scheme_id) 
  207. 	local grp_h = vint_object_find("ctrls", 0, Ctrl_scheme_doc) 
  208. 	 
  209. 	Pause_menu_controller = {} 
  210. 	 
  211. 	if which_controller == 0 then 
  212. 		--XBOX2 
  213. 	else  
  214. 		--PS3 
  215. 		local h = vint_object_find("dpad", grp_h) 
  216. 		vint_set_property(h, "anchor", 0, -109 ) 
  217. 		local h = vint_object_find("left_sticks", grp_h) 
  218. 		vint_set_property(h, "anchor", 0, 190) 
  219. 		local h = vint_object_find("start", grp_h) 
  220. 		vint_set_property(h, "anchor", 20, 0) 
  221. 	end 
  222. 	 
  223. 	 
  224. 	--Left Side buttons 
  225. 	local btn_lt_h = vint_object_find("0_btn", grp_h) 
  226. 	vint_set_property(btn_lt_h, "image", CTRL_BUTTON_LT) 
  227. 	 
  228. 	local btn_lb_h = vint_object_find("1_btn", grp_h) 
  229. 	vint_set_property(btn_lb_h, "image", CTRL_BUTTON_LB) 
  230. 	 
  231. 	local btn_ls_h = vint_object_find("3_btn", grp_h) 
  232. 	vint_set_property(btn_ls_h, "image", CTRL_BUTTON_LS) 
  233.  
  234. 	local btn_ls_press_h = vint_object_find("4_btn", grp_h) 
  235. 	vint_set_property(btn_ls_press_h, "image", CTRL_BUTTON_LS_PRESS) 
  236.  
  237. 	local btn_dpad_up_h = vint_object_find("6_btn", grp_h) 
  238. 	vint_set_property(btn_dpad_up_h, "image", CTRL_BUTTON_DPAD_UP) 
  239.  
  240. 	local btn_dpad_left_h = vint_object_find("7_btn", grp_h) 
  241. 	vint_set_property(btn_dpad_left_h, "image", CTRL_BUTTON_DPAD_LEFT) 
  242.  
  243. 	local btn_dpad_down_h = vint_object_find("8_btn", grp_h) 
  244. 	vint_set_property(btn_dpad_down_h, "image", CTRL_BUTTON_DPAD_DOWN) 
  245.  
  246. 	local btn_dpad_right_h = vint_object_find("9_btn", grp_h) 
  247. 	vint_set_property(btn_dpad_right_h, "image", CTRL_BUTTON_DPAD_RIGHT) 
  248. 	 
  249. 	--Right Side Button... 
  250. 	local btn_rt_h = vint_object_find("10_btn", grp_h) 
  251. 	vint_set_property(btn_rt_h, "image", CTRL_BUTTON_RT) 
  252. 	 
  253. 	local btn_rb_h = vint_object_find("11_btn", grp_h) 
  254. 	vint_set_property(btn_rb_h, "image", CTRL_BUTTON_RB) 
  255.  
  256. 	local btn_y_h = vint_object_find("12_btn", grp_h) 
  257. 	vint_set_property(btn_y_h, "image", CTRL_BUTTON_Y) 
  258. 	 
  259. 	local btn_b_h = vint_object_find("13_btn", grp_h) 
  260. 	vint_set_property(btn_b_h, "image", get_actual_b_button()) 
  261. 	 
  262. 	local btn_a_h = vint_object_find("14_btn", grp_h) 
  263. 	vint_set_property(btn_a_h, "image", CTRL_BUTTON_X) 
  264. 	 
  265. 	local btn_x_h = vint_object_find("15_btn", grp_h) 
  266. 	vint_set_property(btn_x_h, "image", get_actual_a_button()) 
  267. 	 
  268. 	local btn_rs_h = vint_object_find("16_btn", grp_h) 
  269. 	vint_set_property(btn_rs_h, "image", CTRL_BUTTON_RS) 
  270. 	 
  271. 	local btn_rs_press_h = vint_object_find("17_btn", grp_h) 
  272. 	vint_set_property(btn_rs_press_h, "image", CTRL_BUTTON_RS_PRESS) 
  273. 	 
  274. 	--Middle Buttons 
  275. 	local btn_start_h = vint_object_find("18_btn", grp_h) 
  276. 	vint_set_property(btn_start_h, "image", CTRL_BUTTON_START) 
  277.  
  278. 	local btn_back_h = vint_object_find("19_btn", grp_h) 
  279. 	vint_set_property(btn_back_h, "image", CTRL_MENU_BUTTON_BACK) 
  280. 	 
  281. 	Pause_menu_controller = {  
  282. 		["L1"] 						= { labels = { }, num_buttons = 0, cur_button = 0,  
  283. 										  handles = { button_h = vint_object_find("1_txt", grp_h), label_h = btn_lb_h } }, 
  284. 		["L2"] 						= { labels = { }, num_buttons = 0, cur_button = 0,  
  285. 										  handles = { button_h = vint_object_find("0_txt", grp_h), label_h = btn_lt_h } }, 
  286. 		["analog left"] 			= { labels = { }, num_buttons = 0, cur_button = 0,  
  287. 										  handles = { button_h = vint_object_find("3_txt", grp_h), label_h = btn_ls_h } }, 
  288. 		["analog left click 1"]	= { labels = { }, num_buttons = 0, cur_button = 0,  
  289. 										  handles = { button_h = vint_object_find("4_txt", grp_h), label_h = btn_ls_press_h } }, 
  290. 	--	["analog left click 2"]	= { labels = { }, num_buttons = 0, cur_button = 0,  
  291. 	--									  handles = { button_h = 0, label_h = 0 } }, 
  292. 		["dpad up"]					= { labels = { }, num_buttons = 0, cur_button = 0,  
  293. 										  handles = { button_h = vint_object_find("6_txt", grp_h), label_h = btn_dpad_up_h } }, 
  294. 		["dpad left"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  295. 										  handles = { button_h = vint_object_find("7_txt", grp_h), label_h = btn_dpad_left_h } }, 
  296. 		["dpad down"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  297. 										  handles = { button_h = vint_object_find("8_txt", grp_h), label_h = btn_dpad_down_h } }, 
  298. 		["dpad right"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  299. 										  handles = { button_h = vint_object_find("9_txt", grp_h), label_h = btn_dpad_right_h } }, 
  300. 		["R2"]						= { labels = { }, num_buttons = 0, cur_button = 0,  
  301. 										  handles = { button_h = vint_object_find("10_txt", grp_h), label_h = btn_rt_h } }, 
  302. 		["R1"]						= { labels = { }, num_buttons = 0, cur_button = 0,  
  303. 										  handles = { button_h = vint_object_find("11_txt", grp_h), label_h = btn_rb_h } }, 
  304. 		["button y"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  305. 										  handles = { button_h = vint_object_find("12_txt", grp_h), label_h = btn_y_h } }, 
  306. 		["button b"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  307. 										  handles = { button_h = vint_object_find("13_txt", grp_h), label_h = btn_b_h } }, 
  308. 		["button a"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  309. 										  handles = { button_h = vint_object_find("14_txt", grp_h), label_h = btn_a_h } }, 
  310. 		["button x"]				= { labels = { }, num_buttons = 0, cur_button = 0,  
  311. 										  handles = { button_h = vint_object_find("15_txt", grp_h), label_h = btn_x_h } }, 
  312. 		["analog right"]			= { labels = { }, num_buttons = 0, cur_button = 0,  
  313. 										  handles = { button_h = vint_object_find("16_txt", grp_h), label_h = btn_rs_h } }, 
  314. 		["analog right click"]	= { labels = { }, num_buttons = 0, cur_button = 0,  
  315. 										  handles = { button_h = vint_object_find("17_txt", grp_h), label_h = btn_rs_press_h } }, 
  316. 		["back"]						= { labels = { }, num_buttons = 0, cur_button = 0,  
  317. 										  handles = { button_h = vint_object_find("19_txt", grp_h), label_h = btn_back_h } }, 
  318. 		["start"]					= { labels = { }, num_buttons = 0, cur_button = 0,  
  319. 										  handles = { button_h = vint_object_find("18_txt", grp_h), label_h = btn_start_h } },  
  320. 	} 
  321. 	 
  322. 	for idx, val in pairs(Pause_menu_controller) do 
  323. 		vint_set_property(val.handles.button_h, "visible", false) 
  324. 		vint_set_property(val.handles.label_h, "visible", false) 
  325. 		val.num_buttons = 0 
  326. 		val.cur_button = 0 
  327. 	end 
  328.  
  329. 	vint_dataresponder_request("pause_menu_control_scheme", "pause_ctrl_scheme_populate", 0, scheme_id) 
  330. 	 
  331. 	if Pause_menu_controller_thread_h ~= -1 then 
  332. 		thread_kill(Pause_menu_controller_thread_h) 
  333. 		Pause_menu_controller_thread_h = -1 
  334. 	end	 
  335. 	Pause_menu_controller_thread_h = thread_new("pause_ctrl_scheme_cycle") 
  336. end 
  337.  
  338. function pause_ctrl_scheme_cycle() 
  339. 	while true do 
  340. 		delay(2) 
  341. 		for i, val in pairs(Pause_menu_controller) do 
  342. 			local num_buttons = val.num_buttons 
  343. 			local cur_button = val.cur_button 
  344. 			 
  345. 			cur_button = cur_button + 1 
  346. 			if cur_button >= num_buttons then 
  347. 				cur_button = 0 
  348. 			end 
  349. 			 
  350. 			if cur_button ~= val.cur_button then 
  351. 				val.cur_button = cur_button 
  352. 				vint_set_property(val.handles.button_h, "text_tag", val.labels[cur_button])	 
  353. 			end 
  354. 		end 
  355. 	end 
  356. end 
  357.  
  358.  
  359.  
  360. --Populates the control scheme with propert text.. 
  361. --This gets called by a dataresponder... 
  362. -- 
  363. --@param 	button_name		This is the ID sent from game to change text for a certain button... 
  364. --@param		button			this is the text that gets used on the button. 
  365. function pause_ctrl_scheme_populate(button_name, button) 
  366. 	local num_buttons = Pause_menu_controller[button_name].num_buttons 
  367. 	Pause_menu_controller[button_name].labels[num_buttons] = button 
  368. 	 
  369. 	if num_buttons == 0 then 
  370. 		vint_set_property(Pause_menu_controller[button_name].handles.button_h, "visible", true) 
  371. 		vint_set_property(Pause_menu_controller[button_name].handles.button_h, "text_tag", button) 
  372. 		 
  373. 		if Pause_menu_controller[button_name].handles.label_h ~= 0 then  
  374. 			vint_set_property(Pause_menu_controller[button_name].handles.label_h, "visible", true) 
  375. 		end	 
  376. 	end 
  377. 	Pause_menu_controller[button_name].num_buttons = num_buttons + 1 
  378. end 
  379.  
  380.  
  381. -- This gets called after naving or pressing a button... 
  382. -- Changes the Controlscheme internally and updates the menu. 
  383. -- 
  384. -- @param	button_data			Table of button data... 
  385. function pause_ctrl_scheme_update_scheme(button_data) 
  386. 	--This gets called after naving... 
  387. 	pause_menu_change_control_scheme(0) --always use first control scheme in list... 
  388. 	pause_ctrl_scheme_reset(button_data.current_value - 1) 
  389. end 
  390.  
  391.  
  392. function pause_ctrl_scheme_button_start(event, acceleration) 
  393. 	if Tween_done == true then 
  394. 		local screen_grp_h = vint_object_find("screen_grp", 0, Ctrl_scheme_doc) 
  395. 	 
  396. 		local screen_out_anim_h = vint_object_find("screen_out_anim", 0, Ctrl_scheme_doc) 
  397. 		lua_play_anim(screen_out_anim_h, 0, Ctrl_scheme_doc) 
  398. 		 
  399. 		menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_out_anim, pause_menu_top_anim_in_done) 
  400.  
  401. 		bg_saints_slide_out() 
  402. 		-- stack is part of common, which is getting popped, so we don't update it. 
  403. 		if game_get_platform() ~= "PC" then 
  404. 			menu_common_transition_pop(5)	-- pause_ctrl_scheme, options_control, options, pause menu top, pause_menu common 
  405. 		else 
  406. 			menu_common_transition_pop(6) 
  407. 		end 
  408. 	end	 
  409. end 
  410.  
  411. Options_Controls_Data = { 
  412. 	[1] = { 
  413. 		type = TYPE_TOGGLE, 
  414. 		label = "CONTROL_SCHEME", 
  415. 		options = {"CONTROLS_SETUP_FOOT", "CONTROLS_SETUP_DRIVING", "CONTROLS_SETUP_AIRCRAFT"}, 
  416. 		current_value = 1, 
  417. 		on_nav = pause_ctrl_scheme_update_scheme, 
  418. 		on_select = pause_ctrl_scheme_update_scheme, 
  419. 	},	 
  420. } 
  421.  
  422. function pause_ctrl_scheme_mask_morph( screen_type, size_end_x, anchor_end_x ) 
  423. 	--get handles for everyone 
  424. 	local mask_h = vint_object_find("screen_mask", 0, Ctrl_scheme_doc) 
  425. 	local morph_anim_h = vint_object_find("ctrl_mask_anim", 0, Ctrl_scheme_doc) 
  426. 	local morph_scale_twn_h = vint_object_find("ctrl_mask_scale_twn", 0, Ctrl_scheme_doc) 
  427. 	local morph_anchor_twn_h = vint_object_find("ctrl_mask_anchor_twn", 0, Ctrl_scheme_doc)  
  428. 	 
  429. 	--set up the left shadow start and end values 
  430. 	--get the starting x position 
  431. 	--create the center anchor point from the width of the mask, only if we are center aligned 
  432. 	--if screen_type == BG_TYPE_CENTER then 
  433. 		--anchor_end_x = (anchor_end_x) - (size_end_x * 0.5) 
  434. 	--end 
  435. 	 
  436. 	--setup the anchor for the mask 
  437. 	--get the starting x position 
  438. 	local mask_anchor_start_x,mask_anchor_start_y = vint_get_property( mask_h, "anchor" ) 
  439. 	vint_set_property(morph_anchor_twn_h, "start_value", mask_anchor_start_x, mask_anchor_start_y ) 
  440. 	vint_set_property(morph_anchor_twn_h, "end_value", anchor_end_x, mask_anchor_start_y ) 
  441. 	 
  442. 	--setup the scale of the mask 
  443. 	--get the starting scale 
  444. 	local size_start_x,size_start_y = vint_get_property(mask_h,"scale") 
  445. 	--get the correct size, this fixes SD scale issues 
  446. 	local adjusted_size_end_x,crap = element_get_scale_from_size(mask_h, size_end_x, 16) 
  447. 	if vint_is_std_res() and not In_pause_menu then 
  448. 		adjusted_size_end_x = adjusted_size_end_x + 2 
  449. 	end 
  450. 	vint_set_property(morph_scale_twn_h, "start_value", size_start_x , size_start_y) 
  451. 	vint_set_property(morph_scale_twn_h, "end_value", adjusted_size_end_x, size_start_y) 
  452. 	 
  453. 	--play the animation 
  454. 	lua_play_anim(morph_anim_h, 0, Ctrl_scheme_doc)	 
  455. end 
  456.  
  457. function pause_ctrl_scheme_set_slide_in_values( new_x ) 
  458. 	local ctrl_anchor_twn_h = vint_object_find("ctrl_ctrls_back_anchor", 0, Ctrl_scheme_doc) 
  459. 	local header_anchor_twn_h = vint_object_find("ctrl_header_back_anchor", 0, Ctrl_scheme_doc)  
  460. 	local list_anchor_twn_h = vint_object_find("ctrl_list_back_anchor", 0, Ctrl_scheme_doc)  
  461. 	 
  462. 	local ctrl_x,ctrl_y = vint_get_property(ctrl_anchor_twn_h, "end_value") 
  463. 	local header_x,header_y = vint_get_property(header_anchor_twn_h, "end_value") 
  464. 	local list_x,list_y = vint_get_property(list_anchor_twn_h, "end_value") 
  465. 	 
  466. 	local ctrl_offset = 46 
  467. 	local header_offset = 30 
  468. 	local list_offset = 0 
  469. 	if vint_is_std_res() == true then 
  470. 		ctrl_offset = 75 
  471. 		header_offset = 60 
  472. 		list_offset = 28 
  473. 	end 
  474. 	 
  475. 	vint_set_property(ctrl_anchor_twn_h, "end_value", new_x + ctrl_offset, ctrl_y) 
  476. 	vint_set_property(header_anchor_twn_h, "end_value", new_x + header_offset, header_y) 
  477. 	vint_set_property(list_anchor_twn_h, "end_value", new_x + list_offset, list_y) 
  478. end 
  479.  
  480. -- Mouse inputs 
  481. function pause_ctrl_scheme_mouse_click(event, target_handle, mouse_x, mouse_y) 
  482. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  483. 	if hint_index == 1 then 
  484. 		pause_ctrl_scheme_button_b() 
  485. 	end 
  486.  
  487. 	local new_index = Control_list:get_button_index(target_handle) 
  488. 	if new_index ~= 0 then 
  489. 		Control_list:set_selection(new_index) 
  490. 		pause_ctrl_scheme_nav_right() 
  491. 	end 
  492. 	if Control_list:is_left_arrow(target_handle) then 
  493. 		pause_ctrl_scheme_nav_left() 
  494. 	end 
  495. end 
  496.  
  497. function pause_ctrl_scheme_mouse_move(event, target_handle) 
  498. 	Menu_hint_bar:set_highlight(0) 
  499. 	 
  500. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  501. 	if hint_index ~= 0 then 
  502. 		Menu_hint_bar:set_highlight(hint_index) 
  503. 	end 
  504. 	 
  505. 	local new_index = Control_list:get_button_index(target_handle) 
  506. 	if new_index ~= 0 then 
  507. 		Control_list:set_selection(new_index) 
  508. 		Control_list:move_cursor(0, true) 
  509. 	end 
  510. end