./pause_options_display_pc.lua

  1. local Anims = {} 
  2.  
  3. local Input_tracker 
  4. local Mouse_input_tracker 
  5.  
  6. local Display_pc_doc_handle 
  7.  
  8. local Tween_done = true 
  9. local Exit_pending = false 
  10. local Show_dialog = true 
  11. local Confirm_dialog_h = 0 
  12. local Confirm_dialog_thread_h = -1 
  13.  
  14. local ID_DISPLAY_PRESET		= 0 
  15. local ID_VSYNC					= 1 
  16. local ID_MINIMAP				= 2 
  17. local ID_DISPLAY_IDX			= 3 
  18. local ID_ASPECT				= 4 
  19. local ID_RESOLUTIONS			= 5 
  20. local ID_WINDOW_MODE			= 6 
  21. local ID_ANTI_ALIASING		= 7 
  22. local ID_TEXTURE_FILTER_MODE = 8 
  23. local ID_SCENE_DETAIL		= 9 
  24. local ID_LIGHTING_DETAIL	= 10 
  25. local ID_SHADOW_DETAIL		= 11 
  26. local ID_REFLECTIONS			= 12 
  27. local ID_POST_PROCESSING_DETAIL = 13 
  28. local ID_AMBIENT_OCCLUSION	= 14 
  29. local ID_BRIGHTNESS			= 15 
  30.  
  31. local PRESET_INDEX = -1 
  32. local ASPECT_INDEX = -1 
  33. local RESOLUTIONS_INDEX = -1 
  34. local ANTI_ALIASING_INDEX = -1 
  35. local AMBIENT_OCCLUSION_INDEX = -1 
  36. local DX11_INDEX = -1 
  37. local Max_visible = 10 
  38.  
  39. local Display_modes = {} 
  40. local MSAA_levels = {} 
  41.  
  42. local Current_display_preset = 5 
  43. local Current_vsync = false 
  44. local Current_static_map = false 
  45. local Current_num_displays = 0 
  46. local Current_display_idx = 0 
  47. local Current_width = 0 
  48. local Current_height = 0 
  49. local Current_aspect_is_widescreen = false 
  50. local Current_refresh_rate = 0 
  51. local Current_display_mode_idx = 0 
  52. local Current_msaa_level = 0 
  53. local Current_window_mode = 0 
  54. local Current_texture_filter = 0 
  55. local Current_scene_detatil = 0 
  56. local Current_lighting_detatil = 0 
  57. local Current_shadow_level = 0 
  58. local Current_reflections_level = 0 
  59. local Current_post_processing_detail = 0 
  60. local Current_ambient_occlusion_level = 0 
  61.  
  62. local Screen_width = 840 
  63.  
  64. local Screen_id = -1 
  65.  
  66. local Data = {} 
  67.  
  68. local Setting_changed = false 
  69.  
  70. function update_disabled() 
  71. 	Data[ASPECT_INDEX].disabled = In_pause_menu 
  72. 	local should_disable = not (Data[PRESET_INDEX].current_value == 5) 
  73. 	for i = ANTI_ALIASING_INDEX, AMBIENT_OCCLUSION_INDEX do 
  74. 		Data[i].disabled = should_disable 
  75. 	end 
  76. end 
  77.  
  78. local function build_list(skip_to_preset) 
  79.  
  80. 	skip_to_preset = skip_to_preset or false 
  81. 	 
  82. 	-- Allow the ability to skip directly to the preset section of the menu, 
  83. 	-- 	this enables for just the preset section of the menu and after it  
  84. 	-- 	to be rebuilt instead of the entire menu -Rossi 6-21-13 
  85. 	if skip_to_preset == false then 
  86. 		if game_is_pc_dx11() and Current_num_displays > 1 then 
  87. 			Data[#Data + 1] = { 
  88. 				type = TYPE_TOGGLE, 
  89. 				label = "PLT_MENU_DISPLAY_INDEX", 
  90. 				options = {}, 
  91. 				tool_tip_text = "PLT_MENU_DISPLAY_INDEX_TOOLTIP", 
  92. 				id = ID_DISPLAY_IDX, 
  93. 			} 
  94. 			for i = 1, Current_num_displays do 
  95. 				Data[#Data].options[i] = "PLT_MENU_DISPLAY_"..var_to_string(i) 
  96. 			end 
  97. 			Data[#Data].disabled = Current_num_displays < 2 
  98. 			Data[#Data].current_value = Current_display_idx + 1 
  99. 			Data[#Data].old_value = Data[#Data].current_value 
  100. 		end 
  101.  
  102. 		Data[#Data + 1] = { 
  103. 			type = TYPE_TOGGLE, 
  104. 			label = "PLT_MENU_ASPECT", 
  105. 			options = {"PLT_MENU_WIDESCREEN", "PLT_MENU_STANDARD"}, 
  106. 			tool_tip_text = "PLT_MENU_ASPECT_TOOLTIP", 
  107. 			id = ID_ASPECT 
  108. 		} 
  109. 		ASPECT_INDEX = #Data 
  110. 		Data[ASPECT_INDEX].disabled = In_pause_menu -- disable if in gameplay 
  111. 		Data[ASPECT_INDEX].current_value = Current_aspect_is_widescreen and 1 or 2 
  112. 		Data[ASPECT_INDEX].old_value = Data[ASPECT_INDEX].current_values 
  113.  
  114. 		Data[#Data + 1]  = { 
  115. 			type = TYPE_TOGGLE, 
  116. 			label = "PLT_MENU_RESOLUTIONS", 
  117. 			options = {}, 
  118. 			tool_tip_text = "PLT_MENU_RESOLUTIONS_TOOLTIP", 
  119. 			id = ID_RESOLUTIONS, 
  120. 		} 
  121. 		RESOLUTIONS_INDEX = #Data 
  122. 		Data[RESOLUTIONS_INDEX].current_value = -1 
  123. 		populate_display_modes(Current_display_idx, Current_aspect_is_widescreen) 
  124. 				Data[RESOLUTIONS_INDEX].old_value = Data[RESOLUTIONS_INDEX].current_value 
  125.  
  126. 		Data[#Data + 1] = { 
  127. 			type = TYPE_TOGGLE, 
  128. 			label = "PLT_MENU_DISPLAY_MODE", 
  129. 			options = {"PLT_MENU_FULL_SCREEN", "PLT_MENU_WINDOWED", "PLT_MENU_BORDERLESS"}, 
  130. 			tool_tip_text = "PLT_MENU_DISPLAY_MODE_TOOLTIP", 
  131. 			id = ID_WINDOW_MODE, 
  132. 		} 
  133. 		Data[#Data].current_value = Current_window_mode 
  134. 		Data[#Data].old_value = Data[#Data].current_value 
  135. 		 
  136. 		Data[#Data + 1] = { 
  137. 			type = TYPE_TOGGLE, 
  138. 			label = "PLT_MENU_VSYNC", 
  139. 			options = {"OPTION_NO", "OPTION_YES"}, 
  140. 			tool_tip_text = "PLT_MENU_VSYNC_TOOLTIP", 
  141. 			id = ID_VSYNC 
  142. 		} 
  143. 		Data[#Data].current_value = Current_vsync and 2 or 1 
  144. 		Data[#Data].old_value = Data[#Data].current_value 
  145. 	end 
  146. 	 
  147. 	Data[#Data + 1] = { 
  148. 		type = TYPE_TOGGLE, 
  149. 		label = "PLT_MENU_DISPLAY_PRESET", 
  150. 		options = {"MENU_LOW", "MENU_MEDIUM", "MENU_HIGH", "MENU_ULTRA", "MENU_CUSTOM"}, 
  151. 		tool_tip_text = "PLT_MENU_DISPLAY_PRESET_TOOLTIP", 
  152. 		id = ID_DISPLAY_PRESET 
  153. 	} 
  154. 	PRESET_INDEX = #Data 
  155. 	Data[#Data].current_value = Current_display_preset 
  156. 	Data[#Data].old_value = Data[#Data].current_value 
  157.  
  158. 	Data[#Data + 1] = { 
  159. 		type = TYPE_TOGGLE, 
  160. 		label = "PLT_MENU_ANTI_ALIASING", 
  161. 		options = {}, 
  162. 		tool_tip_text = "PLT_MENU_ANTI_ALIASING_TOOLTIP", 
  163. 		id = ID_ANTI_ALIASING, 
  164. 	} 
  165. 	ANTI_ALIASING_INDEX = #Data 
  166. 	populate_anti_aliasing_levels(Current_display_idx) 
  167. 	Data[ANTI_ALIASING_INDEX].current_value = 1 
  168. 	for i, msaa_level in pairs (MSAA_levels) do 
  169. 		if Current_msaa_level == msaa_level.level then 
  170. 			Data[ANTI_ALIASING_INDEX].current_value = i 
  171. 			Data[ANTI_ALIASING_INDEX].old_value = Data[ANTI_ALIASING_INDEX].current_value 
  172. 		end 
  173. 	end 
  174.  
  175. 	Data[#Data + 1] = { 
  176. 		type = TYPE_TOGGLE, 
  177. 		label = "PLT_MENU_TEXTURE_FILTER_MODE", 
  178. 		options = {"PLT_TRILINEAR", "PLT_ANISOTROPIC_TWO", "PLT_ANISOTROPIC_FOUR", "PLT_ANISOTROPIC_EIGHT", "PLT_ANISOTROPIC_SIXTEEN"}, 
  179. 		tool_tip_text = "PLT_MENU_TEXTURE_FILTER_MODE_TOOLTIP", 
  180. 		id = ID_TEXTURE_FILTER_MODE, 
  181. 	} 
  182. 	Data[#Data].current_value = Current_texture_filter 
  183. 	Data[#Data].old_value = Data[#Data].current_value 
  184. 	 
  185. 	Data[#Data + 1] = { 
  186. 		type = TYPE_TOGGLE, 
  187. 		label = "PLT_MENU_SCENE_DETAIL", 
  188. 		options = {"MENU_LOW", "MENU_MEDIUM", "MENU_HIGH"}, 
  189. 		tool_tip_text = "PLT_MENU_SCENE_DETAIL_TOOLTIP", 
  190. 		id = ID_SCENE_DETAIL, 
  191. 	} 
  192. 	Data[#Data].current_value = Current_scene_detatil 
  193. 	Data[#Data].old_value = Data[#Data].current_value 
  194.  
  195. 	Data[#Data + 1] = { 
  196. 		type = TYPE_TOGGLE, 
  197. 		label = "PLT_MENU_LIGHTING_DETAIL", 
  198. 		options = {"MENU_LOW", "MENU_HIGH"}, 
  199. 		tool_tip_text = "PLT_MENU_LIGHTING_DETAIL_TOOLTIP", 
  200. 		id = ID_LIGHTING_DETAIL, 
  201. 	} 
  202. 	Data[#Data].current_value = Current_lighting_detatil 
  203. 	Data[#Data].old_value = Data[#Data].current_value 
  204. 	if Current_lighting_detatil == 3 then 
  205. 		Data[#Data].options[3] = "MENU_ULTRA" 
  206. 	end 
  207.  
  208. 	Data[#Data + 1] = { 
  209. 		type = TYPE_TOGGLE, 
  210. 		label = "PLT_MENU_SHADOW_DETAIL", 
  211. 		options = {"MENU_OFF", "MENU_LOW", "MENU_MEDIUM", "MENU_HIGH"}, 
  212. 		tool_tip_text = "PLT_MENU_SHADOW_DETAIL_TOOLTIP", 
  213. 		id = ID_SHADOW_DETAIL, 
  214. 	} 
  215. 	Data[#Data].current_value = Current_shadow_level 
  216. 	Data[#Data].old_value = Data[#Data].current_value 
  217.  
  218. 	Data[#Data + 1] = { 
  219. 		type = TYPE_TOGGLE, 
  220. 		label = "PLT_MENU_REFLECTIONS", 
  221. 		options = {"MENU_OFF", "MENU_LOW", "MENU_HIGH"}, 
  222. 		tool_tip_text = "PLT_MENU_REFLECTIONS_TOOLTIP", 
  223. 		id = ID_REFLECTIONS, 
  224. 	} 
  225. 	Data[#Data].current_value = Current_reflections_level 
  226. 	Data[#Data].old_value = Data[#Data].current_value 
  227. 	DX11_INDEX = #Data 
  228.  
  229. 	Data[#Data + 1] = { 
  230. 		type = TYPE_TOGGLE, 
  231. 		label = "PLT_MENU_POST_PROCESSING_DETAIL", 
  232. 		options = {"MENU_OFF", "MENU_LOW", "MENU_HIGH"}, 
  233. 		tool_tip_text = "PLT_MENU_POST_PROCESSING_DETAIL_TOOLTIP", 
  234. 		id = ID_POST_PROCESSING_DETAIL, 
  235. 	} 
  236. 	Data[#Data].current_value = Current_post_processing_detail 
  237. 	Data[#Data].old_value = Data[#Data].current_value 
  238.  
  239. 	Data[#Data + 1] = { 
  240. 		type = TYPE_TOGGLE, 
  241. 		label = "PLT_MENU_AMBIENT_OCCLUSION", 
  242. 		options = {"MENU_OFF", "MENU_LOW", "MENU_MEDIUM", "MENU_HIGH"}, 
  243. 		tool_tip_text = "PLT_MENU_AMBIENT_OCCLUSION_TOOLTIP", 
  244. 		id = ID_AMBIENT_OCCLUSION, 
  245. 	} 
  246. 	AMBIENT_OCCLUSION_INDEX = #Data 
  247. 	Data[#Data].current_value = Current_ambient_occlusion_level 
  248. 	Data[#Data].old_value = Data[#Data].current_value 
  249. 	 
  250. 	Data[#Data + 1] = { 
  251. 		type = TYPE_BUTTON, 
  252. 		label = "MENU_DISPLAY_BRIGHTNESS", 
  253. 		tool_tip_text = "PLT_MENU_BRIGHTNESS_TOOLTIP", 
  254. 		id = ID_BRIGHTNESS 
  255. 	} 
  256. 	 
  257. 	update_disabled() 
  258. 	 
  259. 	List:set_properties(nil, nil, nil, nil, nil, nil, true) 
  260. 	List:draw_items(Data, 1, Screen_width, Max_visible) 
  261.  
  262. end 
  263.  
  264. function enforce_dx9() 
  265. 	if game_is_pc_dx11() then 
  266. 		return 
  267. 	end 
  268. 	 
  269. 	local changed = false 
  270. 	if List:get_data_from_id(ID_REFLECTIONS).current_value == 3 then 
  271. 		Data[DX11_INDEX + 0].current_value = 2 
  272. 		changed = true 
  273. 	end 
  274. 	if List:get_data_from_id(ID_POST_PROCESSING_DETAIL).current_value == 3 then 
  275. 		Data[DX11_INDEX + 1].current_value = 2 
  276. 		changed = true 
  277. 	end 
  278. 	if List:get_data_from_id(ID_AMBIENT_OCCLUSION).current_value > 2 then 
  279. 		Data[DX11_INDEX + 2].current_value = 2 
  280. 		changed = true 
  281. 	end 
  282. 	 
  283. 	if changed then 
  284. 		local idx = List.visible_start_idx 
  285. 		List:draw_items(Data, List:get_selection(), Screen_width, Max_visible) 
  286. 		 
  287. 		-- Recreate mouse input tracking 
  288. 		Mouse_input_tracker:remove_all() 
  289. 		List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  290. 		Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  291. 		Mouse_input_tracker:subscribe(true) 
  292. 	end 
  293. end 
  294.  
  295. function populate_display_modes(display_idx, widescreen) 
  296. 	local orig_w = Current_width 
  297. 	local orig_h = Current_height 
  298. 	if Display_modes[Data[RESOLUTIONS_INDEX].current_value] ~= nil then 
  299. 		orig_w = Display_modes[Data[RESOLUTIONS_INDEX].current_value].width 
  300. 		orig_h = Display_modes[Data[RESOLUTIONS_INDEX].current_value].height 
  301. 	end 
  302. 	Data[RESOLUTIONS_INDEX].options = {} 
  303. 	Display_modes = {} 
  304. 	vint_dataresponder_request("options_display_populate_display_modes", "options_display_populate_display_modes", 0, display_idx, widescreen) 
  305.  
  306. 	-- Add all the display modes to the list. 
  307. 	local best_mode_w = 100000; 
  308. 	local best_mode_h = 100000; 
  309. 	for i, mode in pairs (Display_modes) do 
  310. 		Data[RESOLUTIONS_INDEX].options[i] = var_to_string(mode.width).." x "..var_to_string(mode.height) 
  311. 		 
  312. 		-- See if this is the closest mode to our current. 
  313. 		local diff_w = abs(mode.width - orig_w) 
  314. 		local diff_h = abs(mode.height - orig_h) 
  315. 		if diff_w <= best_mode_w and diff_h <= best_mode_h then 
  316. 			-- If so, select it. 
  317. 			Data[RESOLUTIONS_INDEX].current_value = i 
  318. 			best_mode_w = diff_w 
  319. 			best_mode_h = diff_h 
  320. 	end 
  321. 	end 
  322.  
  323. 	-- If we didn't add any, just add the current mode. It'll get grayed out below. 
  324. 	if #Data[RESOLUTIONS_INDEX].options == 0 then 
  325. 		Data[RESOLUTIONS_INDEX].options[1] = var_to_string(Current_width).." x "..var_to_string(Current_height) 
  326. 		Data[RESOLUTIONS_INDEX].current_value = 1 
  327. 	end 
  328.  
  329. 	-- Set the disabled state of the resolutions, depending on if there are more resolutions to choose from 
  330. 	Data[RESOLUTIONS_INDEX].disabled = #Display_modes < 2 
  331. end 
  332.  
  333.  
  334. function options_display_populate_display_modes(width, height, refresh_rate, display_mode_idx) 
  335. 	local num_modes = #Display_modes + 1 
  336. 	Display_modes[num_modes] = {} 
  337. 	Display_modes[num_modes].width = width 
  338. 	Display_modes[num_modes].height = height 
  339. 	Display_modes[num_modes].refresh_rate = refresh_rate 
  340. 	Display_modes[num_modes].display_mode_idx = display_mode_idx 
  341. end 
  342.  
  343. function populate_anti_aliasing_levels(display_idx) 
  344.  
  345. 	MSAA_levels = {} 
  346. 	vint_dataresponder_request("options_display_populate_msaa", "options_display_populate_msaa", 0, display_idx) 
  347. 	for idx, msaa_level in pairs(MSAA_levels) do 
  348. 		if msaa_level.level == 0 or msaa_level.level == 1 then 
  349. 			-- MSAA level 1 is in DirectX 11 
  350. 			Data[ANTI_ALIASING_INDEX].options[idx] = "MENU_OFF" 
  351. 		else 
  352. 			Data[ANTI_ALIASING_INDEX].options[idx] = var_to_string(msaa_level.level).."X MSAA" 
  353. 		end 
  354. 	end 
  355.  
  356. 	-- Set the disabled state of the anti aliasing option, depending on if there are more msaa levels to choose from 
  357. 	Data[ANTI_ALIASING_INDEX].disabled = #MSAA_levels < 2 
  358. end 
  359.  
  360. function options_display_populate_msaa(level) 
  361. 	local num_msaa_levels = #MSAA_levels + 1 
  362. 	MSAA_levels[num_msaa_levels] = {} 
  363. 	MSAA_levels[num_msaa_levels].level = level 
  364. end 
  365.  
  366. function options_display_populate_current_settings(preset, vsync, static_map, num_displays, display_idx, width, height, is_widescreen, refresh_rate, display_mode_idx, current_msaa, current_window_mode, 
  367. 																	current_texture_filter, current_scene_detail, current_lighting_detatil, current_shadow_level, current_reflections_level, post_processing_detail, current_ambient_occlusion_level) 
  368.  
  369. 	Current_display_preset = preset 
  370. 	Current_vsync = vsync 
  371. 	--Current_static_map = static_map 
  372. 	Current_num_displays = num_displays 
  373. 	Current_display_idx = display_idx 
  374. 	Current_width = width 
  375. 	Current_height = height 
  376. 	Current_aspect_is_widescreen = is_widescreen 
  377. 	Current_refresh_rate = refresh_rate 
  378. 	Current_display_mode_idx = display_mode_idx 
  379. 	Current_msaa_level = current_msaa 
  380. 	Current_window_mode = current_window_mode 
  381. 	Current_texture_filter = current_texture_filter 
  382. 	Current_scene_detatil = current_scene_detail 
  383. 	Current_lighting_detatil = current_lighting_detatil 
  384. 	Current_shadow_level = current_shadow_level 
  385. 	Current_reflections_level = current_reflections_level 
  386. 	Current_post_processing_detail = post_processing_detail 
  387. 	Current_ambient_occlusion_level = current_ambient_occlusion_level 
  388.  
  389. end 
  390.  
  391. function pause_options_display_pc_init() 
  392. 	Display_pc_doc_handle = vint_document_find("pause_options_display_pc") 
  393. 	-- Subscribe to the button presses we need 
  394. 	 
  395. 	Input_tracker = Vdo_input_tracker:new() 
  396. 	Input_tracker:add_input("select", "options_display_button_a", 50) 
  397. 	Input_tracker:add_input("back", "options_display_button_b", 50) 
  398. 	Input_tracker:add_input("alt_select", "options_display_button_x", 50) 
  399. 	if In_pause_menu then 
  400. 		Input_tracker:add_input("pause", "options_display_button_start", 50) 
  401. 	end 
  402. 	Input_tracker:add_input("nav_up", "options_display_nav_up", 50) 
  403. 	Input_tracker:add_input("nav_down", "options_display_nav_down", 50) 
  404. 	Input_tracker:add_input("nav_left", "options_display_nav_left", 50) 
  405. 	Input_tracker:add_input("nav_right", "options_display_nav_right", 50) 
  406. 	Input_tracker:add_input("scancode", "options_display_apply", 50, false, 60) --'F2' key 
  407. 	Input_tracker:add_input("gamepad_y", "options_display_apply", 50) 
  408. 	Input_tracker:subscribe(false) 
  409.  
  410.  
  411. 	if vint_is_std_res() then 
  412. 		Screen_width = 750 
  413. 	else 
  414. 		Screen_width = 840 
  415. 	end 
  416. 	 
  417. 	--Set Button hints 
  418. 	local hint_data = { 
  419. 		{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  420. 		{CTRL_BUTTON_X, "PLT_MENU_AUTO_DETECT"}, 
  421. 		{CTRL_BUTTON_Y, "PLT_MENU_APPLY", "F2"}, 
  422. 	} 
  423. 	Menu_hint_bar:set_hints(hint_data)   
  424. 	 
  425. 	Header_obj:set_text("MENU_DISPLAY_TITLE", Screen_width) 
  426. 	 
  427. 	vint_dataresponder_request("options_display_populate_current_settings", "options_display_populate_current_settings", 0) 
  428. 	build_list() 
  429. 	 
  430. 	--set up the list in twns 
  431. 	local list_back_in = Vdo_tween_object:new("back_in_twn2", Screen_back_in_anim.handle) 
  432. 	local header_back_in = Vdo_tween_object:new("back_in_twn3", Screen_back_in_anim.handle) 
  433. 	 
  434. 	list_back_in:set_property("start_value", 100, 140) 
  435. 	header_back_in:set_property("start_value", 130, 83) 
  436. 	 
  437. 	list_back_in:set_property("end_value", 100, 140) 
  438. 	header_back_in:set_property("end_value", 130, 83) 
  439. 	 
  440. 	--set up the list out twns 
  441. 	local list_slide_out = Vdo_tween_object:new("screen_slide_out_twn2", Screen_slide_out_anim.handle) 
  442. 	local header_slide_out = Vdo_tween_object:new("screen_slide_out_twn3", Screen_slide_out_anim.handle) 
  443. 	 
  444. 	list_slide_out:set_property("start_value", 100, 140) 
  445. 	header_slide_out:set_property("start_value", 130, 83) 
  446. 		 
  447. 	list_slide_out:set_property("end_value", 100, 140) 
  448. 	header_slide_out:set_property("end_value", 130, 83) 
  449. 	 
  450. 	local list_slide_in = Vdo_tween_object:new("screen_slide_in_twn2", Screen_slide_in_anim.handle) 
  451. 	local header_slide_in = Vdo_tween_object:new("screen_slide_in_twn3", Screen_slide_in_anim.handle) 
  452. 	 
  453. 	list_slide_in:set_property("start_value", 100, 140) 
  454. 	header_slide_in:set_property("start_value", 130, 83) 
  455. 	 
  456. 	list_slide_in:set_property("end_value", 100, 140) 
  457. 	header_slide_in:set_property("end_value", 130, 83) 
  458. 	 
  459. 	--Store some locals to the pause menu common for screen processing. 
  460. 	menu_common_set_list_style(List, Header_obj, Screen_width) 
  461. 	menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_slide_out_anim) 
  462. 	 
  463. 	-- Add mouse inputs 
  464. 	Menu_hint_bar:set_highlight(0) 
  465. 	 
  466. 	Mouse_input_tracker = Vdo_input_tracker:new() 
  467. 	List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  468. 	Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  469. 	Mouse_input_tracker:subscribe(true) 
  470. 	 
  471. 	-- Align the tooltip to the list 
  472. 	--[[ 
  473. 	if In_pause_menu then 
  474. 		local anchor_in_h = vint_object_find("new_tween2") 
  475. 		local anchor_out_h = vint_object_find("new_tween4") 
  476. 		local anchor_in_x,anchor_in_y = vint_get_property(anchor_in_h, "start_value") 
  477. 		local anchor_out_x,anchor_out_y = vint_get_property(anchor_out_h, "start_value") 
  478. 		 
  479. 		if vint_is_std_res() then 
  480. 			vint_set_property(anchor_in_h, "start_value", 282, anchor_in_y) 
  481. 			vint_set_property(anchor_in_h, "end_value", 282, anchor_out_y) 
  482. 			 
  483. 			vint_set_property(anchor_out_h, "start_value", 282, anchor_out_y) 
  484. 			vint_set_property(anchor_out_h, "end_value", 282, anchor_in_y) 
  485. 		else 
  486. 			vint_set_property(anchor_in_h, "start_value", 448, anchor_in_y) 
  487. 			vint_set_property(anchor_in_h, "end_value", 448, anchor_out_y) 
  488. 			 
  489. 			vint_set_property(anchor_out_h, "start_value", 448, anchor_out_y) 
  490. 			vint_set_property(anchor_out_h, "end_value", 448, anchor_in_y) 
  491. 		end 
  492. 	end 
  493. 	]] 
  494. 	-- animate tooltip in 
  495. 	local anim_h = vint_object_find("animate_in", 0, Display_pc_doc_handle) 
  496. 	lua_play_anim(anim_h, 0, Display_pc_doc_handle) 
  497. 	 
  498. 	pause_options_display_pc_set_tool_tip(Data[1].tool_tip_text) --("X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X") -- Use this to figure out the correct anchor for In_pause_menu 
  499. 	--menu_common_set_mouse_tracker(Mouse_input_tracker) 
  500. end 
  501.  
  502. function pause_options_display_pc_reset() 
  503. 	if Exit_pending then 
  504. 		return 
  505. 	end 
  506. 	 
  507. 	if vint_is_std_res() then 
  508. 		Screen_width = 750 
  509. 	else 
  510. 		Screen_width = 840 
  511. 	end 
  512. 	 
  513. 	Mouse_input_tracker:remove_all() 
  514. 		 
  515. 	local resolution_index = -1 
  516. 	-- Rebuild the list 
  517. 	if Data[ASPECT_INDEX] ~= nil then 
  518. 		Current_aspect_is_widescreen = Data[ASPECT_INDEX].current_value == 1 
  519. 	end 
  520. 	 
  521. 	if Data[RESOLUTIONS_INDEX] ~= nil then 
  522. 		resolution_index = Data[RESOLUTIONS_INDEX].current_value 
  523. 	end 
  524. 	 
  525. 	Data = {} 
  526. 	build_list() 
  527. 	 
  528. 	if resolution_index ~= -1 then 
  529. 		Data[RESOLUTIONS_INDEX].current_value = resolution_index 
  530. 		List:set_properties(nil, nil, nil, nil, nil, nil, true) 
  531. 		List:draw_items(Data, 1, Screen_width, Max_visible) 
  532. 	end 
  533. 	 
  534. 	pause_options_display_pc_set_tool_tip(Data[1].tool_tip_text) 
  535. 	 
  536. 	--set up the list in twns 
  537. 	local list_back_in = Vdo_tween_object:new("back_in_twn2", Screen_back_in_anim.handle) 
  538. 	local header_back_in = Vdo_tween_object:new("back_in_twn3", Screen_back_in_anim.handle) 
  539. 	 
  540. 	list_back_in:set_property("start_value", 100, 140) 
  541. 	header_back_in:set_property("start_value", 130, 83) 
  542. 	 
  543. 	list_back_in:set_property("end_value", 100, 140) 
  544. 	header_back_in:set_property("end_value", 130, 83) 
  545. 	 
  546. 	--Store some locals to the pause menu common for screen processing. 
  547. 	menu_common_set_list_style(List, Header_obj, Screen_width) 
  548. 	menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_slide_out_anim) 
  549. 		 
  550. 	-- Recreate mouse input tracking 
  551. 	List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  552. 	Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  553. 	Mouse_input_tracker:subscribe(true) 
  554. end 
  555.  
  556. function pause_options_display_pc_cleanup() 
  557. 	-- Nuke all button subscriptions 
  558. 	Input_tracker:subscribe(false) 
  559. 	if Mouse_input_tracker ~= nil then 
  560. 		Mouse_input_tracker:subscribe(false) 
  561. 	end 
  562. 	List:enable_toggle_input(false) 
  563. 	 
  564. 	--set up the list in twns 
  565. 	local list_back_in = Vdo_tween_object:new("back_in_twn2", Screen_back_in_anim.handle) 
  566. 	local header_back_in = Vdo_tween_object:new("back_in_twn3", Screen_back_in_anim.handle) 
  567. 	 
  568. 	--set up the list out twns 
  569. 	local list_slide_out = Vdo_tween_object:new("screen_slide_out_twn2", Screen_slide_out_anim.handle) 
  570. 	local header_slide_out = Vdo_tween_object:new("screen_slide_out_twn3", Screen_slide_out_anim.handle) 
  571. 	 
  572. 	local list_slide_in = Vdo_tween_object:new("screen_slide_in_twn2", Screen_slide_in_anim.handle) 
  573. 	local header_slide_in = Vdo_tween_object:new("screen_slide_in_twn3", Screen_slide_in_anim.handle) 
  574. 	 
  575. 	local list_back_out = Vdo_tween_object:new("back_out_twn3", Screen_back_out_anim.handle) 
  576. 	local header_back_out = Vdo_tween_object:new("back_out_twn2", Screen_back_out_anim.handle) 
  577. 	 
  578. 	list_back_in:set_property("start_value", 100, 267) 
  579. 	header_back_in:set_property("start_value", 130, 210) 
  580. 	 
  581. 	list_back_in:set_property("end_value", 100, 267) 
  582. 	header_back_in:set_property("end_value", 130, 210) 
  583.  
  584. 	list_slide_out:set_property("start_value", 100, 267) 
  585. 	header_slide_out:set_property("start_value", 130, 210) 
  586. 	 
  587. 	list_slide_out:set_property("end_value", 100, 267) 
  588. 	header_slide_out:set_property("end_value", 130, 210) 
  589. 		 
  590. 	list_slide_in:set_property("start_value", 100, 267) 
  591. 	header_slide_in:set_property("start_value", 130, 210) 
  592. 	 
  593. 	list_slide_in:set_property("end_value", 100, 267) 
  594. 	header_slide_in:set_property("end_value", 130, 210) 
  595. 	 
  596. 	local current_id = List:get_id() 
  597. 	 
  598. 	if Screen_id ~= ID_BRIGHTNESS then 
  599. 		list_back_out:set_property("start_value", 100, 267) 
  600. 		header_back_out:set_property("start_value", 130, 210) 
  601. 	 
  602. 		list_back_out:set_property("end_value", 100, 267) 
  603. 		header_back_out:set_property("end_value", 130, 210) 
  604. 	end 
  605. 		 
  606. end 
  607.  
  608. function options_display_nav_up(event, acceleration) 
  609. 	-- Move highlight up 
  610. 	List:move_cursor(-1) 
  611. 	 
  612. 	-- Set the tool_tip_text 
  613. 	local current_idx = List:get_selection() 
  614. 	local menu_item = Data[current_idx] 
  615. 	pause_options_display_pc_set_tool_tip(menu_item.tool_tip_text) 
  616. 	 
  617. 	enforce_dx9() 
  618. end 
  619.  
  620. function options_display_nav_down(event, acceleration) 
  621. 	-- Move highlight down 
  622. 	List:move_cursor(1) 
  623. 	 
  624. 	-- Set the tool_tip_text 
  625. 	local current_idx = List:get_selection() 
  626. 	local menu_item = Data[current_idx] 
  627. 	pause_options_display_pc_set_tool_tip(menu_item.tool_tip_text) 
  628. 	 
  629. 	enforce_dx9() 
  630. end 
  631.  
  632. function options_display_nav_left_or_right(direction) 
  633. 	local current_idx = List:get_selection() 
  634. 	local menu_item = Data[current_idx] 
  635. 	if menu_item.type == TYPE_SLIDER or menu_item.type == TYPE_TOGGLE then 
  636. 		-- Move highlight left 
  637. 		List:move_slider(direction) 
  638. 	end 
  639. 	 
  640. 	local refresh_list = false 
  641. 	 
  642. 	if menu_item.id == ID_ASPECT then 
  643. 		local display_idx	= List:get_data_from_id(ID_DISPLAY_IDX) ~= nil and List:get_data_from_id(ID_DISPLAY_IDX).current_value - 1 or Current_display_idx 
  644. 		local widescreen = List:get_data_from_id(ID_ASPECT).current_value == 1 
  645. 		populate_display_modes(display_idx, widescreen) 
  646. 		Data[RESOLUTIONS_INDEX].current_value = 1 
  647. 		 
  648. 		refresh_list = true 
  649. 	end 
  650. 	 
  651. 	if menu_item.id == ID_DISPLAY_IDX then 
  652. 		local display_idx = List:get_data_from_id(ID_DISPLAY_IDX).current_value - 1 
  653. 		local widescreen = List:get_data_from_id(ID_ASPECT).current_value == 1 
  654. 		populate_display_modes(display_idx, widescreen) 
  655. 		populate_anti_aliasing_levels(display_idx) 
  656. 		Data[RESOLUTIONS_INDEX].current_value = min(#Data[RESOLUTIONS_INDEX].options, Data[RESOLUTIONS_INDEX].current_value) 
  657. 		Data[ANTI_ALIASING_INDEX].current_value = min(#Data[ANTI_ALIASING_INDEX].options, Data[ANTI_ALIASING_INDEX].current_value) 
  658. 		update_disabled() 
  659. 		 
  660. 		refresh_list = true 
  661. 	end 
  662. 	 
  663. 	if menu_item.id == ID_DISPLAY_PRESET then 
  664. 		-- Apply the presets 
  665. 		vint_dataresponder_request("options_display_pc_set_preset", "options_display_populate_current_settings", 1, Data[PRESET_INDEX].current_value) 
  666. 		Current_display_preset = Data[PRESET_INDEX].current_value 
  667. 		 
  668. 		-- The entire menu doesn't need to be reset, just the items involved with preset options  
  669. 		local hit_preset = false 
  670. 		for key, obj in pairs( Data ) do 
  671. 			-- Everything before the preset options should be left as is 
  672. 			-- Once we hit the preset options flag it 
  673. 			if Data[key].label == "PLT_MENU_DISPLAY_PRESET" then 
  674. 				hit_preset = true 
  675. 			end 
  676. 			-- Rebuild all options that are included in the preset options and anything after 
  677. 			if hit_preset then 
  678. 				Data[key] = nil 
  679. 			end 
  680. 		end 
  681. 		 
  682. 		 
  683. 		build_list(true) 
  684. 		 
  685. 		refresh_list = true 
  686. 	end 
  687. 	 
  688. 	Setting_changed = true 
  689. 	Menu_hint_bar:set_visible(true) 
  690. 	 
  691. 	if refresh_list then 
  692. 		-- Redraw the items 
  693. 		List:draw_items(Data, current_idx, Screen_width, Max_visible) 
  694. 		 
  695. 		-- Recreate mouse input tracking 
  696. 		Mouse_input_tracker:remove_all() 
  697. 		List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  698. 		Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  699. 		Mouse_input_tracker:subscribe(true) 
  700. 	end 
  701. end 
  702.  
  703. function options_display_nav_left(event, acceleration) 
  704. 	options_display_nav_left_or_right(-1) 
  705. end 
  706.  
  707. function options_display_nav_right(event, acceleration) 
  708. 	options_display_nav_left_or_right(1) 
  709. end 
  710.  
  711. function options_display_confirm(result, action) 
  712. 	debug_print("vint", "result: "..result) 
  713. 	if Confirm_dialog_thread_h ~= -1 then 
  714. 		thread_kill(Confirm_dialog_thread_h) 
  715. 		Confirm_dialog_thread_h = -1 
  716. 	end 
  717. 	Confirm_dialog_h = 0 
  718.  
  719. 	if result == 0 then -- Changes accepted. 
  720. 		if Exit_pending then -- If we're waiting to leave the screen. 
  721. 			pause_options_display_pc_cleanup() 
  722. 			 
  723. 			--Remove current menu from the stack 
  724. 			menu_common_stack_remove() 
  725. 			menu_common_transition_pop(1) 
  726. 		else 
  727. 			-- Recreate mouse input tracking 
  728. 			Mouse_input_tracker:remove_all() 
  729. 			List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  730. 			Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  731. 			Mouse_input_tracker:subscribe(true) 
  732. 		end 
  733. 	else -- Canceled changes. 
  734. 		-- Reread the settings and rebuild the list. 
  735. 		Mouse_input_tracker:remove_all() 
  736. 		vint_dataresponder_request("options_display_populate_current_settings", "options_display_populate_current_settings", 0) 
  737. 		Data = { } 
  738. 		build_list() 
  739. 		 
  740. 		-- Recreate mouse input tracking 
  741. 		List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  742. 		Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  743. 		Mouse_input_tracker:subscribe(true) 
  744. 		 
  745. 		-- Reapply the old settings and make sure we don't leave the screen. 
  746. 		Show_dialog = false 
  747. 		Exit_pending = false 
  748. 		options_display_update_option_value() 
  749. 	end 
  750. end 
  751.  
  752. function options_display_confirm_dialog_process() 
  753. 	local destruct_timer_start = vint_get_time_index() 
  754. 	local done = false 
  755. 	while not done do 
  756. 		thread_yield() 
  757. 		--debug_print("vint","timer: "..var_to_string(vint_get_time_index()).."\n") 
  758. 		--debug_print("vint","timer start "..destruct_timer_start.."\n") 
  759. 		if vint_get_time_index() > destruct_timer_start + 15 then 
  760. 			debug_print("vint","timer up\n") 
  761. 			done = true 
  762. 			dialog_box_force_close(Confirm_dialog_h) 
  763. 		end 
  764. 	end 
  765. 	Confirm_dialog_thread_h = -1 
  766. end 
  767.  
  768. function options_display_update_option_value() 
  769. 	local vsync = List:get_data_from_id(ID_VSYNC).current_value == 2 
  770.  
  771. 	local display_idx	= List:get_data_from_id(ID_DISPLAY_IDX) ~= nil and List:get_data_from_id(ID_DISPLAY_IDX).current_value - 1 or Current_display_idx 
  772. 	local display_mode_selected_index = List:get_data_from_id(ID_RESOLUTIONS).current_value 
  773. 	local display_mode_idx = Display_modes[display_mode_selected_index].display_mode_idx 
  774. 	local window_mode = List:get_data_from_id(ID_WINDOW_MODE).current_value	 
  775. 	local msaa_index = List:get_data_from_id(ID_ANTI_ALIASING).current_value 
  776. 	local msaa_level = MSAA_levels[msaa_index].level 
  777. 	 
  778. 	local texture_filter = List:get_data_from_id(ID_TEXTURE_FILTER_MODE).current_value 
  779. 	local scene_detail = List:get_data_from_id(ID_SCENE_DETAIL).current_value 
  780. 	local lighting_detail = List:get_data_from_id(ID_LIGHTING_DETAIL).current_value 
  781. 	local shadow_detail = List:get_data_from_id(ID_SHADOW_DETAIL).current_value 
  782. 	local scene_detail = List:get_data_from_id(ID_SCENE_DETAIL).current_value 
  783. 	local reflections = List:get_data_from_id(ID_REFLECTIONS).current_value 
  784. 	local post_processing_detail = List:get_data_from_id(ID_POST_PROCESSING_DETAIL).current_value 
  785. 	local ambient_occlusion_level = List:get_data_from_id(ID_AMBIENT_OCCLUSION).current_value 
  786. 	 
  787. 	options_display_pc_set_options(	vsync, display_idx, display_mode_idx, window_mode, msaa_level, texture_filter,  
  788. 												lighting_detail, shadow_detail, scene_detail, reflections, post_processing_detail, ambient_occlusion_level) 
  789. 	Setting_changed = false 
  790. 	 
  791. 	options_display_change_resolution() 
  792. 	 
  793. end 
  794.  
  795. function options_display_change_resolution() 
  796. 	thread_new("options_display_change_resolution_cb") 
  797. end 
  798.  
  799. function options_display_change_resolution_cb() 
  800. 	delay(0.1) 
  801. 	 
  802. 	if Show_dialog then 
  803. 		local options = { [0] = "CONTROL_YES", [1] = "CONTROL_NO" } 
  804. 		Confirm_dialog_h = dialog_box_open("PLT_MENU_DISPLAY_OPTIONS_CONFIRM", "PLT_MENU_DISPLAY_OPTIONS_CONFIRM_TEXT", options, "options_display_confirm", 1, DIALOG_PRIORITY_ACTION, true) 
  805. 		Confirm_dialog_thread_h = thread_new("options_display_confirm_dialog_process") 
  806. 	else 
  807. 		Show_dialog = true 
  808. 	end 
  809. end 
  810.  
  811. function options_display_button_a(event, acceleration) 
  812. 	local current_id = List:get_id() 
  813. 	if Tween_done == true then 
  814. 	 
  815. 		options_display_nav_right() 
  816. 		 
  817. 		List:button_a() 
  818. 		 
  819. 		Screen_id = -1 
  820. 		 
  821. 		if current_id == ID_BRIGHTNESS then 
  822. 			local list_back_out = Vdo_tween_object:new("back_out_twn3", Screen_back_out_anim.handle) 
  823. 			local header_back_out = Vdo_tween_object:new("back_out_twn2", Screen_back_out_anim.handle) 
  824. 	 
  825. 			list_back_out:set_property("start_value", 100, 140) 
  826. 			header_back_out:set_property("start_value", 130, 83) 
  827. 	 
  828. 			list_back_out:set_property("end_value", 100, 140) 
  829. 			header_back_out:set_property("end_value", 130, 83) 
  830. 			 
  831. 			Screen_id = ID_BRIGHTNESS 
  832.  
  833. 			-- animate tooltip in 
  834. 			local anim_h = vint_object_find("animate_out", 0, Display_pc_doc_handle) 
  835. 			lua_play_anim(anim_h, 0, Display_pc_doc_handle) 
  836. 			 
  837. 			menu_common_transition_push("pause_options_display_cal") 
  838. 			pause_options_display_pc_cleanup() 
  839. 		end 
  840. 		 
  841. 	end 
  842. end 
  843.  
  844. function options_display_apply(event, acceleration) 
  845. 	local current_id = List:get_id() 
  846.  
  847. 	if Tween_done == true then 
  848. 		if Setting_changed then 
  849. 			Exit_pending = false 
  850. 			options_display_update_option_value() 
  851. 		end 
  852. 	end 
  853. end 
  854.  
  855. function options_display_accept_cancel(result, action) 
  856.  
  857. 	if result ~= 2 then 
  858. 		List:button_b() 
  859. 		 
  860. 		if result == 0 then 
  861. 			Exit_pending = true 
  862. 			options_display_update_option_value() 
  863. 		else 
  864. 			pause_options_display_pc_cleanup()	 
  865. 			 
  866. 			--set up the list out twns 
  867. 			local list_slide_out = Vdo_tween_object:new("screen_slide_out_twn2", Screen_slide_out_anim.handle) 
  868. 			local header_slide_out = Vdo_tween_object:new("screen_slide_out_twn3", Screen_slide_out_anim.handle) 
  869. 			 
  870. 			list_slide_out:set_property("start_value", 100, 140) 
  871. 			header_slide_out:set_property("start_value", 130, 83) 
  872. 			 
  873. 			list_slide_out:set_property("end_value", 100, 140) 
  874. 			header_slide_out:set_property("end_value", 130, 83) 
  875. 			 
  876. 			-- animate tooltip in 
  877. 			local anim_h = vint_object_find("animate_out", 0, Display_pc_doc_handle) 
  878. 			lua_play_anim(anim_h, 0, Display_pc_doc_handle) 
  879. 	 
  880. 			Input_tracker:subscribe(false) 
  881. 			if Mouse_input_tracker ~= nil then 
  882. 				Mouse_input_tracker:subscribe(false) 
  883. 			end 
  884. 			List:enable_toggle_input(false) 
  885. 	 
  886. 			--Remove current menu from the stack 
  887. 			menu_common_stack_remove() 
  888. 			menu_common_transition_pop(1) 
  889. 		end	 
  890. 	end 
  891.  
  892. end 
  893.  
  894. function options_display_button_b(event, acceleration) 
  895. 	if Tween_done == true then	 
  896. 		if Setting_changed then 
  897. 			local options = { "PLT_MENU_APPLY", "MENU_DISCARD", "CONTROL_CANCEL" } 
  898. 			dialog_box_open("MENU_CHANGES_MADE_TITLE", "MENU_CHANGES_MADE_BODY", options, "options_display_accept_cancel", 2, DIALOG_PRIORITY_SYSTEM_CRITICAL, false, nil, false, false, nil, 2) 
  899. 		else 
  900. 			options_display_accept_cancel(1) 
  901. 		end 
  902. 	end 
  903. end 
  904.  
  905. function options_display_button_x(event, acceleration) 
  906. 	dialog_box_confirmation("OPTIONS_MENU_DEFAULTS_TITLE", "OPTIONS_MENU_AUTO_DETECT_DESC", "options_display_revert", true, true,1) 
  907. end 
  908.  
  909. function options_display_revert(result, action) 
  910. 	if result == 0 then 
  911. 	 
  912. 		Setting_changed = true 
  913.  
  914. 		Mouse_input_tracker:remove_all() 
  915. 		 
  916. 		vint_dataresponder_request("options_display_pc_restore_defaults", "options_display_populate_current_settings", 0) 
  917. 		 
  918. 		-- Rebuild the list 
  919. 		Data = {} 
  920. 		build_list() 
  921. 		 
  922. 		-- Recreate mouse input tracking 
  923. 		List:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  924. 		Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  925. 		Mouse_input_tracker:subscribe(true) 
  926. 	end 
  927. end 
  928.  
  929. function options_display_button_start(event, acceleration) 
  930. 	if Tween_done == true then 
  931. 		-- we still want to save the options? 
  932. 		pause_menu_accept_options() 
  933. 		 
  934. 		menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_out_anim)	 
  935. 		Input_tracker:subscribe(false) 
  936. 		-- stack is part of common, which is getting popped, so we don't update it. 
  937. 		menu_common_transition_pop(4) -- options_display, options_menu, pause_menu_top, menu_common 
  938. 		bg_saints_slide_out() 
  939. 	end 
  940. end 
  941.  
  942. -- Mouse inputs 
  943. function pause_options_display_pc_mouse_click(event, target_handle, mouse_x, mouse_y) 
  944. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  945. 	if hint_index == 1 then 
  946. 		options_display_button_b() 
  947. 	elseif hint_index == 2 then 
  948. 		options_display_button_x() 
  949. 	elseif hint_index == 3 then 
  950. 		options_display_apply() 
  951. 	end 
  952.  
  953. 	local new_index = List:get_button_index(target_handle) 
  954. 	if new_index ~= 0 then 
  955. 		options_display_button_a() 
  956. 	elseif List:is_left_arrow(target_handle) then 
  957. 		options_display_nav_left() 
  958. 	elseif List:is_right_arrow(target_handle) then 
  959. 		options_display_nav_right() 
  960. 	end 
  961. 	 
  962. 	if new_index == ID_BRIGHTNESS then 
  963. 		Screen_id = ID_BRIGHTNESS 
  964. 	else 
  965. 		Screen_id = -1 
  966. 	end 
  967. end 
  968.  
  969. function pause_options_display_pc_mouse_move(event, target_handle) 
  970. 	Menu_hint_bar:set_highlight(0) 
  971. 	 
  972. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  973. 	if hint_index ~= 0 then 
  974. 		Menu_hint_bar:set_highlight(hint_index) 
  975. 		enforce_dx9() 
  976. 	end 
  977. 	 
  978. 	local new_index = List:get_button_index(target_handle) 
  979. 	if new_index ~= 0 then 
  980. 		List:set_selection(new_index) 
  981. 		List:move_cursor(0, true) 
  982. 		 
  983. 		-- Set the tool_tip_text 
  984. 		local menu_item = Data[new_index] 
  985. 		pause_options_display_pc_set_tool_tip(menu_item.tool_tip_text) 
  986. 		enforce_dx9() 
  987. 	end 
  988. end 
  989.  
  990. function pause_options_display_pc_mouse_scroll(event, target_handle, mouse_x, mouse_y, scroll_lines) 
  991. 	if scroll_lines ~= 0 then 
  992. 		if List:get_scroll_region_handle() == target_handle then 
  993. 			List:scroll_list(scroll_lines * -1) 
  994. 			List:update_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  995. 			Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  996. 			Mouse_input_tracker:subscribe(true) 
  997. 		end 
  998. 	end 
  999. end 
  1000.  
  1001. function pause_options_display_pc_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  1002. 	if List.scrollbar.tab_grp.handle == target_handle then 
  1003. 		local new_start_index = List.scrollbar:drag_scrolltab(mouse_y, List.num_buttons - (List.max_buttons - 1)) 
  1004. 		List:scroll_list(0, new_start_index) 
  1005. 	end 
  1006. end 
  1007.  
  1008. -- Updates the mouse inputs for the list and snaps the scrolltab to the closest notch based on the visible index 
  1009. -- 
  1010. function pause_options_display_pc_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  1011. 	if List.scrollbar.tab_grp.handle == target_handle then 
  1012. 		local start_index = List:get_visible_indices() 
  1013. 		List.scrollbar:release_scrolltab(start_index, List.num_buttons - (List.max_buttons - 1)) 
  1014. 		List:update_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  1015. 		Menu_hint_bar:add_mouse_inputs("pause_options_display_pc", Mouse_input_tracker) 
  1016. 		Mouse_input_tracker:subscribe(true) 
  1017. 	end 
  1018. end 
  1019.  
  1020. function pause_options_display_pc_set_tool_tip(new_tip_text) 
  1021. 	local tool_tip_h = vint_object_find("tool_tip_text", 0, Display_pc_doc_handle) 
  1022. 	vint_set_property(tool_tip_h, "text_tag", new_tip_text) 
  1023. end 
  1024.  
  1025. function display_mode_change_failure_callback() 
  1026. 	 
  1027.  
  1028. 	-- Recreate mouse input tracking 
  1029. 	Mouse_input_tracker:remove_all() 
  1030. 	List:add_mouse_input("pause_options_display_pc", Mouse_input_tracker) 
  1031. 	Hint_bar:add_mouse_input("pause_options_display_pc", Mouse_input_tracker) 
  1032. 	Mouse_input_tracker:subscribe(true) 
  1033. end 
  1034.