local PM_MENU_CASUAL_RECORD_MODE = 7
local ENABLE_INDEX = 1
local QUALITY_INDEX = 2
local HUD_INDEX = 3
local Data = {
[ENABLE_INDEX] = {
type = TYPE_TOGGLE,
label = "PC_ENABLE",
options = {"CELL_CAMERA_MODE_DISABLED", "CELL_CAMERA_MODE_ENABLED"},
current_value = 1
},
[QUALITY_INDEX] = {
type = TYPE_TOGGLE,
label = "PC_VIDEO_QUALITY",
options = {"PC_RECORD_MODE_QUALITY_LOW", "PC_RECORD_MODE_QUALITY_MED", "PC_RECORD_MODE_QUALITY_HIGH"},
current_value = 1
},
[HUD_INDEX] = {
type = TYPE_TOGGLE,
label = "PC_SHOW_HUD",
options = {"CELL_CAMERA_MODE_DISABLED", "CELL_CAMERA_MODE_ENABLED"},
current_value = 1
},
}
local DISABLE_VALUE_INDEX = 1
local ENABLE_VALUE_INDEX = 2
local Input_tracker
local Mouse_input_tracker
local Record_mode_doc_handle
local Screen_width = 700
local Tween_done = true
function pause_options_record_mode_init()
options_record_mode_finish_init()
end
function options_record_mode_finish_init()
Record_mode_doc_handle = vint_document_find("pause_options_record_mode")
--Initialize Header
Header_obj:set_text("PC_RECORD_VIDEO", Screen_width)
-- Subscribe to the button presses we need
Input_tracker = Vdo_input_tracker:new()
Input_tracker:add_input("select", "options_record_mode_button_a", 50)
Input_tracker:add_input("back", "options_record_mode_button_b", 50)
if In_pause_menu then
Input_tracker:add_input("pause", "options_record_mode_button_start", 50)
end
Input_tracker:add_input("nav_up", "options_record_mode_nav_up", 50)
Input_tracker:add_input("nav_down", "options_record_mode_nav_down", 50)
Input_tracker:add_input("nav_left", "options_record_mode_nav_left", 50)
Input_tracker:add_input("nav_right", "options_record_mode_nav_right", 50)
Input_tracker:subscribe(false)
--Set Button hints
local hint_data = {
{CTRL_MENU_BUTTON_B, "MENU_BACK"},
}
if game_get_platform() == "PC" then
hint_data[2] = {CTRL_BUTTON_X, "MENU_RESTORE_DEFAULTS"}
Input_tracker:add_input("alt_select", "options_record_mode_button_x", 50)
end
Menu_hint_bar:set_hints(hint_data)
--Data[record_mode_INDEX].current_value = get_current_record_mode() + 1 -- Difficulties start at 0
--vint_dataresponder_request("pause_menu_options", "options_record_mode_populate", 0, PM_MENU_CASUAL_RECORD_MODE)
vint_dataresponder_request("pause_menu_options", "options_record_mode_populate", 0, PM_MENU_CASUAL_RECORD_MODE)
List:draw_items(Data, 1, Screen_width)
--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)
--set the tootip text with the correct PC button
local record_key = game_get_key_name_for_action( "CBA_GAC_MACHINIMA_QUICKSAVE" )
local insert_values = { [0] = record_key }
local body = vint_insert_values_in_string("PC_RECORD_MODE_TEXT", insert_values)
local detail_text_h = vint_object_find("record_text")
vint_set_property( detail_text_h, "text_tag", body )
--position the file path text
local record_path_h = vint_object_find("record_path", 0, Record_mode_doc_handle)
local body_w,body_h = element_get_actual_size(detail_text_h)
vint_set_property(record_path_h, "anchor", 0, body_h + 3)
--scale the file path text
local path_width,crap = vint_get_property(record_path_h, "screen_size")
local max_width = 400
local base_scale = 0.5
if path_width > max_width then
local text_scale = (max_width/path_width)*base_scale
vint_set_property(record_path_h, "scale", text_scale, text_scale)
else
vint_set_property(record_path_h, "scale", base_scale, base_scale)
end
-- animate tooltip in
local anim_h = vint_object_find("animate_in", 0, Record_mode_doc_handle)
lua_play_anim(anim_h, 0, Record_mode_doc_handle)
-- Add mouse inputs for the PC
if game_get_platform() == "PC" then
Menu_hint_bar:set_highlight(0)
Mouse_input_tracker = Vdo_input_tracker:new()
List:add_mouse_inputs("options_record_mode", Mouse_input_tracker)
Menu_hint_bar:add_mouse_inputs("options_record_mode", Mouse_input_tracker)
Mouse_input_tracker:subscribe(true)
--menu_common_set_mouse_tracker(Mouse_input_tracker)
end
end
function options_record_mode_populate(enable, quality, hud)
Data[ENABLE_INDEX].previous_value = Data[ENABLE_INDEX].current_value
Data[ENABLE_INDEX].current_value = enable + 1
Data[QUALITY_INDEX].previous_value = Data[QUALITY_INDEX].current_value
Data[QUALITY_INDEX].current_value = quality
Data[HUD_INDEX].previous_value = Data[HUD_INDEX].current_value
Data[HUD_INDEX].current_value = hud + 1
end
function pause_options_record_mode_cleanup()
-- Nuke all button subscriptions
Input_tracker:subscribe(false)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:subscribe(false)
end
end
function options_record_mode_nav_up(event, acceleration)
-- Move highlight up
List:move_cursor(-1)
end
function options_record_mode_nav_down(event, acceleration)
-- Move highlight down
List:move_cursor(1)
end
function options_record_mode_nav_left(event, acceleration)
List:move_slider(-1)
end
function options_record_mode_nav_right(event, acceleration)
List:move_slider(1)
end
function options_record_mode_confirm_enable(result)
if result == 0 then
options_record_mode_save_and_exit()
end
end
function options_record_mode_button_b(event, acceleration)
-- if they are enabling record mode, then they must confirm this
if Data[ENABLE_INDEX].current_value == ENABLE_VALUE_INDEX then
-- make sure they have the required codec installed
if game_record_mode_can_encode() == false then
dialog_box_message("MENU_TITLE_WARNING", "PC_RECORD_MODE_ERROR_NO_CODEC")
return
end
local header = "MENU_TITLE_NOTICE"
local body = "PC_RECORD_MODE_ENABLE_WARNING"
dialog_box_confirmation(header, body, "options_record_mode_confirm_enable")
return
end
options_record_mode_save_and_exit()
end
function options_record_mode_save_and_exit()
--back up a screen
game_record_set_quality_level(Data[QUALITY_INDEX].current_value)
game_record_mode_enable(Data[ENABLE_INDEX].current_value == ENABLE_VALUE_INDEX)
game_record_mode_show_hud(Data[HUD_INDEX].current_value == ENABLE_VALUE_INDEX)
pause_menu_accept_options()
List:button_b()
-- animate tooltip in
local anim_h = vint_object_find("animate_out", 0, Record_mode_doc_handle)
lua_play_anim(anim_h, 0, Record_mode_doc_handle)
--Remove current menu from the stack
menu_common_stack_remove()
-- if they are enabling record mode, exit completely from the pause menu
if Data[ENABLE_INDEX].current_value == ENABLE_VALUE_INDEX then
menu_common_transition_pop(3)
bg_saints_slide_out()
else
menu_common_transition_pop(1)
end
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:subscribe(false)
end
end
function options_record_mode_button_a(event, acceleration)
options_record_mode_nav_right(event, acceleration)
end
function options_record_mode_button_x(event, acceleration)
dialog_box_confirmation("OPTIONS_MENU_DEFAULTS_TITLE", "OPTIONS_MENU_DEFAULTS_DESC", "options_record_mode_revert", true, true,1)
end
function options_record_mode_revert(result, action)
if result == 0 then
pause_menu_restore_defaults(PM_MENU_CASUAL_RECORD_MODE)
vint_dataresponder_request("pause_menu_options", "options_record_mode_populate", 0, PM_MENU_CASUAL_RECORD_MODE)
List:draw_items(Data, List:get_selection(), 700)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:remove_all()
List:add_mouse_inputs("options_record_mode", Mouse_input_tracker)
Menu_hint_bar:add_mouse_inputs("options_record_mode", Mouse_input_tracker)
Mouse_input_tracker:subscribe(true)
end
end
end
function options_record_mode_button_start(event, acceleration)
menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_out_anim)
Input_tracker:subscribe(false)
menu_common_transition_pop(4) -- options_record_mode, options, pause_menu_top, menu_common
bg_saints_slide_out()
end
-- Mouse inputs
function options_record_mode_mouse_click(event, target_handle, mouse_x, mouse_y)
local hint_index = Menu_hint_bar:get_hint_index(target_handle)
if hint_index == 1 then
options_record_mode_button_b()
end
if hint_index == 2 then
options_record_mode_button_x()
end
local new_index = List:get_button_index(target_handle)
if new_index ~= 0 then
List:set_selection(new_index)
-- Because only toggles are used in this menu, this acts as nav_right
options_record_mode_nav_right()
end
if List:is_left_arrow(target_handle) then
List:move_slider(-1)
end
end
function options_record_mode_mouse_move(event, target_handle)
Menu_hint_bar:set_highlight(0)
local hint_index = Menu_hint_bar:get_hint_index(target_handle)
if hint_index ~= 0 then
Menu_hint_bar:set_highlight(hint_index)
end
local new_index = List:get_button_index(target_handle)
if new_index ~= 0 then
List:set_selection(new_index)
List:move_cursor(0, true)
end
end