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