local PM_MENU_DISPLAY_OPTIONS = 2
--Menu ID's
local ID_BRIGHTNESS_GAMMA = 1
local Data = {}
BRIGHTNESS_GAMMA_OPTION = {
type = TYPE_BUTTON,
label = "MENU_DISPLAY_MONITOR_ADJUSTMENT",
id = ID_BRIGHTNESS_GAMMA,
}
VSYNC_GAMEPLAY_OPTION = {
type = TYPE_TOGGLE,
label = "MENU_VSYNC_GAMEPLAY_TEXT",
options = {"OPTION_NO", "OPTION_YES"},
current_value = 1,
option_index = 1 -- corresponds to an enum in pause_menu_options.cpp
}
VSYNC_CUTSCENE_OPTION = {
type = TYPE_TOGGLE,
label = "MENU_VSYNC_CUTSCENE_TEXT",
options = {"OPTION_NO", "OPTION_YES"},
current_value = 1,
option_index = 2
}
VSYNC_FILM_GRAIN_OPTION = {
type = TYPE_TOGGLE,
label = "MENU_OPTION_SHOW_FILM_GRAIN",
options = {"OPTION_NO", "OPTION_YES"},
current_value = 1,
option_index = 3
}
MINIMAP_OPTION = {
type = TYPE_TOGGLE,
label = "CONTROLS_MINIMAP_VIEW",
options = {"MINIMAP_ROTATIONAL", "MINIMAP_STATIC"},
current_value = 1,
option_index = 4
}
local Anims = {}
local Input_tracker
local Screen_width = 840
local Tween_done = true
function pause_options_display_init()
if vint_is_std_res() then
Screen_width = 750
else
Screen_width = 840
end
-- Subscribe to the button presses we need
Input_tracker = Vdo_input_tracker:new()
Input_tracker:add_input("select", "options_display_button_a", 50)
Input_tracker:add_input("back", "options_display_button_b", 50)
Input_tracker:add_input("alt_select", "options_display_button_x", 50)
if In_pause_menu then
Input_tracker:add_input("pause", "options_display_button_start", 50)
end
Input_tracker:add_input("nav_up", "options_display_nav_up", 50)
Input_tracker:add_input("nav_down", "options_display_nav_down", 50)
Input_tracker:add_input("nav_left", "options_display_nav_left", 50)
Input_tracker:add_input("nav_right", "options_display_nav_right", 50)
Input_tracker:subscribe(false)
--Set Button hints
local hint_data = {
{CTRL_MENU_BUTTON_B, "MENU_BACK"},
{CTRL_BUTTON_X, "MENU_RESTORE_DEFAULTS"},
}
Menu_hint_bar:set_hints(hint_data)
Menu_hint_bar:set_visible(true)
Header_obj:set_text("MENU_DISPLAY_TITLE", Screen_width)
vint_dataresponder_request("pause_menu_options", "options_display_populate", 0, PM_MENU_DISPLAY_OPTIONS)
List:draw_items(Data, 1, Screen_width, 10)
--Store some locals to the pause menu common for screen processing.
menu_common_set_list_style(List, Header_obj, Screen_width)
menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_slide_out_anim)
end
function pause_options_display_cleanup()
-- Nuke all button subscriptions
Input_tracker:subscribe(false)
end
function options_display_populate(gameplay_vsync, cutscene_vsync, film_grain, static_map)
VSYNC_GAMEPLAY_OPTION.current_value = gameplay_vsync and 2 or 1
VSYNC_CUTSCENE_OPTION.current_value = cutscene_vsync and 2 or 1
--VSYNC_FILM_GRAIN_OPTION.current_value = film_grain and 2 or 1
MINIMAP_OPTION.current_value = static_map and 2 or 1
Data = {}
Data[#Data + 1] = BRIGHTNESS_GAMMA_OPTION
if game_get_platform() ~= "PS3" then
Data[#Data + 1] = VSYNC_GAMEPLAY_OPTION
Data[#Data + 1] = VSYNC_CUTSCENE_OPTION
end
--Data[#Data + 1] = VSYNC_FILM_GRAIN_OPTION
Data[#Data + 1] = MINIMAP_OPTION
end
function options_display_nav_up(event, acceleration)
-- Move highlight up
List:move_cursor(-1)
end
function options_display_nav_down(event, acceleration)
-- Move highlight down
List:move_cursor(1)
end
function options_display_nav_left(event, acceleration)
local current_idx = List:get_selection()
local menu_item = Data[current_idx]
if menu_item.type == TYPE_SLIDER or menu_item.type == TYPE_TOGGLE then
-- Move highlight left
List:move_slider(-1)
options_display_update_option_value()
end
end
function options_display_nav_right(event, acceleration)
local current_idx = List:get_selection()
local menu_item = Data[current_idx]
if menu_item.type == TYPE_SLIDER or menu_item.type == TYPE_TOGGLE then
-- Move highlight right
List:move_slider(1)
options_display_update_option_value()
end
end
function options_display_update_option_value()
local current_idx = List:get_selection()
local menu_item = Data[current_idx]
local bool_val = true
if menu_item.current_value == 1 then
bool_val = false
end
-- Convert the value to [0.0 - 1.0]
local converted_float = menu_item.current_value
if converted_float ~= 0 then
converted_float = menu_item.current_value / 100
end
pause_menu_update_option(PM_MENU_DISPLAY_OPTIONS, menu_item.option_index, bool_val, converted_float)
end
function options_display_button_a(event, acceleration)
local current_id = List:get_id()
--Check to see if we are on the other menus
if current_id == ID_BRIGHTNESS_GAMMA then
menu_common_stack_add(current_id)
menu_common_transition_push("pause_options_display_cal")
return
else
options_display_nav_right()
end
if Tween_done == true then
--set the screen data to the list data
Data = List:return_data()
end
end
function options_display_button_b(event, acceleration)
if Tween_done == true then
--set the screen data to the list data
--Data = List:return_data()
--pause_options_display_return_values()
--check if the list is open or closed
--[[if List:return_state() == true then
--pass off the input to the list
List:button_b()
else--]]
--back up a screen
--pass off the input to the list
List:button_b()
-- save the options
pause_menu_accept_options()
Input_tracker:subscribe(false)
--Remove current menu from the stack
menu_common_stack_remove()
menu_common_transition_pop(1)
--end
end
end
function options_display_button_x(event, acceleration)
dialog_box_confirmation("OPTIONS_MENU_DEFAULTS_TITLE", "OPTIONS_MENU_DEFAULTS_DESC", "options_display_revert", true, true,1)
end
function options_display_revert(result, action)
if result == 0 then
pause_menu_restore_defaults(PM_MENU_DISPLAY_OPTIONS)
vint_dataresponder_request("pause_menu_options", "options_display_populate", 0, PM_MENU_DISPLAY_OPTIONS)
List:draw_items(Data, List:get_selection(), Screen_width, 10, nil, nil, true)
end
end
function options_display_button_start(event, acceleration)
if Tween_done == true then
-- we still want to save the options?
pause_menu_accept_options()
menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_out_anim)
Input_tracker:subscribe(false)
-- stack is part of common, which is getting popped, so we don't update it.
menu_common_transition_pop(4) -- options_display, options_menu, pause_menu_top, menu_common
bg_saints_slide_out()
end
end