--Globals...
Main_menu_press_start_peg = -1 --Peg to load language specific pess start button...
Main_menu_list_h = -1
Menu_newsticker = -1
MAIN_MENU_MEGA_LIST_SIZE = 435
Main_menu_input_tracker = -1
local Main_menu_mouse_input_tracker = -1
local Main_menu_returned_to_start = false
local Main_menu_top_doc = -1
local Main_menu_top = { }
local Online_check_thread = -1
local Main_menu_buttons = {}
local Main_menu_idx = 1
-- PC Menu has height adjusted
local PC_menu_adjusted = false
MAIN_MENU_DIALOG_UPDATE_TIME = 1.0 --HVS_JRP[PRINCE] 3/20/2014 (PlayGo) Time between download progress text updates.
local Main_menu_dialog_update_timer = MAIN_MENU_DIALOG_UPDATE_TIME --HVS_JRP[PRINCE] 3/20/2014 (PlayGo) Track the time since the last download progress check.
local main_menu_top_dowload_dialog_box = nil --HVS_JRP[PRINCE] 3/20/2014 (PlayGo) Track the download information dialog box.
function main_menu_top_init()
Main_menu_top_doc = vint_document_find("main_menu_top")
--Load appropriate press start button...
local language = game_get_language()
--Hide press start...
main_menu_top_press_start_hide()
--Initialize Hint Bar store it to global Menu_hint_bar
Menu_hint_bar = Vdo_hint_bar:new("hint_bar", 0, Main_menu_common_doc_h)
-- Subscribe to common inputs
Main_menu_input_tracker = Vdo_input_tracker:new()
Main_menu_input_tracker:add_input("map", "main_menu_do_nothing", 50)
Main_menu_input_tracker:add_input("select", "main_menu_button_a", 50)
Main_menu_input_tracker:add_input("back", "main_menu_button_b", 50)
Main_menu_input_tracker:add_input("nav_up", "main_menu_nav_up", 50)
Main_menu_input_tracker:add_input("nav_down", "main_menu_nav_down", 50)
Main_menu_input_tracker:subscribe(false)
-- Add mouse inputs for the PC, don't subscribe until menu is created
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker = Vdo_input_tracker:new()
Main_menu_mouse_input_tracker:subscribe(false)
end
--Setup button hints
--Menu_hint_bar:set_hints()
Menu_hint_bar:set_visible(false)
main_menu_top_show_list(false)
--Hide megalist
Main_menu_list_h = vint_object_find("list_grp", 0, Main_menu_top_doc)
vint_set_property(Main_menu_list_h, "visible", false)
if game_get_platform() == "PC" then
vint_set_property(Main_menu_list_h, "scale", .92, .92)
else
vint_set_property(Main_menu_list_h, "scale", 1, 1)
end
local newsticker_h = vint_object_find("newsticker")
vint_set_property(newsticker_h, "visible", false)
vint_apply_start_values(Screen_in_anim.handle)
if Main_menu_gameboot_complete == true then
--Game is already loaded, so we know we are coming from game, there is no loading or press start...
--Skip load Screen...
main_menu_load_skip()
--Skip press start...
main_menu_top_press_start_skip()
--Show menu...
main_menu_top_menu_show()
--Show MM logo...
main_menu_logo_show()
else
-- Start load sequence...
main_menu_load_start()
end
main_menu_package_chunk_init()
end
function main_menu_top_reset()
-- Move the ticker down, and everything else up on PC
if game_get_platform() == "PC" then
local screen_grp_h = vint_object_find("screen_grp", 0, Main_menu_common_doc_h)
local base_grp_h = vint_object_find("base_grp")
local x, y = vint_get_property(base_grp_h, "anchor")
if vint_is_std_res() then
vint_set_property(base_grp_h, "anchor", x, y - 30)
else
vint_set_property(base_grp_h, "anchor", x, y - 40)
vint_set_property(screen_grp_h, "anchor", 118, 0)
end
x, y = Menu_newsticker:get_anchor()
if vint_is_std_res() then
Menu_newsticker:set_anchor(x, y + 40)
else
Menu_newsticker:set_anchor(x, y + 50)
end
vint_set_property(Main_menu_list_h, "scale", .9, .9)
PC_menu_adjusted = true
end
end
function main_menu_top_lost_focus()
main_menu_top_show_list(false)
List:set_visible(true)
Header_obj:set_visible(true)
main_menu_logo_hide()
Main_menu_input_tracker:subscribe(false)
if Main_menu_mouse_input_tracker ~= -1 then
Main_menu_mouse_input_tracker:subscribe(false)
end
end
function main_menu_top_input_lock(locked)
if Online_validator_result ~= ONLINE_VALIDATOR_IN_PROGRESS then
Main_menu_input_tracker:subscribe(not locked)
if Main_menu_mouse_input_tracker ~= -1 then
Main_menu_mouse_input_tracker:subscribe(not locked)
end
end
end
function main_menu_top_gained_focus()
ui_audio_post_event("UI_Hub_Menu_Back")
glitch_cell()
if( game_get_platform() == "PC" ) then
main_menu_top_cleanup()
main_menu_top_init()
bg_saints_set_type(BG_TYPE_VIDEO, true)
bg_saints_show(true)
main_menu_start_video(true)
else
List:set_visible(false)
Header_obj:set_visible(false)
-- Hide hint bar hints
Menu_hint_bar:set_hints()
bg_saints_set_type(BG_TYPE_VIDEO, true)
bg_saints_show(true)
main_menu_logo_show()
if Main_menu_returned_to_start == true then
main_menu_top_show_list(false)
main_menu_top_show_list(false)
Menu_newsticker:set_visible(false)
return
else
main_menu_top_show_list(true)
end
Main_menu_input_tracker:subscribe(true)
if Main_menu_mouse_input_tracker ~= -1 then
Main_menu_mouse_input_tracker:subscribe(true)
end
if Enter_dlc_menu == true then
main_menu_top_dlc()
Enter_dlc_menu = false
end
end
--Reset flag for silverlink menu.
In_silverlink_menu = false
main_menu_silverlink_logo_is_visible(false)
end
function main_menu_top_cleanup()
if Main_menu_press_start_peg ~= -1 then
game_peg_unload(Main_menu_press_start_peg)
end
if Online_check_thread ~= -1 then
thread_kill(Online_check_thread)
end
Menu_hint_bar:cleanup()
end
-------------------------------------------------------------------------------
-- Initialize press start screen...
-- Setup controls, and show proper press start bitmap...
-------------------------------------------------------------------------------
function main_menu_top_press_start_init()
--Start init...
end
function main_menu_top_press_start_show()
if Menu_hint_bar ~= -1 then
Menu_hint_bar:set_visible(false)
end
--[[
if Main_menu_list ~= -1 then
--Clear any submenu stacks...
menu_common_stack_clear()
Main_menu_returned_to_start = true
vint_set_property(Main_menu_list, "visible", false)
end
]]
menu_common_stack_clear()
Main_menu_returned_to_start = true
vint_set_property(Main_menu_list_h, "visible", false)
if Main_menu_input_tracker ~= -1 then
Main_menu_input_tracker:subscribe(false)
end
if Main_menu_mouse_input_tracker ~= -1 then
Main_menu_mouse_input_tracker:subscribe(false)
end
local press_start_pulse_h = vint_object_find("press_start_pulse", 0, Main_menu_top_doc)
lua_play_anim(press_start_pulse_h, 0, Main_menu_top_doc)
--Show start group stuff...
local h = vint_object_find("press_start_grp", 0, Main_menu_top_doc)
vint_set_property(h, "visible", true)
vint_set_property(h, "alpha", 0)
local anim_h = vint_object_find("intro_press_start_anim", 0, Main_menu_top_doc)
lua_play_anim(anim_h, 0, Main_menu_top_doc)
local screen_grp_h = vint_object_find("screen_grp", 0, Main_menu_common_doc_h)
vint_set_property(screen_grp_h, "anchor", -1000, 0)
main_menu_silverlink_logo_is_visible(false)
end
function main_menu_top_press_start_hide()
--Show start group stuff...
local h = vint_object_find("press_start_grp")
vint_set_property(h, "visible", false)
end
-- Turns off press start...
function main_menu_top_press_start_skip()
--Show start group stuff...
local h = vint_object_find("press_start_grp")
vint_set_property(h, "visible", false)
end
function main_menu_create_top_menu()
bg_saints_show(true)
Main_menu_top = { }
Main_menu_buttons = { }
if game_is_demo() then
Main_menu_top[#Main_menu_top + 1] = Campaign_button
if game_get_platform() == "PC" then
-- Main_menu_top[#Main_menu_top + 1] = Machinima_button
Main_menu_top[#Main_menu_top + 1] = Mm_quit_game
end
else
if Show_continue then
Main_menu_top[#Main_menu_top + 1] = Continue_button
end
Main_menu_top[#Main_menu_top + 1] = Campaign_button
Main_menu_top[#Main_menu_top + 1] = Coop_button
-- Main_menu_top[#Main_menu_top + 1] = DLC_button -- HVS_JRP[PRINCE] 4/8/2014 DLC is included.
-- No Community options for SRGAT
--if game_get_platform() ~= "PS3" then
--Main_menu_top[#Main_menu_top + 1] = Community_button
--end
--Add this back in once we submit
if (silverlink_is_enabled()) then
Main_menu_top[#Main_menu_top + 1] = Silverlink_button
end
if game_get_platform() == "PC" then
Main_menu_top[#Main_menu_top + 1] = Options_button
end
Main_menu_top[#Main_menu_top + 1] = Extras_button
if game_get_platform() == "PC" then
-- Main_menu_top[#Main_menu_top + 1] = Machinima_button
Main_menu_top[#Main_menu_top + 1] = Mm_quit_game
end
if game_get_platform() == "XBOX3" then --HVS_BT 8/18/2014 - adding account picker for xbox3
local string = main_menu_get_gamer_tag()
Account_picker.label = string
Main_menu_top[#Main_menu_top + 1] = Account_picker
end
end
--Create the main menu list
main_menu_top_list_draw_items(Main_menu_top)
end
--Show menu...
function main_menu_top_menu_show(show_continue)
if show_continue then
Show_continue = true
end
Menu_hint_bar:set_hints()
Menu_hint_bar:set_visible(true)
Main_menu_returned_to_start = false
-- Check for money shot unlocks after Press Start.
main_menu_money_shot_check()
main_menu_create_top_menu()
--Disabling Newsticker for demo...
if not game_is_demo() then
if Menu_newsticker == -1 then
Menu_newsticker = Vdo_newsticker:new("newsticker", 0, 0, "main_menu_top.lua", "Menu_newsticker")
end
Menu_newsticker:set_visible(true)
-- Move the ticker down, and everything else up on PC
if game_get_platform() == "PC" and PC_menu_adjusted == false then
local main_menu_list_h = vint_object_find("main_menu_list")
vint_set_property(main_menu_list_h, "scale", 0.9, 0.9)
local base_grp_h = vint_object_find("base_grp")
local x, y = vint_get_property(base_grp_h, "anchor")
if vint_is_std_res() then
vint_set_property(base_grp_h, "anchor", x, y - 30)
else
vint_set_property(base_grp_h, "anchor", x, y - 40)
end
x, y = Menu_newsticker:get_anchor()
if vint_is_std_res() then
Menu_newsticker:set_anchor(x, y + 40)
else
Menu_newsticker:set_anchor(x, y + 50)
end
PC_menu_adjusted = true
end
end
-- Subscribe to inputs
Main_menu_input_tracker:subscribe(true)
-- Add mouse inputs for the PC
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(true)
end
bg_saints_set_type(BG_TYPE_VIDEO,true)
end
-- show main menu
function main_menu_start()
-- legacy shit...
-- pause_save_get_global_info(false) -- this can block across frames
-- pause_save_get_global_info(get_device)
-- Show main menu on screen...
end
function main_menu_do_nothing()
end
function main_menu_top_clear_list_objects( grp_h )
local child_list = { }
-- build a list of all children before we start destroying
-- don't add the base button, we need that
local h = vint_object_first_child( grp_h )
local base_button = vint_object_find( "btn_grp", grp_h )
local highlight_grp = vint_object_find( "highlight_grp", grp_h )
while h ~= nil do
if h ~= base_button and h ~= highlight_grp --[[and h ~= mask]] then
child_list[ h ] = true
end
h = vint_object_next_sibling(h)
end
-- kill em all!
for k, v in pairs( child_list ) do
vint_object_destroy( k )
end
end
function main_menu_top_list_draw_items(data)
local base_btn_h = vint_object_find("btn_grp", Main_menu_list_h, Main_menu_top_doc)
local base_btn_x, base_btn_y = vint_get_property(base_btn_h, "anchor")
local BTN_Y_OFFSET = 42
--Clear any buttons in old list...
main_menu_top_clear_list_objects( Main_menu_list_h )
if game_get_platform() == "PC" then
--Clear all mouse inputs
Main_menu_mouse_input_tracker:remove_all()
end
--Clone new buttons and add mouse inputs.
for i = 1, #data do
local btn_h = vint_object_clone(base_btn_h)
local btn_txt_h = vint_object_find("btn_txt", btn_h, Main_menu_top_doc)
local btn_bg_img_h = vint_object_find("btn_bg_img", btn_h, Main_menu_top_doc)
vint_set_property(btn_h, "anchor", base_btn_x, BTN_Y_OFFSET * i - 1)
vint_set_property(btn_txt_h, "text_tag", data[i].label)
--Save handles for later
Main_menu_buttons[i] = {
btn_h = btn_h,
btn_txt_h = btn_txt_h,
btn_bg_img_h = btn_bg_img_h,
}
if game_get_platform() == "PC" then
--Add new mouse inputs...
Main_menu_mouse_input_tracker:add_mouse_input("mouse_move", "main_menu_mouse_move", 100, btn_bg_img_h)
Main_menu_mouse_input_tracker:add_mouse_input("mouse_click", "main_menu_mouse_click", 100, btn_bg_img_h)
end
end
if game_get_platform() == "PC" then
--Subscribe new Mouse inputs
Main_menu_mouse_input_tracker:subscribe(true)
end
vint_set_property(base_btn_h, "visible", false)
vint_set_property(Main_menu_list_h, "visible", true)
--reset all buttons to off state
for i = 1, #Main_menu_buttons do
local btn_h = Main_menu_buttons[i].btn_h
local txt_h = vint_object_find("btn_txt", btn_h, Main_menu_top_doc)
local bg_h = vint_object_find("btn_bg_img", btn_h, Main_menu_top_doc)
vint_set_property(bg_h, "visible", true)
vint_set_property(txt_h, "tint", 167/255, 167/255, 167/255)
end
--Update the highlight and set it at 1
Main_menu_idx = 1
main_menu_top_list_move_cursor(0)
end
function main_menu_top_list_move_cursor(direction)
--Move up or down from where we are currently
local idx = Main_menu_idx + direction
--Wrap if we need to
if idx > #Main_menu_buttons then
idx = 1
elseif idx < 1 then
idx = #Main_menu_buttons
end
--Highlight new index, reset old button
--This is a separate function for mouse inputs
main_menu_top_list_set_selection(idx)
--Store off new index
Main_menu_idx = idx
end
--Highlight new index, reset old button
function main_menu_top_list_set_selection(idx)
local current_btn_h = Main_menu_buttons[idx].btn_h
local current_txt_h = vint_object_find("btn_txt", current_btn_h, Main_menu_top_doc)
local current_bg_h = vint_object_find("btn_bg_img", current_btn_h, Main_menu_top_doc)
local old_btn_h = Main_menu_buttons[Main_menu_idx].btn_h
local old_txt_h = vint_object_find("btn_txt", old_btn_h, Main_menu_top_doc)
local old_bg_h = vint_object_find("btn_bg_img", old_btn_h, Main_menu_top_doc)
--hide the dark bg for highlighted item, show others for unhighlighted
vint_set_property(old_bg_h, "visible", true)
vint_set_property(old_txt_h, "tint", 167/255, 167/255, 167/255)
vint_set_property(current_bg_h, "visible", false)
vint_set_property(current_txt_h, "tint", 0, 0, 0)
local highlight_grp_h = vint_object_find("highlight_grp", 0, Main_menu_top_doc)
local highlight_x, new_y = vint_get_property(current_btn_h, "anchor")
vint_set_property(highlight_grp_h, "anchor", highlight_x, new_y)
end
--Set the visibility of the main menu list
function main_menu_top_show_list(is_visible)
vint_set_property(Main_menu_list_h, "visible", is_visible)
end
-------------------------------------------------------------------------------
-- PlayGo / QuickStart Functions...
-------------------------------------------------------------------------------
function main_menu_package_chunk_init() --HVS_JRP[PRINCE] 3/25/2014
-- Generate a list of all the package IDs we care about.
local all_package_chunk_ids = { }
for i = 1, #Main_menu_top do
local menu_button = Main_menu_top[i]
local package_chunk_ids = menu_button.package_chunk_ids
if package_chunk_ids ~= nil then
for j = 1, #package_chunk_ids do
local new_id
local bFound = false
for k = 1, #all_package_chunk_ids do
if new_id == all_package_chunk_ids[k] then
bFound = true
break
end
end
if not bFound then
all_package_chunk_ids[#all_package_chunk_ids + 1] = new_id
end
end
end
end
if (all_package_chunk_ids == nil) or (#all_package_chunk_ids <= 0) then
return
end
-- Start tracking information for these package chunks.
-- If the game is already fully downloaded, hopefully we will have that information before the user attempts to access a button that would otherwise pop up a progress dialog.
for i = 1, #all_package_chunk_ids do
package_chunk_tracking_add(all_package_chunk_ids[i])
end
package_chunk_tracking_start()
end
function main_menu_is_button_available(menu_button) --HVS_JRP[PRINCE] 3/20/2014 Determine if we have downloaded all of the package chunks this button depends on.
local package_chunk_movies = 1
if game_get_platform() == "XBOX3" then
package_chunk_movies = 2
end
-- HVS_EC don't allow co-op until full game is installed.
if menu_button == Coop_button then
if not package_chunk_loaded(package_chunk_movies) then
return false
end
end
return true
-- HVS_EC Don't bother executing any of this for King...
--local package_chunk_ids = menu_button.package_chunk_ids
--if (package_chunk_ids == nil) or (#package_chunk_ids <= 0) then
-- return true --Not dependent on a package chunk.
--end
--for i = 1, #package_chunk_ids do
-- if not package_chunk_loaded(package_chunk_ids[i]) then
-- return false
-- end
--end
--return true
end
function main_menu_attempt_button(menu_button) --HVS_JRP[PRINCE] 3/20/2014 If we haven't finished downloading, display a progress dialog.
if main_menu_is_button_available(menu_button) then
return true
end
-- HVS_EC We already set up the tracking list when we started the game. This is redundant.
-- Start tracking information for the package chunks associated with this button.
--local package_chunk_ids = menu_button.package_chunk_ids
--for i = 1, #package_chunk_ids do
-- package_chunk_tracking_add(package_chunk_ids[i])
--end
--package_chunk_tracking_start()
-- Open the download dialog.
local options = { [0] = "CONTROL_CONTINUE" }
main_menu_top_dowload_dialog_box = dialog_box_open("GAME_INSTALL_INCOMPLETE_TITLE", "GAME_INSTALL_INCOMPLETE_LOAD", options, "main_menu_download_dialog_callback", 0, DIALOG_PRIORITY_ACTION, false, false, false, false, false, 0)
main_menu_update_download_dialog()
Main_menu_dialog_update_timer = MAIN_MENU_DIALOG_UPDATE_TIME
return false
end
function main_menu_download_dialog_callback() --HVS_JRP[PRINCE] 3/20/2014 Clear reference to the dialog box, so we don't try to access it.
main_menu_top_dowload_dialog_box = nil
end
function main_menu_top_process(time_diff) --HVS_JRP[PRINCE] 3/17/2014 Periodically update the download dialog box progress.
if main_menu_top_dowload_dialog_box then
Main_menu_dialog_update_timer = Main_menu_dialog_update_timer - time_diff
if Main_menu_dialog_update_timer <= 0.0 then
Main_menu_dialog_update_timer = Main_menu_dialog_update_timer + MAIN_MENU_DIALOG_UPDATE_TIME
package_chunk_tracking_update()
main_menu_update_download_dialog()
end
end
end
function main_menu_update_download_dialog() --HVS_JRP[PRINCE] 3/20/2014 Update the body text of the download progress dialog.
-- HVS_EC Enable this function once we figure out how to fix the percentages/times being wrong.
if true then
return
end
if not main_menu_top_dowload_dialog_box then
return
end
local menu_button = Main_menu_top[Main_menu_idx]
--Check if it's done downloading.
if main_menu_is_button_available(menu_button) then
ui_audio_post_event("clothing_purchase")
dialog_box_force_close(main_menu_top_dowload_dialog_box)
return
end
--Update the body text.
local platform = game_get_platform()
local body_text = ""
local progress = floor(100 * package_chunk_tracking_progress())
if platform == "PS4" then
-- Determine the total download remaining.
local chunk_size_MB = floor(package_chunk_tracking_size() / 1024 / 1024)
local chunk_size_loaded_MB = floor(package_chunk_tracking_size_loaded() / 1024 / 1024)
local chunk_eta = package_chunk_tracking_eta()
local eta_text = format_time(chunk_eta, false, false, false, true)
body_text = progress.."%%\n"..chunk_size_loaded_MB.." MB / "..chunk_size_MB.." MB\n"..get_localized_string_for_tag("STREAMING_INSTALL_TIME")..": "..eta_text
elseif platform == "XBOX3" then
body_text = progress.."%%"
end
dialog_box_set_body(main_menu_top_dowload_dialog_box, body_text)
end
-------------------------------------------------------------------------------
-- Navigation Functions...
-------------------------------------------------------------------------------
function main_menu_nav_up()
-- Move highlight up
--Main_menu_list:move_cursor(-1)
game_UI_audio_play("UI_MAIN_MENU_NAV_UP")
main_menu_top_list_move_cursor(-1)
end
function main_menu_nav_down()
-- Move highlight down
--Main_menu_list:move_cursor(1)
game_UI_audio_play("UI_MAIN_MENU_NAV_DOWN")
main_menu_top_list_move_cursor(1)
end
function main_menu_button_b()
if game_get_platform() == "PC" then
main_menu_initiate_quit_game()
end
--Nav the screen back...
end
function main_menu_button_a()
--Nav the screen forward...
--Set the screen data to the list data
--local data = Main_menu_list:return_data()
local current_selection = Main_menu_idx --Main_menu_list:get_selection()
if current_selection == -1 then
return
end
--Clear any sub menu stacks...
menu_common_stack_clear()
--pass off the input to the list
--Main_menu_list:button_a()
Main_menu_top[Main_menu_idx].on_select(Main_menu_top)
end
function main_menu_mouse_click(event, target_handle)
for i =1, #Main_menu_buttons do
if target_handle == Main_menu_buttons[i].btn_bg_img_h then
main_menu_button_a()
end
end
end
function main_menu_mouse_move(event, target_handle)
for i =1, #Main_menu_buttons do
if target_handle == Main_menu_buttons[i].btn_bg_img_h then
--Directly set selection then update list index after
main_menu_top_list_set_selection(i)
game_UI_audio_play("UI_MAIN_MENU_NAV_DOWN")
Main_menu_idx = i
end
end
end
-- Continue button
function main_menu_top_continue()
if not main_menu_attempt_button(Continue_button) then --HVS_JRP[PRINCE] 3/20/2014 (PlayGo)
return
end
main_menu_continue()
end
-- Campaign menu
function main_menu_top_campaign()
if not main_menu_attempt_button(Campaign_button) then --HVS_JRP[PRINCE] 3/20/2014 (PlayGo)
return
end
--Do Campaign Game
push_screen("main_menu_campaign")
end
function mm_top_redeem_check()
main_menu_supress_profile_change(true)
Main_menu_input_tracker:subscribe(false)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(false)
end
online_and_privilege_validator_begin(true, true, true, false, false)
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Main_menu_input_tracker:subscribe(true)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(true)
end
main_menu_supress_profile_change(false)
main_menu_top_input_lock(false)
if Online_validator_result ~= ONLINE_VALIDATOR_PASSED then
return
end
main_menu_redeem_code()
Online_check_thread = -1
end
function mm_top_coop_dlg_cb(result, action)
if game_get_platform() == "PC" then
if result == 0 then
main_menu_top_dlc()
end
else
if result == 0 then
Online_check_thread = thread_new("mm_top_redeem_check")
elseif result == 1 then
main_menu_top_dlc()
end
end
end
function main_menu_top_coop_dlc_checked(has_coop, cancelled)
if has_coop then
--Do coop Coop
push_screen("main_menu_coop_top")
elseif not cancelled then
local options
local back_option = 1
if game_get_platform() == "PC" then
options = { [0] = "GO_DLC_STORE", [1] = "CONTROL_CANCEL" }
else
options = { [0] = "REDEEM_CODE", [1] = "GO_DLC_STORE", [2] = "CONTROL_CANCEL" }
back_option = 2
end
dialog_box_open("DIALOG_COOP_DLC_TITLE", "DLC_COOP_DLC_MAIN_BODY", options, "mm_top_coop_dlg_cb",
0, DIALOG_PRIORITY_ACTION, false, nil, false, false, false, back_option)
end
end
function main_menu_top_check_coop()
main_menu_top_input_lock(false)
game_check_coop_dlc("main_menu_top_coop_dlc_checked")
Online_check_thread = -1
end
function main_menu_top_coop()
if not main_menu_attempt_button(Coop_button) then --HVS_JRP[PRINCE] 3/20/2014 (PlayGo)
return
end
main_menu_top_input_lock(true)
Online_check_thread = thread_new("main_menu_top_check_coop")
end
function mm_check_dlc()
-- If there's a previous check, let it finish
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Main_menu_input_tracker:subscribe(false)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(false)
end
online_and_privilege_validator_begin(true, true, false, false, false)
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Main_menu_input_tracker:subscribe(true)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(true)
end
main_menu_top_input_lock(false)
if Online_validator_result == ONLINE_VALIDATOR_PASSED then
push_screen("store_dlc")
end
Online_check_thread = -1
end
function main_menu_top_dlc()
if game_get_platform() == "PC" then
game_steam_open_dlc_page_overlay()
return
end
main_menu_top_input_lock(true)
Online_check_thread = thread_new("mm_check_dlc")
end
function mm_community_check()
Main_menu_input_tracker:subscribe(false)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(false)
end
online_and_privilege_validator_begin(true, true, true, false, false)
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Main_menu_input_tracker:subscribe(true)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(true)
end
if Online_validator_result == ONLINE_VALIDATOR_PASSED then
if (game_get_platform() == "XBOX360") or (game_get_platform() == "XBOX3") then
if main_menu_xbox_get_age_group() ~= "adult" then
dialog_box_message( "MENU_TITLE_NOTICE", "PLATFORM_XBOX_COMMUNITY_AGE_RESTRICTED" )
return
end
end
if main_menu_check_user_content() == false or main_menu_check_social_privilege() == false then
dialog_box_message("MENU_TITLE_WARNING", "USER_CONTENT_PRIV_DENIED")
else
community_login_open()
end
end
Online_check_thread = -1
end
function mm_silverlink_check()
Main_menu_input_tracker:subscribe(false)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(false)
end
online_and_privilege_validator_begin(true, true, true, false, false)
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Main_menu_input_tracker:subscribe(true)
if game_get_platform() == "PC" then
Main_menu_mouse_input_tracker:subscribe(true)
end
if Online_validator_result == ONLINE_VALIDATOR_PASSED then
if main_menu_check_user_content() == false or main_menu_check_social_privilege() == false then
dialog_box_message("MENU_TITLE_WARNING", "USER_CONTENT_PRIV_DENIED")
else
push_screen("main_menu_silverlink")
--silverlink_login_open()
end
end
Online_check_thread = -1
end
function main_menu_top_community()
Online_check_thread = thread_new("mm_community_check")
end
function main_menu_top_silverlink()
Online_check_thread = thread_new("mm_silverlink_check")
end
function main_menu_top_options()
--Top Options
push_screen("pause_options_menu")
end
function main_menu_top_extras()
--Top Extras
push_screen("main_menu_extras")
end
function main_menu_top_machinima()
-- This should bring up cinema_clip_manager, or show a dialog box saying that there are no clips to edit
push_screen("pause_options_clip_select")
end
function main_menu_initiate_quit_game()
dialog_box_destructive_confirmation("PLT_QUIT_GAME", "PLT_QUIT_GAME_WARNING", "main_menu_top_confirm_quit")
end
function main_menu_top_confirm_quit(return_value)
if return_value == 0 then -- YES
game_request_game_terminate()
end
end
function main_menu_top_account_picker() --HVS_BT 8/18/2014
main_menu_account_picker()
end
-------------------------------------------------------------------------------
-- Main Menu BMS Loaded
-------------------------------------------------------------------------------
function main_menu_top_bmp_loaded()
--This is for the press start image...
--It is a null function callback...
end
-------------------------------------------------------------------------------
-- Temp function to remove the demo disabling..stuff...
-- use the console to access... "vint_lua main_menu_top mm_coop"
-------------------------------------------------------------------------------
function mm_coop()
for i, v in pairs(Main_menu_top) do
v.disabled = nil
end
-- Create megalist...
--Main_menu_list:draw_items(Main_menu_top, 1, MAIN_MENU_MEGA_LIST_SIZE, "center")
-- Main_menu_list:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY)
end
Continue_button = { label = "MAINMENU_CONTINUE", type = TYPE_BUTTON, on_select = main_menu_top_continue, package_chunk_ids = nil } -- HVS_EC King doesn't use these...
Campaign_button = { label = "MAINMENU_CAMPAIGN", type = TYPE_BUTTON, on_select = main_menu_top_campaign, package_chunk_ids = nil }
Coop_button = { label = "MAINMENU_COOP_OPTION", type = TYPE_BUTTON, on_select = main_menu_top_coop, package_chunk_ids = nil }
DLC_button = { label = "MAINMENU_DLC", type = TYPE_BUTTON, on_select = main_menu_top_dlc, package_chunk_ids = nil }
Community_button = { label = "MAINMENU_COMMUNITY", type = TYPE_BUTTON, on_select = main_menu_top_community, package_chunk_ids = nil }
Silverlink_button = { label = "SILVERLINK", type = TYPE_BUTTON, on_select = main_menu_top_silverlink, package_chunk_ids = nil }
Options_button = { label = "MAINMENU_OPTIONS", type = TYPE_BUTTON, on_select = main_menu_top_options, package_chunk_ids = nil }
Extras_button = { label = "MAINMENU_EXTRAS", type = TYPE_BUTTON, on_select = main_menu_top_extras, package_chunk_ids = nil }
Machinima_button = { label = "MAINMENU_MACHINIMA_MODE", type = TYPE_BUTTON, on_select = main_menu_top_machinima, package_chunk_ids = nil }
Mm_quit_game = { label = "PLT_QUIT_GAME", type = TYPE_BUTTON, on_select = main_menu_initiate_quit_game, package_chunk_ids = nil }
Account_picker = { label = "MAIN_MENU_ACCOUNT_PICKER", type = TYPE_BUTTON, on_select = main_menu_top_account_picker, package_chunk_ids = nil } --HVS_BT 8/18/2014 - adding account picker for xbox one