./pause_menu_common.lua

  1. Menu_hint_bar = -1 
  2.  
  3. SAVE_OPERATION_SAVE_GAME = 0 
  4. SAVE_OPERATION_LOAD_GAME = 1 
  5. Save_system_operation = SAVE_OPERATION_LOAD_GAME 
  6.  
  7. COOP_INVITE_LIST			= 0 
  8. COOP_ONLINE_JOIN_LIST  	= 1 
  9. COOP_SYSLINK_JOIN_LIST 	= 2 
  10. Coop_connect_operation = COOP_INVITE_LIST 
  11.  
  12. In_pause_menu = true 
  13. Load_for_coop = false 
  14. Exit_after_closing = false 
  15. Save_message_displayed = false 
  16. Close_all_menu = false 
  17.  
  18. Pause_menu_common_doc_h = -1 
  19.  
  20. Header_obj = -1 
  21. List = -1 
  22.  
  23. Screen_slide_out_anim = -1 
  24. Screen_slide_in_anim = -1 
  25. Screen_in_anim = -1 
  26. Screen_out_anim = -1 
  27. Screen_back_in_anim = -1 
  28. Screen_back_out_anim = -1 
  29.  
  30. First_time = true 
  31. Start_game_after_display = false 
  32. Join_friend_after_display = -1 
  33.  
  34. function pause_menu_common_init() 
  35. 	 
  36. 	Pause_menu_common_doc_h = vint_document_find("pause_menu_common") 
  37.  
  38. 	local hacking_doc_h = vint_document_find("hack_main_sticks") 
  39. 	if Bg_saints_doc_handle ~= 0 then 
  40. 		if hacking_doc_h ~= 0 then 
  41. 			vint_document_set_depth( Bg_saints_doc_handle, -31 ) 
  42. 		else 
  43. 			vint_document_set_depth( Bg_saints_doc_handle, 0 ) 
  44. 		end 
  45. 	end 
  46. 	 
  47. 	--Apply purple lut! 
  48. 	pause_menu_lut_effect("none") 
  49. 	 
  50. 	-- Play sound effect for pause menu starting up 
  51. 	--play_ui_sound( "INT_PAUSE" ) 
  52. 	 
  53. 	--Initialize Hint Bar store it to global Menu_hint_bar 
  54. 	Menu_hint_bar = Vdo_hint_bar:new("hint_bar") 
  55. 	 
  56. 	 
  57. 	 
  58. 	Screen_in_anim = Vdo_anim_object:new("screen_in_anim",0,Pause_menu_common_doc_h) 
  59. 	local twn = Vdo_tween_object:new("screen_in_twn", Screen_in_anim.handle) 
  60. 	twn:set_end_event("menu_common_anim_in_cb") 
  61. 	 
  62. 	Screen_out_anim = Vdo_anim_object:new("screen_out_anim",0,Pause_menu_common_doc_h) 
  63. 	local twn2 = Vdo_tween_object:new("screen_out_twn", Screen_out_anim.handle) 
  64. 	twn2:set_end_event("menu_common_anim_out_cb") 
  65. 	 
  66. 	Screen_slide_out_anim = Vdo_anim_object:new("screen_slide_out_anim",0,Pause_menu_common_doc_h) 
  67. 	local twn_out = Vdo_tween_object:new("screen_slide_out_twn1", Screen_slide_out_anim.handle) 
  68. 	twn_out:set_end_event("menu_common_anim_out_cb") 
  69. 	 
  70. 	Screen_slide_in_anim = Vdo_anim_object:new("screen_slide_in_anim",0,Pause_menu_common_doc_h) 
  71. 	local twn_in = Vdo_tween_object:new("screen_slide_in_twn1", Screen_slide_in_anim.handle) 
  72. 	twn_in:set_end_event("menu_common_anim_in_cb") 
  73. 	 
  74. 	Screen_back_in_anim = Vdo_anim_object:new("screen_back_in_anim",0,Pause_menu_common_doc_h) 
  75. 	local twn_back_in = Vdo_tween_object:new("back_in_twn1", Screen_back_in_anim.handle) 
  76. 	twn_back_in:set_end_event("menu_common_anim_in_cb") 
  77. 	 
  78. 	Screen_back_out_anim = Vdo_anim_object:new("screen_back_out_anim",0,Pause_menu_common_doc_h) 
  79. 	local twn_back_out = Vdo_tween_object:new("back_out_twn1", Screen_back_out_anim.handle) 
  80. 	twn_back_out:set_end_event("menu_common_anim_out_cb") 
  81. 	 
  82. 	List = Vdo_mega_list:new("list", 0, Pause_menu_common_doc_h, "pause_menu_common.lua", "List") 
  83. 	List:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY) 
  84. 	 
  85. 	Header_obj = Vdo_pause_header:new("header",0,Pause_menu_common_doc_h) 
  86.  
  87. 	bg_saints_show(false) 
  88.  
  89. 	vint_apply_start_values(Screen_in_anim.handle) 
  90. 	 
  91. 	 -- HVS_EC  Set GPU Reserve on  (Enable Kinect Eye) 
  92. 	os_set_gpu_reserve_state(true) 
  93. end 
  94.  
  95. function pause_menu_common_cleanup() 
  96. 	-- HVS_EC  Set GPU Reserve off  (Disable Kinect Eye) 
  97. 	os_set_gpu_reserve_state(false) 
  98. 	 
  99. 	-- Possibly, free up controller memory when document is unloaded... 
  100. 	-- This also happens in pause_options_controls_config() but is done here in case the user presses 
  101. 	-- The back button... 
  102. 	pause_menu_control_scheme_init(false) 
  103.  
  104. 	--Remove purple lut... 
  105. 	pause_menu_lut_effect("none") 
  106. 	 
  107. 	Menu_hint_bar:cleanup() 
  108. end 
  109.  
  110. function pause_menu_common_server_drop() 
  111. 	Save_system_operation = SAVE_OPERATION_SAVE_GAME 
  112. 	Exit_after_closing = true 
  113. 	push_screen("pause_save_game") 
  114. end 
  115.  
  116. function pause_menu_common_open_invite() 
  117. 	Exit_after_closing = true 
  118. 	push_screen("pause_invite_friends") 
  119. end 
  120.  
  121. function pause_menu_common_open_cheat_save() 
  122. 	Save_system_operation = SAVE_OPERATION_SAVE_GAME 
  123. 	Close_all_menu = true 
  124. 	push_screen("pause_save_game") 
  125. end 
  126.  
  127. function pause_menu_intro_done() 
  128.  
  129. 	-- Jeff: This needs to be setup properly 
  130. 	--pause_menu_top_anim_in() 
  131.  
  132. end 
  133.  
  134. -- Make the pause menu megalist look pause menu 
  135. -- 
  136. function pause_menu_set_style(list, header, width, num_pops) 
  137. 	--get the list width 
  138. 	local list_w, list_h = vint_get_property(List.handle, "screen_size") 
  139. 	list_w = width or list_w 
  140. 	 
  141. 	header:set_visible(true) 
  142. 	list:set_visible(true) 
  143. 	 
  144. 	local max_width = 650 
  145. 	local back_out_twn1_h = vint_object_find("back_out_twn1", Screen_back_out_anim.handle) 
  146. 	local back_out_twn2_h = vint_object_find("back_out_twn2", Screen_back_out_anim.handle) 
  147. 	local back_out_twn3_h = vint_object_find("back_out_twn3", Screen_back_out_anim.handle) 
  148. 	--[[ 
  149. 	if list_w > max_width then 
  150. 		vint_set_property(back_out_twn1_h, "end_value", -1 * max_width, 652) 
  151. 		vint_set_property(back_out_twn2_h, "end_value", -1 * max_width, 230) 
  152. 		vint_set_property(back_out_twn3_h, "end_value", -1 * max_width, 267) 
  153. 	else 
  154. 		vint_set_property(back_out_twn1_h, "end_value", -300, 652) 
  155. 		vint_set_property(back_out_twn2_h, "end_value", -300, 230) 
  156. 		vint_set_property(back_out_twn3_h, "end_value", -300, 267) 
  157. 	end 
  158. 	]] 
  159. 	local bg_anchor = 100 
  160. 	if vint_is_std_res() then 
  161. 		bg_anchor = 74 
  162. 	end 
  163. 	 
  164. 	if not First_time then 
  165. 		bg_saints_set_type(BG_TYPE_PAUSE, true, list_w, bg_anchor) 
  166. 		 
  167. 		 
  168. 			 
  169. 		if num_pops > 0 then 
  170. 			vint_apply_start_values(Screen_slide_in_anim.handle) 
  171. 			Screen_slide_in_anim:play(0) 
  172. 		else 
  173. 			vint_apply_start_values(Screen_back_in_anim.handle) 
  174. 			Screen_back_in_anim:play(0) 
  175. 		end 
  176. 	else 
  177. 		 
  178. 		bg_saints_set_type(BG_TYPE_PAUSE, false, list_w, bg_anchor) 
  179. 	end 
  180. end 
  181.  
  182. function pause_menu_mask_morph( screen_type, size_end_x, anchor_end_x ) 
  183. 	--get handles for everyone 
  184. 	 
  185. 	 
  186. 	--set up the left shadow start and end values 
  187. 	--get the starting x position 
  188. 	--create the center anchor point from the width of the mask, only if we are center aligned 
  189. 	 
  190. 	 
  191. 	--setup the anchor for the mask 
  192. 	--get the starting x position 
  193. 	 
  194. 	 
  195. 	--setup the scale of the mask 
  196. 	--get the starting scale 
  197. 	 
  198. 	 
  199. 	 
  200. 	 
  201. end 
  202.  
  203.  
  204.  
  205. --Wrapper for c++ lut swap function... 
  206. function pause_menu_lut_effect(lut_table_string) 
  207.  
  208. 	if lut_table_string ~= "none" then 
  209. 		local platform = game_get_platform() 
  210. 		local lut_platform_string = "" 
  211. 		 
  212. 		if platform == "PS3" then 
  213. 			lut_platform_string = "_ps3" 
  214. 		elseif platform == "XBOX360" then 
  215. 			lut_platform_string = "_xbox2" 
  216. 		elseif platform == "XBOX3" then 
  217. 			lut_platform_string = "_xbox3" 
  218. 		elseif platform == "PS4" then 
  219. 			lut_platform_string = "_ps4" 
  220. 		elseif platform == "PC" then 
  221. 			lut_platform_string = "_pc" 
  222. 		end 
  223. 		completion_load_lut(lut_table_string .. lut_platform_string) 
  224. 	else 
  225. 		completion_load_lut(lut_table_string) 
  226. 	end 
  227. end