./cell_foreground.lua

  1. -- These are for the 9 buttons on the cellphone. 
  2. ID_INVALID			= -2 
  3. ID_MAIN				= -1 
  4. ID_MAP				= 0 
  5. ID_MISSIONS 		= 1 
  6. ID_POWERS			= 2 
  7. ID_REWARDS			= 3 
  8. --ID_MUSIC				= 4 
  9. --ID_CAMERA			= 5 
  10. --ID_PHONE				= 6 
  11. --ID_CASH				= 4 
  12. --ID_EXTRAS			= 5 
  13. ID_STATS			= 4 
  14. ID_TOMES			= 5 
  15.  
  16. Cell_foreground_doc	= -1 
  17. Cell_background_doc 	= -1 
  18. Cell_foreground_h 	= 0 
  19. Cell_background_h 	= 0 
  20.  
  21. -- HVS_TBT 5/19/2014 - Set these to be true by default, since we usually DO come from the main menu. 
  22. Pause_map_from_menu	= true				--Are we coming from the cell_menu_main or directly from game? 
  23. Rewards_from_menu	= true				--Are we coming from the cell_menu_main or directly from game? 
  24. Missions_from_menu	= true				--Are we coming from the cell_menu_main or directly from game? 
  25.  
  26. Gps_has_been_set = false 
  27.  
  28. local Tutorial_h 
  29.  
  30. --Transtition Enums... 
  31. CELL_TRANSITION_INVALID 		= 0 
  32. CELL_TRANSITION_IN_PORTRAIT 	= 1		--set to portrait 
  33. CELL_TRANSITION_IN_LANDSCAPE 	= 2		--set to landscape 
  34. CELL_TRANSITION_OUT_PORTRAIT 	= 3		--transition out to portrait 
  35. CELL_TRANSITION_OUT_LANDSCAPE = 4		--transition out to landscape 
  36.  
  37. CELL_STATE_INVALID 				= 0 
  38. CELL_STATE_START					= 1 
  39. CELL_STATE_OUT 					= 2 
  40. CELL_STATE_PORTRAIT				= 3 
  41. CELL_STATE_LANDSCAPE 			= 4  
  42. CELL_STATE_START_PORTRAIT		= 5 
  43. CELL_STATE_START_LANDSCAPE		= 6 
  44. CELL_STATE_OUT_PORTRAIT			= 7  
  45. CELL_STATE_OUT_LANDSCAPE		= 8   
  46.  
  47. CELL_TYPE_LANDSCAPE	= 1 
  48. CELL_TYPE_PORTRAIT	= 2 
  49.  
  50. local Cell_current_state = CELL_STATE_START 
  51. Cell_transition_cb_func = -1 
  52.  
  53. --This is a seperate enum because the ID_* enums does not have every screen in the phone... 
  54. CELL_SCREEN_NONE 			= 0 
  55. CELL_SCREEN_MAIN 			= 1 
  56. CELL_SCREEN_MAP 			= 2 
  57. CELL_SCREEN_MISSIONS		= 3 
  58. CELL_SCREEN_POWERS		= 4 
  59. CELL_SCREEN_REWARDS		= 5 
  60. CELL_SCREEN_MUSIC			= 6 
  61. CELL_SCREEN_MUSIC_SUB	= 7 
  62. CELL_SCREEN_PLAYLIST		= 8 
  63. CELL_SCREEN_CAMERA		= 9 
  64. CELL_SCREEN_PHONE			= 10 
  65. CELL_SCREEN_EXTRAS		= 11 
  66. CELL_SCREEN_CHEATS		= 12 
  67. CELL_SCREEN_STATS			= 13 
  68. CELL_SCREEN_CASH			=14 
  69. CELL_SCREEN_POWERS_SUB			=15 
  70. CELL_SCREEN_COLLECTIBLES	= 16 
  71.  
  72.  
  73. -- Table is used to define screen types.  
  74. -- Allows us to store the type of screen it is, document name and target element. 
  75. -- This allows us to make any kind of transtion to a particular screen. 
  76. -- Screen type is either CELL_TYPE_LANDSCAPE (screens designed to be wide) or CELL_TYPE_PORTRAIT (screens in vertical orientation. 
  77. local Cell_menu_types = { 
  78. 	--Screen ID defined above		Screen Type				Document Name			First element of the group 
  79. 	[CELL_SCREEN_NONE] 			= {nil, 						nil,						nil},				--This is used so we can transition to nothing... 
  80. 	[CELL_SCREEN_MAIN] 			= {CELL_TYPE_LANDSCAPE, "cell_menu_main",		"cell_menu_grp"}, 
  81. 	[CELL_SCREEN_MAP]				= {CELL_TYPE_LANDSCAPE, "pause_map",			"map_all_grp"}, 
  82. 	[CELL_SCREEN_MISSIONS] 		= {CELL_TYPE_LANDSCAPE, "cell_missions",		"missions_grp"}, 
  83. 	[CELL_SCREEN_POWERS]			= {CELL_TYPE_LANDSCAPE,	"powers_main",			"screen_grp"}, 
  84. 	[CELL_SCREEN_REWARDS]		= {CELL_TYPE_LANDSCAPE, "cell_rewards", 		"rewards_base_grp"}, 
  85. 	[CELL_SCREEN_MUSIC_SUB]		= {CELL_TYPE_LANDSCAPE, "cell_music_sub", 	"cell_menu_grp"}, 
  86. 	[CELL_SCREEN_MUSIC]			= {CELL_TYPE_LANDSCAPE, "cell_music_menu", 	"station_group"}, 
  87. 	[CELL_SCREEN_PLAYLIST]		= {CELL_TYPE_LANDSCAPE, "cell_playlist", 		"playlist_grp"}, 
  88. 	[CELL_SCREEN_CAMERA]			= {CELL_TYPE_LANDSCAPE,	"cell_camera",			"camera_grp"}, 
  89. 	[CELL_SCREEN_PHONE]			= {CELL_TYPE_LANDSCAPE,	"cell_phone",			"phone_grp"}, 
  90. 	[CELL_SCREEN_EXTRAS]			= {CELL_TYPE_LANDSCAPE, "cell_extras", 		"cell_menu_grp"}, 
  91. 	[CELL_SCREEN_CHEATS]			= {CELL_TYPE_LANDSCAPE, "cell_cheats", 		"cheats_grp"}, 
  92. 	[CELL_SCREEN_STATS]			= {CELL_TYPE_LANDSCAPE, "cell_stats", 			"stats_grp"}, 
  93. 	[CELL_SCREEN_CASH]			= {CELL_TYPE_LANDSCAPE, "store_crib_cash", 	"cell_bonus_grp"}, 
  94. 	[CELL_SCREEN_POWERS_SUB]	= {CELL_TYPE_LANDSCAPE, "powers_sub", 			"powers_base_grp"}, 
  95. 	[CELL_SCREEN_COLLECTIBLES]	= {CELL_TYPE_LANDSCAPE, "col_main",			"screen_grp"}, 
  96. } 
  97.  
  98. -- Positions, rotation and scale values for screens in HD 
  99. local Cell_states = { 
  100. 	[CELL_TYPE_PORTRAIT] = { 
  101. 		--[CELL_STATE_START_PORTRAIT] 	= {x = 1000, 	y = 1300, 	r = (45 * DEG_TO_RAD), 		s = 1.0}, 
  102. 		--[CELL_STATE_START_LANDSCAPE] 	= {x = 1000, 	y = 1300, 	r = (-45 * DEG_TO_RAD), 	s = 1.5}, 
  103. 		[CELL_STATE_START_PORTRAIT] 	= {x = 640, 	y = 360, 	r = (45 * DEG_TO_RAD), 		s = 1.0}, 
  104. 		[CELL_STATE_START_LANDSCAPE] 	= {x = 640, 	y = 360, 	r = (-45 * DEG_TO_RAD), 	s = 1.0}, 
  105. 		[CELL_STATE_PORTRAIT] 			= {x = 640, 	y = 360, 	r = (0 * DEG_TO_RAD), 		s = 1.0}, 
  106. 		[CELL_STATE_LANDSCAPE] 			= {x = 640, 	y = 360, 	r = (-90 * DEG_TO_RAD), 	s = 1.0}, 
  107. 		--[CELL_STATE_OUT_PORTRAIT] 	= {x = 1000, 	y = 1300, 	r = (45 * DEG_TO_RAD), 		s = 1.0}, 
  108. 		--[CELL_STATE_OUT_LANDSCAPE] 	= {x = 1000, 	y = 1300, 	r = (-45 * DEG_TO_RAD), 	s = 1.5}, 
  109. 		[CELL_STATE_OUT_PORTRAIT] 		= {x = 640, 	y = 360, 	r = (45 * DEG_TO_RAD), 		s = 0.01}, 
  110. 		[CELL_STATE_OUT_LANDSCAPE] 	= {x = 640, 	y = 360, 	r = (-45 * DEG_TO_RAD), 	s = 0.02}, 
  111. 	}, 
  112. 	[CELL_TYPE_LANDSCAPE] = { 
  113. 		--[CELL_STATE_START_PORTRAIT] 	= {x = 1000, 	y = 1300, 	r = (135 * DEG_TO_RAD), 	s = .65}, 
  114. 		--[CELL_STATE_START_LANDSCAPE] 	= {x = 1000, 	y = 1300, 	r = (45 * DEG_TO_RAD), 		s = 1.0}, 
  115. 		[CELL_STATE_START_PORTRAIT] 	= {x = 640, 	y = 360, 	r = (135 * DEG_TO_RAD), 	s = 1.0}, 
  116. 		[CELL_STATE_START_LANDSCAPE] 	= {x = 640, 	y = 360, 	r = (45 * DEG_TO_RAD), 		s = 1.0}, 
  117. 		[CELL_STATE_PORTRAIT] 			= {x = 640, 	y = 360, 	r = (90 * DEG_TO_RAD), 		s = 1.0}, 
  118. 		[CELL_STATE_LANDSCAPE] 			= {x = 640, 	y = 360, 	r = (0 * DEG_TO_RAD), 		s = 1.0}, 
  119. 		--[CELL_STATE_OUT_PORTRAIT] 	= {x = 1000, 	y = 1300, 	r = (135 * DEG_TO_RAD), 	s = 1.0}, 
  120. 		--[CELL_STATE_OUT_LANDSCAPE] 	= {x = 1000, 	y = 1300, 	r = (45 * DEG_TO_RAD), 		s = 1.5}, 
  121. 		[CELL_STATE_OUT_PORTRAIT] 		= {x = 640, 	y = 360, 	r = (135 * DEG_TO_RAD), 	s = 0.01}, 
  122. 		[CELL_STATE_OUT_LANDSCAPE] 	= {x = 640, 	y = 360, 	r = (45 * DEG_TO_RAD), 		s = 0.02}, 
  123. 	}, 
  124. } 
  125.  
  126. --Initialize 
  127. function cell_foreground_init() 
  128. 	if vint_is_std_res() then 
  129. 		-- Positions, rotation and scale values for screens in SD 
  130. 		for idx, val in pairs(Cell_states) do  
  131. 			for idx2, val2 in pairs(val) do  
  132. 				if val2.x == 640 then 
  133. 					val2.x = 320 
  134. 				elseif val2.x == 1000 then 
  135. 					 val2.x = 700 
  136. 				end 
  137. 				if val2.y == 360 then 
  138. 					val2.y = 240 
  139. 				elseif val2.y == 1300 then 
  140. 					val2.y = 900  
  141. 				end 
  142. 				val2.s = val2.s *.667 *.9 
  143. 			end 
  144. 		end 
  145. 	end 
  146. 	 
  147. 	 
  148. 	 
  149. 	Cell_foreground_doc = vint_document_find("cell_foreground") 
  150. 	Cell_background_doc = vint_document_find("cell_background")	 
  151. 	Cell_foreground_h = 	vint_object_find("screen_grp",  0, Cell_foreground_doc) 
  152. 	Cell_background_h = 	vint_object_find("screen_grp",  0, Cell_background_doc) 
  153. 	 
  154. 	local top_icons_h = vint_object_find("top_icons", 0, Cell_foreground_doc) 
  155. 	 
  156. 	--Hide all elements to start out with... 
  157. 	vint_set_property(Cell_foreground_h, "visible", false) 
  158. 	vint_set_property(Cell_background_h, "visible", false) 
  159.  
  160. 	--Powers Tutorial 
  161. 	Tutorial_h = Vdo_gsi_lite:new("tutorial", 0, Cell_foreground_doc) 
  162. 	 
  163. 	local intro_anim_h = vint_object_find("intro_anim", 0, Cell_background_doc)	 
  164. 	local bg_loop = Vdo_anim_object:new("bg_loop", 0, Cell_background_doc) 
  165. 	 
  166. 	--Play sound when HUB screen animation starts 
  167. 	local audio_twn_h = vint_object_find("audio_twn_hub_enter", intro_anim_h)	 
  168. 	vint_set_property(audio_twn_h, "start_event", "cell_foreground_audio_hub_enter_cb") 
  169. 	 
  170. 	vint_apply_start_values(intro_anim_h) 
  171. 	 
  172. 	 
  173. 	lua_play_anim(intro_anim_h) 
  174. 	bg_loop:play(0) 
  175. 	 
  176. 	--Apply lut 
  177. 	--cell_foreground_lut_effect("lut_completion_screen") 
  178. 	 
  179. end 
  180.  
  181. --Cleanup 
  182. function cell_foreground_cleanup() 
  183. 	cell_foreground_lut_effect("none") 
  184. end 
  185.  
  186.  
  187. function cell_foreground_update_tutorial(tutorial) 
  188. 	 
  189. 	if tutorial == "off" then 
  190. 		Tutorial_h:set_visible(false) 
  191. 	end 
  192. 	 
  193. 	if pause_map_is_tutorial_mode() then 
  194. 		if tutorial == "access_map" then 
  195. 			if Gps_has_been_set == false then 
  196. 				Tutorial_h:update("MM_1_1_OBJ_GO_TO_MAP", "ui_target_icon_use") 
  197. 			end 
  198. 		elseif tutorial == "gps_weapon" then 
  199. 			Tutorial_h:update("MM_1_1_OBJ_SET_GPS", "ui_target_icon_location") 
  200. 		elseif tutorial == "exit_hub" then 
  201. 			Tutorial_h:update("POWERS_TUT_EXIT_HUB", "ui_target_icon_use") 
  202. 		end 
  203. 	end 
  204. 	 
  205. 	if challenge_tutorial_mode_is_active() then 
  206. 		if tutorial == "open_menu" then 
  207. 			Tutorial_h:update("CHALLENGE_TUT_ENTER_MENU", "ui_target_icon_use") 
  208. 		elseif tutorial == "set_challenge" then 
  209. 			Tutorial_h:update("CHALLENGE_TUT_PICK_CHALLENGE", "ui_target_icon_use") 
  210. 		elseif tutorial == "pick_objective" then 
  211. 			Tutorial_h:update("CHALLENGE_TUT_PICK_OBJECTIVE", "ui_target_icon_use") 
  212. 		elseif tutorial == "exit_hub" then 
  213. 			Tutorial_h:update("POWERS_TUT_EXIT_HUB", "ui_target_icon_use") 
  214. 		end 
  215. 	end 
  216. 	 
  217. 	if Powers_main_tutorial_enable then 
  218. 		if tutorial == "hub" then 
  219. 			--tell them to click on powers screen 
  220. 			Tutorial_h:update("POWERS_TUT_FIRST", "ui_target_icon_use")	 
  221. 		elseif tutorial == "main" then 
  222. 			--tell them to buy sprint and jump 
  223. 			Tutorial_h:update("POWERS_TUT_SECOND", "ui_target_icon_use")	 
  224. 		elseif tutorial == "final" then 
  225. 			Tutorial_h:set_visible(false) 
  226. 			dialog_box_message("MENU_TITLE_NOTICE", "POWERS_TUT_FINAL", true, true, "cell_foreground_exit_tutorial") 
  227. 		end 
  228. 	end 
  229. 	 
  230. 	 
  231. 	 
  232. end 
  233.  
  234. function cell_foreground_exit_tutorial() 
  235. 	pop_screen() 
  236. 	pop_screen() 
  237. 	pop_screen() 
  238. 	pop_screen() 
  239. end 
  240.  
  241. --DELETE THIS.. 
  242. function cell_foreground_set_state() 
  243. end 
  244. ------------------------------------------------------------------------------- 
  245. -- Transitions the cellphone screen to next  
  246. -- 
  247. -- @transition_type		transition type... (CELL_TRANSITION_IN_LANDSCAPE) 
  248. -- @doc_name				"document name" 
  249. -- @doc_name				"base_name" 
  250. -- 
  251. --  transition_type, "pause_map", "map_all_grp", 
  252.  
  253. --cell_transition_screen(CELL_TYPE_LANDSCAPE, CELL_STATE_LANDSCAPE, "pause_map", "map_all_grp", pause_map_trans_in_complete) 
  254. function cell_transition_screen(target_state, screen1, screen2, callback_func) 
  255. 	local screen_1_data = Cell_menu_types[screen1] 
  256. 	local screen_2_data = Cell_menu_types[screen2] 
  257. 	 
  258. 	local transition_screens = { 
  259. 		[1] = {screen_type = screen_1_data[1],  		doc_name = screen_1_data[2], 		base_name = screen_1_data[3]}, 
  260. 		[2] = {screen_type = CELL_TYPE_LANDSCAPE,		doc_name = "cell_foreground", 	base_name = "top_bar"},--"cell_frame_grp"}, 
  261. 		[3] = {screen_type = CELL_TYPE_PORTRAIT, 		doc_name = "cell_background", 	base_name = "cell_bg_grp"}, 
  262. 		[4] = {screen_type = screen_2_data[1],  		doc_name = screen_2_data[2], 		base_name = screen_2_data[3]} 
  263. 	} 
  264. 	 
  265. 	if screen1 == nil or screen2 == nil then 
  266. 		--ABORT: attempt to do whack transition... 
  267. 		debug_print("vint", "No valid screen set for cell_transition_screen(). screen1 or screen2: " .. var_to_string(screen1) .. "\n") 
  268.  
  269. 		return 
  270. 	end 
  271. 	--Special case for cell rewards... needs to have an extra document transition... 
  272. 	if screen1 == CELL_SCREEN_REWARDS or screen2 == CELL_SCREEN_REWARDS then 
  273. 		transition_screens[5] = {screen_type = CELL_TYPE_LANDSCAPE, doc_name = "store_common", base_name = "cell_rotate_grp"} 
  274. 		 
  275. 		--Also needs to reset scale of store common because it gets overriden. 
  276. 		local store_common_doc_h = vint_document_find("store_common") 
  277. 		local h = vint_object_find("screen_grp", 0, store_common_doc_h) 
  278. 		vint_set_property(h, "scale", 1,1) 
  279. 	end 
  280. 	 
  281. 	local twn_h 
  282. 	 
  283. 	--This is used to ensure our callbacks context is called to the appropriate document. 
  284. 	local transition_callback_idx = 1 
  285. 	if screen1 == CELL_SCREEN_NONE then 
  286. 		-- If screen is none this means we are exiting the phone, 
  287. 		-- Our function callback should happen in the context of the screen we are exiting from... 
  288. 		transition_callback_idx = 2 
  289. 		--outro anim can be added here 
  290. 	end 
  291. 	 
  292. 	for idx, screen in pairs(transition_screens) do 
  293. 		if screen.screen_type ~= nil then 
  294. 			--Screen transitions... 
  295. 			local doc_h = vint_document_find(screen.doc_name) 
  296. 			local target_h = vint_object_find(screen.base_name, 0, doc_h) 
  297. 			 
  298. 			--Animation we use as the base(anchor, rotation, scale) 
  299. 			local anim_h = vint_object_find("transition_element_anim", 0, Cell_background_doc) 
  300. 			local anim_clone_h = vint_object_clone(anim_h) 
  301. 			 
  302. 			local root_anim_h = vint_object_find("root_animation", 0, doc_h) 
  303. 			vint_object_set_parent(anim_clone_h, root_anim_h) 
  304. 			 
  305. 			local anchor_twn_h 		= vint_object_find("anchor_twn", anim_clone_h) 
  306. 			local rotation_twn_h 	= vint_object_find("rotation_twn", anim_clone_h) 
  307. 			local scale_twn_h 		= vint_object_find("scale_twn", anim_clone_h) 
  308. 			--local alpha_twn_h			= vint_object_find("alpha_twn", anim_clone_h) 
  309. 			 
  310. 			local start_state = Cell_current_state		--start state is the last state saved... 
  311. 			local end_state 	= target_state				--end state is the target state... 
  312. 			 
  313. 			 
  314. 			-- Do some translations for the start and end states... 
  315. 			-- If our state is starting then we need to figure out what type we should transition from. 
  316. 			-- This is to keep the size ratios the same all the way through... 
  317. 			if start_state == CELL_STATE_START then 
  318. 				if end_state == CELL_STATE_PORTRAIT then 
  319. 					start_state = CELL_STATE_START_PORTRAIT 
  320. 				else 
  321. 					start_state = CELL_STATE_START_LANDSCAPE 
  322. 				end 
  323. 			end 
  324. 			 
  325. 			--We do the same for when we are transitioning out... 
  326. 			if end_state == CELL_STATE_OUT then 
  327. 				if start_state == CELL_STATE_PORTRAIT then 
  328. 					end_state = CELL_STATE_OUT_PORTRAIT 
  329. 				else 
  330. 					end_state = CELL_STATE_OUT_LANDSCAPE 
  331. 				end 
  332. 			end 
  333. 				 
  334. 			local start_data 	= table_clone(Cell_states[screen.screen_type][start_state]) 
  335. 			local end_data 	= table_clone(Cell_states[screen.screen_type][end_state]) 
  336.  
  337. 			--Check to make sure we have valid states... 
  338. 			if start_data == nil or end_data == nil then 
  339. 				debug_print("vint", "invalid target_state: " .. var_to_string(target_state) .. "\n") 
  340. 				debug_print("vint", "invalid screen_type: " .. var_to_string(screen.screen_type) .. "\n") 
  341. 				return 
  342. 			end 
  343.  
  344. 			--Set target handle of our cloned tweens. 
  345. 			vint_set_property(anchor_twn_h, 	"target_handle", target_h) 
  346. 			vint_set_property(rotation_twn_h,"target_handle", target_h) 
  347. 			vint_set_property(scale_twn_h, 	"target_handle", target_h) 
  348. 			--vint_set_property(alpha_twn_h, 	"target_handle", target_h) 
  349. 			 
  350. 			--Set callback so we know we are completed and can cleanup the tweens. 
  351. 			--Additionally, the callback will call our sent in callback function. 
  352. 			if idx == transition_callback_idx then 
  353. 				-- only setup the action callback for the screen we are transitioning to... 
  354. 				-- this is to maintain vint context of the lua function call to that document. 
  355. 				vint_set_property(anchor_twn_h, "end_event", "cell_transition_action_cb") 
  356. 			else 
  357. 				--callback to make sure we cleanup the animation when we are finished. 
  358. 				vint_set_property(anchor_twn_h, "end_event", "cell_transition_delete_cb") 
  359. 			end 
  360. 			 
  361. 			--Get and set properties based on our start/end data. 
  362. 			vint_set_property(anchor_twn_h, 		"start_value", 	start_data.x, 	start_data.y) 
  363. 			vint_set_property(anchor_twn_h, 		"end_value", 		end_data.x, 	end_data.y) 
  364. 			--REMOVED FOR SR4 and changed to zero, we don't need no rotation 
  365. 			--vint_set_property(rotation_twn_h, 	"start_value", 	start_data.r) 
  366. 			--vint_set_property(rotation_twn_h, 	"end_value", 		end_data.r) 
  367. 			vint_set_property(rotation_twn_h, 	"start_value", 	0) 
  368. 			vint_set_property(rotation_twn_h, 	"end_value", 		0) 
  369. 			vint_set_property(scale_twn_h, 		"start_value", 	start_data.s, 	start_data.s) 
  370. 			vint_set_property(scale_twn_h, 		"end_value", 		end_data.s, 	end_data.s) 
  371. 			 
  372. 			--if end_state == CELL_STATE_OUT_PORTRAIT or end_state == CELL_STATE_OUT_LANDSCAPE then 
  373. 				--vint_set_property(anchor_twn_h, 	"algorithm", "ease_out_quart") 
  374. 				--vint_set_property(rotation_twn_h,"algorithm", "ease_out_quart") 
  375. 				vint_set_property(scale_twn_h, 	"algorithm", "ease_out_quart") 
  376. 			--end 
  377. 			 
  378. 			-- Play animation... 
  379. 			vint_apply_start_values(anim_clone_h) 
  380. 			lua_play_anim(anim_clone_h, 0, doc_h) 
  381. 			 
  382. 			 
  383. 			--Play incomming screens transition animation 
  384. 			if idx == 1 then 
  385. 				--Pause out animation 
  386. 				local trans_out_anim_h = vint_object_find("trans_out_anim", 0, doc_h) 
  387. 				if trans_out_anim_h ~= 0 then 
  388. 					vint_set_property(trans_out_anim_h, "is_paused", true) 
  389. 				end 
  390. 				--Play in animation... 
  391. 				local trans_in_anim_h = vint_object_find("trans_in_anim", 0, doc_h) 
  392. 				if trans_in_anim_h ~= 0 then 
  393. 					lua_play_anim(trans_in_anim_h, 0, doc_h) 
  394. 				end 
  395. 	 
  396. 				if screen1 == CELL_SCREEN_MAIN or screen1 == CELL_SCREEN_EXTRAS or screen1 == CELL_SCREEN_MUSIC_SUB then 
  397. 					--cell_menu_main_animate_in() 
  398. 				end 
  399. 				 
  400. 				--cell_menu_animate_in() 
  401. 			end 
  402. 			 
  403. 			if idx == 3 then 
  404. 				--local bg_rotate_h = vint_object_find("bg_rotate",0,Cell_background_doc) 
  405. 				--bg rotation over ride 
  406. 				if start_state ~= end_state then 
  407. 					if (start_state == CELL_STATE_LANDSCAPE or start_state == CELL_STATE_START_PORTRAIT) and end_state == CELL_STATE_PORTRAIT then 
  408. 						--vint_set_property(bg_rotate_h, 	"rotation", 	(-35 * DEG_TO_RAD)) 
  409. 					elseif (start_state == CELL_STATE_PORTRAIT or start_state == CELL_STATE_START_LANDSCAPE) and end_state == CELL_STATE_LANDSCAPE then 
  410. 						--vint_set_property(bg_rotate_h, 	"rotation", 	(55 * DEG_TO_RAD)) 
  411. 					end 
  412. 				end 
  413. 			end 
  414. 			 
  415. 			--Play outgoing screens transition animation 
  416. 			if idx == 4 then 
  417. 				--Pause in animation 
  418. 				local trans_in_anim_h = vint_object_find("trans_in_anim", 0, doc_h) 
  419. 				if trans_in_anim_h ~= 0 then 
  420. 					vint_set_property(trans_in_anim_h, "is_paused", true) 
  421. 				end 
  422. 				--Play out animation 
  423. 				local trans_out_anim_h = vint_object_find("trans_out_anim", 0, doc_h) 
  424. 				if trans_out_anim_h ~= 0 then 
  425. 					lua_play_anim(trans_out_anim_h, 0, doc_h) 
  426. 				end 
  427. 				 
  428. 				if screen2 == CELL_SCREEN_MAIN or screen2 == CELL_SCREEN_EXTRAS or screen2 == CELL_SCREEN_MUSIC_SUB  then 
  429. 					--need to play hide top bar anim... 
  430. 					if start_state ~= end_state then 
  431. 						if screen.end_state == CELL_STATE_PORTRAIT then 
  432. 							--fade in header 
  433. 							cell_foreground_fade_in_header() 
  434. 						else 
  435. 							--fade out header 
  436. 							cell_foreground_fade_out_header() 
  437. 						end 
  438. 					end 
  439. 				end 
  440. 			end 
  441. 		end 
  442. 	end 
  443. 	 
  444. 	--Store callback function to global 
  445. 	if callback_func ~= nil then 
  446. 		Cell_transition_cb_func = callback_func 
  447. 	else 
  448. 		Cell_transition_cb_func = -1 
  449. 	end 
  450.  
  451. 	--Glitch the screen 
  452. 	glitch_cell() 
  453. 	 
  454. 	--Update clusters 
  455. 	local cell_menu_main_doc_h = vint_document_find("cell_menu_main") 
  456. 	if cell_menu_main_doc_h ~= nil then 
  457. 		cell_menu_main_cluster_update() 
  458. 	end 
  459. 	 
  460. 	--Store current state. 
  461. 	Cell_current_state = target_state 
  462. end 
  463.  
  464. ------------------------------------------------------------------------------- 
  465. -- Callback functions for tweens.  
  466. -- 1. Destroys its parent anim. 
  467. --  
  468. function cell_transition_delete_cb(tween_h) 
  469. 	vint_object_destroy(vint_object_parent(tween_h)) 
  470. end 
  471.  
  472. -- Callback functions for tweens.  
  473. -- 1. Destroys its parent anim. 
  474. -- 2. Does callback that was stored in the global from our last transition.  
  475. -- 3. Wipes the callback out so other tweens don't call it. 
  476. function cell_transition_action_cb(tween_h) 
  477. 	vint_object_destroy(vint_object_parent(tween_h)) 
  478. 	 
  479. 	--Do cell transition callback if it exists the reset it. 
  480. 	if Cell_transition_cb_func ~= -1 then 
  481. 		Cell_transition_cb_func() 
  482. 		Cell_transition_cb_func = -1 
  483. 	end 
  484. end 
  485.  
  486.  
  487. ------------------------------------------------------------------------------- 
  488. -- Fades in the header(battery, power) 
  489. -- 
  490. function cell_foreground_fade_in_header() 
  491. 	lua_play_anim(vint_object_find("in_header_anim", 0, Cell_foreground_doc), 0, Cell_foreground_doc) 
  492. end 
  493.  
  494. ------------------------------------------------------------------------------- 
  495. -- Fades out the header(battery, power) 
  496. -- 
  497. function cell_foreground_fade_out_header() 
  498. 	lua_play_anim(vint_object_find("out_header_anim", 0, Cell_foreground_doc), 0, Cell_foreground_doc) 
  499. end 
  500.  
  501. function cell_show_frame() 
  502. 	vint_set_property(Cell_foreground_h, "visible", true) 
  503. 	vint_set_property(Cell_background_h, "visible", true) 
  504. end 
  505.  
  506.  
  507. function cell_foreground_lut_effect(lut_table_string) 
  508.  
  509. 	if lut_table_string ~= "none" then 
  510. 		local platform = game_get_platform() 
  511. 		local lut_platform_string = "" 
  512. 		 
  513. 		if platform == "PS3" then 
  514. 			lut_platform_string = "_ps3" 
  515. 		elseif platform == "XBOX360" then 
  516. 			lut_platform_string = "_xbox2" 
  517. 		elseif platform == "XBOX3" then 
  518. 			lut_platform_string = "_xbox3" 
  519. 		elseif platform == "PS4" then 
  520. 			lut_platform_string = "_ps4" 
  521. 		elseif platform == "PC" then 
  522. 			lut_platform_string = "_pc" 
  523. 		end 
  524. 		completion_load_lut(lut_table_string .. lut_platform_string) 
  525. 	else 
  526. 		completion_load_lut(lut_table_string) 
  527. 	end 
  528. end 
  529.  
  530.  
  531. --Callback for HUB Enter audio cue 
  532. function cell_foreground_audio_hub_enter_cb() 
  533. 	ui_audio_post_event("UI_Hub_Enter") 
  534. end 
  535.